#! perl
sub update_status {
my ($status, @pl) = ext::commands::who_listing;
open my $fh, ">", cf::localdir . "/usercount";
print $fh scalar @pl;
open my $fh, ">", cf::localdir . "/userlisting.html";
print $fh "$status
\n";
for (@pl) {
s/[<&]//g;
print $fh "
$_
\n";
}
}
cf::attach_to_players
on_login => sub {
my ($pl) = @_;
$pl->ob->set_ob_key_value (schmorplog_last_login => time);
$pl->ob->set_ob_key_value (schmorplog_login_count =>
1 + $pl->ob->get_ob_key_value ("schmorplog_login_count"));
ext::schmorp_irc::do_notice (sprintf "%s logged in", $pl->ob->name);
update_status;
},
on_logout => sub {
my ($pl) = @_;
$pl->ob->set_ob_key_value (schmorplog_last_logout => time);
ext::schmorp_irc::do_notice (sprintf "%s left", $pl->ob->name);
update_status;
},
on_birth => sub {
my ($pl) = @_;
ext::schmorp_irc::do_notice (sprintf "%s was just born", $pl->ob->name);
$pl->ob->set_ob_key_value (schmorplog_birthdate => time);
},
on_quit => sub {
my ($pl) = @_;
ext::schmorp_irc::do_notice (sprintf "%s quit the game", $pl->ob->name);
},
on_death => sub {
my ($pl) = @_;
ext::schmorp_irc::do_notice (sprintf "%s was killed by %s", $pl->ob->name, $pl->killer);
},
on_load => sub {
my ($pl, $path) = @_;
$pl->ob->set_ob_key_value (schmorplog_last_load => time);
},
on_save => sub {
my ($pl, $path) = @_;
$pl->ob->set_ob_key_value (schmorplog_last_save => time);
},
;