--- deliantra/server/ext/commands.ext 2007/08/10 05:25:16 1.58 +++ deliantra/server/ext/commands.ext 2008/04/15 14:21:04 1.67 @@ -49,7 +49,7 @@ $ob->speed_left ($ob->speed_left - 4); - $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who"), $arg), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); + $ob->send_msg ("c/who" => (join "\n\n", who_listing $ob->may ("extended_who"), $arg), cf::NDI_DK_ORANGE | cf::NDI_REPLY | cf::NDI_CLEAR | cf::NDI_DEF); }; cf::register_command seen => sub { @@ -57,21 +57,21 @@ if (my ($login) = $args =~ /(\S+)/) { if ($login eq $pl->name) { - $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_UNIQUE); + $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_REPLY); } elsif (cf::player::find_active $login) { - $pl->message ("$login is right here on this server!", cf::NDI_UNIQUE); + $pl->message ("$login is right here on this server!", cf::NDI_REPLY); } elsif (cf::player::exists $login and stat cf::player::path $login) { my $time = (stat _)[9]; $pl->message ("$login was last seen here " . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) - . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_UNIQUE); + . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_REPLY); } else { - $pl->message ("No player named $login is known to me.", cf::NDI_UNIQUE); + $pl->message ("No player named $login is known to me.", cf::NDI_REPLY); } } else { - $pl->message ("Usage: seen ", cf::NDI_UNIQUE); + $pl->message ("Usage: seen ", cf::NDI_REPLY); } }; @@ -98,7 +98,7 @@ $reply .= "You are not allowed to use weapons\n\n" unless $ob->flag (cf::FLAG_USE_WEAPON); - $ob->reply (undef, $reply); + $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY); }; cf::register_command mark => sub { @@ -147,18 +147,20 @@ my $map = $observe->map or return; - $ob->reply (undef, (sprintf "%s (%s) %s", $map->name, $map->path, $observe->region->longname)); - $ob->reply (undef, (sprintf "players: %d difficulty: %d size: %d start: %dx%d timeout: %d", - (scalar $map->players), $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout)) + + my $msg = sprintf "%s (%s) %s", $map->name, $map->path, $observe->region->longname; + $msg .= sprintf "\n\nplayers: %d difficulty: %d size: %d start: %dx%d timeout: %d", + (scalar $map->players), $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout if $ob->flag (cf::FLAG_WIZ); - $ob->reply (undef, $map->msg); + + $ob->send_msg ("c/mapinfo" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR); }; cf::register_command whereami => sub { my ($ob) = @_; my $reg = $ob->contr->observe->region; - $ob->reply (undef, (sprintf "You are %s.\n%s", $reg->longname, $reg->msg)); + $ob->send_msg ("c/who" => (sprintf "You are %s.\n%s", $reg->longname, $reg->msg), cf::NDI_REPLY | cf::NDI_CLEAR); }; cf::register_command whereabouts => sub { @@ -171,16 +173,16 @@ } my $msg = "In the world currently there are:\n\n" - . join "", map "$count{$_} player(s) in $_\n\n", sort keys %count; + . join "", map "$count{$_} player(s) $_\n\n", sort keys %count; - $ob->contr->ns->send_msg (log => $msg, cf::NDI_REPLY); + $ob->send_msg ("c/who" => $msg, cf::NDI_REPLY | cf::NDI_CLEAR); }; cf::register_command hiscore => sub { my ($ob, $arg) = @_; - my $url = $cf::CFG->{hiscore_url}; - $ob->contr->ns->send_msg (log => "See $url", cf::NDI_REPLY); + my $url = $cf::CFG{hiscore_url}; + $ob->send_msg (log => "See $url", cf::NDI_REPLY); }; sub _set_mode($$$@) { @@ -370,11 +372,11 @@ my $startup = POSIX::strftime "%Y-%m-%d %H:%M:%S %Z", localtime $cf::UPTIME; my $runtime = sprintf "%.1f", (time - $cf::UPTIME) / 86400; - $ob->reply (undef, "server started $startup, uptime ${runtime}\d"); + $ob->send_msg ("c/uptime" => "server started $startup, uptime ${runtime}\d", cf::NDI_REPLY | cf::NDI_CLEAR); }; my %IN_MEMORY = ( - cf::MAP_IN_MEMORY => "I", + cf::MAP_ACTIVE => "I", cf::MAP_SWAPPED => "S", cf::MAP_LOADING => "L", ); @@ -386,7 +388,7 @@ my $format = "%2s %1s %3s %5s %.60s\n"; - $ob->reply (undef, (sprintf $format, "Pl", "I", "Svd", "Reset", "Name"), cf::NDI_BLACK | cf::NDI_UNIQUE); + $ob->send_msg ("c/mapinfo" => (sprintf $format, "Pl", "I", "Svd", "Reset", "Name"), cf::NDI_REPLY | cf::NDI_CLEAR); for (sort keys %cf::MAP) { my $map = $cf::MAP{$_} @@ -398,14 +400,14 @@ my $svd = int $cf::RUNTIME - $map->{last_save}; $svd = "++" if $svd > 99; - $ob->reply (undef, + $ob->send_msg ("c/mapinfo" => (sprintf $format, (scalar $map->players), $IN_MEMORY{$map->in_memory} || "?", $svd, (int $map->reset_at - $cf::RUNTIME), - $map->visible_name), - cf::NDI_BLACK | cf::NDI_UNIQUE); + $map->visible_name) + ); } };