Debian Codegraph @

doc/playbook/items-extract

raw
1 # items-extract - parse the archetypes-file and output the
2 # artifacts in a structured format.
3
4 # Variables passed when invoked:
5 # living_c - filename where the array attacks is defined.
6
7 BEGIN {
8 # These types are always artifacts:
9 # containers, gems, rods, wands
10 artifact[122] = artifact[60] = artifact[3] = artifact[109] = 1;
11 # money, rings, runes, scrolls
12 artifact[36] = artifact[70] = artifact[154] = artifact[111] = 1;
13 # map, id altars, shop mat, lighters
14 artifact[22] = artifact[139] = artifact[69] = artifact[75] = 1;
15 # food, flesh, horn
16 artifact[6] = artifact[72] = artifact[35] = 1;
17
18 # armour improver, weapon improver, skills
19 artifact[123] = artifact[124] = artifact[43] = 1;
20
21 # exits --- lots and lots of stuff!
22 artifact[66] = 1;
23
24 # armour, bows, gravestone
25 artifact[16] = artifact[14] = artifact[38] = 1;
26
27 # book, altar, corpse
28 artifact[8] = artifact[18] = artifact[157] = 1;
29
30 # lock_door, special_key, door, keys
31 artifact[20] = artifact[21] = artifact[23] = artifact[24] = 1;
32
33 # potion, sign, savebed
34 artifact[5] = artifact[98] = artifact[106] = 1;
35
36 # button, handle, gate, trapdoor
37 artifact[92] = artifact[93] = artifact[91] = artifact[95] = 1;
38
39 # earthwall, firewall, spinner, director
40 artifact[45] = artifact[62] = artifact[90] = artifact[112] = 1;
41
42 # skill tools, spells
43 artifact[74] = artifact[101] = 1;
44 force[101] = 1;
45
46 # Don't eleminate repeat occurances
47 keeprepeat[66] = keeprepeat[98] = keeprepeat[24] = 1;
48
49 # will take only matching names
50 valuable[154] = "Magical Rune,Rune of Fire,Rune of Frost,Rune of Death,Rune of Shocking,Rune of Blasting"
51 valuable[123] = "prepare";
52 valuable[66] = "guild,shop";
53 valuable[43] = "talisman,holy symbol,lockpicks";
54
55 # throw out all matching names
56 worthless["chalice"] = worthless["acid spit"] = 1;
57 worthless["pyromaniac"] = worthless["rock thrower"] = 1;
58 worthless["a cracked cauldron"] = 1;
59 worthless["small bagpipe"] = worthless["magic_mouth"] = worthless["trap"] = 1;
60 worthless["spikes"] = worthless["stoneblock"] = worthless["cannon"] = 1;
61 worthless["volcano"] = worthless["rock thrower"] = 1;
62 worthless["drop 10 goldcoins"] = 1;
63 }
64
65 /^Object/ {
66 slay = magik = "";
67 name = obj = $2;
68 x = y = 0;
69 xmin = xmax = ymin = ymax = 0;
70 More = 0;
71 dam = type = magical = ac = armour = weight = last_sp = 0;
72 att = prot = immune = invisible = 0;
73 }
74
75 /^type/ { type = $2 }
76 /^last_sp/ { last_sp = $2 }
77 /^dam/ { dam = $2 }
78 /^ac/ { ac = $2 }
79 /^armour/ { armour = $2 }
80 /^weight/ { weight = $2 }
81 /^attacktype/ { att = $2 }
82 /^protected/ { prot = $2 }
83 /^immune/ { immune = $2 }
84 /^slaying/ { slay = $2; }
85 /^magic/ { magical = $2 }
86 /^name/ { name = substr($0, 6) }
87 /^invisible/ { invisible = $2 }
88 /^end/ {
89 # but they are in the worthless, we ignore it
90 if (artifact[type] && !worthless[name] && (!invisible || force[type])) {
91
92 if(!valuable[type] || (valuable[type] ~ name))
93 if(keeprepeat[type] || !(oldname ~ name))
94 printf("%d &~~%s~~ \n", type, obj);
95 oldname = name;
96
97 }
98 }
99
100 END {
101 close("items");
102 }