# HG changeset patch # User Matti Hamalainen # Date 1270810722 0 # Node ID bc05f9d391bbd400b2ac5aee7443763f0b2625a7 # Parent 3eca3030c1758455b7c5bf6df146fd3cd4fc47af Cleanups. diff -r 3eca3030c175 -r bc05f9d391bb magestats.pl --- a/magestats.pl Fri Apr 09 10:49:31 2010 +0000 +++ b/magestats.pl Fri Apr 09 10:58:42 2010 +0000 @@ -1,9 +1,17 @@ #!/usr/bin/perl -w +# Magestats - BatMUD Mage guild statistics generator +# Developed by Matti Hämäläinen (Ggr), +# (C) Copyright 2010 Tecnic Software productions (TNSP) +# +# Requires Perl 5.8 and following modules: +# In Debian / Ubuntu, apt-get install libgd-graph-perl + use strict; use Data::Dumper; use GD::Graph; use GD::Graph::linespoints; +# List of spells per damage type. Only major blasts/areas. my %spell_data = ( "acid" => [ "acid blast", "acid storm" ], "fire" => [ "lava blast", "lava storm" ], @@ -14,6 +22,7 @@ "asph" => [ "blast vacuum", "vacuum globe" ], ); +# Settings and defaults my $progName = "magestats.pl"; my $opt_cachefile; my $opt_verbosity = 1; @@ -23,6 +32,7 @@ my $opt_width = 500; my $opt_height = 250; +# Log level support sub mlog($$) { my $level = shift; @@ -30,8 +40,13 @@ print STDERR "* $msg\n" if ($opt_verbosity >= $level); } +### +### Print out help if no arguments given +### my $opt_mode = shift or die( -"Magestats v0.3 by ccr/TNSP (C) 2010 TNSP +"Magestats - BatMUD Mage guild statistics generator +Developed by Matti Hamalainen (Ggr \@ bat), +(C) Copyright 2010 Tecnic Software productions (TNSP) Usage: $progName dump [options] < logfile $progName stats [options] < logfile @@ -88,6 +103,9 @@ push(@{$spells->{"single"}}, $src->[0]); push(@{$spells->{"area"}}, $src->[1]); } +$spells->{"total"}{"blasts"} = 0; +$spells->{"total"}{"essence"} = 0; +$spells->{"total"}{"reagents"} = 0; sub get_spell_type($) { @@ -118,7 +136,7 @@ my $last_spell = ""; if ($opt_noinput) { - + mlog(1, "Skipping input parsing."); } else { mlog(1, "Parsing log from stdin..."); while (defined(my $s = )) {