changeset 343:9267d2b51e57 misc

Count lines since last spell hit.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 Aug 2016 23:06:01 +0300
parents f4c26eba10af
children 55edb7d42ce4
files magestats.pl
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/magestats.pl	Tue Aug 09 23:05:34 2016 +0300
+++ b/magestats.pl	Tue Aug 09 23:06:01 2016 +0300
@@ -226,6 +226,8 @@
 my $crit_type;
 my $last_spell = "";
 my $staff_worn = 0;
+my $spell_active = 0;
+my $nline = 0;
 
 
 sub staff_update($$)
@@ -272,6 +274,7 @@
 {
   $last_spell = $_[0];
 
+  $spell_active = $nline;
   my $type = get_spell_type($last_spell);
 
   $$spells{$last_spell}{"blasts"}++;
@@ -363,6 +366,7 @@
   mlog(1, "Parsing log from stdin ...");
 
   while (defined(my $s = <STDIN>)) {
+    $nline++;
     if ($s =~ /^You wear (.+?)\.$/) {
       staff_match($1, 1, $s);
     } elsif ($s =~ /^You remove (.+?)\.$/) {