1 |
root |
1.1 |
# stats-extract - parse the archetypes-file and output the |
2 |
|
|
# player's stats in a structured format. |
3 |
|
|
|
4 |
|
|
/^Object/ { |
5 |
|
|
randomitems = ""; |
6 |
|
|
name = obj = $2; |
7 |
|
|
type = 0; |
8 |
|
|
} |
9 |
|
|
|
10 |
|
|
/^type/ { type = $2 } |
11 |
|
|
/^randomitems/ { randomitems = $2 } |
12 |
|
|
/^name/ { name = substr($0, 6) } |
13 |
|
|
|
14 |
|
|
/^end/ { |
15 |
|
|
if (type == 1) { # Players |
16 |
|
|
printf("%s,%s\n", decapitalize(name), randomitems); |
17 |
|
|
} |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
END { |
21 |
|
|
close("items"); |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
function decapitalize(str) { |
25 |
|
|
return tolower (substr(str, 1, 1)) substr(str, 2); |
26 |
|
|
} |