ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cf.schmorp.de/maps/perl/schmorplog.ext
(Generate patch)

Comparing cf.schmorp.de/maps/perl/schmorplog.ext (file contents):
Revision 1.6 by root, Thu Mar 30 15:44:48 2006 UTC vs.
Revision 1.14 by root, Fri Nov 3 21:51:24 2006 UTC

1#! perl 1#! perl
2 2
3sub on_login { 3sub update_status {
4 my ($ob, $host) = @_; 4 my ($status, @pl) = ext::commands::who_listing;
5 5
6 cf::LOG cf::llevDebug, sprintf "QBERT %s logged in\n", 6 open my $fh, ">", cf::localdir . "/usercount";
7 $ob->name, $host; 7 print $fh scalar @pl;
8
9 open my $fh, ">", cf::localdir . "/userlisting.html";
10 print $fh "$status<br />\n";
11 for (@pl) {
12 s/[<&]//g;
13 print $fh "<pre>$_</pre><br />\n";
14 }
8} 15}
9 16
10sub on_logout { 17cf::attach_to_players
11 my ($ob, $host) = @_; 18 on_login => sub {
19 my ($pl) = @_;
20 $pl->ob->set_ob_key_value (schmorplog_last_login => time);
12 21
13 cf::LOG cf::llevDebug, sprintf "QBERT %s left\n", 22 $pl->ob->set_ob_key_value (schmorplog_login_count =>
14 $ob->name, $host; 23 1 + $pl->ob->get_ob_key_value ("schmorplog_login_count"));
15}
16 24
17sub on_shout { 25 ext::schmorp_irc::do_notice (sprintf "%s logged in", $pl->ob->name);
18 my ($ob, $msg) = @_;
19 26
20 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", 27 update_status;
21 $ob->name, $msg; 28 },
22} 29 on_logout => sub {
30 my ($pl) = @_;
31 $pl->ob->set_ob_key_value (schmorplog_last_logout => time);
32 ext::schmorp_irc::do_notice (sprintf "%s left", $pl->ob->name);
23 33
24sub on_player_death { 34 update_status;
35 },
36 on_birth => sub {
25 my ($ob) = @_; 37 my ($pl) = @_;
26 38 ext::schmorp_irc::do_notice (sprintf "%s was just born", $pl->ob->name);
27 cf::LOG cf::llevDebug, sprintf "QBERT %s died a quick and not very horrible death\n", 39 $pl->ob->set_ob_key_value (schmorplog_birthdate => time);
28 $ob->name; 40 },
29} 41 on_quit => sub {
42 my ($pl) = @_;
43 ext::schmorp_irc::do_notice (sprintf "%s quit the game", $pl->ob->name);
44 },
45 on_death => sub {
46 my ($pl) = @_;
47 ext::schmorp_irc::do_notice (sprintf "%s was killed by %s", $pl->ob->name, $pl->killer);
48 },
49 on_load => sub {
50 my ($pl, $path) = @_;
51 $pl->ob->set_ob_key_value (schmorplog_last_load => time);
52 },
53 on_save => sub {
54 my ($pl, $path) = @_;
55 $pl->ob->set_ob_key_value (schmorplog_last_save => time);
56 },
57;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines