--- deliantra/maps/perl/chat.ext 2006/07/21 00:25:29 1.22 +++ deliantra/maps/perl/chat.ext 2006/07/21 08:22:02 1.23 @@ -4,6 +4,7 @@ # adds ignore/unignore functionality use NPC_Dialogue; +use POSIX (); # for strftime only sub clean_timeouts($) { my ($player) = @_; @@ -227,7 +228,7 @@ } } else { - $who->message ("Usage: ignore \n" + $who->message ("Usage: ignore \n" . "will ignore a player for hours.\n" . "Usage: ignore list\n" . "will show you a list of players currently ignored.", cf::NDI_UNIQUE); @@ -248,7 +249,6 @@ $who->message ("Not ignoring anyone", cf::NDI_UNIQUE); } } else { - if (cf::player::exists $target) { if ($type eq "tell") { $who->message ("Not ignoring private messages from $target anymore.", cf::NDI_UNIQUE); @@ -266,7 +266,27 @@ } else { $who->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); } + } +}; + +cf::register_command seen => 0, sub { + my ($who, $args) = @_; + if (my ($login) = $args =~ /(\S+)/) { + if (cf::player::find $login) { + $who->message ("$login is right here on this server!", cf::NDI_UNIQUE); + } elsif (cf::player::exists $login + and stat sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($login) x 2) { + my $time = (stat _)[9]; + + $who->message ("$login was last seen here on " + . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) + . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_UNIQUE); + } else { + $who->message ("No player named $login is known to me.", cf::NDI_UNIQUE); + } + } else { + $who->message ("Usage: seen ", cf::NDI_UNIQUE); } };