summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Logs/parse.pl45
1 files changed, 26 insertions, 19 deletions
diff --git a/Logs/parse.pl b/Logs/parse.pl
index 144da11..721c842 100644
--- a/Logs/parse.pl
+++ b/Logs/parse.pl
@@ -28,16 +28,17 @@ sub reset_stats {
return;
}
-
-
-
-
-
-
-
-
-
-
+sub number_scale {
+ my ($num) = @_;
+ # I find it prettier to leave giga out and not have giga for now
+ if ($num > 1000 ** 2) {
+ return sprintf "%.2fm", $num / (1000 ** 2);
+ }
+ if ($num > 1000) {
+ return sprintf "%.2fk", $num / 1000;
+ }
+ return sprintf "%d ", $num
+}
sub print_forum {
our ($total_damage, $mainmob, $duration);
@@ -45,18 +46,20 @@ sub print_forum {
print "FORUM ----------------------\n\n";
printf "[b]Total %s (and possibly friends)[/b]\n", $mainmob;
- printf "[b]--- DMG:[/b] %dk @ %ddps (%ds)\n\n", $total_damage/1000, $total_damage/$duration, $duration;
+ printf "[b]--- DMG:[/b] %s @ %sdps (%ds)\n\n", number_scale($total_damage),
+ number_scale($total_damage/$duration), $duration;
foreach my $player (sort { $players{$b}{total} <=> $players{$a}{total} } keys %players) {
next if $players{$player}{mob};
next unless $players{$player}{total};
my $player_duration = $players{$player}{time_end} - $players{$player}{time_start} + 1;
printf "[b]#%d %s[/b]\n", $i++, $player;
- printf "[b]--- DMG:[/b] %dk @ %ddps (%ds)\n", $players{$player}{total}, $players{$player}{total} / $player_duration, $player_duration;
+ printf "[b]--- DMG:[/b] %s @ %sdps (%ds)\n", number_scale($players{$player}{total}),
+ number_scale($players{$player}{total} / $player_duration), $player_duration;
foreach my $type (sort { $players{$player}{$b} <=> $players{$player}{$a} } ('melee', 'dd', 'dot')) {
- printf "[b]---- %s (%d%%):[/b] %dk (crits: %dk, %d%% damages, %d%% hits)\n",
+ printf "[b]---- %s (%d%%):[/b] %s (crits: %s, %d%% damages, %d%% hits)\n",
$type, $players{$player}{$type} * 100 / $players{$player}{total},
- $players{$player}{$type} / 1000, $players{$player}{"${type}_crit"} / 1000,
+number_scale( $players{$player}{$type}), number_scale($players{$player}{"${type}_crit"}),
$players{$player}{"${type}_crit"} * 100 / $players{$player}{$type},
$players{$player}{"${type}_crit_count"} * 100 / $players{$player}{"${type}_count"}
if $players{$player}{$type};
@@ -69,12 +72,14 @@ sub print_forum {
sub print_selfdetails {
print "\nSelf nuke summary\n";
foreach my $spell (sort { $players{$me}{dds}{$b} <=> $players{$me}{dds}{$a} } keys %{$players{$me}{dds_count}}) {
- 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};
+ 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";
foreach my $spell (sort { $players{$me}{dots}{$b} <=> $players{$me}{dots}{$a} } keys %{$players{$me}{dots_count}}) {
- 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};
+ 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";
}
@@ -86,7 +91,8 @@ sub print_summary {
printf "Duration: %d (%s - %s)\n", $duration, time2str("%Y-%m-%d %T", $time_start), time2str("%T", $time_end);
foreach my $player (sort { $players{$b}{damaged} <=> $players{$a}{damaged} } keys %players) {
next unless $players{$player}{mob};
- printf "%s (%dk @%d dps in %d)\n", $player, $players{$player}{damaged} / 1000, $players{$player}{damaged} / $duration, $duration;
+ printf "%s (%s @%sdps in %d)\n", $player, number_scale($players{$player}{damaged}),
+ number_scale($players{$player}{damaged} / $duration), $duration;
$mainmob = $player if $mainmob eq 'fight';
}
foreach my $player (keys %players) {
@@ -97,12 +103,13 @@ sub print_summary {
print "\nEQ copypaste string\n";
my ($eqstring, $len, $i) = ($eq_copypaste_prefix, length $eq_copypaste_prefix, 1);
$eqstring .= sprintf "%s in %ds, ", $mainmob, $duration;
- $eqstring .= sprintf "%dk @%ddps --- ", $total_damage / 1000, $total_damage / $duration;
+ $eqstring .= sprintf "%s @%sdps --- ", number_scale($total_damage), number_scale($total_damage / $duration);
foreach my $player (sort { $players{$b}{total} <=> $players{$a}{total} } keys %players) {
next if $players{$player}{mob};
next unless $players{$player}{total};
my $player_duration = $players{$player}{time_end} - $players{$player}{time_start} + 1;
- $_ = sprintf "#%d %s %dk@(%d dps in %ds)", $i++, $player, $players{$player}{total}/1000, $players{$player}{total} / $player_duration, $player_duration;
+ $_ = sprintf "#%d %s %s@(%sdps in %ds)", $i++, $player, number_scale($players{$player}{total}),
+ number_scale($players{$player}{total} / $player_duration), $player_duration;
$len += length;
if ($len > $eq_copypaste_limit) {
print $eqstring, "\n";