--- deliantra/server/ext/chat.ext 2007/01/07 02:39:14 1.3 +++ deliantra/server/ext/chat.ext 2007/02/28 19:13:23 1.4 @@ -31,6 +31,8 @@ clean_timeouts $pl->ob; }, + + 1 ); cf::register_command listen => sub { @@ -48,8 +50,658 @@ } else { $who->message ("Your verbose level is " . $player->listening . ".", cf::NDI_UNIQUE); } + + 1 }; +my $emotes = { + growl => { + noparams => { + other => " growls." + self => "Grrrrrrrrr...." + }, + params => { + }, + self => { + }, + }, + giggle => { + noparams => { + other => " giggles." + self => "You giggle." + }, + params => { + }, + self => { + }, + }, + shiver => { + noparams => { + other => " shivers uncomfortably." + self => "Brrrrrrrrr." + }, + params => { + }, + self => { + }, + }, + chuckle => { + noparams => { + other => " chuckles politely." + self => "You chuckle politely" + }, + params => { + }, + self => { + }, + }, + sigh => { + noparams => { + other => " sighs loudly." + self => "You sigh." + }, + params => { + }, + self => { + }, + }, + scream => { + noparams => { + other => " screams at the top of his lungs!" + self => "ARRRRRRRRRRGH!!!!!" + }, + params => { + }, + self => { + }, + }, + puke => { + noparams => { + other => " pukes." + self => "Bleaaaaaghhhhhhh!" + }, + params => { + target => " pukes on your clothes!" + other => " pukes on ." + self => "You puke on ." + }, + self => { + other => " pukes on his clothes." + self => "You puke on yourself." + }, + }, + strut => { + noparams => { + other => " struts proudly." + self => "Strut your stuff." + }, + params => { + }, + self => { + }, + }, + cringe => { + noparams => { + other => " cringes in terror!" + self => "You cringe in terror." + }, + params => { + target => " cringes away from in mortal terror." + self => "You cringe away from ." + }, + self => { + }, + }, + hiccup => { + noparams => { + other => " hiccups." + self => "*HIC*" + }, + params => { + }, + self => { + }, + }, + clap => { + noparams => { + other => " gives a round of applause." + self => "Clap, clap, clap." + }, + params => { + }, + self => { + }, + }, + kiss => { + noparams => { + other => " makes a weird facial contortion" + self => "All the lonely people.." + }, + params => { + target => " kisses you." + other => " kisses ." + self => "You kiss ." + }, + self => { + }, + }, + wink => { + noparams => { + other => " winks suggestively." + self => "Have you got something in your eye?" + }, + params => { + target => " winks at ." + self => "You wink suggestively at ." + }, + self => { + other => " winks at himself - something strange is going on..." + self => "You wink at yourself?? What are you up to?" + }, + }, + pout => { + noparams => { + other => " pouts." + self => "Aww, don't take it so hard." + }, + params => { + }, + self => { + }, + }, + cackle => { + noparams => { + other => " throws back his head and cackles with insane glee!" + self => "You cackle gleefully." + }, + params => { + }, + self => { + }, + }, + sniff => { + noparams => { + other => " sniffs sadly." + self => "You sniff sadly. *SNIFF*" + }, + params => { + target => " sniffs you." + other => " sniffs " + self => "You sniff ." + }, + self => { + other => " sniffs himself." + self => "You sniff yourself." + }, + }, + nod => { + noparams => { + other => " nods solemnly." + self => "You nod solemnly." + }, + params => { + target => " nods solemnly to you." + other => " nods solemnly to ." + self => "You nod solemnly to ." + }, + self => { + }, + }, + frown => { + noparams => { + other => " frowns." + self => "What's bothering you?" + }, + params => { + target => " frowns darkly at you." + other => " frowns darkly at ." + self => "You frown darkly at ." + }, + self => { + other => " frowns at himself." + self => "You frown at yourself." + }, + }, + snicker => { + noparams => { + other => " snickers softly." + self => "You snicker softly." + }, + params => { + }, + self => { + }, + }, + shrug => { + noparams => { + other => " shrugs helplessly." + self => "You shrug." + }, + params => { + target => " shrugs at you." + other => " shrugs at ." + self => "You shrug at ." + }, + self => { + }, + }, + bleed => { + noparams => { + other => " is bleeding all over the carpet - got a spare tourniquet?" + self => "You bleed all over your nice new armour." + }, + params => { + target => " slashes his wrist and bleeds all over ." + self => "You slash your wrist and bleed all over " + }, + self => { + other => " performs some satanic ritual while wiping his blood on himself." + self => "Very impressive! You wipe your blood all over yourself." + }, + }, + twiddle => { + noparams => { + other => " patiently twiddles his thumbs." + self => "You patiently twiddle your thumbs." + }, + params => { + }, + self => { + }, + }, + spit => { + noparams => { + other => " spits over his left shoulder." + self => "You spit over your left shoulder." + }, + params => { + target => " spits in your face!" + other => " spits in 's face." + self => "You spit on ." + }, + self => { + other => " drools all over himself." + self => "You drool all over yourself." + }, + }, + glare => { + noparams => { + other => " glares around him." + self => "You glare at nothing in particular." + }, + params => { + target => " glares icily at you, you feel cold to your bones." + other => " glares at ." + self => "You glare icily at ." + }, + self => { + other => " glares at his feet, what is bothering him?" + self => "You glare icily at your feet, they are suddenly very cold." + }, + }, + bow => { + noparams => { + other => " bows deeply." + self => "You bow deeply." + }, + params => { + target => " bows before you." + other => " bows before ." + self => "You bow before ." + }, + self => { + other => " folds up like a jackknife and kisses his own toes." + self => "You kiss your toes." + }, + }, + dance => { + noparams => { + other => " expresses himself through interpretive dance." + self => "You dance with glee." + }, + params => { + target => " grabs you, and begins dancing!" + other => "Yipe! and are doing the Macarena!" + self => "You grab and begin doing the Cha-Cha!" + }, + self => { + other => " embraces himself and begins to dance!" + self => "You skip and dance around by yourself." + }, + }, + other => { + noparams => { + other => " dances with glee." + self => "You are a nut." + }, + params => { + target => "You get the distinct feeling that is nuts." + other => " is eyeing quizzically." + self => "You are still nuts." + }, + self => { + other => "You look away from ." + self => "My god! Is that LEGAL?" + }, + }, + snore => { + noparams => { + other => " snores loudly." + self => "Zzzzzzzzzzzzzzz." + }, + params => { + }, + self => { + }, + }, + blush => { + noparams => { + other => " blushes." + self => "Your cheeks are burning." + }, + params => { + }, + self => { + }, + }, + snap => { + noparams => { + other => " snaps his fingers." + self => "PRONTO! you snap your fingers." + }, + params => { + }, + self => { + }, + }, + wave => { + noparams => { + other => " waves happily." + self => "You wave." + }, + params => { + target => " waves goodbye to you. Have a good journey." + other => " waves goodbye to ." + self => "You wave goodbye to ." + }, + self => { + other => " waves goodbye to himself." + self => "Are you going on adventures as well??" + }, + }, + smile => { + noparams => { + other => " smiles happily." + self => "You smile happily." + }, + params => { + target => " smiles at you." + other => " beams a smile at ." + self => "You smile at ." + }, + self => { + }, + }, + sneeze => { + noparams => { + other => " sneezes." + self => "Gesundheit!" + }, + params => { + target => " sneezes on you, you feel the snot cover you. EEEEEEW." + other => " sneezes on and a film of snot covers him." + self => "You sneeze at and a film of snot shoots onto him." + }, + self => { + other => " sneezes, and covers himself in a slimy substance." + self => "You sneeze on yourself, what a mess!" + }, + }, + bounce => { + noparams => { + other => " bounces around." + self => "BOIINNNNNNGG!" + }, + params => { + target => " bounces around the room with you." + other => " bounces around the room with ." + self => "You bounce around the room with ." + }, + self => { + }, + }, + shake => { + noparams => { + other => " shakes his head." + self => "You shake your head." + }, + params => { + target => " shakes your hand." + other => " shakes 's hand." + self => "You shake 's hand." + }, + self => { + other => " shakes and quivers like a bowlful of jelly." + self => "You are shaken by yourself." + }, + }, + lick => { + noparams => { + other => " licks his mouth and smiles." + self => "You lick your mouth and smile." + }, + params => { + target => " licks you." + other => " licks ." + self => "You lick ." + }, + self => { + other => " licks himself - YUCK." + self => "You lick yourself." + }, + }, + flip => { + noparams => { + other => " flips head over heels." + self => "You flip head over heels." + }, + params => { + }, + self => { + }, + }, + think => { + noparams => { + other => " closes his eyes and thinks really hard." + self => "Anything in particular that you'd care to think about?" + }, + params => { + }, + self => { + }, + }, + yawn => { + noparams => { + other => " yawns sleepily." + self => "You open up your yap and let out a big breeze of stale air." + }, + params => { + }, + self => { + }, + }, + laugh => { + noparams => { + other => " falls down laughing." + self => "You fall down laughing." + }, + params => { + target => " looks at you and falls down on the ground laughing." + other => " looks at and falls down on the ground laughing." + self => "You take one look at and fall down laughing." + }, + self => { + other => " is laughing at something." + self => "Laugh at yourself all you want, the others won't understand." + }, + }, + burp => { + noparams => { + other => " burps loudly." + self => "You burp loudly." + }, + params => { + }, + self => { + }, + }, + gasp => { + noparams => { + other => " gasps in astonishment." + self => "You gasp in astonishment." + }, + params => { + }, + self => { + }, + }, + smirk => { + noparams => { + other => " smirks." + self => "You smirk." + }, + params => { + }, + self => { + }, + }, + cry => { + noparams => { + other => " bursts into tears." + self => "Waaaaaaahhh.." + }, + params => { + target => " cries on your shoulder." + other => " cries on 's shoulder." + self => "You cry on 's shoulder." + }, + self => { + other => " sobs quietly to himself." + self => "You cry to yourself." + }, + }, + sulk => { + noparams => { + other => " sulks in the corner." + self => "You sulk." + }, + params => { + }, + self => { + }, + }, + whistle => { + noparams => { + other => " whistles appreciatively." + self => "You whistle appreciatively." + }, + params => { + target => " whistles at ." + self => "You whistle at ." + }, + self => { + other => " whistles to himself in boredom." + self => "You whistle while you work." + }, + }, + groan => { + noparams => { + other => " groans loudly." + self => "You groan loudly." + }, + params => { + }, + self => { + }, + }, + cough => { + noparams => { + other => " coughs loudly." + self => "Yuck, try to cover your mouth next time!" + }, + params => { + }, + self => { + }, + }, + grin => { + noparams => { + other => " grins evilly." + self => "You grin evilly." + }, + params => { + target => " grins evilly at you." + other => " grins evilly at ." + self => "You grin at ." + }, + self => { + }, + }, +}; +for my $emotion (keys %$emotes) { + cf::register_command $emotion => sub { + my ($ob, $tname) = @_; + + cf::async { + my $name = $ob->name; + + if ($tname eq $name) { + my $emote = $emotes->{$emotion}->{self}; + $emote->{other} =~ s//$name/; + + for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { + next + if $other->ob == $ob; + $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); + } + + $ob->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); + } elsif ($tname) { + my $target = cf::player::find $tname + or return $ob->reply (undef, "$tname is not around."); + + my $emote = $emotes->{$emotion}->{params}; + $emote->{self} =~ s//$tname/; + $emote->{target} =~ s//$name/; + $emote->{other} =~ s//$tname/; + $emote->{other} =~ s//$name/; + + for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { + next + if $other->ob == $ob or $other == $target; + $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); + } + + $target->ob->message ($emote->{target}, cf::NDI_GREY | cf::NDI_UNIQUE); + $ob->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); + } else { + my $emote = $emotes->{$emotion}->{noparams}; + $emote->{other} =~ s//$name/; + + for my $other ( grep { $ob->on_same_map_as ($_->ob) } cf::player::list ) { + next + if $other->ob == $ob; + $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); + } + + $ob->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); + } + }; + + 1 + }; +} + cf::register_command say => sub { my ($who, $msg) = @_; @@ -108,6 +760,8 @@ } else { $who->message ("What do you want to say?", cf::NDI_UNIQUE); } + + 1 }; cf::register_command chat => sub { @@ -131,6 +785,8 @@ } else { $who->message ("Chat what?", cf::NDI_UNIQUE); } + + 1 }; cf::register_command shout => sub { @@ -155,6 +811,7 @@ $who->message ("Shout what?", cf::NDI_UNIQUE); } + 1 }; cf::register_command tell => sub { @@ -193,6 +850,8 @@ } else { $who->message ("No such player. Your message: $msg", cf::NDI_UNIQUE); } + + 1 }; cf::register_command reply => sub { @@ -230,6 +889,8 @@ } else { $who->message ("Can't reply, player left. Your message: $args".$who->{ext_last_tell}, cf::NDI_UNIQUE); } + + 1 }; cf::register_command ignore => sub { @@ -279,6 +940,8 @@ . "Usage: ignore list\n" . "will show you a list of players currently ignored.", cf::NDI_UNIQUE); } + + 1 }; cf::register_command unignore => sub { @@ -313,6 +976,8 @@ $who->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); } } + + 1 }; cf::register_command seen => sub { @@ -336,5 +1001,7 @@ } else { $who->message ("Usage: seen ", cf::NDI_UNIQUE); } + + 1 };