--- deliantra/server/ext/chat.ext 2007/07/22 14:17:57 1.22 +++ deliantra/server/ext/chat.ext 2007/07/22 17:10:05 1.23 @@ -774,61 +774,61 @@ }; cf::register_command say => sub { - my ($pl, $msg) = @_; + my ($ob, $msg) = @_; utf8::decode $msg; - return if $pl->contr->invoke (cf::EVENT_PLAYER_SAY, $msg); + return if $ob->contr->invoke (cf::EVENT_PLAYER_SAY, $msg); if ($msg) { - my $name = $pl->name; - my @plonmap = grep $pl->on_same_map_as ($_->ob), cf::player::list; + my $name = $ob->name; + my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; - $_->ns->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, $_ == $pl ? (reply => 1) : ()) + $_->ns->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, $_ == $ob ? (reply => 1) : ()) for @plonmap; # npcs, magic_ears etc. # first find all objects and their first-level inventories # within a 5x5 square that have something resembling # dialogue or support on_say. - my ($map, $x, $y) = ($pl->map, $pl->x - 2, $pl->y - 2); + my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); for my $npc ( - grep +($_->invoke (cf::EVENT_OBJECT_SAY, $pl->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, + grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, map +($_, $_->inv), grep $_, map $map->at ($x + $_ % 5, $y + (int $_ / 5)), 0..24 ) { # if some listener teleported us somewhere else, stop right here - last unless $map->path == $pl->map->path; + last unless $map->path == $ob->map->path; - my $dialog = new NPC_Dialogue pl => $pl->contr, npc => $npc; + my $dialog = new NPC_Dialogue pl => $ob->contr, npc => $npc; my ($reply, @kw) = $dialog->tell ($msg); if (defined $reply) { if ($npc->type == cf::MAGIC_EAR) { if (length $reply) { - $_->contr->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) + $_->ns->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) for @plonmap; } $npc->use_trigger; } else { if (length $reply) { - $_->contr->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) + $_->ns->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) for @plonmap; } } } if (@kw) { - $_->contr->send_msg ($SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) + $_->ns->send_msg ($SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) for @plonmap; } } } else { - $pl->contr->send_msg ($SAY_CHANNEL => "What do you want to say?", 0, reply => 1); + $ob->contr->send_msg ($SAY_CHANNEL => "What do you want to say?", 0, reply => 1); } };