ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/schmorplog.ext
Revision: 1.15
Committed: Sat Nov 4 12:23:12 2006 UTC (17 years, 6 months ago) by root
Branch: MAIN
Changes since 1.14: +6 -3 lines
Log Message:
remember client

File Contents

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