1 |
root |
1.1 |
|
2 |
|
|
BEGIN { |
3 |
|
|
# Read the array data from living.c |
4 |
|
|
while ((getline buff < living_c) == 1) { |
5 |
|
|
if (buff ~ /con_bonus\[/) { |
6 |
|
|
get_values(buff); |
7 |
|
|
for(i=1;i<=30;i++) con[i]=array[i]; |
8 |
|
|
} |
9 |
|
|
if (buff ~ /sp_bonus\[/) { |
10 |
|
|
get_values(buff); |
11 |
|
|
for(i=1;i<=30;i++) sp[i]=array[i]; |
12 |
|
|
} |
13 |
|
|
if (buff ~ /dex_bonus\[/) { |
14 |
|
|
get_values(buff); |
15 |
|
|
for(i=1;i<=30;i++) ac[i]=-1*array[i]; |
16 |
|
|
} |
17 |
|
|
if (buff ~ /dam_bonus\[/) { |
18 |
|
|
get_values(buff); |
19 |
|
|
for(i=1;i<=30;i++) dam[i]=array[i]; |
20 |
|
|
} |
21 |
|
|
if (buff ~ /float cha_bonus\[/) { |
22 |
|
|
get_values(buff); |
23 |
|
|
for(i=1;i<=30;i++) { |
24 |
|
|
diff = (array[i] - 1)/(array[i] + 1); |
25 |
|
|
buy[i] = diff + 1; |
26 |
|
|
sell[i] = 1 - diff; |
27 |
|
|
} |
28 |
|
|
} |
29 |
|
|
if (buff ~ /speed_bonus\[/) { |
30 |
|
|
get_values(buff); |
31 |
|
|
for(i=1;i<=30;i++) speed[i]= 1 + array[i]; |
32 |
|
|
} |
33 |
|
|
if (buff ~ /max_carry\[/) { |
34 |
|
|
get_values(buff); |
35 |
|
|
for(i=1;i<=30;i++) carry[i]=array[i]; |
36 |
|
|
} |
37 |
|
|
if (buff ~ /thaco_bonus\[/) { |
38 |
|
|
get_values(buff); |
39 |
|
|
for(i=1;i<=30;i++) thaco[i]=array[i]; |
40 |
|
|
} |
41 |
|
|
if (buff ~ /learn_spell\[/) { |
42 |
|
|
get_values(buff); |
43 |
|
|
for(i=1;i<=30;i++) learn[i]=array[i]; |
44 |
|
|
break; |
45 |
|
|
} |
46 |
|
|
} |
47 |
|
|
# print it out |
48 |
|
|
for(i=1; i<=30 ; i++) { |
49 |
|
|
printf("%d & %s & %s & %s & %s & %s & %s & %s & %s & %6.3f/%6.3f \\\\ \n",i, |
50 |
|
|
con[i],sp[i],ac[i],dam[i],thaco[i],carry[i],speed[i],learn[i],buy[i],sell[i]); |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
close(living_c); |
54 |
|
|
} |
55 |
|
|
|
56 |
|
|
function get_values (buff) { |
57 |
|
|
tind = 0; |
58 |
|
|
while (1) { |
59 |
|
|
getline buff < living_c; |
60 |
|
|
# if(lev==1) getline buff < living_c; |
61 |
|
|
if (buff ~ /};/) |
62 |
|
|
break; |
63 |
|
|
gsub("[ \t]*\"", "", buff); |
64 |
|
|
nr = split(buff, val, ","); |
65 |
|
|
for (i = 1; i<=nr ; i++) |
66 |
|
|
if(val[i]!="") array[tind++]=val[i]; |
67 |
|
|
} |
68 |
|
|
} |