… | |
… | |
2459 | can be C<undef>. Does the right thing when the player is currently in a |
2459 | can be C<undef>. Does the right thing when the player is currently in a |
2460 | dialogue with the given NPC character. |
2460 | dialogue with the given NPC character. |
2461 | |
2461 | |
2462 | =cut |
2462 | =cut |
2463 | |
2463 | |
|
|
2464 | our $SAY_CHANNEL = { |
|
|
2465 | id => "say", |
|
|
2466 | title => "Map", |
|
|
2467 | reply => "say ", |
|
|
2468 | tooltip => "Things said to and replied from npcs near you and other players on the same map only.", |
|
|
2469 | }; |
|
|
2470 | |
|
|
2471 | our $CHAT_CHANNEL = { |
|
|
2472 | id => "chat", |
|
|
2473 | title => "Chat", |
|
|
2474 | reply => "chat ", |
|
|
2475 | tooltip => "Player chat and shouts, global to the server.", |
|
|
2476 | }; |
|
|
2477 | |
2464 | # rough implementation of a future "reply" method that works |
2478 | # rough implementation of a future "reply" method that works |
2465 | # with dialog boxes. |
2479 | # with dialog boxes. |
2466 | #TODO: the first argument must go, split into a $npc->reply_to ( method |
2480 | #TODO: the first argument must go, split into a $npc->reply_to ( method |
2467 | sub cf::object::player::reply($$$;$) { |
2481 | sub cf::object::player::reply($$$;$) { |
2468 | my ($self, $npc, $msg, $flags) = @_; |
2482 | my ($self, $npc, $msg, $flags) = @_; |
… | |
… | |
2479 | my $dialog = $pl->{npc_dialog}; |
2493 | my $dialog = $pl->{npc_dialog}; |
2480 | $dialog->{pl}->ext_msg ($dialog->{id}, update => msg => $dialog->{pl}->expand_cfpod ($msg)); |
2494 | $dialog->{pl}->ext_msg ($dialog->{id}, update => msg => $dialog->{pl}->expand_cfpod ($msg)); |
2481 | |
2495 | |
2482 | } else { |
2496 | } else { |
2483 | $msg = $npc->name . " says: $msg" if $npc; |
2497 | $msg = $npc->name . " says: $msg" if $npc; |
2484 | $self->message ($msg, $flags); |
2498 | $self->send_msg ($SAY_CHANNEL => $msg, $flags); |
2485 | } |
2499 | } |
2486 | } |
2500 | } |
2487 | } |
2501 | } |
2488 | |
2502 | |
2489 | =item $object->send_msg ($channel, $msg, $color, [extra...]) |
2503 | =item $object->send_msg ($channel, $msg, $color, [extra...]) |