#!/mit/perl5/bin/perl -w

use strict;

my $me="Thanaomira";
my ($boss, $file);
$boss="Hive\'Zara Wasp";
$file="wasp2";
#    $boss="Ayamiss the Hunter";
#    $file="log-ayamiss-all-060702.txt";
#    $boss="Ossirian the Unscarred";
#    $file="log-ossirian-all-060702.txt";
open(IN, $file) || die "crap.\n";
my %person;
while(<IN>) {
    if (/(\w+)\'s [\w\s]+ hits $boss for (\d+)/) {
	$person{$1}+=$2;
    } elsif (/(\w+)\'s [\w\s]+ crits $boss for (\d+)/) {
	$person{$1}+=$2;
    } elsif (/Your [\w\s]+ hits $boss for (\d+)/) {
	$person{$me}+=$1;
    } elsif (/Your [\w\s]+ crits $boss for (\d+)/) {
	$person{$me}+=$1;
    }
}
close(IN);
print "[table]\n";
my $total;
foreach (sort keys %person) {
    print "[tr][td]$_ [/td][td] $person{$_} [/td][/tr]\n";
    $total+=$person{$_};
}
print "[/table]\n";
print "total: $total\n";
