Mercurial > hg > batmud > misc
annotate log2template.pl @ 351:d5735e2cdb16 misc
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 20 Oct 2017 23:20:34 +0300 |
parents | b35c643a64d9 |
children | b80107b8a493 |
rev | line source |
---|---|
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 #!/usr/bin/perl -w |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
2 # |
232
7745b79f5e1f
log2template: Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
3 # log2template - Log parser for BatWiki NPC/Armour/Item/Weapon templates |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
4 # Developed by Matti Hämäläinen (Ggr Pupunen) <ccr@tnsp.org> |
232
7745b79f5e1f
log2template: Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
5 # (C) Copyright 2010-2012 Tecnic Software productions (TNSP) |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
6 # |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
7 # Requires Perl 5.8. |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
8 # |
185 | 9 # Usage |
10 # ===== | |
11 # 1) command qla say -- $* --;prod $*;whereami;say -??-;blook at $*;say -==-;look at $*;say ==== | |
12 # 2) rip_action set party kills (or spam party kills every once in a while to collect expvalue data) | |
13 # 3) qla monster | |
14 # 4) Cast detect race, detect alignment, whatnot at monster (if you wish/can/have those). | |
15 # 5) Fight and kill monster. | |
232
7745b79f5e1f
log2template: Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents:
231
diff
changeset
|
16 # 6) run log2template.pl < logfile.log > output.txt |
185 | 17 # |
239 | 18 # 7) command id say -ID-;blook at $*;say -%-;weigh $*;say -#-;look at $*;say -!-;cast identify at $* |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
19 # |
185 | 20 # Notes |
21 # ===== | |
22 # - You must have spellname translator, preferably one with format: | |
23 # Xxxx claps its hands and says (cure critical wounds) | |
24 # | |
25 # - There is some flexibility in the parser, it can filter out ANSI from the | |
26 # input log, etc. but you may have to customize it. And that requires Perl | |
27 # knowledge. | |
28 # | |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
29 use strict; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
30 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
31 # Options |
172 | 32 my $opt_ansi = 1; # 1 = strip ANSI, 0 = don't (is faster) |
173 | 33 my $opt_debug = 0; # 1 = enable debug output |
34 my $opt_pkills_crop = 60; | |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
35 my $opt_outfile; |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
36 my $opt_getlocs = 0; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
37 my $opt_locpath; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
38 my $opt_identify = 1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
39 my $opt_npc = 1; |
217
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
40 my $opt_dist = 1; |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
41 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
42 # Define the regular expression to match any outputs of "say" |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
43 # as this is somewhat race-dependant. |
213
930862631d57
Add wolfman 'say' output to log2template.
Matti Hamalainen <ccr@tnsp.org>
parents:
205
diff
changeset
|
44 my $sayregex = "(quack|say|howl)"; |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
45 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
46 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
47 # Define the various spell chant prefixes here, we need them |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
48 # for matching the spell cast lines themselves. |
231 | 49 my @spellChants = ( |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 "claps its hands and says", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 "claps his hands and whispers", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 "fills up his cheeks with air and exhales", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
53 "booms in sinister voice", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
54 "throws a pinch of magic dust in air and chants", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
55 "rolls her eyes wildly and exclaims", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 "rolls its eyes frantically and states", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
57 "utters the magic words", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
58 "spreads her fingers and whispers", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
59 "waves its index finger while uttering", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 "points an accusing finger and cries", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
61 "gets an evil gleam in its eyes and chants", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
62 "flaps arms and utters the magic words", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 "flaps his arms and utters the magic words", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
64 "taps its foot three times and utters the words", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
65 "is surrounded by blue waves as you hear the words:", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
66 "closes his eyes and with a dry, dark voice entones", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
67 "shakes with firey rage and yells", |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
68 "traces fiery demonic night runes in the air", |
160 | 69 "weaves a mystic matrix with glowing red lines in arcane ways and chants", |
222
1c0b3b4cef40
log2template: Added some spellword lines.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
70 "mutters the holy words", |
1c0b3b4cef40
log2template: Added some spellword lines.
Matti Hamalainen <ccr@tnsp.org>
parents:
220
diff
changeset
|
71 "mutters the magic words", |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
72 "makes shooing gestures with his hands and whispers", |
224
a5dbc08a1ae8
Added some more spell chant prefixes, including various folklorist ones.
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
73 "frantically waves his hands and yells", |
a5dbc08a1ae8
Added some more spell chant prefixes, including various folklorist ones.
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
74 "grabs a herb and chants", |
a5dbc08a1ae8
Added some more spell chant prefixes, including various folklorist ones.
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
75 "consults her guide and chants", |
a5dbc08a1ae8
Added some more spell chant prefixes, including various folklorist ones.
Matti Hamalainen <ccr@tnsp.org>
parents:
223
diff
changeset
|
76 "utters the magic words", |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 ); |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
78 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
79 |
230
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
80 my %areaMappings = ( |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
81 "Ocp west" => { "name" => "Old Central Park in Arelium", "continent" => "Laenor" }, |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
82 ); |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
83 |
239 | 84 |
85 my %genderMappings = ( | |
86 "it" => "n", | |
87 "she" => "f", | |
88 "he" => "m", | |
89 ); | |
90 | |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
91 # Stat name translations |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
92 my @statTransTable = ( |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
93 sub { return $_[0] =~ s/^ability at the (skill|spell) (.+)$/$2/ }, |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
94 sub { return $_[0] =~ s/^mental regeneration$/spr/g }, |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
95 sub { return $_[0] =~ s/^physical regeneration$/hpr/g }, |
194
1b5fdb431582
Random improvements in identify parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
96 sub { return $_[0] =~ s/^agility in combat$/avoid/g }, |
1b5fdb431582
Random improvements in identify parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
97 sub { return $_[0] =~ s/^damage you do in combat$/dam/g }, |
1b5fdb431582
Random improvements in identify parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
98 sub { return $_[0] =~ s/^resistance you have against physical damage/physical resistance/g }, |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
99 # sub { return $_[0] =~ s///g }, |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
100 ); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
101 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
102 |
351 | 103 ### |
104 ### Parse commandline arguments | |
105 ### | |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
106 while (defined(my $arg = shift)) { |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
107 if ($arg eq "-d") { |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
108 $opt_debug++; |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
109 } |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
110 elsif ($arg eq "-i") { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
111 $opt_identify = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
112 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
113 elsif ($arg eq "-n") { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
114 $opt_npc = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
115 } |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
116 elsif ($arg eq "-o") { |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
117 $opt_outfile = shift or die("Output file option -o requires an argument.\n"); |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
118 } |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
119 elsif ($arg eq "-L") { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
120 $opt_locpath = shift or die("Locfile path option -L requires an argument.\n"); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
121 } |
217
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
122 elsif ($arg eq "-f") { |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
123 $opt_dist = shift or die("Distance factor option -f requires an argument.\n"); |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
124 if ($opt_dist < 1 || $opt_dist > 50) { |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
125 die("-f value must be 1 .. 50.\n"); |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
126 } |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
127 } |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
128 else { |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
129 die("Invalid option '$arg'. |
351 | 130 Usage: $0 [options] < input.log |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
131 |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
132 -o <filename> Output filename. |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
133 -d Enable debug mode. |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
134 -i Disable identify parser. |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
135 -n Disable NPC parser. |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
136 -L <locfile_path> Path to <continent_name>.loc files. |
217
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
137 -f <value> Set spell/skill detection line distance factor. |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
138 |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
139 "); |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
140 } |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
141 } |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
142 |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
143 print STDERR "Debug mode enabled, level=".$opt_debug.".\n" if ($opt_debug); |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
144 |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
145 if (defined($opt_outfile)) { |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
146 open(STDOUT, '>', $opt_outfile) or die("Could not open output file '$opt_outfile'.\n"); |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
147 } |
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
148 |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
149 if (defined($opt_locpath)) { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
150 $opt_getlocs = 1; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
151 print STDERR "Locfile path '".$opt_locpath."' set.\n"; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
152 } |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
153 |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
154 |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
155 ### Translate stats |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
156 sub trans_stat($) |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
157 { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
158 my ($s) = @_; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
159 foreach my $pat (@statTransTable) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
160 return $s if ($pat->($s)); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
161 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
162 return $s; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
163 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
164 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
165 |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
166 my %locations = (); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
167 sub parse_locfile($) |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
168 { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
169 my ($continent) = @_; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
170 |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
171 return if defined($locations{$continent}{"OK"}); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
172 |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
173 my $nline = 0; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
174 my $filename = $opt_locpath."/".$continent.".loc"; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
175 |
231 | 176 open(INFILE, '<', $filename) or print(STDERR "Could not open locfile '$filename'.\n"); |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
177 while (defined(my $line = <INFILE>)) { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
178 $nline++; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
179 chomp($line); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
180 if ($line =~ /^(#|\s*$)/) { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
181 } elsif ($line =~ /^\s*(\d+)\s*;\s*(\d+)\s*;\s*(\d\S*)\s*;\s*([^;]+);(.*)/) { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
182 my ($xc, $yc, $flags, $namestr, $rest) = ($1,$2,$3,$4,$5); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
183 my @names = split(/\s*\|\s*/, $namestr); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
184 $locations{$continent}{$xc}{$yc} = \@names; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
185 } else { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
186 print STDERR "Error on LOCfile '$filename' #$nline.\n"; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
187 } |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
188 } |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
189 |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
190 close(INFILE); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
191 $locations{$continent}{"OK"} = 1; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
192 } |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
193 |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
194 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
195 ### Globals |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
196 my %monsters = (); |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
197 my %aligns = (); |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
198 my %spells = (); |
216
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
199 my %skills = (); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
200 my %races = (); |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
201 my %ids = (); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
202 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
203 my $line = 0; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
204 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
205 my $mob_sdesc; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
206 my $mob = { }; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
207 my $state = 0; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
208 |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
209 my $id_tale; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
210 my $id_tale2; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
211 my $id = {}; |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
212 |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
213 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
214 ### Convert spellchants array to regexp |
231 | 215 my $spellregexps = join("|", map { s/ (his|its|her) / ... /g; $_ } @spellChants); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
216 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
217 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
218 ### Change parsing state |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
219 sub set_state($$) |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
220 { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
221 return unless ($_[0] != $state); |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
222 print STDERR "STATE = $_[0], old = $state\n" if ($opt_debug > 1); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
223 $state = $_[0]; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
224 if ($state < 0) { |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
225 print STDERR "ERROR($line): $_[1]\n"; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
226 $state = 0; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
227 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
228 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
229 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
230 |
239 | 231 sub check_gender($$) |
232 { | |
233 my ($mob, $s) = @_; | |
234 | |
235 if ($s =~ /^(He|She|It) +\[[a-z]+\] \([0-9-]+\%\)$/o || | |
236 $s =~ /^(He|She|It) is (in (a )?)?(excellent shape|good shape|slightly hurt|noticeably hurt|not in a good shape|bad shape|very bad shape|near death)/o) { | |
237 my $gender = lc($1); | |
238 if (defined($genderMappings{$gender})) { | |
239 $$mob{"gender"} = $genderMappings{$gender}; | |
240 } else { | |
241 print STDERR "ERROR($line): Invalid gender '$gender'\n"; | |
242 } | |
243 return 1; | |
244 } | |
245 return 0; | |
246 } | |
247 | |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
248 sub parse_npc($) |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
249 { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
250 my ($s) = @_; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
251 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
252 if ($state == 1) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
253 if ($s =~ /^You prod (.+?) like a stray cow\.$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
254 # Get 'short name' |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
255 $$mob{"sname"} = $1; |
229
cbbef11d7cac
Add support for parsing 'whereami' output with global coordinates.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
256 } elsif ($s =~ /^You are in '.*?' in (.+?) on the continent of ([A-Z][a-z]+). \(Coordinates: (\d+)x, (\d+)y(; Global: \d+x, \d+y)?\)$/o) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
257 # Area, continent |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
258 $$mob{"area"} = $1; |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
259 $$mob{"continent"} = $2; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
260 $$mob{"xc"} = $3; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
261 $$mob{"yc"} = $4; |
229
cbbef11d7cac
Add support for parsing 'whereami' output with global coordinates.
Matti Hamalainen <ccr@tnsp.org>
parents:
224
diff
changeset
|
262 } elsif ($s =~ /^You are in '.*?', which is on the continent of ([A-Z][a-z]+). \(Coordinates: (\d)+x, (\d)+y(; Global: \d+x, \d+y)?\)$/o) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
263 # Area, continent |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
264 $$mob{"area"} = $1; |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
265 $$mob{"continent"} = $1; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
266 $$mob{"xc"} = $2; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
267 $$mob{"yc"} = $3; |
230
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
268 } elsif ($s =~ /^You are in '.*?' in (.+?)\.$/o) { |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
269 my $area = $1; |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
270 # Area, continent |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
271 if (defined($areaMappings{$area})) { |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
272 $$mob{"area"} = $areaMappings{$area}{"name"}; |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
273 } |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
274 $$mob{"continent"} = $areaMappings{$area}{"continent"}; |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
275 $$mob{"xc"} = 0; |
84e762667995
Add support for location/area name mappings.
Matti Hamalainen <ccr@tnsp.org>
parents:
229
diff
changeset
|
276 $$mob{"yc"} = 0; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
277 } elsif ($s =~ /^You $sayregex '(-\?\?-|--\?\?--\?\?--\?\?--\?\?--)\.'$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
278 set_state(2, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
279 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
280 set_state(-1, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
281 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
282 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
283 elsif ($state == 2) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
284 # Mostly just grab shortdesc here |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
285 if ($s =~ /^You $sayregex '(-==-|-=-=-=-=-=-=-=-=-)\.'$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
286 set_state(3, $s); |
239 | 287 } elsif (check_gender($mob, $s)) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
288 set_state(-1, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
289 } elsif ($s =~ /^You $sayregex /o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
290 set_state(-1, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
291 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
292 $mob_sdesc = $s; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
293 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
294 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
295 elsif ($state == 3) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
296 if ($s =~ /^ +([a-zA-Z ,-]+?)'s equipment:$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
297 # End of long desc |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
298 set_state(4, $s); |
239 | 299 } elsif (check_gender($mob, $s)) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
300 # End of long desc |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
301 set_state(4, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
302 } elsif ($s =~ /^You $sayregex /o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
303 set_state(-1, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
304 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
305 # Collect long desc |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
306 $$mob{"ldesc"} .= $s." "; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
307 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
308 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
309 elsif ($state == 4) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
310 if ($s =~ /^You $sayregex '====*'?\.'$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
311 # Finished, submit information to hash |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
312 $monsters{$mob_sdesc} = $mob; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
313 set_state(0, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
314 } elsif ($s =~ /^([A-Z][a-z, ]+): (.*)$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
315 # Collect EQ and slot information |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
316 $$mob{"eqs"}{$1} = $2; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
317 } elsif ($s =~ /^([A-Z][a-z, ]+)\s+\(partially hidden\)\s*: (.*)$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
318 # Collect EQ and slot information |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
319 $$mob{"eqs"}{$1} = $2; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
320 } elsif ($s =~ /^ +([a-zA-Z -]+?)'s equipment:$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
321 # Ignore this line |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
322 } elsif ($s =~ /^((It|She|He) has a blueish black kiss on ... cheek\.|(It|She|He) suffers from scourge\.|Some glittering red mist is surrounding this creature.|Nothing\.|(It|He|She) has a faint ring of .+ magic mist around ... neck\.)$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
323 # Ignore various useless lines such as holz markings |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
324 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
325 # Error. |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
326 set_state(-1, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
327 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
328 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
329 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
330 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
331 |
199 | 332 ### Parse the big data blob |
333 sub parse_id_blob($) | |
334 { | |
335 my $info = $_[0]; | |
336 | |
337 # Weight & size | |
338 if ($info =~ /It is ([A-Za-z -]+), ([A-Za-z -]+),/) { | |
339 $$id{"weight2"} = $1; | |
340 $$id{"size"} = $2; | |
341 } | |
342 | |
343 # Quality | |
344 if ($info =~ /of ([A-Za-z ]+) quality/) { | |
345 $$id{"quality"} = $1; | |
346 } | |
347 | |
348 # Emits darkness or light | |
349 if ($info =~ /(emits darkness|emits light)/) { | |
350 push(@{$$id{"stats"}}, $1); | |
351 $$id{"cat"}{$1} = 1; | |
352 } | |
353 | |
354 # Materials, figure out primary material | |
355 if ($info =~ /made of,? ?(.+?), (feather|worth)/) { | |
356 @{$$id{"materials"}} = split(/\s*,\s*/, $1); | |
357 my $qmat = $$id{"materials"}[0]; | |
358 my $qmax = -1; | |
359 foreach my $mat (@{$$id{"materials"}}) { | |
360 if ($mat =~ /^(\d+)% (.+)$/) { | |
361 if ($1 >= $qmax) { | |
362 $qmax = $1; | |
363 $qmat = $2; | |
364 } | |
365 } | |
366 } | |
367 $$id{"material"} = $qmat; | |
368 $$id{"cat"}{$qmat} = 1; | |
369 } | |
370 | |
371 # Check for nun relics | |
219
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
372 if (defined($$id{"full"}) && $$id{"full"} =~ / \(holy\)/) { |
199 | 373 $$id{"cat"}{"relic"} = 1; |
374 } | |
375 | |
376 # Set item class | |
377 $$id{"class"} = "Item"; | |
378 if ($info =~ /The weapon skill to best use this in combat/) { | |
379 $$id{"class"} = "Weapon"; | |
380 } elsif (defined($$id{"type"}) && $$id{"type"} ne "") { | |
381 $$id{"class"} = "Armour"; | |
382 } | |
383 | |
384 # Check if the weight data is for FW'd item | |
219
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
385 if (defined($$id{"full"})) { |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
386 if ($$id{"full"} =~ / <(yellow|green|white) glow>$/) { |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
387 $$id{"kg"} = ""; |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
388 $$id{"weight"} = ""; |
199 | 389 } else { |
219
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
390 if (defined($$id{"kg"}{$$id{"full"}})) { |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
391 $$id{"kg"} = $$id{"kg"}{$$id{"full"}}; |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
392 } else { |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
393 $$id{"kg"} = ""; |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
394 } |
199 | 395 } |
396 } | |
397 } | |
398 | |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
399 sub parse_identify($) |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
400 { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
401 my ($s) = @_; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
402 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
403 if ($state == 10) { |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
404 if ($s =~ /^You $sayregex '-%-\.'$/o) { |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
405 set_state(11, $s); |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
406 } elsif (!defined($$id{"full"})) { |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
407 $$id{"full"} = $s; |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
408 } else { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
409 set_state(11, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
410 } |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
411 } |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
412 elsif ($state == 11) { |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
413 if ($s =~ /^:\s*(\d+\.\d+)\s+(.+)$/) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
414 # Weigh in kgs, and sdesc. Will have to match these later. |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
415 $$id{"kg"}{$2} = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
416 $$id{"full"} = $2; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
417 } |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
418 elsif ($s =~ /^You $sayregex '-#-\.'$/o) { |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
419 set_state(12, $s); |
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
420 } |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
421 } |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
422 elsif ($state == 12) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
423 if ($s =~ /^It is surrounded by .+? glow\.$|^It is labeled as|^This item is a present from santa to /) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
424 # Just skip these |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
425 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
426 elsif ($s =~ /You $sayregex '-!-\.'$/o) { |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
427 set_state(13, $s); |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
428 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
429 elsif ($s =~ /^It contains a tale;$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
430 $id_tale = 1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
431 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
432 elsif ($s =~ /^This (.+?) is in .+? condition\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
433 $$id{"type"} = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
434 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
435 elsif ($s =~ /^These (.+?) are in .+? condition\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
436 $$id{"type"} = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
437 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
438 elsif ($s =~ /^It looks (light weight|a bit heavy|heavy|very very heavy|very light weight|very heavy|ridiculously heavy)\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
439 $$id{"weight"} = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
440 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
441 else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
442 if ($id_tale) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
443 $$id{"tale"} .= $s." "; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
444 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
445 my $len = length($s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
446 if (defined($$id{"len"}) && $len + $$id{"len"} < 79) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
447 $$id{"ldesc"} .= "\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
448 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
449 $$id{"ldesc"} .= " "; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
450 } |
192
bcfe2ccf6c72
Fix detection of 'hardcoded' linefeeds in the long desc of items.
Matti Hamalainen <ccr@tnsp.org>
parents:
190
diff
changeset
|
451 $$id{"ldesc"} .= $s; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
452 $$id{"len"} = $len; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
453 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
454 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
455 } |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
456 elsif ($state == 13) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
457 if ($s =~ /^The following messages seem to vibrate from (.+?):$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
458 $$id{"sdesc"} = $1; |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
459 set_state(14, $s); |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
460 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
461 } |
223
6c436d33b53f
Fix 'identify' parsing. NOTICE NOTICE!! The required command alias for identify parsing has changed!
Matti Hamalainen <ccr@tnsp.org>
parents:
222
diff
changeset
|
462 elsif ($state == 14) { |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
463 if ($s =~ /^It is called (.+)\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
464 $$id{"handles"} = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
465 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
466 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
467 elsif ($s =~ /^It takes the following slots: (.+)\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
468 $$id{"slots"} = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
469 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
470 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
471 elsif ($s =~ /^A halo of purity surrounds it\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
472 push(@{$$id{"stats"}}, "[[:category:halo of purity|good wear only]]"); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
473 $$id{"cat"}{"halo of purity"} = 1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
474 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
475 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
476 elsif ($s =~ /^An aura of blackness surrounds it\.$/) { |
215
e0a4ddf06d79
Evil wear only was being added to category "aura of darkness" instead of
Matti Hamalainen <ccr@tnsp.org>
parents:
214
diff
changeset
|
477 push(@{$$id{"stats"}}, "[[:category:aura of blackness|evil wear only]]"); |
e0a4ddf06d79
Evil wear only was being added to category "aura of darkness" instead of
Matti Hamalainen <ccr@tnsp.org>
parents:
214
diff
changeset
|
478 $$id{"cat"}{"aura of blackness"} = 1; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
479 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
480 } |
194
1b5fdb431582
Random improvements in identify parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
481 elsif ($s =~ /^It will (.+?) (improve|reduce) (your|the) (.+?)\.$/) { |
1b5fdb431582
Random improvements in identify parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
193
diff
changeset
|
482 my ($amt, $imp, $stat) = ($1, $2, $4); |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
483 push(@{$$id{"stats"}}, ($imp eq "improve" ? "+" : "-").$amt." ".trans_stat($stat)); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
484 $$id{"cat"}{trans_stat($stat)} = 1 if ($imp eq "improve"); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
485 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
486 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
487 elsif ($s =~ /^It will (raise|lower) your (.+?)\.$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
488 my $imp = $1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
489 my $stat = substr($2, 0, 3); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
490 push(@{$$id{"stats"}}, ($imp eq "raise" ? "+" : "-").$stat); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
491 $$id{"cat"}{$stat} = 1 if ($imp eq "raise"); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
492 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
493 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
494 elsif ($s =~ /^It contains a tale;$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
495 $id_tale2 = 1; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
496 } |
199 | 497 elsif ($s =~ /^(.+?) did the heroic deed to bring this piece of equipment before you (.+)$/) { |
498 parse_id_blob($2); | |
219
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
499 if (defined($$id{"full"})) { |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
500 $ids{$$id{"full"}} = $id; |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
501 } |
199 | 502 set_state(0, $s); |
503 } | |
504 elsif ($s =~ /^It has been in the game for (.+)$/) { | |
505 parse_id_blob($1); | |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
506 $ids{$$id{"full"}} = $id; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
507 set_state(0, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
508 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
509 else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
510 if ($id_tale2) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
511 $$id{"tale"} .= $s." "; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
512 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
513 push(@{$$id{"other"}}, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
514 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
515 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
516 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
517 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
518 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
519 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
520 ### |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
521 ### Main parsing loop |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
522 ### |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
523 while (defined(my $s = <STDIN>)) { |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
524 $line++; |
172 | 525 chomp($s); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
526 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
527 # Strip ANSI colours and escapes |
172 | 528 $s =~ s/\e\[?.*?[\@-~]//g if ($opt_ansi); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
529 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
530 if |
218
e5e8083769fa
log2template: Accept ' in NPC short names.
Matti Hamalainen <ccr@tnsp.org>
parents:
217
diff
changeset
|
531 ($s =~ /^([A-Za-z][A-Za-z\'\ -]+?)\ ($spellregexps)\ \(([A-Za-z][A-Za-z\ ]+)\)/o) |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
532 { |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
533 # Grab cast spells |
175 | 534 $spells{$1}{$line} = lc($3); |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
535 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
536 elsif ($s =~ /\| \d\d:\d\d +(\d+): (.+?) +\|$/) { |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
537 # Grab exp worth |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
538 my $exp = $1; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
539 my $tmp = $2; |
173 | 540 my $sdesc = substr($tmp, 0, $opt_pkills_crop); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
541 if (defined($monsters{$sdesc}) && $line > $monsters{$sdesc}{"line"}) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
542 $monsters{$sdesc}{"exp"} = $exp; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
543 } else { |
205
4a360b40ed43
Fix how exp value is fetched for certain undead monsters from 'party kills'.
Matti Hamalainen <ccr@tnsp.org>
parents:
199
diff
changeset
|
544 $sdesc = $tmp . " (undead)"; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
545 if (defined($monsters{$sdesc}) && $line > $monsters{$sdesc}{"line"}) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
546 $monsters{$sdesc}{"exp"} = $exp; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
547 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
548 } |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
549 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
550 elsif ($s =~ /^\[\d\d:\d\d:\d\d\] hp|^You laugh out loud\.$|^Dunk dunk$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
551 # Ignore these lines |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
552 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
553 elsif ($s =~ /^You see nothing special\.$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
554 # Reset parsing state if the target obviously didn't exist |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
555 set_state(0, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
556 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
557 elsif ($state == 0 && $s =~ /^You $sayregex '-+ .+? -+\.'$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
558 next unless ($opt_npc); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
559 # Beginning of NPC info block |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
560 set_state(1, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
561 undef($mob); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
562 $mob_sdesc = ""; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
563 $$mob{"line"} = $line; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
564 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
565 elsif ($state == 0 && $s =~ /^You $sayregex '-ID-\.'$/o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
566 next unless ($opt_identify); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
567 # Beginning of identify info block |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
568 set_state(10, $s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
569 $id = {}; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
570 undef($id); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
571 $id_tale = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
572 $id_tale2 = 0; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
573 $$id{"line"} = $line; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
574 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
575 elsif ($state > 0 && $state < 10) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
576 # States for NPC parsing |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
577 parse_npc($s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
578 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
579 elsif ($state >= 10) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
580 parse_identify($s); |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
581 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
582 elsif ($s =~ /^(.+?) is (a bit good|a bit evil|evil|good|neutral)\.$/o) { |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
583 # Grab detect alignment |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
584 $aligns{$1}{$line} = $2; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
585 } |
218
e5e8083769fa
log2template: Accept ' in NPC short names.
Matti Hamalainen <ccr@tnsp.org>
parents:
217
diff
changeset
|
586 elsif ($s =~ /^([A-Za-z][A-Za-z\'\ .-]+?)\ is an? ([a-z-]+)\.$/o) { |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
587 # Grab detect race |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
588 $races{$1}{$line} = $2; |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
589 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
590 elsif ($s =~ /^You $sayregex /o) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
591 # Error, reset parsing state |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
592 set_state(0, $s); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
593 } |
218
e5e8083769fa
log2template: Accept ' in NPC short names.
Matti Hamalainen <ccr@tnsp.org>
parents:
217
diff
changeset
|
594 elsif ($s =~ /^([A-Za-z][A-Za-z\'\ -]+?) starts grappling [A-Z][a-z]+\.$/) { |
216
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
595 $skills{$1}{$line} = "grapple"; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
596 } |
219
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
597 elsif ($s =~ /^([A-Za-z][A-Za-z\'\ -]+?) pushes [A-Z][a-z]+ extremely hard\.$/) { |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
598 $skills{$1}{$line} = "push"; |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
599 } |
220
96ab088dba30
log2template: Added support for 'kick'.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
600 elsif ($s =~ /^([A-Za-z][A-Za-z\'\ -]+?)\'s (powerful bash sends|tries to bash)/) { |
219
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
601 $skills{$1}{$line} = "bash"; |
d352ae078cbb
Add support for 'bash' and 'push' skills. Fix some minor warnings.
Matti Hamalainen <ccr@tnsp.org>
parents:
218
diff
changeset
|
602 } |
220
96ab088dba30
log2template: Added support for 'kick'.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
603 elsif ($s =~ /^([A-Za-z][A-Za-z\'\ -]+?) (aims a fast kick at|kicks [A-Z][a-z]+ in the groin very hard|swings a foot in a long arc|performs a fast kick)/) { |
96ab088dba30
log2template: Added support for 'kick'.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
604 $skills{$1}{$line} = "kick"; |
96ab088dba30
log2template: Added support for 'kick'.
Matti Hamalainen <ccr@tnsp.org>
parents:
219
diff
changeset
|
605 } |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
606 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
607 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
608 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
609 ### |
187
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
610 ### Print out item/identify information |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
611 ### |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
612 foreach my $sdesc (sort { $a cmp $b } keys %ids) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
613 my $item = $ids{$sdesc}; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
614 my $name = $$item{"sdesc"}; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
615 $name =~ s/ labeled as .*$//; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
616 my $qdesc = $name; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
617 if ($$item{"full"} =~ / <(red|purple|white) glow>$/) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
618 $name .= " <red glow>"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
619 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
620 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
621 print "---------------------------\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
622 $qdesc."\n\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
623 "{{ Infobox ".$$item{"class"}."\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
624 "| name = ".$name."\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
625 "| description = ".$$item{"ldesc"}."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
626 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
627 if (defined($$item{"tale"}) && $$item{"tale"} ne "") { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
628 print "| tale = ".$$item{"tale"}."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
629 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
630 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
631 if (defined($$item{"type"})) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
632 print "| type = ".$$item{"type"}."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
633 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
634 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
635 if (defined($$item{"stats"})) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
636 print "| stats = ".join(", ", @{$$item{"stats"}})."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
637 } else { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
638 print "| stats = \n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
639 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
640 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
641 print |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
642 "| weight = ".$$item{"weight"}."\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
643 "| kg = ".$$item{"kg"}."\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
644 "| sacvalue = \n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
645 "| handles = ".$$item{"handles"}."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
646 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
647 if (defined($$item{"materials"})) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
648 print "| material = ".join(", ", @{$$item{"materials"}})."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
649 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
650 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
651 print |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
652 "| size = ".$$item{"size"}."\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
653 "| quality = ".$$item{"quality"}."\n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
654 "| from = \n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
655 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
656 if ($$item{"class"} eq "Weapon") { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
657 print |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
658 "| wep1 = \n". |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
659 "| wep2 = \n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
660 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
661 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
662 if (defined($$item{"other"})) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
663 print "| other = ".join("\n", @{$$item{"other"}})."\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
664 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
665 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
666 print |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
667 "}}\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
668 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
669 foreach my $cat (keys %{$$item{"cat"}}) { |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
670 print "[[Category:$cat]]\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
671 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
672 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
673 print "---------------------\n"; |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
674 } |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
675 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
676 |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
677 ### |
18b142c83761
Some major refactoring, added code for parsing 'identify' spell output (and other related data) to produce Item/Weapon/Armour templates.
Matti Hamalainen <ccr@tnsp.org>
parents:
185
diff
changeset
|
678 ### Print out the NPC information |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
679 ### |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
680 foreach my $sdesc (sort { $a cmp $b } keys %monsters) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
681 my $mob = $monsters{$sdesc}; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
682 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
683 print "--------------------------- |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
684 $sdesc |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
685 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
686 {{ NPC |
172 | 687 | name = ".$$mob{"sname"}." |
688 | description = ".$$mob{"ldesc"}." | |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
689 | eqs = "; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
690 |
172 | 691 foreach my $slot (sort { $a cmp $b } keys %{$$mob{"eqs"}}) { |
193
5052cb36ad34
Remove (glowing) from mob eq shortdescs.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
692 my $s = $$mob{"eqs"}{$slot}; |
5052cb36ad34
Remove (glowing) from mob eq shortdescs.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
693 $s =~ s/ \(glowing\)//; |
5052cb36ad34
Remove (glowing) from mob eq shortdescs.
Matti Hamalainen <ccr@tnsp.org>
parents:
192
diff
changeset
|
694 my $k = $s; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
695 $k =~ s/ <[a-z]+ glow>$//; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
696 if ($k eq $s) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
697 print "$slot: [[$s]]\n\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
698 } else { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
699 print "$slot: [[$k|$s]]\n\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
700 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
701 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
702 |
172 | 703 print "none" unless (scalar keys %{$$mob{"eqs"}} > 0); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
704 print "\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
705 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
706 if ($sdesc =~ / \(undead\)$/) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
707 print "| undead = x\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
708 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
709 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
710 # Check if we find a matching alignment: find a cast of 'detect alignment' |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
711 # with matching short name and withing appropriate distance from the mob look. |
172 | 712 my $mname = $$mob{"sname"}; |
713 my $mline = $$mob{"line"}; | |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
714 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
715 print "| alignment = "; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
716 if (defined($aligns{$mname})) { |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
717 my $qoffs = 1000; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
718 my $qline = -1; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
719 foreach my $aline (sort { $a <=> $b } keys %{$aligns{$mname}}) { |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
720 my $offs = ($aline - $mline); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
721 if ($offs < $qoffs) { |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
722 $qoffs = $offs; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
723 $qline = $aline; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
724 } |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
725 } |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
726 if ($qline >= 0) { |
172 | 727 print STDERR "ALIGN: $mname ($sdesc) \@ #$qline ($qoffs)\n" if ($opt_debug); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
728 print $aligns{$mname}{$qline}; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
729 } |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
730 } |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
731 print "\n". |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
732 "| race = "; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
733 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
734 # Check for race |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
735 if (defined($races{$mname})) { |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
736 my $qoffs = 1000; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
737 my $qline = -1; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
738 foreach my $aline (sort { $a <=> $b } keys %{$races{$mname}}) { |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
739 my $offs = ($aline - $mline); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
740 if ($offs < $qoffs) { |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
741 $qoffs = $offs; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
742 $qline = $aline; |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
743 } |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
744 } |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
745 if ($qline >= 0) { |
172 | 746 print STDERR "RACE: $mname ($sdesc) \@ #$qline ($qoffs)\n" if ($opt_debug); |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
747 print $races{$mname}{$qline}; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
748 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
749 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
750 print "\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
751 |
171
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
752 |
7198e3ba605c
Various improvements and cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
160
diff
changeset
|
753 # Spells |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
754 my $hasspells = 0; |
180
6fbb025265b2
Bugfixes; Added commandline option handling and setting of debugmode and output file.
Matti Hamalainen <ccr@tnsp.org>
parents:
176
diff
changeset
|
755 if (defined($spells{$mname}) && length($mname) >= 4) { |
217
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
756 my $maxdist = length($mname) * 150 * $opt_dist * length($mname); |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
757 my $mindist = length($mname) * -5 * $opt_dist * length($mname); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
758 my %mspells = (); |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
759 foreach my $sline (sort { $a <=> $b } keys %{$spells{$mname}}) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
760 my $offs = $sline - $mline; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
761 # print STDERR "TEST $mname @ $offs vs $mindist...$maxdist : '".$spells{$mname}{$sline}."'\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
762 if ($offs < $maxdist && $offs > $mindist) { |
172 | 763 print STDERR "SPELL $mname \@ $offs / $mindist...$maxdist : '".$spells{$mname}{$sline}."'\n" if ($opt_debug); |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
764 $mspells{$spells{$mname}{$sline}} = 1; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
765 $hasspells++; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
766 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
767 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
768 my $n = 1; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
769 foreach my $spell (sort { $a cmp $b } keys %mspells) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
770 print "| spell".($n < 2 ? "" : $n)." = $spell\n"; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
771 $n++; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
772 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
773 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
774 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
775 unless ($hasspells > 0) { |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
776 print "| spell = |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
777 | spell# = |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
778 "; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
779 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
780 |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
781 print " |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
782 | area = "; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
783 |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
784 if ($opt_getlocs) { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
785 my $cont = lc($$mob{"continent"}); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
786 my $xc = $$mob{"xc"}; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
787 my $yc = $$mob{"yc"}; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
788 parse_locfile($cont); |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
789 if (defined($locations{$cont}{$xc}{$yc})) { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
790 my $nm = $locations{$cont}{$xc}{$yc}[0]; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
791 $nm =~ s/^[\@]//; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
792 print $nm; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
793 } else { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
794 print $$mob{"area"}; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
795 } |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
796 } else { |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
797 print $$mob{"area"}; |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
798 } |
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
799 |
216
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
800 |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
801 print "\n"; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
802 |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
803 # Skills |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
804 my $hasskills = 0; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
805 if (defined($skills{$mname}) && length($mname) >= 4) { |
217
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
806 my $maxdist = length($mname) * 150 * $opt_dist * length($mname); |
138a3143a1fd
Add adjustable spell/skill detection threshold line distance factor option '-f'.
Matti Hamalainen <ccr@tnsp.org>
parents:
216
diff
changeset
|
807 my $mindist = length($mname) * -5 * $opt_dist * length($mname); |
216
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
808 my %mskills = (); |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
809 foreach my $sline (sort { $a <=> $b } keys %{$skills{$mname}}) { |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
810 my $offs = $sline - $mline; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
811 # print STDERR "TEST $mname @ $offs vs $mindist...$maxdist : '".$skills{$mname}{$sline}."'\n"; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
812 if ($offs < $maxdist && $offs > $mindist) { |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
813 print STDERR "SPELL $mname \@ $offs / $mindist...$maxdist : '".$skills{$mname}{$sline}."'\n" if ($opt_debug); |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
814 $mskills{$skills{$mname}{$sline}} = 1; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
815 $hasskills++; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
816 } |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
817 } |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
818 my $n = 1; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
819 foreach my $skill (sort { $a cmp $b } keys %mskills) { |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
820 print "| skill".($n < 2 ? "" : $n)." = $skill\n"; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
821 $n++; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
822 } |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
823 } |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
824 |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
825 unless ($hasskills > 0) { |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
826 print "| skill = |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
827 | skill# = |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
828 "; |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
829 } |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
830 |
f121fb47c65f
Implement support for gathering skill information. Only 'grapple' is
Matti Hamalainen <ccr@tnsp.org>
parents:
215
diff
changeset
|
831 |
214
54c65ca9af76
log2template: Add -L option for specifying path for *.loc files. If enabled,
Matti Hamalainen <ccr@tnsp.org>
parents:
213
diff
changeset
|
832 print " |
172 | 833 | exp = "; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
834 |
172 | 835 if (defined($$mob{"exp"})) { |
836 if ($$mob{"exp"} > 1000000) { | |
837 printf "%1.2fM", $$mob{"exp"} / 1000000.0; | |
838 } elsif ($$mob{"exp"} > 1000) { | |
839 printf "%dk", $$mob{"exp"} / 1000; | |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
840 } else { |
172 | 841 printf "%d", $$mob{"exp"}; |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
842 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
843 } |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
844 |
172 | 845 print " |
846 | GAP = | |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
847 | PAP = |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
848 | kerbholz = |
239 | 849 | gender = "; |
850 | |
851 if (defined($$mob{"gender"})) { | |
852 print $$mob{"gender"}; | |
853 } | |
854 | |
855 print " | |
100
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
856 | other = |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
857 }} |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
858 --------------------- |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
859 "; |
90033967a42d
Added perl-script that processes logfiles with specially marked information of NPCs and produces ready to cut & paste NPC templates for BatWiki. This is completely undocumented for the moment.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
860 } |