#! perl our $UPDATE_LOGINS = Event->idle (repeat => 0, min => 1, cb => sub { my ($status, @pl) = ext::commands::who_listing; open my $fh, ">", cf::localdir . "/usercount"; print $fh scalar @pl; open my $fh, ">", cf::localdir . "/userlisting.html"; for ($status, @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")); (my $client = $pl->client) =~ s/\n/\\n/g; $pl->ob->set_ob_key_value (schmorplog_client => $client); ext::schmorp_irc::do_notice (sprintf "%s logged in", $pl->ob->name); $UPDATE_LOGINS->start; }, 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_LOGINS->start; }, 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); $pl->ob->set_ob_key_value (schmorplog_death_count => 1 + $pl->ob->get_ob_key_value ("schmorplog_death_count")); }, 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); }, ;