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.21 by root, Fri Jul 20 16:11:10 2007 UTC vs.
Revision 1.52 by root, Wed Apr 21 03:34:26 2010 UTC

1#! perl # depends=irc 1#! perl # depends=irc mandatory
2#CONVERSION: PARTIAL
3 2
4# implement a replacement for the built-in say/chat/shout/tell/reply commands 3# implement a replacement for the built-in say/chat/shout/tell commands
5# adds ignore/unignore functionality 4# adds ignore/unignore functionality
6 5
7use NPC_Dialogue; 6use NPC_Dialogue;
8use POSIX (); # for strftime only 7use POSIX (); # for strftime only
8
9sub tell_channel($) {
10 my ($target) = @_;
11
12 {
13 id => "tell-$target",
14 title => "$target",
15 reply => "tell $target ",
16 tooltip => "Private messages from/to $target",
17 }
18}
19
20sub send_msg($$$$$) {
21 my ($pl, $channel, $msg, $flags, $sound) = @_;
22 $pl->play_sound (cf::sound::find $sound) if defined $sound;
23 $pl->send_msg ($channel, $msg, $flags);
24 ()
25}
9 26
10sub clean_timeouts($) { 27sub clean_timeouts($) {
11 my ($player) = @_; 28 my ($player) = @_;
12 my $NOW = time; 29 my $NOW = time;
13 30
14 for my $hash (@$player{qw(ext_ignore_shout ext_ignore_tell)}) { 31 for my $hash (@$player{qw(ext_ignore_shout ext_ignore_tell)}) {
15 while (my ($k, $v) = each %$hash) { 32 while (my ($k, $v) = each %$hash) {
16 if ($v < $NOW) { 33 if ($v < $NOW) {
17 $player->message ("Your ignore on $k has expired.", cf::NDI_GREEN | cf::NDI_UNIQUE); 34 $player->message ("Your ignore on $k has expired.", cf::NDI_GREEN);
18 delete $hash->{$k}; 35 delete $hash->{$k};
19 } elsif (!cf::player::exists $k) { 36 } elsif (!cf::player::exists $k) {
20 $player->message ("Your ignore on $k is no longer valid (no such user).", cf::NDI_GREEN | cf::NDI_UNIQUE); 37 $player->message ("Your ignore on $k is no longer valid (no such user).", cf::NDI_GREEN);
21 delete $hash->{$k}; 38 delete $hash->{$k};
22 } 39 }
23 } 40 }
24 } 41 }
25} 42}
37cf::player->attach ( 54cf::player->attach (
38 prio => -1000, 55 prio => -1000,
39 on_login => sub { 56 on_login => sub {
40 my ($pl) = @_; 57 my ($pl) = @_;
41 58
59 cf::async {
42 clean_timeouts $pl->ob; 60 clean_timeouts $pl->ob;
61 };
62
63 $pl->send_msg ($cf::SAY_CHANNEL);
64 $pl->send_msg ($cf::CHAT_CHANNEL);
43 }, 65 },
44); 66);
45 67
68# TODO: remove once safe
46cf::register_command listen => sub { 69cf::register_command listen => sub {
47 my ($pl, $msg) = @_;
48 my $player = cf::player::find_active $pl->name;
49
50 if ($msg ne "") {
51 $msg = 10 if $msg > 10;
52
53 my $prev_listen = $player->listening;
54 $player->listening ($msg);
55 if ($prev_listen == $player->listening) {
56 $pl->message ("Your verbose level stays at $prev_listen.", cf::NDI_UNIQUE);
57 } else {
58 $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_UNIQUE);
59 }
60 } else {
61 $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_UNIQUE);
62 }
63}; 70};
64 71
65cf::register_command cointoss => sub { 72cf::register_command cointoss => sub {
66 my ($pl, $msg) = @_; 73 my ($ob, $msg) = @_;
67 74
75 my $pl = $ob->contr;
68 my $name = $pl->name; 76 my $name = $ob->name;
77
69 my $coin = int rand 2 ? "Heads" : "Tails"; 78 my $coin = int rand 2 ? "Heads" : "Tails";
70 79
80 send_msg $_, $cf::SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say"
71 for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { 81 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list;
72 next
73 if $other->ob == $pl;
74 $other->ob->message ("$name flips a coin.... $coin!", cf::NDI_GREY | cf::NDI_UNIQUE);
75 }
76 82
77 $pl->message ("You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_UNIQUE); 83 $pl->send_msg ($cf::SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY);
78}; 84};
79 85
80cf::register_command orcknuckle => sub { 86cf::register_command orcknuckle => sub {
81 my ($pl, $msg) = @_; 87 my ($ob, $msg) = @_;
88
89 my $pl = $ob->contr;
90 my $name = $ob->name;
91
82 my @orcknuckle = ("none", "beholder", "ghost", "knight", "princess", "dragon", "orc"); 92 my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc");
83 93 my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6);
84 my $name = $pl->name;
85
86 my ($i, $j, $k, $l) = ((int rand 5) + 1, (int rand 5) + 1, (int rand 5) + 1, (int rand 6) + 1);
87 my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; 94 my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]";
88 95
96 send_msg $_, $cf::SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say"
89 for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { 97 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list;
90 next
91 if $other->ob == $pl;
92 $other->ob->message ("$name rolls $result!", cf::NDI_GREY | cf::NDI_UNIQUE);
93 } 98
94
95 $pl->message ("You roll $result!", cf::NDI_GREY | cf::NDI_UNIQUE); 99 $pl->send_msg ($cf::SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY);
96}; 100};
97 101
98my $emotes = { 102my $emotes = {
99 growl => { 103 growl => {
100 noparams => { 104 noparams => {
146 self => { 150 self => {
147 }, 151 },
148 }, 152 },
149 scream => { 153 scream => {
150 noparams => { 154 noparams => {
151 other => "<self> screams at the top of his lungs!", 155 other => "<self> screams at the top of G<his|her> lungs!",
152 self => "ARRRRRRRRRRGH!!!!!", 156 self => "ARRRRRRRRRRGH!!!!!",
153 }, 157 },
154 params => { 158 params => {
155 }, 159 },
156 self => { 160 self => {
165 target => "<self> pukes on your clothes!", 169 target => "<self> pukes on your clothes!",
166 other => "<self> pukes on <other>.", 170 other => "<self> pukes on <other>.",
167 self => "You puke on <other>.", 171 self => "You puke on <other>.",
168 }, 172 },
169 self => { 173 self => {
170 other => "<self> pukes on his clothes.", 174 other => "<self> pukes on G<his|her> clothes.",
171 self => "You puke on yourself.", 175 self => "You puke on yourself.",
172 }, 176 },
173 }, 177 },
174 strut => { 178 strut => {
175 noparams => { 179 noparams => {
214 }, 218 },
215 }, 219 },
216 kiss => { 220 kiss => {
217 noparams => { 221 noparams => {
218 other => "<self> makes a weird facial contortion", 222 other => "<self> makes a weird facial contortion",
219 self => "All the lonely people..", 223 self => "All the lonely people...",
220 }, 224 },
221 params => { 225 params => {
222 target => "<self> kisses you.", 226 target => "<self> kisses you.",
223 other => "<self> kisses <other>.", 227 other => "<self> kisses <other>.",
224 self => "You kiss <other>.", 228 self => "You kiss <other>.",
225 }, 229 },
226 self => { 230 self => {
227 }, 231 },
228 }, 232 },
233 hug => {
234 noparams => {
235 other => "<self> makes weird body movements.",
236 self => "All the lonely people...",
237 },
238 params => {
239 target => "<self> suddenly grabs you and gives you a bear hug.",
240 other => "<self> hugs <other>.",
241 self => "You hug <other>.",
242 },
243 self => {
244 other => "<self> tries to hug G<himself|herself>, but stumbles and now feels stupid.",
245 self => "You try and fail to hug yourself.",
246 },
247 },
248 smother => {
249 noparams => {
250 other => "<self> makes weird facial contortions",
251 self => "All the lonely people...",
252 },
253 params => {
254 target => "<self> smothers you with kisses.",
255 other => "<self> smothers <other> with kisses.",
256 self => "You smother <other> with kisses.",
257 },
258 self => {
259 },
260 },
229 wink => { 261 wink => {
230 noparams => { 262 noparams => {
231 other => "<self> winks suggestively.", 263 other => "<self> winks suggestively.",
232 self => "Have you got something in your eye?", 264 self => "Have you got something in your eye?",
233 }, 265 },
235 target => "<self> winks at you.", 267 target => "<self> winks at you.",
236 other => "<self> winks at <other>.", 268 other => "<self> winks at <other>.",
237 self => "You wink suggestively at <other>.", 269 self => "You wink suggestively at <other>.",
238 }, 270 },
239 self => { 271 self => {
240 other => "<self> winks at himself - something strange is going on...", 272 other => "<self> winks at G<him|her>self - something strange is going on...",
241 self => "You wink at yourself?? What are you up to?", 273 self => "You wink at yourself?? What are you up to?",
242 }, 274 },
243 }, 275 },
244 pout => { 276 pout => {
245 noparams => { 277 noparams => {
251 self => { 283 self => {
252 }, 284 },
253 }, 285 },
254 cackle => { 286 cackle => {
255 noparams => { 287 noparams => {
256 other => "<self> throws back his head and cackles with insane glee!", 288 other => "<self> throws back G<his|her> head and cackles with insane glee!",
257 self => "You cackle gleefully.", 289 self => "You cackle gleefully.",
258 }, 290 },
259 params => { 291 params => {
260 }, 292 },
261 self => { 293 self => {
270 target => "<self> sniffs you.", 302 target => "<self> sniffs you.",
271 other => "<self> sniffs <other>", 303 other => "<self> sniffs <other>",
272 self => "You sniff <other>.", 304 self => "You sniff <other>.",
273 }, 305 },
274 self => { 306 self => {
275 other => "<self> sniffs himself.", 307 other => "<self> sniffs G<him|her>self.",
276 self => "You sniff yourself.", 308 self => "You sniff yourself.",
277 }, 309 },
278 }, 310 },
279 nod => { 311 nod => {
280 noparams => { 312 noparams => {
281 other => "<self> nods solemnly.", 313 other => "<self> nods solemnly.",
282 self => "You nod solemnly.", 314 self => "You nod solemnly.",
283 }, 315 },
284 params => { 316 params => {
285 target => "<self> nods solemnly to you.", 317 target => "<self> nods solemnly at you.",
286 other => "<self> nods solemnly to <other>.", 318 other => "<self> nods solemnly at <other>.",
287 self => "You nod solemnly to <other>.", 319 self => "You nod solemnly at <other>.",
288 }, 320 },
289 self => { 321 self => {
290 }, 322 },
291 }, 323 },
292 frown => { 324 frown => {
298 target => "<self> frowns darkly at you.", 330 target => "<self> frowns darkly at you.",
299 other => "<self> frowns darkly at <other>.", 331 other => "<self> frowns darkly at <other>.",
300 self => "You frown darkly at <other>.", 332 self => "You frown darkly at <other>.",
301 }, 333 },
302 self => { 334 self => {
303 other => "<self> frowns at himself.", 335 other => "<self> frowns at G<him|her>self.",
304 self => "You frown at yourself.", 336 self => "You frown at yourself.",
305 }, 337 },
306 }, 338 },
307 snicker => { 339 snicker => {
308 noparams => { 340 noparams => {
331 noparams => { 363 noparams => {
332 other => "<self> is bleeding all over the carpet - got a spare tourniquet?", 364 other => "<self> is bleeding all over the carpet - got a spare tourniquet?",
333 self => "You bleed all over your nice new armour.", 365 self => "You bleed all over your nice new armour.",
334 }, 366 },
335 params => { 367 params => {
336 target => "<self> slashes his wrist and bleeds all over you.", 368 target => "<self> slashes G<his|her> wrist and bleeds all over you.",
337 other => "<self> slashes his wrist and bleeds all over <other>.", 369 other => "<self> slashes G<his|her> wrist and bleeds all over <other>.",
338 self => "You slash your wrist and bleed all over <other>", 370 self => "You slash your wrist and bleed all over <other>",
339 }, 371 },
340 self => { 372 self => {
341 other => "<self> performs some satanic ritual while wiping his blood on himself.", 373 other => "<self> performs some satanic ritual while wiping G<his|her> blood on G<him|her>self.",
342 self => "Very impressive! You wipe your blood all over yourself.", 374 self => "Very impressive! You wipe your blood all over yourself.",
343 }, 375 },
344 }, 376 },
345 twiddle => { 377 twiddle => {
346 noparams => { 378 noparams => {
347 other => "<self> patiently twiddles his thumbs.", 379 other => "<self> patiently twiddles G<his|her> thumbs.",
348 self => "You patiently twiddle your thumbs.", 380 self => "You patiently twiddle your thumbs.",
349 }, 381 },
350 params => { 382 params => {
351 }, 383 },
352 self => { 384 self => {
353 }, 385 },
354 }, 386 },
355 spit => { 387 spit => {
356 noparams => { 388 noparams => {
357 other => "<self> spits over his left shoulder.", 389 other => "<self> spits over G<his|her> left shoulder.",
358 self => "You spit over your left shoulder.", 390 self => "You spit over your left shoulder.",
359 }, 391 },
360 params => { 392 params => {
361 target => "<self> spits in your face!", 393 target => "<self> spits in your face!",
362 other => "<self> spits in <other>'s face.", 394 other => "<self> spits in <other>'s face.",
363 self => "You spit on <other>.", 395 self => "You spit on <other>.",
364 }, 396 },
365 self => { 397 self => {
366 other => "<self> drools all over himself.", 398 other => "<self> drools all over G<him|her>self.",
367 self => "You drool all over yourself.", 399 self => "You drool all over yourself.",
368 }, 400 },
369 }, 401 },
370 glare => { 402 glare => {
371 noparams => { 403 noparams => {
372 other => "<self> glares around him.", 404 other => "<self> glares around G<him|her>.",
373 self => "You glare at nothing in particular.", 405 self => "You glare at nothing in particular.",
374 }, 406 },
375 params => { 407 params => {
376 target => "<self> glares icily at you, you feel cold to your bones.", 408 target => "<self> glares icily at you, you feel cold to your bones.",
377 other => "<self> glares at <other>.", 409 other => "<self> glares at <other>.",
378 self => "You glare icily at <other>.", 410 self => "You glare icily at <other>.",
379 }, 411 },
380 self => { 412 self => {
381 other => "<self> glares at his feet, what is bothering him?", 413 other => "<self> glares at G<his|her> feet, what is bothering G<him|her>?",
382 self => "You glare icily at your feet, they are suddenly very cold.", 414 self => "You glare icily at your feet, they are suddenly very cold.",
383 }, 415 },
384 }, 416 },
385 bow => { 417 bow => {
386 noparams => { 418 noparams => {
391 target => "<self> bows before you.", 423 target => "<self> bows before you.",
392 other => "<self> bows before <other>.", 424 other => "<self> bows before <other>.",
393 self => "You bow before <other>.", 425 self => "You bow before <other>.",
394 }, 426 },
395 self => { 427 self => {
396 other => "<self> folds up like a jackknife and kisses his own toes.", 428 other => "<self> folds up like a jackknife and kisses G<his|her> own toes.",
397 self => "You kiss your toes.", 429 self => "You kiss your toes.",
398 }, 430 },
399 }, 431 },
400 dance => { 432 dance => {
401 noparams => { 433 noparams => {
402 other => "<self> expresses himself through interpretive dance.", 434 other => "<self> expresses G<him|her>self through interpretive dance.",
403 self => "You dance with glee.", 435 self => "You dance with glee.",
404 }, 436 },
405 params => { 437 params => {
406 target => "<self> grabs you, and begins dancing!", 438 target => "<self> grabs you, and begins dancing!",
407 other => "Yipe! <self> and <other> are doing the Macarena!", 439 other => "Yipe! <self> and <other> are doing the Macarena!",
408 self => "You grab <other> and begin doing the Cha-Cha!", 440 self => "You grab <other> and begin doing the Cha-Cha!",
409 }, 441 },
410 self => { 442 self => {
411 other => "<self> embraces himself and begins to dance!", 443 other => "<self> embraces G<him|her>self and begins to dance!",
412 self => "You skip and dance around by yourself.", 444 self => "You skip and dance around by yourself.",
413 }, 445 },
414 }, 446 },
415 snore => { 447 snore => {
416 noparams => { 448 noparams => {
432 self => { 464 self => {
433 }, 465 },
434 }, 466 },
435 snap => { 467 snap => {
436 noparams => { 468 noparams => {
437 other => "<self> snaps his fingers.", 469 other => "<self> snaps G<his|her> fingers.",
438 self => "PRONTO! you snap your fingers.", 470 self => "PRONTO! you snap your fingers.",
439 }, 471 },
440 params => { 472 params => {
441 }, 473 },
442 self => { 474 self => {
451 target => "<self> waves goodbye to you. Have a good journey.", 483 target => "<self> waves goodbye to you. Have a good journey.",
452 other => "<self> waves goodbye to <other>.", 484 other => "<self> waves goodbye to <other>.",
453 self => "You wave goodbye to <other>.", 485 self => "You wave goodbye to <other>.",
454 }, 486 },
455 self => { 487 self => {
456 other => "<self> waves goodbye to himself.", 488 other => "<self> waves goodbye to G<him|her>self.",
457 self => "Are you going on adventures as well??", 489 self => "Are you going on adventures as well??",
458 }, 490 },
459 }, 491 },
460 smile => { 492 smile => {
461 noparams => { 493 noparams => {
475 other => "<self> sneezes.", 507 other => "<self> sneezes.",
476 self => "Gesundheit!", 508 self => "Gesundheit!",
477 }, 509 },
478 params => { 510 params => {
479 target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.", 511 target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.",
480 other => "<self> sneezes on <other> and a film of snot covers him.", 512 other => "<self> sneezes on <other> and a film of snot covers G<him|her>.",
481 self => "You sneeze at <other> and a film of snot shoots onto him.", 513 self => "You sneeze at <other> and a film of snot shoots onto G<him|her>.",
482 }, 514 },
483 self => { 515 self => {
484 other => "<self> sneezes, and covers himself in a slimy substance.", 516 other => "<self> sneezes, and covers G<him|her>self in a slimy substance.",
485 self => "You sneeze on yourself, what a mess!", 517 self => "You sneeze on yourself, what a mess!",
486 }, 518 },
487 }, 519 },
488 bounce => { 520 bounce => {
489 noparams => { 521 noparams => {
498 self => { 530 self => {
499 }, 531 },
500 }, 532 },
501 shake => { 533 shake => {
502 noparams => { 534 noparams => {
503 other => "<self> shakes his head.", 535 other => "<self> shakes G<his|her> head.",
504 self => "You shake your head.", 536 self => "You shake your head.",
505 }, 537 },
506 params => { 538 params => {
507 target => "<self> shakes your hand.", 539 target => "<self> shakes your hand.",
508 other => "<self> shakes <other>'s hand.", 540 other => "<self> shakes <other>'s hand.",
513 self => "You are shaken by yourself.", 545 self => "You are shaken by yourself.",
514 }, 546 },
515 }, 547 },
516 lick => { 548 lick => {
517 noparams => { 549 noparams => {
518 other => "<self> licks his mouth and smiles.", 550 other => "<self> licks G<his|her> mouth and smiles.",
519 self => "You lick your mouth and smile.", 551 self => "You lick your mouth and smile.",
520 }, 552 },
521 params => { 553 params => {
522 target => "<self> licks you.", 554 target => "<self> licks you.",
523 other => "<self> licks <other>.", 555 other => "<self> licks <other>.",
524 self => "You lick <other>.", 556 self => "You lick <other>.",
525 }, 557 },
526 self => { 558 self => {
527 other => "<self> licks himself - YUCK.", 559 other => "<self> licks G<him|her>self - YUCK.",
528 self => "You lick yourself.", 560 self => "You lick yourself.",
529 }, 561 },
530 }, 562 },
531 flip => { 563 flip => {
532 noparams => { 564 noparams => {
538 self => { 570 self => {
539 }, 571 },
540 }, 572 },
541 think => { 573 think => {
542 noparams => { 574 noparams => {
543 other => "<self> closes his eyes and thinks really hard.", 575 other => "<self> closes G<his|her> eyes and thinks really hard.",
544 self => "Anything in particular that you'd care to think about?", 576 self => "Anything in particular that you'd care to think about?",
545 }, 577 },
546 params => { 578 params => {
547 }, 579 },
548 self => { 580 self => {
612 target => "<self> cries on your shoulder.", 644 target => "<self> cries on your shoulder.",
613 other => "<self> cries on <other>'s shoulder.", 645 other => "<self> cries on <other>'s shoulder.",
614 self => "You cry on <other>'s shoulder.", 646 self => "You cry on <other>'s shoulder.",
615 }, 647 },
616 self => { 648 self => {
617 other => "<self> sobs quietly to himself.", 649 other => "<self> sobs quietly to G<him|her>self.",
618 self => "You cry to yourself.", 650 self => "You cry to yourself.",
619 }, 651 },
620 }, 652 },
621 sulk => { 653 sulk => {
622 noparams => { 654 noparams => {
636 params => { 668 params => {
637 target => "<self> whistles at <other>.", 669 target => "<self> whistles at <other>.",
638 self => "You whistle at <other>.", 670 self => "You whistle at <other>.",
639 }, 671 },
640 self => { 672 self => {
641 other => "<self> whistles to himself in boredom.", 673 other => "<self> whistles to G<him|her>self in boredom.",
642 self => "You whistle while you work.", 674 self => "You whistle while you work.",
643 }, 675 },
644 }, 676 },
645 groan => { 677 groan => {
646 noparams => { 678 noparams => {
677 }, 709 },
678}; 710};
679 711
680for my $emotion (keys %$emotes) { 712for my $emotion (keys %$emotes) {
681 cf::register_command $emotion => sub { 713 cf::register_command $emotion => sub {
682 my ($pl, $tname) = @_; 714 my ($ob, $tname) = @_;
715
716 my $pl = $ob->contr;
683 717
684 cf::async { 718 cf::async {
685 my $name = $pl->name; 719 my $name = $ob->name;
720 $Coro::current->{desc} = "emote handler for $name";
686 721
687 if ($tname eq $name) { 722 if ($tname eq $name) {
688 my $emote = $emotes->{$emotion}->{self}; 723 my %emote = %{ $emotes->{$emotion}->{self} || {} };
689 724
690 $emote->{other} = "You look away from <self>." 725 $emote{other} ||= "You look away from <self>.";
691 if !$emote->{other};
692 $emote->{self} = "My god! Is that LEGAL?" 726 $emote{self} ||= "My god! Is that LEGAL?";
693 if !$emote->{self};
694 727
695 $emote->{other} =~ s/<self>/$name/; 728 $emote{other} =~ s/<self>/$name/;
729
730 $_ = $pl->expand_cfpod ($_)
731 for values %emote;
696 732
733 send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat"
697 for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { 734 for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list;
698 next
699 if $other->ob == $pl;
700 $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE);
701 }
702 735
703 $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); 736 $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM);
704 } elsif ($tname) { 737 } elsif ($tname) {
705 my $target = cf::player::find $tname 738 my $target = cf::player::find $tname
706 or return $pl->reply (undef, "$tname is not around."); 739 or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat";
707 740
708 my $emote = $emotes->{$emotion}->{params}; 741 my %emote = %{ $emotes->{$emotion}->{params} || {} };
709 742
710 $emote->{other} = "<self> is eyeing <other> quizzically." 743 $emote{other} ||= "<self> is eyeing <other> quizzically.";
711 if !$emote->{other};
712 $emote->{self} = "You are still nuts." 744 $emote{self} ||= "You are still nuts.";
713 if !$emote->{self};
714 $emote->{target} = "You get the distinct feeling that <other> is nuts." 745 $emote{target} ||= "You get the distinct feeling that <self> is nuts.";
715 if !$emote->{target};
716 746
717 $emote->{self} =~ s/<other>/$tname/; 747 $emote{self} =~ s/<other>/$tname/;
718 $emote->{target} =~ s/<self>/$name/; 748 $emote{target} =~ s/<self>/$name/;
719 $emote->{other} =~ s/<other>/$tname/; 749 $emote{other} =~ s/<other>/$tname/;
720 $emote->{other} =~ s/<self>/$name/; 750 $emote{other} =~ s/<self>/$name/;
721 751
722 for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { 752 $_ = $pl->expand_cfpod ($_)
723 next 753 for values %emote;
724 if $other->ob == $pl or $other == $target;
725 $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE);
726 }
727 754
728 $target->ob->message ($emote->{target}, cf::NDI_GREY | cf::NDI_UNIQUE); 755 send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat"
729 $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); 756 for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list;
757
758 send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_shout";
759 $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM);
730 } else { 760 } else {
731 my $emote = $emotes->{$emotion}->{noparams}; 761 my %emote = %{ $emotes->{$emotion}->{noparams} || {} };
732 $emote->{other} =~ s/<self>/$name/;
733 762
734 $emote->{other} = "<self> dances with glee." 763 $emote{other} ||= "<self> dances with glee.";
735 if !$emote->{other};
736 $emote->{self} = "You are a nut." 764 $emote{self} ||= "You are a nut.";
737 if !$emote->{self};
738 765
766 $emote{other} =~ s/<self>/$name/;
767
768 $_ = $pl->expand_cfpod ($_)
769 for values %emote;
770
771 send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat"
739 for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { 772 for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list;
740 next
741 if $other->ob == $pl;
742 $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE);
743 }
744 773
745 $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); 774 $pl->send_msg ($cf::CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM);
746 } 775 }
747 }; 776 };
748 }; 777 };
749} 778}
750 779
751our $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
758cf::register_command me => sub {
759 my ($pl, $msg) = @_;
760
761 my $name = $pl->name;
762
763 $_->ns->send_msg ($SAY_CHANNEL => "* $name $msg", cf::NDI_GREY, $_ == $pl ? (reply => 1) : ())
764 for grep $pl->on_same_map_as ($_->ob), cf::player::list;
765};
766
767cf::register_command say => sub { 780cf::register_command say => sub {
768 my ($pl, $msg) = @_; 781 my ($ob, $msg) = @_;
769 782
770 utf8::decode $msg; 783 utf8::decode $msg;
771 784
772 return if $pl->contr->invoke (cf::EVENT_PLAYER_SAY, $msg); 785 return if $ob->contr->invoke (cf::EVENT_PLAYER_SAY, $msg);
773 786
774 if ($msg) { 787 if ($msg) {
775 my $name = $pl->name; 788 my $name = $ob->name;
776 my @plonmap = grep $pl->on_same_map_as ($_->ob), cf::player::list; 789 my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list;
777 790
778 $_->ns->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, $_ == $pl ? (reply => 1) : ()) 791 send_msg $_, $cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, "msg_say"
779 for @plonmap; 792 for grep $_ != $ob->contr, @plonmap;
793 $ob->contr->send_msg ($cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | cf::NDI_REPLY);
794
795 my @npc;
780 796
781 # npcs, magic_ears etc. 797 # npcs, magic_ears etc.
782 # first find all objects and their first-level inventories 798 # first find all objects and their first-level inventories
783 # within a 5x5 square that have something resembling 799 # within a 5x5 square that have something resembling
784 # dialogue or support on_say. 800 # dialogue or support on_say.
801 # we prefer the nearest items NOT in the player, otherwise in player.
785 my ($map, $x, $y) = ($pl->map, $pl->x - 2, $pl->y - 2); 802 my ($map, $x, $y) = ($ob->map, $ob->x, $ob->y);
786 803
787 for my $npc ( 804 for my $dir (0 .. cf::SIZEOFFREE2) {
788 grep +($_->invoke (cf::EVENT_OBJECT_SAY, $pl->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, 805 @npc = grep $_->should_invoke (cf::EVENT_OBJECT_SAY) || $_->has_dialogue,
789 map +($_, $_->inv), 806 map +($_, $_->inv),
790 grep $_, 807 grep $_ != $ob,
791 map $map->at ($x + $_ % 5, $y + (int $_ / 5)), 808 $map->at ($x, $y, $dir)
792 0..24 809 and last;
793 ) { 810 }
811
812 unless (@npc) {
813 # nothing found, try the player inventory
814 @npc = grep $_->should_invoke (cf::EVENT_OBJECT_SAY) || $_->has_dialogue,
815 $ob->inv;
816 }
817
818 for my $npc (@npc) {
819 return if $npc->invoke (cf::EVENT_OBJECT_SAY);
820
794 # if some listener teleported us somewhere else, stop right here 821 # if some listener teleported us somewhere else, stop right here
795 last unless $map->path == $pl->map->path; 822 last unless $map->path == $ob->map->path;
796 823
824 if ($npc->has_dialogue) {
797 my $dialog = new NPC_Dialogue pl => $pl->contr, npc => $npc; 825 my $dialog = new NPC_Dialogue pl => $ob->contr, npc => $npc;
798 my ($reply, @kw) = $dialog->tell ($msg); 826 my ($reply, @kw) = $dialog->tell ($msg);
799 827
800 if (defined $reply) { 828 if (defined $reply) {
801 if ($npc->type == cf::MAGIC_EAR) { 829 if ($npc->type == cf::MAGIC_EAR) {
802 if (length $reply) {
803 $_->contr->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) 830 send_msg $_, $cf::SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say"
804 for @plonmap; 831 for @plonmap;
805 }
806 $npc->use_trigger;
807 } else { 832 } else {
808 if (length $reply) {
809 $_->contr->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) 833 send_msg $_, $cf::SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say"
810 for @plonmap; 834 for @plonmap;
811 } 835 }
812 } 836 }
813 }
814 837
815 if (@kw) { 838 if (@kw) {
816 $_->contr->send_msg ($SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) 839 $_->send_msg ($cf::SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN)
817 for @plonmap; 840 for @plonmap;
841 }
818 } 842 }
819 } 843 }
820 844
821 } else { 845 } else {
822 $pl->contr->send_msg ($SAY_CHANNEL => "What do you want to say?", 0, reply => 1); 846 $ob->send_msg ($cf::SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY);
823 } 847 }
824}; 848};
825 849
826our $CHAT_CHANNEL = { 850
827 id => "chat", 851sub _chat {
828 title => "Chat", 852 my ($ob, $msg) = @_;
829 reply => "chat ", 853
830 tooltip => "Player chat and shouts, global to the server.", 854 my $pl = $ob->contr;
855
856 return if $pl->invoke (cf::EVENT_PLAYER_CHAT, $msg);
857
858 if ($msg) {
859 my $name = $ob->name;
860 my $NOW = time;
861
862 cf::LOG cf::llevDebug, sprintf "QBERT %s\n", $msg;
863 send_irc ("%s", $msg);
864
865 send_msg $_, $cf::CHAT_CHANNEL => $msg, cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat"
866 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list;
867
868 } else {
869 $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY);
870 }
871}
872
873cf::register_command chat => sub {
874 my ($ob, $msg) = @_;
875
876 utf8::decode $msg;
877 _chat $ob, $ob->name . " chats: $msg";
831}; 878};
832 879
833cf::register_command chat => sub { 880cf::register_command me => sub {
834 my ($pl, $msg) = @_; 881 my ($ob, $msg) = @_;
835 882
836 utf8::decode $msg; 883 utf8::decode $msg;
837 884 _chat $ob, "* " . $ob->name . " $msg";
838 return if $pl->contr->invoke (cf::EVENT_PLAYER_CHAT, $msg);
839
840 if ($msg) {
841 my $name = $pl->name;
842 my $NOW = time;
843
844 cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg;
845 send_irc ("[%s] %s", $name, $msg);
846
847 $_->ns->send_msg ($CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE, $_ == $pl ? (reply => 1) : ())
848 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list;
849
850 } else {
851 $pl->ns->send_msg ($CHAT_CHANNEL => "Chat what?");
852 }
853}; 885};
854 886
855cf::register_command shout => sub { 887cf::register_command shout => sub {
856 my ($pl, $msg) = @_; 888 my ($ob, $msg) = @_;
857 889
858 utf8::decode $msg; 890 utf8::decode $msg;
859 891
892 my $pl = $ob->contr;
893
860 return if $pl->contr->invoke (cf::EVENT_PLAYER_SHOUT, $msg); 894 return if $pl->invoke (cf::EVENT_PLAYER_SHOUT, $msg);
861 895
862 if ($msg) { 896 if ($msg) {
863 my $NOW = time; 897 my $NOW = time;
864 my $name = $pl->name; 898 my $name = $ob->name;
865 899
866 cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; 900 cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg;
867 send_irc ("\007\0034{%s} %s\n", $name, $msg); 901 send_irc ("\007\0034{%s} %s\n", $name, $msg);
868 902
869 $_->ns->send_msg ($CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_BLUE, $_ == $pl ? (reply => 1) : ()) 903 send_msg $_, $cf::CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout"
870 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; 904 for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list;
871 905
872 } else { 906 } else {
873 $pl->ns->send_msg ($CHAT_CHANNEL => "Shout what?"); 907 $pl->send_msg ($cf::CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY);
874 } 908 }
875}; 909};
876 910
877cf::register_command tell => sub { 911cf::register_command tell => sub {
878 my ($ob, $args) = @_; 912 my ($ob, $args) = @_;
885 or return; 919 or return;
886 my $name = $ob->name; 920 my $name = $ob->name;
887 921
888 return if $pl->invoke (cf::EVENT_PLAYER_TELL, $target, $msg); 922 return if $pl->invoke (cf::EVENT_PLAYER_TELL, $target, $msg);
889 923
890 my $pl_channel = { 924 my $pl_channel = tell_channel $target;
891 id => "tell-$target",
892 title => "$target",
893 reply => "tell $target ",
894 tooltip => "Private messages from/to $target",
895 };
896 925
897 if ($target =~ /irc\//) { 926 if ($target =~ /irc\//) {
898 my (undef, $nick) = split /\//, $target, 2; 927 my (undef, $nick) = split /\//, $target, 2;
899 $ns->send_msg ($pl_channel => "You tell $target: $args", reply => 1); 928 $ns->send_msg ($pl_channel => "You tell $target: $args", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);
900 send_irc ("(%s) %s: %s\n", $name, $nick, $msg); 929 send_irc ("(%s) %s: %s\n", $name, $nick, $msg);
930
901 } elsif (my $other = cf::player::find_active $target) { 931 } elsif (my $other = cf::player::find_active $target) {
902 my $other_channel = { 932 my $other_channel = tell_channel $name;
903 id => "tell-$name",
904 title => "$name",
905 reply => "tell $name ",
906 tooltip => "Private messages from/to $name",
907 };
908 933
909 if ($msg) { 934 if ($msg) {
910 if ($target eq $name) { 935 if ($target eq $name) {
911 $ns->send_msg ($pl_channel => "You are talking to yourself, you freak!", reply => 1); 936 $ns->send_msg ($pl_channel => "You are talking to yourself, you freak!", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);
912 } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { 937 } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) {
913 $ns->send_msg ($pl_channel => "$target ignores what you say. Give up on it.", reply => 1); 938 $ns->send_msg ($pl_channel => "$target ignores what you say. Give up on it.", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);
914 } else { 939 } else {
915 return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl->contr, $msg); 940 return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg);
916 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; 941 cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg;
917 942
918 $ns->send_msg ($pl_channel => "You tell $target: $msg", reply => 1); 943 $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);
919 $other->ns->send_msg ($other_channel => "$name tells you: $msg"); 944 send_msg $other, $other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF, "msg_tell";
920 } 945 }
921 } else { 946 } else {
922 $ns->send_msg ($pl_channel => "What do you want to tell $target?"); 947 $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);
923 } 948 }
924 949
925 } else { 950 } else {
926 $ns->send_msg ($pl_channel => "No such player. Your message: $msg"); 951 $ns->send_msg ($pl_channel => "No such player. Your message: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY);
927 } 952 }
928}; 953};
929 954
930cf::register_command ignore => sub { 955cf::register_command ignore => sub {
931 my ($pl, $args) = @_; 956 my ($pl, $args) = @_;
932 my ($target, $type, $timeout) = split /\s+/, $args; 957 my ($target, $type, $timeout) = split /\s+/, $args;
933 958
959 cf::async {
934 if ($args eq "list") { 960 if ($args eq "list") {
935 clean_timeouts $pl; 961 clean_timeouts $pl;
936 962
937 if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) 963 if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}})
938 + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { 964 + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) {
939 $pl->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); 965 $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY);
940 $pl->message ((join ", ", @ignored_tell), cf::NDI_UNIQUE); 966 $pl->message ((join ", ", @ignored_tell), cf::NDI_REPLY);
941 $pl->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); 967 $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY);
942 $pl->message ((join ", ", @ignored_shout), cf::NDI_UNIQUE); 968 $pl->message ((join ", ", @ignored_shout), cf::NDI_REPLY);
943 $pl->message ("To stop ignoring one, use unignore.", cf::NDI_UNIQUE); 969 $pl->message ("To stop ignoring one, use unignore.", cf::NDI_REPLY);
970 } else {
971 $pl->message ("Not ignoring anyone", cf::NDI_REPLY);
972 }
973
974 } elsif ($target && $type) {
975 $timeout ne "" or $timeout = 24;
976 my $absolute_timeout = time + $timeout * 3600;
977
978 if (cf::player::exists $target) {
979 if ($type eq "tell") {
980 $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_REPLY);
981 $pl->{ext_ignore_tell}{$target} = $absolute_timeout;
982 } elsif ($type eq "shout") {
983 $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_REPLY);
984 $pl->{ext_ignore_shout}{$target} = $absolute_timeout;
985 } elsif ($type eq "all") {
986 $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_REPLY);
987 $pl->{ext_ignore_tell}{$target} = $absolute_timeout;
988 $pl->{ext_ignore_shout}{$target} = $absolute_timeout;
989 } else {
990 $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY);
991 }
992 } else {
993 $pl->message ("No such player: $target", cf::NDI_REPLY);
994 }
995
944 } else { 996 } else {
945 $pl->message ("Not ignoring anyone", cf::NDI_UNIQUE); 997 $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n"
998 . "will ignore a player for <timeout> hours.\n"
999 . "Usage: ignore list\n"
1000 . "will show you a list of players currently ignored.", cf::NDI_REPLY);
946 } 1001 }
947
948 } elsif ($target && $type) {
949
950 $timeout ne "" or $timeout = 24;
951 my $absolute_timeout = time + $timeout * 3600;
952
953 if (cf::player::exists $target) {
954 if ($type eq "tell") {
955 $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_UNIQUE);
956 $pl->{ext_ignore_tell}{$target} = $absolute_timeout;
957 } elsif ($type eq "shout") {
958 $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_UNIQUE);
959 $pl->{ext_ignore_shout}{$target} = $absolute_timeout;
960 } elsif ($type eq "all") {
961 $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_UNIQUE);
962 $pl->{ext_ignore_tell}{$target} = $absolute_timeout;
963 $pl->{ext_ignore_shout}{$target} = $absolute_timeout;
964 } else {
965 $pl->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE);
966 }
967 } else {
968 $pl->message ("No such player: $target", cf::NDI_UNIQUE);
969 }
970
971 } else {
972 $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n"
973 . "will ignore a player for <timeout> hours.\n"
974 . "Usage: ignore list\n"
975 . "will show you a list of players currently ignored.", cf::NDI_UNIQUE);
976 } 1002 };
977}; 1003};
978 1004
979cf::register_command unignore => sub { 1005cf::register_command unignore => sub {
980 my ($pl, $args) = @_; 1006 my ($pl, $args) = @_;
981 my ($target, $type) = split /\s+/, $args; 1007 my ($target, $type) = split /\s+/, $args;
982 1008
1009 cf::async {
983 if ($args eq "") { 1010 if ($args eq "") {
984 if ($pl->{ext_ignore_tell}) { 1011 if ($pl->{ext_ignore_tell}) {
985 $pl->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); 1012 $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY);
986 $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_UNIQUE); 1013 $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_REPLY);
987 $pl->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); 1014 $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY);
988 $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_UNIQUE); 1015 $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_REPLY);
989 } else {
990 $pl->message ("Not ignoring anyone", cf::NDI_UNIQUE);
991 }
992 } else {
993 if (cf::player::exists $target) {
994 if ($type eq "tell") {
995 $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_UNIQUE);
996 delete $pl->{ext_ignore_tell} {$target};
997 } elsif ($type eq "shout") {
998 $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_UNIQUE);
999 delete $pl->{ext_ignore_shout}{$target};
1000 } elsif ($type eq "all") {
1001 $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_UNIQUE);
1002 delete $pl->{ext_ignore_tell} {$target};
1003 delete $pl->{ext_ignore_shout}{$target};
1004 } else { 1016 } else {
1005 $pl->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); 1017 $pl->message ("Not ignoring anyone", cf::NDI_REPLY);
1006 } 1018 }
1007 } else { 1019 } else {
1020 if (cf::player::exists $target) {
1021 if ($type eq "tell") {
1022 $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_REPLY);
1023 delete $pl->{ext_ignore_tell} {$target};
1024 } elsif ($type eq "shout") {
1025 $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_REPLY);
1026 delete $pl->{ext_ignore_shout}{$target};
1027 } elsif ($type eq "all") {
1028 $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_REPLY);
1029 delete $pl->{ext_ignore_tell} {$target};
1030 delete $pl->{ext_ignore_shout}{$target};
1031 } else {
1032 $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY);
1033 }
1034 } else {
1008 $pl->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); 1035 $pl->message ("No such player or ambiguous name: $target", cf::NDI_REPLY);
1036 }
1009 } 1037 }
1010 } 1038 };
1011}; 1039};
1012 1040

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines