ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/schmorplog.ext
Revision: 1.14
Committed: Fri Nov 3 21:51:24 2006 UTC (17 years, 6 months ago) by root
Branch: MAIN
Changes since 1.13: +22 -0 lines
Log Message:
web-site support

File Contents

# Content
1 #! perl
2
3 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 print $fh "$status<br />\n";
11 for (@pl) {
12 s/[<&]//g;
13 print $fh "<pre>$_</pre><br />\n";
14 }
15 }
16
17 cf::attach_to_players
18 on_login => sub {
19 my ($pl) = @_;
20 $pl->ob->set_ob_key_value (schmorplog_last_login => time);
21
22 $pl->ob->set_ob_key_value (schmorplog_login_count =>
23 1 + $pl->ob->get_ob_key_value ("schmorplog_login_count"));
24
25 ext::schmorp_irc::do_notice (sprintf "%s logged in", $pl->ob->name);
26
27 update_status;
28 },
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);
33
34 update_status;
35 },
36 on_birth => sub {
37 my ($pl) = @_;
38 ext::schmorp_irc::do_notice (sprintf "%s was just born", $pl->ob->name);
39 $pl->ob->set_ob_key_value (schmorplog_birthdate => time);
40 },
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 ;