annotate magestats.pl @ 344:55edb7d42ce4 misc

Possibly improve spell crit detection/handling.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Aug 2016 00:21:04 +0300
parents 9267d2b51e57
children 4dce0dd371a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
3 # Magestats - BatMUD Mage guild statistics generator
133
5535e20ff79a Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 110
diff changeset
4 # Developed by Matti Hämäläinen (Ggr Pupunen) <ccr@tnsp.org>
341
5044666f6de2 Update copyright.
Matti Hamalainen <ccr@tnsp.org>
parents: 340
diff changeset
5 # (C) Copyright 2010-2016 Tecnic Software productions (TNSP)
72
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
6 #
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
7 # Requires Perl 5.8 and following modules:
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
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;
342
f4c26eba10af Use warnings.
Matti Hamalainen <ccr@tnsp.org>
parents: 341
diff changeset
11 use warnings;
110
5b7ed510342d Add use File::Basename;
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
12 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
13 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
14 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
15 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
16
91
d513a05279d3 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
17 # List of spells per damage type. Only major blasts/areas are counted
d513a05279d3 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
18 # 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
19 my %spell_data = (
73
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
20 "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
21 "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
22 "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
23 "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
24 "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
25 "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
26 "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
27 );
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
28
72
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
29 # 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
30 my $prog_name = "Magestats";
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
31 my $prog_version = "0.7.5";
95
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
32 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
33
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
34 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
35 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
36 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
37 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
38 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
39 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
40 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
41 my $opt_ggrtf = 0;
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
42 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
43
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
44 my @crit_types = ("Unseen", "ENERGY", "POWER", "power");
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
45
72
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
46 # 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
47 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
48 {
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 $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
50 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
51 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
52 }
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
53
72
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
54 ###
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
55 ### Print out help if no arguments given
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
56 ###
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
57 my $opt_mode = shift or die(
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
58 "$prog_name v$prog_version - BatMUD Mage guild statistics generator
72
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
59 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
60 (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
61
95
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
62 Usage: $prog_file dump [options] < logfile
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
63 $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
64
97
1b370b589202 Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
65 '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
66 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
67 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
68
1b370b589202 Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
69 '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
70 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
71 image format ($opt_imgfmt by default).
1b370b589202 Add information about operation modes into help.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
72
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
73 -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
74 -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
75 -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
76 -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
77 -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
78 -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
79 -g Assume GgrTF mangled logfiles
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
80
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
81 -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
82 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
83 fragile and EXPERIMENTAL feature!
88
6d3f15ee18d9 Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
84
6d3f15ee18d9 Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
85 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
86 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
87 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
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
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 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
91
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 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
93 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
94 # 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
95 $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
96 } 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
97 $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
98 } 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
99 $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
100 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
101 } 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
102 $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
103 } 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
104 $opt_noinput = 1;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
105 } elsif ($opt eq "-g") {
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
106 $opt_ggrtf = 1;
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
107 } elsif ($opt eq "-i") {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
108 $opt_ignore = 1;
76
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
109 } elsif ($opt eq "-s") {
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
110 my $tmp = shift or die("-s option requires an argument.\n");
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
111 if ($tmp =~ /^(\d+)[x:](\d+)$/) {
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
112 $opt_width = $1;
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
113 $opt_height = $2;
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
114 } else {
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
115 die("-s option expects WxH, for example 320x200.\n");
0ca7343edec0 Parse -s option correctly.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
116 }
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
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 ###
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 ### 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
123 ###
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 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
125 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
126 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
127 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
128
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
129 foreach my $spell (@{$src}) {
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
130 $$spells{$spell}{"type"} = $type;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
131 $$spells{$spell}{"blasts"} = 0;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
132 $$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
133 }
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
134
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
135 $$spells{$type}{"essence"}{"increase"} = 0;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
136 $$spells{$type}{"essence"}{"blasts"}{"single"} = [];
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
137 $$spells{$type}{"essence"}{"blasts"}{"area"} = [];
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
138 $$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
139
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
140 $$spells{"staff"}{$type}{"blasts"} = 0;
77
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
141
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
142 $$spells{$type}{"blasts"} = 0;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
143 $$spells{$type}{"reagents"} = 0;
83
e12c03b40e61 Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
144
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
145 $$spells{$type}{"single"} = $$src[0];
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
146 $$spells{$type}{"area"} = $$src[1];
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
147
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
148 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
149 $$spells{$type}{"crits"}{$crit} = 0;
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
150 }
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
151
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
152 push(@{$$spells{"single"}}, $$src[0]);
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
153 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
154 }
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
155 $$spells{"total"}{"blasts"} = 0;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
156 $$spells{"total"}{"essence"} = 0;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
157 $$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
158
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
159 $$spells{"staff"}{"desc"} = "";
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
160 $$spells{"staff"}{"data"}{"normal"} = [];
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
161 $$spells{"staff"}{"data"}{"ignore"} = [];
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
162 $$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
163
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
164
85
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
165 ### 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
166 my %entities = (
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
167 "<" => "lt",
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
168 ">" => "gt",
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
169 "&" => "amp",
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
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
172 sub htmlentities($)
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
173 {
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
174 my $value = $_[0];
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
175 $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
176 return $value;
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
177 }
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
178
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
179
85
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
180 ### 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
181 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
182 {
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
183 my $spell = $_[0];
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
184 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
185 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
186 }
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
187
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
188
77
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
189 ### 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
190 my $has_warned = 0;
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
191 $SIG{__WARN__} = sub {
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
192 warn("* ", @_);
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
193 if (!$has_warned) {
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
194 if (defined($opt_cachefile)) {
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
195 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
196 } else {
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
197 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
198 }
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
199 }
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
200 $has_warned = 1;
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
201 };
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
202
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
203
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
204 ###
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 ### 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
206 ###
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 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
208 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
209 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
210 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
211 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
212 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
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 ###
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 ### 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
218 ###
73
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
219 my @all_spells = ();
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
220 foreach my $type (keys %spell_data) {
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
221 push(@all_spells, @{$spell_data{$type}});
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
222 }
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
223 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
224 my $essence_flag = 0;
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
225 my $crit_flag = 0;
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
226 my $crit_type;
344
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
227 my $crit_dist;
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
228 my $last_spell = "";
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
229 my $staff_worn = 0;
343
9267d2b51e57 Count lines since last spell hit.
Matti Hamalainen <ccr@tnsp.org>
parents: 342
diff changeset
230 my $spell_active = 0;
9267d2b51e57 Count lines since last spell hit.
Matti Hamalainen <ccr@tnsp.org>
parents: 342
diff changeset
231 my $nline = 0;
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
232
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
233
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
234 sub staff_update($$)
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
235 {
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
236 my ($desc, $line) = @_;
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
237
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
238 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
239 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
240 my %blasts = ();
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
241 my $area = 0;
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
242
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
243 foreach my $type (keys %spell_data) {
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
244 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
245 my $name = $$spells{$type}{$class};
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
246 $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
247 $blasts{"normal"}{$class} += $$spells{$name}{"blasts"};
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
248 }
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
249 }
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
250
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
251 push(@{$$spells{"staff"}{"data"}{"normal"}},
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
252 {
90
bf736fdd4290 Cleanups, added debug thingies.
Matti Hamalainen <ccr@tnsp.org>
parents: 89
diff changeset
253 "desc" => $desc,
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
254 "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
255 "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
256 "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
257 "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
258 });
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
259
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
260 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
261 {
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 "desc" => $desc,
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
263 "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
264 "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
265 "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
266 "area" => $blasts{"ignore"}{"area"},
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
267 });
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
268
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
269 $$spells{"staff"}{"desc"} = $desc;
87
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
270 }
28e24f92e957 Try to improve mage staff shortdesc grabbing.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
271 }
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
272
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
273
344
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
274 sub crit_update()
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
275 {
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
276 if ($crit_flag) {
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
277 my $type = get_spell_type($last_spell);
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
278 # print STDERR "crit: $type : $last_spell : $crit_type [$crit_dist]\n";
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
279 $$spells{$type}{"crits"}{$crit_type}++;
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
280 $crit_flag = 0;
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
281 }
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
282 }
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
283
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
284
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
285 sub spell_update($)
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
286 {
344
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
287 crit_update();
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
288
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
289 $last_spell = $_[0];
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
290
343
9267d2b51e57 Count lines since last spell hit.
Matti Hamalainen <ccr@tnsp.org>
parents: 342
diff changeset
291 $spell_active = $nline;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
292 my $type = get_spell_type($last_spell);
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
293
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
294 $$spells{$last_spell}{"blasts"}++;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
295 $$spells{"total"}{"blasts"}++;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
296 $$spells{$type}{"blasts"}++;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
297
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
298 if ($staff_worn) {
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
299 $$spells{"staff"}{$last_spell}{"blasts"}++;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
300 $$spells{"staff"}{"total"}{"blasts"}++;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
301 $$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
302 }
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
303
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
304 # 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
305 if ($essence_flag) {
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
306 $essence_flag = 0;
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
307
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
308 # 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
309 if ($$spells{$type}{"reinc"}) {
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
310 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
311 $$spells{$type}{"reinc"} = 0;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
312 } else {
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
313 $$spells{"total"}{"essence"}++;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
314 $$spells{$type}{"essence"}{"increase"}++;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
315
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
316 # 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
317 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
318 my $name = $$spells{$type}{$class};
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
319 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
320 }
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
321 }
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
322 }
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
323 }
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
324
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
325
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
326 sub staff_match($$$)
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
327 {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
328 my ($str, $wear, $line) = @_;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
329 my ($result, $postfix) = ("", "");
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
330
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
331 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
332 $result = $1;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
333 $postfix = $4;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
334 } 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
335 $result = $1;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
336 $postfix = $3;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
337 } 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
338 $result = $1;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
339 $postfix = $4;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
340 } 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
341 $result = $1;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
342 $postfix = $3;
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 if ($postfix ne "") {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
346 if ($postfix =~ /^ \(glowing\) <.+? glow>/) {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
347 $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
348 } 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
349 $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
350 } elsif ($postfix =~ /^( of Power)/i) {
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
351 $postfix = $1;
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
352 } else {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
353 $postfix = "";
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 }
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
356
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
357 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
358 $staff_worn = $wear;
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
359 if ($wear) {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
360 # print STDERR "'$result' :: '$postfix'\n";
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
361 staff_update($result.$postfix, $line);
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
362 }
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
363 }
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
364 }
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
365
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
366
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
367 if ($opt_noinput) {
72
bc05f9d391bb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 71
diff changeset
368 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
369 } else {
340
36464fccd38f Rename a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 339
diff changeset
370 my $ggrtf_flag = 0;
92
013e69791387 Cleanups; Version bump; Make GgrTF log assumption not to be default.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
371 mlog(1, "Using GgrTF format only!") if ($opt_ggrtf);
339
007859954b6c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 210
diff changeset
372 mlog(2, "Matching regexp '".$match."'\n");
007859954b6c Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 210
diff changeset
373 mlog(1, "Parsing log from stdin ...");
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
374
73
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
375 while (defined(my $s = <STDIN>)) {
343
9267d2b51e57 Count lines since last spell hit.
Matti Hamalainen <ccr@tnsp.org>
parents: 342
diff changeset
376 $nline++;
169
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
377 if ($s =~ /^You wear (.+?)\.$/) {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
378 staff_match($1, 1, $s);
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
379 } elsif ($s =~ /^You remove (.+?)\.$/) {
863c9d955d71 Improve mage staff wear/remove detection.
Matti Hamalainen <ccr@tnsp.org>
parents: 134
diff changeset
380 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
381 } elsif ($s =~ /^Time to choose your reincarnation method./) {
83
e12c03b40e61 Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
382 # Set reinc flags for each type that has essence
e12c03b40e61 Handle post-reinc essence gains.
Matti Hamalainen <ccr@tnsp.org>
parents: 77
diff changeset
383 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
384 $$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
385 }
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
386 } elsif ($s =~ /^You watch with selfpride as your ($match) hits / || $s =~ /^You hit .+? with your ($match)\.$/) {
340
36464fccd38f Rename a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 339
diff changeset
387 spell_update($1) if ($ggrtf_flag == 0);
36464fccd38f Rename a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 339
diff changeset
388 $ggrtf_flag = 0;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
389 } 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
390 if ($opt_ggrtf) {
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
391 spell_update($1);
340
36464fccd38f Rename a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 339
diff changeset
392 $ggrtf_flag = 1;
73
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
393 }
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
394 } 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
395 if ($last_spell ne "") {
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
396 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
397 $$spells{$type}{"reagents"}++;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
398 $$spells{"total"}{"reagents"}++;
89
56cee55c2a6c Perhaps handle old GgrTF mangled logs better.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
399 }
73
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
400 } 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
401 $essence_flag = 1;
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
402 } elsif ($s =~ /^Your fingertips are surrounded with swirling (ENERGY) as you cast the spell\./ ||
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
403 $s =~ /^You feel like you managed to channel additional (POWER) to your spell\./ ||
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
404 $s =~ /^You feel like your spell gained additional (power)\./ ||
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
405 $s =~ /^(Unseen) BURSTS of magic are absorbed into the spell/) {
344
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
406 $crit_dist = $nline - $spell_active;
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
407 if ($spell_active > 0 && $crit_dist <= 5) {
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
408 $crit_type = $1;
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
409 $crit_flag = 1;
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
410 }
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
411 }
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 }
344
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
413
55edb7d42ce4 Possibly improve spell crit detection/handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 343
diff changeset
414 crit_update();
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
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
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 ###
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 ### 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
420 ###
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 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
422 $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
423 $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
424 $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
425
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
426 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
427 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
428 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
429 }
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
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
431
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
432 ###
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
433 ### 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
434 ###
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
435 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
436 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
437 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
438
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
439 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
440
91
d513a05279d3 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
441 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
442 <!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
443 <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
444 <head>
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
445 <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
446 <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
447 <title>Mage statistics</title>
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
448 <style type="text/css">
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
449 body {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
450 margin: 1em;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
451 background-color: #353;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
452 color: #cdc;
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
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
455 body, p, ul, td, th {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
456 font-family: Verdana, Arial, helvetica, sans-serif;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
457 font-size: 10pt;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
458 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
459
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
460 a, a:visited, a:active {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
461 text-decoration: underline;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
462 color: #fc0;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
463 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
464
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
465 a:hover {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
466 text-decoration: none;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
467 background-color: black;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
468 color: white;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
469 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
470
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
471 .icenter {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
472 text-align: center;
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
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
475 .noborder {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
476 border: none;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
477 padding: 0pt;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
478 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
479
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
480 h1, h2, h3 {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
481 font-family: Arial, sans-serif;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
482 font-weight: normal;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
483 color: #efe;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
484 background: #575;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
485 padding: 4px;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
486 padding-bottom: 8px;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
487 text-shadow: 2px 2px 2px #000;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
488 border-bottom: 2px solid #242;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
489 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
490
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
491 th {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
492 padding: 2px;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
493 margin: 2px;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
494 background: #575;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
495 color: #fc0;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
496 text-align: center;
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
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
499 td {
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
500 padding: 4px;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
501 margin: 2px;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
502 background: #242;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
503 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
504
210
45a9682a462a Layout improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
505 td.blasts {
45a9682a462a Layout improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
506 margin: 0px;
45a9682a462a Layout improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
507 padding: 0px;
45a9682a462a Layout improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
508 }
45a9682a462a Layout improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
509
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
510 table.blasts {
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
511 width: 100%;
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
512 background: #464;
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
513 }
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
514
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
515 </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
516 </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
517 <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
518
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
519 <h1>Mage statistics</h1>
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
520 <p>
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
521 Generated with $prog_name v$prog_version by Matti H&auml;m&auml;l&auml;inen aka Ggr Pupunen.
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
522 </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
523
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
524 <h2>Mage staff development</h2>
86
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
525 |;
85
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
526
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
527 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
528 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
529 }
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
530
86
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
531 print OUT "
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
532 <table class=\"info\">
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
533 <tr>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
534 <th>Blasts</th>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
535 <th>Major blasts</th>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
536 <th>Singles</th>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
537 <th>Areas</th>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
538 <th>Staff short description</th>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
539 </tr>
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
540 ";
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
541
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
542 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
543
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
544 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
545 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
546 $$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
547 $$foo{"area"}."</td><td>".htmlentities($$foo{"desc"})."</td></tr>\n";
86
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
548 }
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
549
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
550 print OUT "
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
551 </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
552
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
553 <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
554 <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
555 <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
556 <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
557 <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
558 </ul>
86
3e301f23b20d Change order of output.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
559
85
9aa648df2366 Mage staff progression stuff. Probably does not work perfectly yet.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
560 <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
561 <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
562 <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
563 <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
564 <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
565 <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
566 <th>Essence gained</th>
98
ed2389b3b3eb Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 97
diff changeset
567 <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
568 </tr>
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
569 ";
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
570
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
571 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
572
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
573 $dographs{"ALL"} = 1;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
574 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
575 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
576
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
577 foreach my $crit (@crit_types) {
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
578 $$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
579 }
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
580 $$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
581 $$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
582 $$spells{"ALL"}{"essence"}{"increase"} += $$spells{$type}{"essence"}{"increase"};
77
ece6f3a45ee1 Improvements, cleanups, better error handling.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
583
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
584 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
585 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
586 $$spells{"ALL"}{"single"} = "ALL_SINGLE";
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
587 $$spells{"ALL"}{"area"} = "ALL_AREA";
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
588 $$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
589 $$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
590 $dographs{$type} = 1;
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
591 }
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
592
73
54e33015ba7c Lots of fixes, and minor improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 72
diff changeset
593
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
594 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
595
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
596 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
597 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
598
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
599 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
600 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
601 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
602
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
603 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
604
210
45a9682a462a Layout improvements.
Matti Hamalainen <ccr@tnsp.org>
parents: 204
diff changeset
605 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
606 <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
607 <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
608 <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
609 <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
610
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
611 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
612 print OUT "<tr><th>$crit</th><td colspan=\"2\">".$$spells{$type}{"crits"}{$crit}."</td></tr>\n";
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
613 }
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
614
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
615 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
616 $$spells{$type}{"reagents"},
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
617 ($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
618 $$spells{$type}{"essence"}{"increase"};
75
c4bb202b5cc4 Fixes, etc.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
619
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
620 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
621 my ($gfilename, $gpath, $gsuffix) = fileparse($opt_prefix);
49db8f7d9833 Fix handling of prefixes with directory paths.
Matti Hamalainen <ccr@tnsp.org>
parents: 98
diff changeset
622 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
623 } else {
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
624 $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
625 }
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
626
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
627 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
628 </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
629 </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
630 }
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 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
633 </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
634 </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
635 ";
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
636
88
6d3f15ee18d9 Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
637
6d3f15ee18d9 Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
638 ###
6d3f15ee18d9 Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
639 ### Output graphs
6d3f15ee18d9 Add note about having log input in chronological order.
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
640 ###
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
641 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
642
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
643 foreach my $type (keys %dographs) {
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
644 next unless $dographs{$type};
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
645
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
646 my $s = $$spells{$type}{"single"};
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
647 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
648
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 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
650 $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
651 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
652 x_label => 'Essence gained',
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
653 show_values => 1,
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
654 transparent => 0,
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
655 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
656 );
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 my @titles = ();
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
659 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
660 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
661 }
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
84
c3554f46ca49 Add some CSS formatting flavour for output.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
663 my @total = ();
204
0dd8daa71369 Change representation of "total" summary statistics; Internal code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 170
diff changeset
664 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
665 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
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
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
668 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
669 \@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
670 \@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
671 );
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
672
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
673 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
674
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
675 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
676 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
677 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
678 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
679 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
680 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
681 }
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
682 }
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
683
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
684 }