--- deliantra/server/ext/chat.ext 2007/09/19 21:56:30 1.33 +++ deliantra/server/ext/chat.ext 2008/01/13 09:50:40 1.38 @@ -31,6 +31,13 @@ } } +sub send_msg($$$$$) { + my ($pl, $channel, $msg, $flags, $sound) = @_; + $pl->play_sound (cf::sound::find $sound) if defined $sound; + $pl->send_msg ($channel, $msg, $flags); + () +} + sub clean_timeouts($) { my ($player) = @_; my $NOW = time; @@ -97,7 +104,7 @@ my $coin = int rand 2 ? "Heads" : "Tails"; - $_->send_msg ($SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY) + send_msg $_, $SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; $pl->send_msg ($SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); @@ -113,7 +120,7 @@ my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; - $_->send_msg ($SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY) + send_msg $_, $SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; $pl->send_msg ($SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); @@ -250,6 +257,19 @@ self => { }, }, + smother => { + noparams => { + other => " makes weird facial contortions", + self => "All the lonely people..", + }, + params => { + target => " smothers you with kisses.", + other => " smothers with kisses.", + self => "You smother with kisses.", + }, + self => { + }, + }, wink => { noparams => { other => " winks suggestively.", @@ -719,29 +739,29 @@ $emote{other} =~ s//$name/; - $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) + send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY); } elsif ($tname) { my $target = cf::player::find $tname - or return $pl->send_msg (tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY); + or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; my %emote = %{ $emotes->{$emotion}->{params} || {} }; $emote{other} ||= " is eyeing quizzically."; $emote{self} ||= "You are still nuts."; - $emote{target} ||= "You get the distinct feeling that is nuts."; + $emote{target} ||= "You get the distinct feeling that is nuts."; $emote{self} =~ s//$tname/; $emote{target} =~ s//$name/; $emote{other} =~ s//$tname/; $emote{other} =~ s//$name/; - $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) + send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; - $target->send_msg (tell_channel $name, $emote{target}, cf::NDI_GREY); + send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY, "msg_shout"; $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); } else { my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; @@ -751,7 +771,7 @@ $emote{other} =~ s//$name/; - $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) + send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; $pl->send_msg ($CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); @@ -765,7 +785,7 @@ my $name = $pl->name; - $_->send_msg ($SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) + send_msg $_, $SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say" for grep $pl->on_same_map_as ($_->ob), cf::player::list; }; @@ -780,8 +800,9 @@ my $name = $ob->name; my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; - $_->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | ($_ == $ob->contr ? cf::NDI_REPLY : 0)) - for @plonmap; + send_msg $_, $SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, "msg_say" + for grep $_ != $ob->contr, @plonmap; + $ob->contr->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | cf::NDI_REPLY); # npcs, magic_ears etc. # first find all objects and their first-level inventories @@ -805,13 +826,13 @@ if (defined $reply) { if ($npc->type == cf::MAGIC_EAR) { if (length $reply) { - $_->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) + send_msg $_, $SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" for @plonmap; } $npc->use_trigger; } else { if (length $reply) { - $_->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) + send_msg $_, $SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" for @plonmap; } } @@ -844,7 +865,7 @@ cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; send_irc ("[%s] %s", $name, $msg); - $_->send_msg ($CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) + send_msg $_, $CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; } else { @@ -868,7 +889,7 @@ cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; send_irc ("\007\0034{%s} %s\n", $name, $msg); - $_->send_msg ($CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) + send_msg $_, $CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout" for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; } else { @@ -909,7 +930,7 @@ cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); - $other->send_msg ($other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF); + send_msg $other, $other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF, "msg_tell"; } } else { $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);