… | |
… | |
27 | id => "tell-$target", |
27 | id => "tell-$target", |
28 | title => "$target", |
28 | title => "$target", |
29 | reply => "tell $target ", |
29 | reply => "tell $target ", |
30 | tooltip => "Private messages from/to $target", |
30 | tooltip => "Private messages from/to $target", |
31 | } |
31 | } |
|
|
32 | } |
|
|
33 | |
|
|
34 | sub send_msg($$$$$) { |
|
|
35 | my ($pl, $channel, $msg, $flags, $sound) = @_; |
|
|
36 | $pl->play_sound (cf::sound::find $sound) if defined $sound; |
|
|
37 | $pl->send_msg ($channel, $msg, $flags); |
|
|
38 | () |
32 | } |
39 | } |
33 | |
40 | |
34 | sub clean_timeouts($) { |
41 | sub clean_timeouts($) { |
35 | my ($player) = @_; |
42 | my ($player) = @_; |
36 | my $NOW = time; |
43 | my $NOW = time; |
… | |
… | |
95 | my $pl = $ob->contr; |
102 | my $pl = $ob->contr; |
96 | my $name = $ob->name; |
103 | my $name = $ob->name; |
97 | |
104 | |
98 | my $coin = int rand 2 ? "Heads" : "Tails"; |
105 | my $coin = int rand 2 ? "Heads" : "Tails"; |
99 | |
106 | |
100 | $_->send_msg ($SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY) |
107 | send_msg $_, $SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" |
101 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
108 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
102 | |
109 | |
103 | $pl->send_msg ($SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
110 | $pl->send_msg ($SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
104 | }; |
111 | }; |
105 | |
112 | |
… | |
… | |
111 | |
118 | |
112 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
119 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
113 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
120 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
114 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
121 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
115 | |
122 | |
116 | $_->send_msg ($SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY) |
123 | send_msg $_, $SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" |
117 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
124 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
118 | |
125 | |
119 | $pl->send_msg ($SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
126 | $pl->send_msg ($SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
120 | }; |
127 | }; |
121 | |
128 | |
… | |
… | |
244 | }, |
251 | }, |
245 | params => { |
252 | params => { |
246 | target => "<self> kisses you.", |
253 | target => "<self> kisses you.", |
247 | other => "<self> kisses <other>.", |
254 | other => "<self> kisses <other>.", |
248 | self => "You kiss <other>.", |
255 | self => "You kiss <other>.", |
|
|
256 | }, |
|
|
257 | self => { |
|
|
258 | }, |
|
|
259 | }, |
|
|
260 | smother => { |
|
|
261 | noparams => { |
|
|
262 | other => "<self> makes weird facial contortions", |
|
|
263 | self => "All the lonely people..", |
|
|
264 | }, |
|
|
265 | params => { |
|
|
266 | target => "<self> smothers you with kisses.", |
|
|
267 | other => "<self> smothers <other> with kisses.", |
|
|
268 | self => "You smother <other> with kisses.", |
249 | }, |
269 | }, |
250 | self => { |
270 | self => { |
251 | }, |
271 | }, |
252 | }, |
272 | }, |
253 | wink => { |
273 | wink => { |
… | |
… | |
717 | $emote{other} ||= "You look away from <self>."; |
737 | $emote{other} ||= "You look away from <self>."; |
718 | $emote{self} ||= "My god! Is that LEGAL?"; |
738 | $emote{self} ||= "My god! Is that LEGAL?"; |
719 | |
739 | |
720 | $emote{other} =~ s/<self>/$name/; |
740 | $emote{other} =~ s/<self>/$name/; |
721 | |
741 | |
722 | $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) |
742 | send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
723 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
743 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
724 | |
744 | |
725 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
745 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
726 | } elsif ($tname) { |
746 | } elsif ($tname) { |
727 | my $target = cf::player::find $tname |
747 | my $target = cf::player::find $tname |
728 | or return $pl->send_msg (tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY); |
748 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
729 | |
749 | |
730 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
750 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
731 | |
751 | |
732 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
752 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
733 | $emote{self} ||= "You are still nuts."; |
753 | $emote{self} ||= "You are still nuts."; |
… | |
… | |
736 | $emote{self} =~ s/<other>/$tname/; |
756 | $emote{self} =~ s/<other>/$tname/; |
737 | $emote{target} =~ s/<self>/$name/; |
757 | $emote{target} =~ s/<self>/$name/; |
738 | $emote{other} =~ s/<other>/$tname/; |
758 | $emote{other} =~ s/<other>/$tname/; |
739 | $emote{other} =~ s/<self>/$name/; |
759 | $emote{other} =~ s/<self>/$name/; |
740 | |
760 | |
741 | $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) |
761 | send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
742 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
762 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
743 | |
763 | |
744 | $target->send_msg (tell_channel $name, $emote{target}, cf::NDI_GREY); |
764 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY, "msg_shout"; |
745 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
765 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
746 | } else { |
766 | } else { |
747 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
767 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
748 | |
768 | |
749 | $emote{other} ||= "<self> dances with glee."; |
769 | $emote{other} ||= "<self> dances with glee."; |
750 | $emote{self} ||= "You are a nut."; |
770 | $emote{self} ||= "You are a nut."; |
751 | |
771 | |
752 | $emote{other} =~ s/<self>/$name/; |
772 | $emote{other} =~ s/<self>/$name/; |
753 | |
773 | |
754 | $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) |
774 | send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
755 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
775 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
756 | |
776 | |
757 | $pl->send_msg ($CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
777 | $pl->send_msg ($CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
758 | } |
778 | } |
759 | }; |
779 | }; |
… | |
… | |
763 | cf::register_command me => sub { |
783 | cf::register_command me => sub { |
764 | my ($pl, $msg) = @_; |
784 | my ($pl, $msg) = @_; |
765 | |
785 | |
766 | my $name = $pl->name; |
786 | my $name = $pl->name; |
767 | |
787 | |
768 | $_->send_msg ($SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) |
788 | send_msg $_, $SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say" |
769 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
789 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
770 | }; |
790 | }; |
771 | |
791 | |
772 | cf::register_command say => sub { |
792 | cf::register_command say => sub { |
773 | my ($ob, $msg) = @_; |
793 | my ($ob, $msg) = @_; |
… | |
… | |
778 | |
798 | |
779 | if ($msg) { |
799 | if ($msg) { |
780 | my $name = $ob->name; |
800 | my $name = $ob->name; |
781 | my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; |
801 | my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; |
782 | |
802 | |
|
|
803 | send_msg $_, $SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, "msg_say" |
|
|
804 | for grep $_ != $ob->contr, @plonmap; |
783 | $_->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | ($_ == $ob->contr ? cf::NDI_REPLY : 0)) |
805 | $ob->contr->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | cf::NDI_REPLY); |
784 | for @plonmap; |
|
|
785 | |
806 | |
786 | # npcs, magic_ears etc. |
807 | # npcs, magic_ears etc. |
787 | # first find all objects and their first-level inventories |
808 | # first find all objects and their first-level inventories |
788 | # within a 5x5 square that have something resembling |
809 | # within a 5x5 square that have something resembling |
789 | # dialogue or support on_say. |
810 | # dialogue or support on_say. |
… | |
… | |
803 | my ($reply, @kw) = $dialog->tell ($msg); |
824 | my ($reply, @kw) = $dialog->tell ($msg); |
804 | |
825 | |
805 | if (defined $reply) { |
826 | if (defined $reply) { |
806 | if ($npc->type == cf::MAGIC_EAR) { |
827 | if ($npc->type == cf::MAGIC_EAR) { |
807 | if (length $reply) { |
828 | if (length $reply) { |
808 | $_->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) |
829 | send_msg $_, $SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" |
809 | for @plonmap; |
830 | for @plonmap; |
810 | } |
831 | } |
811 | $npc->use_trigger; |
832 | $npc->use_trigger; |
812 | } else { |
833 | } else { |
813 | if (length $reply) { |
834 | if (length $reply) { |
814 | $_->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) |
835 | send_msg $_, $SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" |
815 | for @plonmap; |
836 | for @plonmap; |
816 | } |
837 | } |
817 | } |
838 | } |
818 | } |
839 | } |
819 | |
840 | |
… | |
… | |
842 | my $NOW = time; |
863 | my $NOW = time; |
843 | |
864 | |
844 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
865 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
845 | send_irc ("[%s] %s", $name, $msg); |
866 | send_irc ("[%s] %s", $name, $msg); |
846 | |
867 | |
847 | $_->send_msg ($CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) |
868 | send_msg $_, $CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" |
848 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
869 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
849 | |
870 | |
850 | } else { |
871 | } else { |
851 | $pl->send_msg ($CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
872 | $pl->send_msg ($CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
852 | } |
873 | } |
… | |
… | |
866 | my $name = $ob->name; |
887 | my $name = $ob->name; |
867 | |
888 | |
868 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
889 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
869 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
890 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
870 | |
891 | |
871 | $_->send_msg ($CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) |
892 | send_msg $_, $CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout" |
872 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
893 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
873 | |
894 | |
874 | } else { |
895 | } else { |
875 | $pl->send_msg ($CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
896 | $pl->send_msg ($CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
876 | } |
897 | } |
… | |
… | |
907 | } else { |
928 | } else { |
908 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg); |
929 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg); |
909 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
930 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
910 | |
931 | |
911 | $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
932 | $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
912 | $other->send_msg ($other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF); |
933 | send_msg $other, $other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF, "msg_tell"; |
913 | } |
934 | } |
914 | } else { |
935 | } else { |
915 | $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
936 | $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
916 | } |
937 | } |
917 | |
938 | |