… | |
… | |
4 | # implement a replacement for the built-in say/chat/shout/tell/reply commands |
4 | # implement a replacement for the built-in say/chat/shout/tell/reply commands |
5 | # adds ignore/unignore functionality |
5 | # adds ignore/unignore functionality |
6 | |
6 | |
7 | use NPC_Dialogue; |
7 | use NPC_Dialogue; |
8 | use POSIX (); # for strftime only |
8 | use POSIX (); # for strftime only |
|
|
9 | |
|
|
10 | our $SAY_CHANNEL = { |
|
|
11 | id => "say", |
|
|
12 | title => "Map", |
|
|
13 | reply => "say ", |
|
|
14 | tooltip => "Things said to and replied from npcs near you and other players on the same map only.", |
|
|
15 | }; |
|
|
16 | |
|
|
17 | our $CHAT_CHANNEL = { |
|
|
18 | id => "chat", |
|
|
19 | title => "Chat", |
|
|
20 | reply => "chat ", |
|
|
21 | tooltip => "Player chat and shouts, global to the server.", |
|
|
22 | }; |
9 | |
23 | |
10 | sub clean_timeouts($) { |
24 | sub clean_timeouts($) { |
11 | my ($player) = @_; |
25 | my ($player) = @_; |
12 | my $NOW = time; |
26 | my $NOW = time; |
13 | |
27 | |
… | |
… | |
38 | prio => -1000, |
52 | prio => -1000, |
39 | on_login => sub { |
53 | on_login => sub { |
40 | my ($pl) = @_; |
54 | my ($pl) = @_; |
41 | |
55 | |
42 | clean_timeouts $pl->ob; |
56 | clean_timeouts $pl->ob; |
|
|
57 | $pl->ns->send_msg ($SAY_CHANNEL); |
|
|
58 | $pl->ns->send_msg ($CHAT_CHANNEL); |
43 | }, |
59 | }, |
44 | ); |
60 | ); |
45 | |
61 | |
46 | cf::register_command listen => sub { |
62 | cf::register_command listen => sub { |
47 | my ($pl, $msg) = @_; |
63 | my ($pl, $msg) = @_; |
… | |
… | |
745 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
761 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
746 | } |
762 | } |
747 | }; |
763 | }; |
748 | }; |
764 | }; |
749 | } |
765 | } |
750 | |
|
|
751 | our $SAY_CHANNEL = { |
|
|
752 | id => "say", |
|
|
753 | title => "Map", |
|
|
754 | reply => "say ", |
|
|
755 | tooltip => "Things said to and replied from npcs near you and other players on the same map only.", |
|
|
756 | }; |
|
|
757 | |
766 | |
758 | cf::register_command me => sub { |
767 | cf::register_command me => sub { |
759 | my ($pl, $msg) = @_; |
768 | my ($pl, $msg) = @_; |
760 | |
769 | |
761 | my $name = $pl->name; |
770 | my $name = $pl->name; |
… | |
… | |
819 | } |
828 | } |
820 | |
829 | |
821 | } else { |
830 | } else { |
822 | $pl->contr->send_msg ($SAY_CHANNEL => "What do you want to say?", 0, reply => 1); |
831 | $pl->contr->send_msg ($SAY_CHANNEL => "What do you want to say?", 0, reply => 1); |
823 | } |
832 | } |
824 | }; |
|
|
825 | |
|
|
826 | our $CHAT_CHANNEL = { |
|
|
827 | id => "chat", |
|
|
828 | title => "Chat", |
|
|
829 | reply => "chat ", |
|
|
830 | tooltip => "Player chat and shouts, global to the server.", |
|
|
831 | }; |
833 | }; |
832 | |
834 | |
833 | cf::register_command chat => sub { |
835 | cf::register_command chat => sub { |
834 | my ($pl, $msg) = @_; |
836 | my ($pl, $msg) = @_; |
835 | |
837 | |