ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/chat.ext
(Generate patch)

Comparing deliantra/server/ext/chat.ext (file contents):
Revision 1.9 by pippijn, Thu Mar 1 13:01:37 2007 UTC vs.
Revision 1.14 by root, Tue Apr 24 18:24:31 2007 UTC

36cf::register_command listen => sub { 36cf::register_command listen => sub {
37 my ($pl, $msg) = @_; 37 my ($pl, $msg) = @_;
38 my $player = cf::player::find_active $pl->name; 38 my $player = cf::player::find_active $pl->name;
39 39
40 if ($msg ne "") { 40 if ($msg ne "") {
41 $msg = 10 if $msg > 10;
42
41 my $prev_listen = $player->listening; 43 my $prev_listen = $player->listening;
42 $player->listening ($msg); 44 $player->listening ($msg);
43 if ($prev_listen == $player->listening) { 45 if ($prev_listen == $player->listening) {
44 $pl->message ("Your verbose level stayed $prev_listen.", cf::NDI_UNIQUE); 46 $pl->message ("Your verbose level stayed $prev_listen.", cf::NDI_UNIQUE);
45 } else { 47 } else {
72 74
73 $pl->message ("You flip a coin.... Tails!", cf::NDI_GREY | cf::NDI_UNIQUE); 75 $pl->message ("You flip a coin.... Tails!", cf::NDI_GREY | cf::NDI_UNIQUE);
74 } 76 }
75}; 77};
76 78
79cf::register_command orcknuckle => sub {
80 my ($pl, $msg) = @_;
81 my @orcknuckle = ("none", "beholder", "ghost", "knight", "princess", "dragon", "orc");
82
83 my $name = $pl->name;
84
85 my ($i, $j, $k, $l) = ((int rand 5) + 1, (int rand 5) + 1, (int rand 5) + 1, (int rand 6) + 1);
86 my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]";
87
88 for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) {
89 next
90 if $other->ob == $pl;
91 $other->ob->message ("$name rolls $result!", cf::NDI_GREY | cf::NDI_UNIQUE);
92 }
93
94 $pl->message ("You roll $result!", cf::NDI_GREY | cf::NDI_UNIQUE);
95};
96
77my $emotes = { 97my $emotes = {
78 growl => { 98 growl => {
79 noparams => { 99 noparams => {
80 other => "<self> growls.", 100 other => "<self> growls.",
81 self => "Grrrrrrrrr....", 101 self => "Grrrrrrrrr....",
209 noparams => { 229 noparams => {
210 other => "<self> winks suggestively.", 230 other => "<self> winks suggestively.",
211 self => "Have you got something in your eye?", 231 self => "Have you got something in your eye?",
212 }, 232 },
213 params => { 233 params => {
234 target => "<self> winks at you.",
214 target => "<self> winks at <other>.", 235 other => "<self> winks at <other>.",
215 self => "You wink suggestively at <other>.", 236 self => "You wink suggestively at <other>.",
216 }, 237 },
217 self => { 238 self => {
218 other => "<self> winks at himself - something strange is going on...", 239 other => "<self> winks at himself - something strange is going on...",
219 self => "You wink at yourself?? What are you up to?", 240 self => "You wink at yourself?? What are you up to?",
309 noparams => { 330 noparams => {
310 other => "<self> is bleeding all over the carpet - got a spare tourniquet?", 331 other => "<self> is bleeding all over the carpet - got a spare tourniquet?",
311 self => "You bleed all over your nice new armour.", 332 self => "You bleed all over your nice new armour.",
312 }, 333 },
313 params => { 334 params => {
335 target => "<self> slashes his wrist and bleeds all over you.",
314 target => "<self> slashes his wrist and bleeds all over <other>.", 336 other => "<self> slashes his wrist and bleeds all over <other>.",
315 self => "You slash your wrist and bleed all over <other>", 337 self => "You slash your wrist and bleed all over <other>",
316 }, 338 },
317 self => { 339 self => {
318 other => "<self> performs some satanic ritual while wiping his blood on himself.", 340 other => "<self> performs some satanic ritual while wiping his blood on himself.",
319 self => "Very impressive! You wipe your blood all over yourself.", 341 self => "Very impressive! You wipe your blood all over yourself.",
860 if ($target eq $name) { 882 if ($target eq $name) {
861 $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); 883 $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE);
862 } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { 884 } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) {
863 $pl->message ("$target ignores what you say. Give up on it.", cf::NDI_UNIQUE); 885 $pl->message ("$target ignores what you say. Give up on it.", cf::NDI_UNIQUE);
864 } else { 886 } else {
887 return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl->contr, $msg);
865 utf8::encode $msg; # ->message not yet utf8-ified 888 utf8::encode $msg; # ->message not yet utf8-ified
866 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; 889 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg;
867 890
868 $pl->message ("You tell $target: $msg"); 891 $pl->message ("You tell $target: $msg");
869 $other->ob->message ("$name tells you: $msg"); 892 $other->ob->message ("$name tells you: $msg");
996 $pl->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); 1019 $pl->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE);
997 } 1020 }
998 } 1021 }
999}; 1022};
1000 1023
1001cf::register_command seen => sub {
1002 my ($pl, $args) = @_;
1003
1004 if (my ($login) = $args =~ /(\S+)/) {
1005 if ($login eq $pl->name) {
1006 $pl->message ("Very funny, $login. Ha. Ha.", cf::NDI_UNIQUE);
1007 } elsif (cf::player::find_active $login) {
1008 $pl->message ("$login is right here on this server!", cf::NDI_UNIQUE);
1009 } elsif (cf::player::exists $login
1010 and stat sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($login) x 2) {
1011 my $time = (stat _)[9];
1012
1013 $pl->message ("$login was last seen here "
1014 . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time)
1015 . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_UNIQUE);
1016 } else {
1017 $pl->message ("No player named $login is known to me.", cf::NDI_UNIQUE);
1018 }
1019 } else {
1020 $pl->message ("Usage: seen <player>", cf::NDI_UNIQUE);
1021 }
1022};
1023

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines