diff options
author | Dominique Martinet <asmadeus@codewreck.org> | 2019-01-14 21:14:56 +0900 |
---|---|---|
committer | Dominique Martinet <asmadeus@codewreck.org> | 2019-01-14 21:14:56 +0900 |
commit | c7192903ab0d5d3523a6b9411f36e4e3a6f2b740 (patch) | |
tree | 4bae3926721a0b1627344ae9738d4ca03f074bc8 | |
parent | d3176981c256c90e9757da098abf719e3915ed3d (diff) |
parser: record nukes, fix stuff
-rw-r--r-- | Logs/parse.pl | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/Logs/parse.pl b/Logs/parse.pl index 6c1476a..73c9d31 100644 --- a/Logs/parse.pl +++ b/Logs/parse.pl @@ -1,14 +1,15 @@ #!/usr/bin/perl use strict; -#use warnings; +#use warnings; # summary prints many uninitialized use use Date::Parse; use Date::Format; use Data::Dumper qw(Dumper); -my $debug = 1; +my $debug = 0; my $me = "Asmadeus"; +my $interbattle_time = 30; my ($time, $rawtime, $line); my ($player, $dmg); @@ -38,7 +39,21 @@ sub print_summary { printf " / sdps %d (%d, %d, %d) (in %ds)\n", $players{$player}{total} / $player_duration, $players{$player}{melee} / $player_duration, $players{$player}{dd} / $player_duration, $players{$player}{dot} / $player_duration, $player_duration; } - print Dumper \%players if $debug; + + print "\nSelf nuke summary\n"; + my @dds = keys %{$players{$me}{dds_count}}; + foreach my $spell (sort { $players{$me}{dds}{$b} <=> $players{$me}{dds}{$a} } @dds) { + printf "%s: %d / %d = %d\n", $spell, $players{$me}{dds}{$spell}, $players{$me}{dds_count}{$spell}, $players{$me}{dds}{$spell} / $players{$me}{dds_count}{$spell}; + } + + print "\nSelf dot summary\n"; + my @dots = keys %{$players{$me}{dots_count}}; + foreach my $spell (sort { $players{$me}{dots}{$b} <=> $players{$me}{dots}{$a} } @dots) { + printf "%s: %d / %d = %d\n", $spell, $players{$me}{dots}{$spell}, $players{$me}{dots_count}{$spell}, $players{$me}{dots}{$spell} / $players{$me}{dots_count}{$spell}; + } + + print "\n"; + print Dumper \%players{$me} if $debug; return; } @@ -52,6 +67,11 @@ sub add_dd { $players{$player}{dd_count}++; $players{$player}{time_start} = $time unless $players{$player}{time_start}; $players{$player}{time_end} = $time; + if ($players{$player}{$player}{lastspell}) { + $players{$player}{dds_count}{$players{$player}{$player}{lastspell}}++ if $players{$player}{$player}{lastspell} and !$players{$player}{$player}{nukecounted}; + $players{$player}{$player}{nukecounted} = 1; + $players{$player}{dds}{$players{$player}{$player}{lastspell}} += $dmg; + } if ($line =~ /\(Critical\)/) { $players{$player}{dd_crit} += $dmg; $players{$player}{dd_crit_count}++; @@ -67,6 +87,7 @@ sub add_dot { $mobs{$mob}++; $players{$player}{total} += $dmg; $players{$player}{dots}{$dot} += $dmg; + $players{$player}{dots_count}{$dot}++; $players{$player}{dot} += $dmg; $players{$player}{dot_count}++; $players{$player}{time_start} = $time unless $players{$player}{time_start}; @@ -97,6 +118,20 @@ sub add_melee { $time_end = $time; } +sub record_spell { + my ($player, $spell) = @_; + $player = check_pet($player); + $players{$player}{$player}{lastspell} = $spell; + $players{$player}{$player}{nukecounted} = 0; + return; +} + +sub record_twincast { + my ($player, $spell) = @_; + $players{$player}{dds_count}{$spell}++ if $players{$player}{$player}{lastspell} eq $spell; + return; +} + sub check_pet { my ($player) = @_; $player = $1 if $player =~ /^(.*)`s pet/; @@ -126,17 +161,17 @@ while (<>) { $time = str2time($1) unless $1 eq $rawtime; $rawtime = $1; $line = $2; - if ($time_start && $time > $time_end + 30) { + if ($time_start && $time > $time_end + $interbattle_time) { print_summary(); reset_stats(); } if ($line =~ /^([\w ]+) hit ([\w ]+) for (\d+) points of non-melee damage./) { add_dd($2, $1, $3); } - if ($line =~ /^([\w ]+) has taken (\d+) damage from your ([\w .]+)\.($| \(Critical\))/) { + if ($line =~ /^([\w ]+) has taken (\d+) damage from your ([\w .-]+)\.($| \(Critical\))/) { add_dot($1, $me, $2, $3); } - if ($line =~ /^([\w ]+) has taken (\d+) damage from ([\w .]+) by ([\w ]+)./) { + if ($line =~ /^([\w ]+) has taken (\d+) damage from ([\w .-]+) by ([\w ]+)./) { add_dot($1, $4, $2, $3); } if ($line =~ /^([\w ]+) (?:hits?|kicks?|bash(?:es)?|slash(?:es)?|crush(?:es)?|smash(?:es)?|pieces?) ([\w ]+) for (\d+) points of damage./) { @@ -145,6 +180,12 @@ while (<>) { # if ($line =~ /^([\w ]+) says, 'My leader is (\w+)./) { # merge_pet($1, $2); # } + if ($line =~ /^(?:(You) begin casting |([\w ]+) begins to cast a spell. <)([\w .-]+)(>|\.)/) { + record_spell($1 eq "You" ? $me : $2, $3); + } + if ($line =~ /^You twincast ([\w .-]+)\./) { + record_twincast($me, $1); + } } print_summary() if $time_start; |