changeset 72:bc05f9d391bb misc

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 09 Apr 2010 10:58:42 +0000
parents 3eca3030c175
children 54e33015ba7c
files magestats.pl
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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), <ccr@tnsp.org>
+# (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), <ccr\@tnsp.org>
+(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 = <STDIN>)) {