Mercurial > hg > batmud > misc
annotate magestats.pl @ 339:007859954b6c misc
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 09 Aug 2016 19:35:44 +0300 |
parents | 45a9682a462a |
children | 36464fccd38f |
rev | line source |
---|---|
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 #!/usr/bin/perl -w |
134
b2685ec16e67
Update copyrights, add comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
133
diff
changeset
|
2 # |
72 | 3 # Magestats - BatMUD Mage guild statistics generator |
133 | 4 # Developed by Matti Hämäläinen (Ggr Pupunen) <ccr@tnsp.org> |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
5 # (C) Copyright 2010-2011 Tecnic Software productions (TNSP) |
72 | 6 # |
7 # Requires Perl 5.8 and following modules: | |
8 # In Debian / Ubuntu, apt-get install libgd-graph-perl | |
134
b2685ec16e67
Update copyrights, add comments.
Matti Hamalainen <ccr@tnsp.org>
parents:
133
diff
changeset
|
9 # |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 use strict; |
110 | 11 use File::Basename; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 use Data::Dumper; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 use GD::Graph; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 use GD::Graph::linespoints; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 |
91 | 16 # List of spells per damage type. Only major blasts/areas are counted |
17 # for things like essence gain, etc. | |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 my %spell_data = ( |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
19 "acid" => [ "acid blast", "acid storm", "acid ray", "acid rain", "acid arrow", "acid wind", "disruption" ], |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
20 "fire" => [ "lava blast", "lava storm", "meteor blast", "meteor swarm", "fire blast", "fire bolt", "flame arrow" ], |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
21 "elec" => [ "electrocution", "lightning storm", "forked lightning", "chain lightning", "blast lightning", "lightning bolt", "shocking grasp" ], |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
22 "pois" => [ "summon carnal spores","killing cloud", "power blast", "venom strike", "poison blast", "poison spray", "thorn spray" ], |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
23 "cold" => [ "cold ray", "hailstorm", "ice bolt", "cone of cold", "darkfire", "flaming ice", "chill touch" ], |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
24 "mana" => [ "golden arrow", "magic eruption", "summon greater spores", "magic wave", "levin bolt", "summon lesser spores", "magic missile" ], |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
25 "asph" => [ "blast vacuum", "vacuum globe", "strangulation", "chaos bolt", "vacuum ball", "suffocation", "vacuumbolt" ], |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 ); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 |
72 | 28 # Settings and defaults |
92
013e69791387
Cleanups; Version bump; Make GgrTF log assumption not to be default.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
29 my $prog_name = "Magestats"; |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
30 my $prog_version = "0.7.5"; |
95 | 31 my $prog_file = $0; |
92
013e69791387
Cleanups; Version bump; Make GgrTF log assumption not to be default.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
32 |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 my $opt_cachefile; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 my $opt_verbosity = 1; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
35 my $opt_prefix = "magestats"; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
36 my $opt_imgfmt = "png"; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 my $opt_noinput = 0; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 my $opt_width = 500; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 my $opt_height = 250; |
92
013e69791387
Cleanups; Version bump; Make GgrTF log assumption not to be default.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
40 my $opt_ggrtf = 0; |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
41 my $opt_ignore = 0; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
42 |
75 | 43 my @crit_types = ("Unseen", "ENERGY", "POWER", "power"); |
44 | |
72 | 45 # Log level support |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
46 sub mlog($$) |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
47 { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
48 my $level = shift; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
49 my $msg = shift; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
50 print STDERR "* $msg\n" if ($opt_verbosity >= $level); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
51 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
52 |
72 | 53 ### |
54 ### Print out help if no arguments given | |
55 ### | |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
56 my $opt_mode = shift or die( |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
57 "$prog_name v$prog_version - BatMUD Mage guild statistics generator |
72 | 58 Developed by Matti Hamalainen (Ggr \@ bat), <ccr\@tnsp.org> |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
59 (C) Copyright 2010-2011 Tecnic Software productions (TNSP) |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
60 |
95 | 61 Usage: $prog_file dump [options] < logfile |
62 $prog_file stats [options] < logfile | |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
63 |
97
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
64 'dump' mode parses input log (unless -n is specified) and dumps |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
65 the whole state into standard output. This dump acts as |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
66 a cache, which can be later restored and added to. |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
67 |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
68 'stats' mode parses input (unless -n is specified) and outputs |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
69 statistics in HTML format file with graphs in specified |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
70 image format ($opt_imgfmt by default). |
1b370b589202
Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents:
95
diff
changeset
|
71 |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
72 -v Verbose mode |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
73 -c <cachefile> Specify a cache file to restore from |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
74 -p <prefix> Output filename prefix ('$opt_prefix') |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
75 -t <png|gif> Image format to be used ('$opt_imgfmt') |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
76 -s <WxH> Graph dimensions in pixels ($opt_width x $opt_height) |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
77 -n No input (only handle cache, if specified) |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
78 -g Assume GgrTF mangled logfiles |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
79 |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
80 -i Try to ignore blasts for staff counters that occured |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
81 when staff was not being worn. WARNING! This is a very |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
82 fragile and EXPERIMENTAL feature! |
88
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
83 |
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
84 NOTICE! The input log data is assumed to be in CHRONOLOGICAL ORDER! |
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
85 Things will go bonkers if that is not the case. Thus, make sure you |
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
86 are feeding the data in correct order (older logs first, etc.) |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
87 "); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
88 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
89 die("Invalid operation mode '$opt_mode'!\n") unless ($opt_mode =~ /^(dump|stats)$/); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
90 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
91 while (my $opt = shift) { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
92 if ($opt eq "-c") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
93 # Restore cache from file |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
94 $opt_cachefile = shift or die("-c option requires an argument.\n"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
95 } elsif ($opt eq "-v") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
96 $opt_verbosity++; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
97 } elsif ($opt eq "-t") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
98 $opt_imgfmt = shift or die("-t option requires an argument.\n"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
99 die("Invalid format '$opt_imgfmt' specified!\n") unless ($opt_imgfmt =~ /^(png|gif)$/); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
100 } elsif ($opt eq "-p") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
101 $opt_prefix = shift or die("-p option requires an argument.\n"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
102 } elsif ($opt eq "-n") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
103 $opt_noinput = 1; |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
104 } elsif ($opt eq "-g") { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
105 $opt_ggrtf = 1; |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
106 } elsif ($opt eq "-i") { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
107 $opt_ignore = 1; |
76 | 108 } elsif ($opt eq "-s") { |
109 my $tmp = shift or die("-s option requires an argument.\n"); | |
110 if ($tmp =~ /^(\d+)[x:](\d+)$/) { | |
111 $opt_width = $1; | |
112 $opt_height = $2; | |
113 } else { | |
114 die("-s option expects WxH, for example 320x200.\n"); | |
115 } | |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
116 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
117 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
118 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
119 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
120 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
121 ### Construct full data structure |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
122 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
123 mlog(1, "Initializing structures."); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
124 my $spells = {}; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
125 foreach my $type (keys %spell_data) { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
126 my $src = $spell_data{$type}; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
127 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
128 foreach my $spell (@{$src}) { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
129 $$spells{$spell}{"type"} = $type; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
130 $$spells{$spell}{"blasts"} = 0; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
131 $$spells{"staff"}{$spell}{"blasts"} = 0; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
132 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
133 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
134 $$spells{$type}{"essence"}{"increase"} = 0; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
135 $$spells{$type}{"essence"}{"blasts"}{"single"} = []; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
136 $$spells{$type}{"essence"}{"blasts"}{"area"} = []; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
137 $$spells{$type}{"reinc"} = 0; |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
138 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
139 $$spells{"staff"}{$type}{"blasts"} = 0; |
77
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
140 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
141 $$spells{$type}{"blasts"} = 0; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
142 $$spells{$type}{"reagents"} = 0; |
83
e12c03b40e61
Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents:
77
diff
changeset
|
143 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
144 $$spells{$type}{"single"} = $$src[0]; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
145 $$spells{$type}{"area"} = $$src[1]; |
75 | 146 |
147 foreach my $crit (@crit_types) { | |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
148 $$spells{$type}{"crits"}{$crit} = 0; |
75 | 149 } |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
150 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
151 push(@{$$spells{"single"}}, $$src[0]); |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
152 push(@{$$spells{"area"}}, $$src[1]); |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
153 } |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
154 $$spells{"total"}{"blasts"} = 0; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
155 $$spells{"total"}{"essence"} = 0; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
156 $$spells{"total"}{"reagents"} = 0; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
157 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
158 $$spells{"staff"}{"desc"} = ""; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
159 $$spells{"staff"}{"data"}{"normal"} = []; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
160 $$spells{"staff"}{"data"}{"ignore"} = []; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
161 $$spells{"staff"}{"total"}{"blasts"} = 0; |
85
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
162 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
163 |
85
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
164 ### Convert special characters to HTML/XML entities |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
165 my %entities = ( |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
166 "<" => "lt", |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
167 ">" => "gt", |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
168 "&" => "amp", |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
169 ); |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
170 |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
171 sub htmlentities($) |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
172 { |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
173 my $value = $_[0]; |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
174 $value =~ s/$_/\&$entities{$_}\;/g foreach (keys %entities); |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
175 return $value; |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
176 } |
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
177 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
178 |
85
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
179 ### Get damage type of given mage spell, die if not known spell. |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
180 sub get_spell_type($) |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
181 { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
182 my $spell = $_[0]; |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
183 die("get_spell_type($spell): No such spell.\n") unless exists($$spells{$spell}{"type"}); |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
184 return $$spells{$spell}{"type"}; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
185 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
186 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
187 |
77
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
188 ### Trap warnings to inform the user that the cache might be stale |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
189 my $has_warned = 0; |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
190 $SIG{__WARN__} = sub { |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
191 warn("* ", @_); |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
192 if (!$has_warned) { |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
193 if (defined($opt_cachefile)) { |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
194 mlog(-1, "!! The given cache file '$opt_cachefile' is probably stale / incompatible !!"); |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
195 } else { |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
196 mlog(-1, "!! There seems to be a bug. Report to Ggr !!"); |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
197 } |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
198 } |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
199 $has_warned = 1; |
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
200 }; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
201 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
202 |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
203 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
204 ### Read cache |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
205 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
206 if (defined($opt_cachefile)) { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
207 mlog(1, "Restoring cache from '$opt_cachefile'."); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
208 open(CACHE, "<", $opt_cachefile) or die("Could not open cache file '$opt_cachefile'!\n"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
209 my $s = <CACHE>; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
210 close(CACHE); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
211 eval $s; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
212 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
213 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
214 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
215 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
216 ### Scan input for blasts etc. |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
217 ### |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
218 my @all_spells = (); |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
219 foreach my $type (keys %spell_data) { |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
220 push(@all_spells, @{$spell_data{$type}}); |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
221 } |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
222 my $match = join("|", @all_spells); |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
223 my $essence_flag = 0; |
75 | 224 my $crit_flag = 0; |
225 my $crit_type; | |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
226 my $last_spell = ""; |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
227 my $staff_worn = 0; |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
228 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
229 |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
230 sub staff_update($$) |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
231 { |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
232 my ($desc, $line) = @_; |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
233 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
234 if ($$spells{"staff"}{"desc"} ne $desc) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
235 mlog(2, "Staff change '".$$spells{"staff"}{"desc"}."' -> '$desc'\n# $line\n"); |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
236 my %blasts = (); |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
237 my $area = 0; |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
238 |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
239 foreach my $type (keys %spell_data) { |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
240 foreach my $class ("single", "area") { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
241 my $name = $$spells{$type}{$class}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
242 $blasts{"ignore"}{$class} += $$spells{"staff"}{$name}{"blasts"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
243 $blasts{"normal"}{$class} += $$spells{$name}{"blasts"}; |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
244 } |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
245 } |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
246 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
247 push(@{$$spells{"staff"}{"data"}{"normal"}}, |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
248 { |
90
bf736fdd4290
Cleanups, added debug thingies.
Matti Hamalainen <ccr@tnsp.org>
parents:
89
diff
changeset
|
249 "desc" => $desc, |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
250 "blasts" => $$spells{"total"}{"blasts"}, |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
251 "major" => $blasts{"normal"}{"single"} + $blasts{"normal"}{"area"}, |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
252 "single" => $blasts{"normal"}{"single"}, |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
253 "area" => $blasts{"normal"}{"area"}, |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
254 }); |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
255 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
256 push(@{$$spells{"staff"}{"data"}{"ignore"}}, |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
257 { |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
258 "desc" => $desc, |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
259 "blasts" => $$spells{"staff"}{"total"}{"blasts"}, |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
260 "major" => $blasts{"ignore"}{"single"} + $blasts{"ignore"}{"area"}, |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
261 "single" => $blasts{"ignore"}{"single"}, |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
262 "area" => $blasts{"ignore"}{"area"}, |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
263 }); |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
264 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
265 $$spells{"staff"}{"desc"} = $desc; |
87
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
266 } |
28e24f92e957
Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents:
86
diff
changeset
|
267 } |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
268 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
269 |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
270 sub spell_update($) |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
271 { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
272 $last_spell = $_[0]; |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
273 |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
274 my $type = get_spell_type($last_spell); |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
275 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
276 $$spells{$last_spell}{"blasts"}++; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
277 $$spells{"total"}{"blasts"}++; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
278 $$spells{$type}{"blasts"}++; |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
279 |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
280 if ($staff_worn) { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
281 $$spells{"staff"}{$last_spell}{"blasts"}++; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
282 $$spells{"staff"}{"total"}{"blasts"}++; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
283 $$spells{"staff"}{$type}{"blasts"}++; |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
284 } |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
285 |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
286 # If essence was gained, get the type etc .. |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
287 if ($essence_flag) { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
288 $essence_flag = 0; |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
289 |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
290 # Handle the post-reinc essence increase |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
291 if ($$spells{$type}{"reinc"}) { |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
292 mlog(2, "Ignoring post-reinc essence gain for type $type.\n"); |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
293 $$spells{$type}{"reinc"} = 0; |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
294 } else { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
295 $$spells{"total"}{"essence"}++; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
296 $$spells{$type}{"essence"}{"increase"}++; |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
297 |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
298 # Save amount of major blasts for each "essence gain" step |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
299 foreach my $class ("single", "area") { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
300 my $name = $$spells{$type}{$class}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
301 push(@{$$spells{$type}{"essence"}{"blasts"}{$class}}, $$spells{$name}{"blasts"}); |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
302 } |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
303 } |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
304 } |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
305 |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
306 # Crit hits |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
307 if ($crit_flag) { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
308 $crit_flag = 0; |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
309 # print STDERR "crit: $type : $last_spell : $crit_type\n"; |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
310 $$spells{$type}{"crits"}{$crit_type}++; |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
311 } |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
312 } |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
313 |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
314 |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
315 sub staff_match($$$) |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
316 { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
317 my ($str, $wear, $line) = @_; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
318 my ($result, $postfix) = ("", ""); |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
319 |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
320 if ($str =~ /(\S+ the (Shimmering|Radiating|Glowing) (white|grey|dark|black) mage staff)(.*)$/i) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
321 $result = $1; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
322 $postfix = $4; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
323 } elsif ($str =~ /(\S+ the (white|grey|dark|black) mage staff)(.*)$/i) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
324 $result = $1; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
325 $postfix = $3; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
326 } elsif ($str =~ /((Shimmering|Radiating|Glowing) (white|grey|dark|black) mage staff)(.*)$/i) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
327 $result = $1; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
328 $postfix = $4; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
329 } elsif ($str =~ /((white|grey|dark|black) mage staff)(.*)$/i) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
330 $result = $1; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
331 $postfix = $3; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
332 } |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
333 |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
334 if ($postfix ne "") { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
335 if ($postfix =~ /^ \(glowing\) <.+? glow>/) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
336 $postfix = " <red glow>"; |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
337 } elsif ($postfix =~ /^ <.+? glow>/) { |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
338 $postfix = " <red glow>"; |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
339 } elsif ($postfix =~ /^( of Power)/i) { |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
340 $postfix = $1; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
341 } else { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
342 $postfix = ""; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
343 } |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
344 } |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
345 |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
346 if ($result ne "") { |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
347 $staff_worn = $wear; |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
348 if ($wear) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
349 # print STDERR "'$result' :: '$postfix'\n"; |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
350 staff_update($result.$postfix, $line); |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
351 } |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
352 } |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
353 } |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
354 |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
355 |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
356 if ($opt_noinput) { |
72 | 357 mlog(1, "Skipping input parsing."); |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
358 } else { |
92
013e69791387
Cleanups; Version bump; Make GgrTF log assumption not to be default.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
359 my $gflag = 0; |
013e69791387
Cleanups; Version bump; Make GgrTF log assumption not to be default.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
360 mlog(1, "Using GgrTF format only!") if ($opt_ggrtf); |
339 | 361 mlog(2, "Matching regexp '".$match."'\n"); |
362 mlog(1, "Parsing log from stdin ..."); | |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
363 |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
364 while (defined(my $s = <STDIN>)) { |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
365 if ($s =~ /^You wear (.+?)\.$/) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
366 staff_match($1, 1, $s); |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
367 } elsif ($s =~ /^You remove (.+?)\.$/) { |
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
368 staff_match($1, 0, $s); |
85
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
369 } elsif ($s =~ /^Time to choose your reincarnation method./) { |
83
e12c03b40e61
Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents:
77
diff
changeset
|
370 # Set reinc flags for each type that has essence |
e12c03b40e61
Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents:
77
diff
changeset
|
371 foreach my $type (keys %spell_data) { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
372 $$spells{$type}{"reinc"} = 1 if ($$spells{$type}{"essence"}{"increase"} > 0); |
83
e12c03b40e61
Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents:
77
diff
changeset
|
373 } |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
374 } elsif ($s =~ /^You watch with selfpride as your ($match) hits / || $s =~ /^You hit .+? with your ($match)\.$/) { |
169
863c9d955d71
Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents:
134
diff
changeset
|
375 spell_update($1) if ($gflag == 0); |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
376 $gflag = 0; |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
377 } elsif ($s =~ /^Your .($match). hits / || $s =~ /^Your ($match) hits /) { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
378 if ($opt_ggrtf) { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
379 spell_update($1); |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
380 $gflag = 1; |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
381 } |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
382 } elsif ($s =~ /^Your knowledge in elemental powers helps you to save the reagent for further use\./) { |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
383 if ($last_spell ne "") { |
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
384 my $type = get_spell_type($last_spell); |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
385 $$spells{$type}{"reagents"}++; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
386 $$spells{"total"}{"reagents"}++; |
89
56cee55c2a6c
Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
387 } |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
388 } elsif ($s =~ /^You feel your skills in handling elemental forces improve\./) { |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
389 $essence_flag = 1; |
75 | 390 } elsif ($s =~ /^Your fingertips are surrounded with swirling (ENERGY) as you cast the spell\./ || |
391 $s =~ /^You feel like you managed to channel additional (POWER) to your spell\./ || | |
392 $s =~ /^You feel like your spell gained additional (power)\./ || | |
393 $s =~ /^(Unseen) BURSTS of magic are absorbed into the spell/) { | |
394 $crit_type = $1; | |
395 $crit_flag = 1; | |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
396 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
397 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
398 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
399 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
400 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
401 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
402 ### Dump cache to stdout |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
403 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
404 if ($opt_mode eq "dump") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
405 $Data::Dumper::Indent = 0; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
406 $Data::Dumper::Useqq = 1; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
407 $Data::Dumper::Purity = 1; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
408 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
409 my $dumper = Data::Dumper->new([$spells], ["spells"]); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
410 print $dumper->Dump(); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
411 exit; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
412 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
413 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
414 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
415 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
416 ### Output statistics |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
417 ### |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
418 if ($opt_mode eq "stats") { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
419 my $filename = $opt_prefix.".html"; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
420 open(OUT, ">", $filename) or die("Could not create output file '$filename'.\n"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
421 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
422 mlog(1, "Outputting stats HTML to '$filename'"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
423 |
91 | 424 print OUT qq|<?xml version="1.0" encoding="UTF-8"?> |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
425 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
426 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
427 <head> |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
428 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
429 <meta name="Generator" content="$prog_name version $prog_version" /> |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
430 <title>Mage statistics</title> |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
431 <style type="text/css"> |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
432 body { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
433 margin: 1em; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
434 background-color: #353; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
435 color: #cdc; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
436 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
437 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
438 body, p, ul, td, th { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
439 font-family: Verdana, Arial, helvetica, sans-serif; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
440 font-size: 10pt; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
441 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
442 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
443 a, a:visited, a:active { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
444 text-decoration: underline; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
445 color: #fc0; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
446 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
447 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
448 a:hover { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
449 text-decoration: none; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
450 background-color: black; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
451 color: white; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
452 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
453 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
454 .icenter { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
455 text-align: center; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
456 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
457 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
458 .noborder { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
459 border: none; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
460 padding: 0pt; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
461 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
462 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
463 h1, h2, h3 { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
464 font-family: Arial, sans-serif; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
465 font-weight: normal; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
466 color: #efe; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
467 background: #575; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
468 padding: 4px; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
469 padding-bottom: 8px; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
470 text-shadow: 2px 2px 2px #000; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
471 border-bottom: 2px solid #242; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
472 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
473 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
474 th { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
475 padding: 2px; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
476 margin: 2px; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
477 background: #575; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
478 color: #fc0; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
479 text-align: center; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
480 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
481 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
482 td { |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
483 padding: 4px; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
484 margin: 2px; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
485 background: #242; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
486 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
487 |
210 | 488 td.blasts { |
489 margin: 0px; | |
490 padding: 0px; | |
491 } | |
492 | |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
493 table.blasts { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
494 width: 100%; |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
495 background: #464; |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
496 } |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
497 |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
498 </style> |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
499 </head> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
500 <body> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
501 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
502 <h1>Mage statistics</h1> |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
503 <p> |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
504 Generated with $prog_name v$prog_version by Matti Hämäläinen aka Ggr Pupunen. |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
505 </p> |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
506 |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
507 <h2>Mage staff development</h2> |
86 | 508 |; |
85
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
509 |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
510 if ($opt_ignore) { |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
511 print OUT "<p><b>NOTICE!</b> Experimental 'ignore non-worn staff blasts' mode enabled.</p>\n"; |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
512 } |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
513 |
86 | 514 print OUT " |
515 <table class=\"info\"> | |
516 <tr> | |
517 <th>Blasts</th> | |
518 <th>Major blasts</th> | |
519 <th>Singles</th> | |
520 <th>Areas</th> | |
521 <th>Staff short description</th> | |
522 </tr> | |
523 "; | |
524 | |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
525 my $tab = $opt_ignore ? "ignore" : "normal"; |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
526 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
527 foreach my $foo (@{$$spells{"staff"}{"data"}{$tab}}) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
528 print OUT "<tr><td>".$$foo{"blasts"}."</td><td>". |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
529 $$foo{"major"}."</td><td>".$$foo{"single"}."</td><td>". |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
530 $$foo{"area"}."</td><td>".htmlentities($$foo{"desc"})."</td></tr>\n"; |
86 | 531 } |
532 | |
533 print OUT " | |
534 </table> | |
170
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
535 |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
536 <ul> |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
537 <li><b>Blasts</b>: All blasts, including minor.</li> |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
538 <li><b>Major blasts</b>: Only major blasts (sum of major singles + areas).</li> |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
539 <li><b>Singles</b>: Major single blasts.</li> |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
540 <li><b>Areas</b>: Major area blasts.</li> |
d5b260fae82a
Added experimental option for attempting to ignore blasts for mage staff counters that were cast when staff was not worn.
Matti Hamalainen <ccr@tnsp.org>
parents:
169
diff
changeset
|
541 </ul> |
86 | 542 |
85
9aa648df2366
Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
543 <h2>Blasts, essence, etc</h2> |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
544 <table class=\"info\"> |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
545 <tr> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
546 <th>Type</th> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
547 <th>Blasts</th> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
548 <th>Reagents saved</th> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
549 <th>Essence gained</th> |
98 | 550 <th>Major blasts per essence gain</th> |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
551 </tr> |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
552 "; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
553 |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
554 my %dographs = (); |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
555 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
556 $dographs{"ALL"} = 1; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
557 foreach my $type (keys %spell_data) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
558 next unless ($$spells{$type}{"blasts"} > 0); |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
559 |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
560 foreach my $crit (@crit_types) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
561 $$spells{"ALL"}{"crits"}{$crit} += $$spells{$type}{"crits"}{$crit}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
562 } |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
563 $$spells{"ALL"}{"reagents"} += $$spells{$type}{"reagents"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
564 $$spells{"ALL"}{"blasts"} += $$spells{$type}{"blasts"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
565 $$spells{"ALL"}{"essence"}{"increase"} += $$spells{$type}{"essence"}{"increase"}; |
77
ece6f3a45ee1
Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents:
76
diff
changeset
|
566 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
567 my $s_s = $$spells{$type}{"single"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
568 my $s_a = $$spells{$type}{"area"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
569 $$spells{"ALL"}{"single"} = "ALL_SINGLE"; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
570 $$spells{"ALL"}{"area"} = "ALL_AREA"; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
571 $$spells{"ALL_SINGLE"}{"blasts"} += $$spells{$s_s}{"blasts"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
572 $$spells{"ALL_AREA"}{"blasts"} += $$spells{$s_a}{"blasts"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
573 $dographs{$type} = 1; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
574 } |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
575 |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
576 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
577 foreach my $type (sort { $a cmp $b } keys %dographs) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
578 |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
579 my $s_s = $$spells{$type}{"single"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
580 my $s_a = $$spells{$type}{"area"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
581 |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
582 my $b_s = $$spells{$s_s}{"blasts"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
583 my $b_a = $$spells{$s_a}{"blasts"}; |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
584 my $total_blasts = $b_s + $b_a; |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
585 |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
586 next unless ($total_blasts > 0); |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
587 |
210 | 588 print OUT "<tr><td>$type</td><td class=\"blasts\"> |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
589 <table class=\"blasts\"><th></th><th>Single</th><th>Area</th></tr> |
73
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
590 <tr><th>Name</th><td>$s_s</td><td>$s_a</td></tr> |
54e33015ba7c
Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents:
72
diff
changeset
|
591 <tr><th>Blasts</th><td>".$b_s."</td><td>".$b_a."</td></tr> |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
592 <tr><th>Total</th><td colspan=\"2\">".$total_blasts."</td></tr>"; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
593 |
75 | 594 foreach my $crit (@crit_types) { |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
595 print OUT "<tr><th>$crit</th><td colspan=\"2\">".$$spells{$type}{"crits"}{$crit}."</td></tr>\n"; |
75 | 596 } |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
597 |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
598 printf OUT "</table></td><td><b>%d</b> (%1.2f %%)</td><td>%d</td><td>", |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
599 $$spells{$type}{"reagents"}, |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
600 ($total_blasts > 0) ? ($$spells{$type}{"reagents"} * 100.0) / $total_blasts : 0.0, |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
601 $$spells{$type}{"essence"}{"increase"}; |
75 | 602 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
603 if ($type ne "ALL" && exists($$spells{$type}{"essence"}{"blasts"})) { |
108
49db8f7d9833
Fix handling of prefixes with directory paths.
Matti Hamalainen <ccr@tnsp.org>
parents:
98
diff
changeset
|
604 my ($gfilename, $gpath, $gsuffix) = fileparse($opt_prefix); |
49db8f7d9833
Fix handling of prefixes with directory paths.
Matti Hamalainen <ccr@tnsp.org>
parents:
98
diff
changeset
|
605 print OUT "<img src=\"".$gfilename.$gsuffix."_".$type.".".$opt_imgfmt."\" alt=\"?\" />"; |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
606 } else { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
607 $dographs{$type} = 0; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
608 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
609 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
610 print OUT " |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
611 </td> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
612 </tr>\n"; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
613 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
614 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
615 print OUT "</table> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
616 </body> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
617 </html> |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
618 "; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
619 |
88
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
620 |
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
621 ### |
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
622 ### Output graphs |
6d3f15ee18d9
Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
623 ### |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
624 mlog(1, "Outputting graphs '".$opt_prefix."_*.".$opt_imgfmt."'..."); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
625 |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
626 foreach my $type (keys %dographs) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
627 next unless $dographs{$type}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
628 |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
629 my $s = $$spells{$type}{"single"}; |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
630 my $a = $$spells{$type}{"area"}; |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
631 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
632 my $graph = GD::Graph::linespoints->new($opt_width, $opt_height); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
633 $graph->set( |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
634 y_label => 'Blasts', |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
635 x_label => 'Essence gained', |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
636 show_values => 1, |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
637 transparent => 0, |
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
638 bgclr => 'white', |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
639 ); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
640 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
641 my @titles = (); |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
642 for (my $i = 1; $i <= $$spells{$type}{"essence"}{"increase"}; $i++) { |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
643 push(@titles, "+".$i); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
644 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
645 |
84
c3554f46ca49
Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents:
83
diff
changeset
|
646 my @total = (); |
204
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
647 for (my $i = 0; $i < $$spells{$type}{"essence"}{"increase"}; $i++) { |
0dd8daa71369
Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents:
170
diff
changeset
|
648 push(@total, $$spells{$type}{"essence"}{"blasts"}{"single"}[$i] + $$spells{$type}{"essence"}{"blasts"}{"area"}[$i]); |
71
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
649 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
650 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
651 my @data = ( |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
652 \@titles, |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
653 \@total, |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
654 ); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
655 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
656 my $gd = $graph->plot(\@data) or mlog(0, "Error creating graph ($type): ".$graph->error); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
657 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
658 if ($gd) { |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
659 open(IMG, ">", $opt_prefix."_".$type.".".$opt_imgfmt) or die("Error openiong file ".$!."\n"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
660 binmode IMG; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
661 print IMG $gd->gif if ($opt_imgfmt eq "gif"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
662 print IMG $gd->png if ($opt_imgfmt eq "png"); |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
663 close IMG; |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
664 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
665 } |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
666 |
3eca3030c175
Added a simplistic Perl-based utility for generating Mage-guild related statistics and graphs in HTML + image formats from log file input.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
667 } |