1 |
root |
1.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 |
|
|
# Don't eleminate repeat occurances |
43 |
|
|
keeprepeat[66] = keeprepeat[98] = keeprepeat[24] = 1; |
44 |
|
|
|
45 |
|
|
# will take only matching names |
46 |
|
|
valuable[154] = "Magical Rune,Rune of Fire,Rune of Frost,Rune of Death,Rune of Shocking,Rune of Blasting" |
47 |
|
|
valuable[123] = "prepare"; |
48 |
|
|
valuable[66] = "guild,shop"; |
49 |
|
|
valuable[43] = "talisman,holy symbol,lockpicks"; |
50 |
|
|
|
51 |
|
|
# throw out all matching names |
52 |
|
|
worthless["chalice"] = worthless["acid spit"] = 1; |
53 |
|
|
worthless["pyromaniac"] = worthless["rock thrower"] = 1; |
54 |
|
|
worthless["a cracked cauldron"] = 1; |
55 |
|
|
worthless["small bagpipe"] = worthless["magic_mouth"] = worthless["trap"] = 1; |
56 |
|
|
worthless["spikes"] = worthless["stoneblock"] = worthless["cannon"] = 1; |
57 |
|
|
worthless["volcano"] = worthless["rock thrower"] = 1; |
58 |
|
|
worthless["drop 10 goldcoins"] = 1; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
/^Object/ { |
62 |
|
|
slay = magik = ""; |
63 |
|
|
name = obj = $2; |
64 |
|
|
x = y = 0; |
65 |
|
|
xmin = xmax = ymin = ymax = 0; |
66 |
|
|
More = 0; |
67 |
|
|
dam = type = magical = ac = armour = weight = last_sp = 0; |
68 |
|
|
att = prot = immune = invisible = 0; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
/^type/ { type = $2 } |
72 |
|
|
/^last_sp/ { last_sp = $2 } |
73 |
|
|
/^dam/ { dam = $2 } |
74 |
|
|
/^ac/ { ac = $2 } |
75 |
|
|
/^armour/ { armour = $2 } |
76 |
|
|
/^weight/ { weight = $2 } |
77 |
|
|
/^attacktype/ { att = $2 } |
78 |
|
|
/^protected/ { prot = $2 } |
79 |
|
|
/^immune/ { immune = $2 } |
80 |
|
|
/^slaying/ { slay = $2; } |
81 |
|
|
/^magic/ { magical = $2 } |
82 |
|
|
/^name/ { name = substr($0, 6) } |
83 |
|
|
/^invisible/ { invisible = $2 } |
84 |
|
|
/^end/ { |
85 |
|
|
# but they are in the worthless, we ignore it |
86 |
|
|
if (artifact[type] && !worthless[name] && !invisible) { |
87 |
|
|
|
88 |
|
|
if(!valuable[type] || (valuable[type] ~ name)) |
89 |
|
|
if(keeprepeat[type] || !(oldname ~ name)) |
90 |
|
|
printf("%d &~~%s~~ \n", type, obj); |
91 |
|
|
oldname = name; |
92 |
|
|
|
93 |
|
|
} |
94 |
|
|
} |
95 |
|
|
|
96 |
|
|
END { |
97 |
|
|
close("items"); |
98 |
|
|
} |