5 my ($state, $map, $pro, $total, $who) = @_;
6 open my $fh, '>>', "$ENV{HOME}/.nexuiz/__votelog.$config{irc_nick}.txt"
7 or die "votelog open: $!";
8 print $fh "@{[time()]} $config{irc_nick} $state $map $pro $total" . (defined $who ? " $who" : "") . "\n";
12 # call the log analyzer at the end of a match
13 [ dp => q{:end} => sub {
15 for X in ~/Nexuiz/home/.nexuiz/extramaps/data/*.log; do
16 if [ x"`tail -n 1 "$X"`" = x":gameover" ]; then
17 ssh hector 'l=$HOME/.nexuiz/server-remote-$RANDOM.log; cat >"$l"; ~/.nexuiz/logspam/addlogs-processonly.sh "$l"' < "$X"
26 [ dp => q{\001(.*?)\^7: d} => sub {
27 my $aoltime = time() - 746748000;
28 my $day = int($aoltime / 86400);
29 my $wday = [qw[Tue Wed Thu Fri Sat Sun Mon]]->[$day % 7];
30 my $hour = int($aoltime / 3600) % 24;
31 my $minute = int($aoltime / 60) % 60;
32 my $second = int($aoltime / 1) % 60;
33 out dp => 0, sprintf 'rcon2irc_say_as "AOL service" "The time is %3s Sep %2d %02d:%02d:%02d 1993"',
34 $wday, $day, $hour, $minute, $second;
39 [ dp => q{:vote:suggestion_accepted:(.*)} => sub {
41 markmap suggestion_accepted => $map, $store{rbi_winvotes}, $store{rbi_totalvotes};
44 [ dp => q{:vote:suggested:(.*?):\d+:(.*)} => sub {
46 markmap suggested => $map, 1, 1, $who;
49 [ dp => q{\001\^2\* .*'s vote for \^1gotomap (.*)\^2 was accepted} => sub {
51 markmap voted => $map, 1, 1;
54 [ dp => q{\001\^2\* .*'s vote for \^1timelimit -1\^2 was accepted} => sub {
55 markmap cancelled => $store{map}, 1, 1;
58 [ dp => q{:vote:(keeptwo|finished):(.*)} => sub {
59 my ($status, $result) = @_;
60 my @result = split /:/, $result;
65 $cutoff = $_ if $result[2*$_] eq '';
66 $totalvotes += int($result[2*$_+1] || 0);
67 [$result[2*$_], int($result[2*$_+1] || 0)]
69 die "Invalid vote result: $result" unless $cutoff >= 0;
70 my @winners = @allmaps[0..($cutoff-1)];
71 my @losers = @allmaps[($cutoff+1)..(@allmaps-1)];
73 $winvotes += $_->[1] for @winners;
74 if($status eq 'keeptwo')
76 markmap irrelevant_relative => $_->[0], $winvotes, $totalvotes
79 elsif($status eq 'finished')
81 markmap((@losers == 1 ? 'duel_winner' : 'winner_absolute') => $_->[0], $_->[1], $totalvotes)
83 markmap((@losers == 1 ? 'duel_loser' : 'irrelevant_absolute') => $_->[0], $winvotes, $totalvotes)
86 $store{rbi_winvotes} = $winvotes;
87 $store{rbi_totalvotes} = $totalvotes;