… | |
… | |
54 | cf::player->attach ( |
54 | cf::player->attach ( |
55 | prio => -1000, |
55 | prio => -1000, |
56 | on_login => sub { |
56 | on_login => sub { |
57 | my ($pl) = @_; |
57 | my ($pl) = @_; |
58 | |
58 | |
|
|
59 | cf::async { |
59 | clean_timeouts $pl->ob; |
60 | clean_timeouts $pl->ob; |
|
|
61 | }; |
60 | |
62 | |
61 | $pl->send_msg ($cf::SAY_CHANNEL); |
63 | $pl->send_msg ($cf::SAY_CHANNEL); |
62 | $pl->send_msg ($cf::CHAT_CHANNEL); |
64 | $pl->send_msg ($cf::CHAT_CHANNEL); |
63 | }, |
65 | }, |
64 | ); |
66 | ); |
65 | |
67 | |
|
|
68 | # TODO: remove once safe |
66 | cf::register_command listen => sub { |
69 | cf::register_command listen => sub { |
67 | my ($pl, $msg) = @_; |
|
|
68 | my $player = cf::player::find_active $pl->name; |
|
|
69 | |
|
|
70 | if ($msg ne "") { |
|
|
71 | $msg = 10 if $msg > 10; |
|
|
72 | |
|
|
73 | my $prev_listen = $player->listening; |
|
|
74 | $player->listening ($msg); |
|
|
75 | if ($prev_listen == $player->listening) { |
|
|
76 | $pl->message ("Your verbose level stays at $prev_listen.", cf::NDI_REPLY); |
|
|
77 | } else { |
|
|
78 | $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_REPLY); |
|
|
79 | } |
|
|
80 | } else { |
|
|
81 | $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_REPLY); |
|
|
82 | } |
|
|
83 | }; |
70 | }; |
84 | |
71 | |
85 | cf::register_command cointoss => sub { |
72 | cf::register_command cointoss => sub { |
86 | my ($ob, $msg) = @_; |
73 | my ($ob, $msg) = @_; |
87 | |
74 | |
… | |
… | |
163 | self => { |
150 | self => { |
164 | }, |
151 | }, |
165 | }, |
152 | }, |
166 | scream => { |
153 | scream => { |
167 | noparams => { |
154 | noparams => { |
168 | other => "<self> screams at the top of his lungs!", |
155 | other => "<self> screams at the top of G<his|her> lungs!", |
169 | self => "ARRRRRRRRRRGH!!!!!", |
156 | self => "ARRRRRRRRRRGH!!!!!", |
170 | }, |
157 | }, |
171 | params => { |
158 | params => { |
172 | }, |
159 | }, |
173 | self => { |
160 | self => { |
… | |
… | |
182 | target => "<self> pukes on your clothes!", |
169 | target => "<self> pukes on your clothes!", |
183 | other => "<self> pukes on <other>.", |
170 | other => "<self> pukes on <other>.", |
184 | self => "You puke on <other>.", |
171 | self => "You puke on <other>.", |
185 | }, |
172 | }, |
186 | self => { |
173 | self => { |
187 | other => "<self> pukes on his clothes.", |
174 | other => "<self> pukes on G<his|her> clothes.", |
188 | self => "You puke on yourself.", |
175 | self => "You puke on yourself.", |
189 | }, |
176 | }, |
190 | }, |
177 | }, |
191 | strut => { |
178 | strut => { |
192 | noparams => { |
179 | noparams => { |
… | |
… | |
265 | target => "<self> winks at you.", |
252 | target => "<self> winks at you.", |
266 | other => "<self> winks at <other>.", |
253 | other => "<self> winks at <other>.", |
267 | self => "You wink suggestively at <other>.", |
254 | self => "You wink suggestively at <other>.", |
268 | }, |
255 | }, |
269 | self => { |
256 | self => { |
270 | other => "<self> winks at himself - something strange is going on...", |
257 | other => "<self> winks at G<him|her>self - something strange is going on...", |
271 | self => "You wink at yourself?? What are you up to?", |
258 | self => "You wink at yourself?? What are you up to?", |
272 | }, |
259 | }, |
273 | }, |
260 | }, |
274 | pout => { |
261 | pout => { |
275 | noparams => { |
262 | noparams => { |
… | |
… | |
281 | self => { |
268 | self => { |
282 | }, |
269 | }, |
283 | }, |
270 | }, |
284 | cackle => { |
271 | cackle => { |
285 | noparams => { |
272 | noparams => { |
286 | other => "<self> throws back his head and cackles with insane glee!", |
273 | other => "<self> throws back G<his|her> head and cackles with insane glee!", |
287 | self => "You cackle gleefully.", |
274 | self => "You cackle gleefully.", |
288 | }, |
275 | }, |
289 | params => { |
276 | params => { |
290 | }, |
277 | }, |
291 | self => { |
278 | self => { |
… | |
… | |
300 | target => "<self> sniffs you.", |
287 | target => "<self> sniffs you.", |
301 | other => "<self> sniffs <other>", |
288 | other => "<self> sniffs <other>", |
302 | self => "You sniff <other>.", |
289 | self => "You sniff <other>.", |
303 | }, |
290 | }, |
304 | self => { |
291 | self => { |
305 | other => "<self> sniffs himself.", |
292 | other => "<self> sniffs G<him|her>self.", |
306 | self => "You sniff yourself.", |
293 | self => "You sniff yourself.", |
307 | }, |
294 | }, |
308 | }, |
295 | }, |
309 | nod => { |
296 | nod => { |
310 | noparams => { |
297 | noparams => { |
311 | other => "<self> nods solemnly.", |
298 | other => "<self> nods solemnly.", |
312 | self => "You nod solemnly.", |
299 | self => "You nod solemnly.", |
313 | }, |
300 | }, |
314 | params => { |
301 | params => { |
315 | target => "<self> nods solemnly to you.", |
302 | target => "<self> nods solemnly at you.", |
316 | other => "<self> nods solemnly to <other>.", |
303 | other => "<self> nods solemnly at <other>.", |
317 | self => "You nod solemnly to <other>.", |
304 | self => "You nod solemnly at <other>.", |
318 | }, |
305 | }, |
319 | self => { |
306 | self => { |
320 | }, |
307 | }, |
321 | }, |
308 | }, |
322 | frown => { |
309 | frown => { |
… | |
… | |
328 | target => "<self> frowns darkly at you.", |
315 | target => "<self> frowns darkly at you.", |
329 | other => "<self> frowns darkly at <other>.", |
316 | other => "<self> frowns darkly at <other>.", |
330 | self => "You frown darkly at <other>.", |
317 | self => "You frown darkly at <other>.", |
331 | }, |
318 | }, |
332 | self => { |
319 | self => { |
333 | other => "<self> frowns at himself.", |
320 | other => "<self> frowns at G<him|her>self.", |
334 | self => "You frown at yourself.", |
321 | self => "You frown at yourself.", |
335 | }, |
322 | }, |
336 | }, |
323 | }, |
337 | snicker => { |
324 | snicker => { |
338 | noparams => { |
325 | noparams => { |
… | |
… | |
361 | noparams => { |
348 | noparams => { |
362 | other => "<self> is bleeding all over the carpet - got a spare tourniquet?", |
349 | other => "<self> is bleeding all over the carpet - got a spare tourniquet?", |
363 | self => "You bleed all over your nice new armour.", |
350 | self => "You bleed all over your nice new armour.", |
364 | }, |
351 | }, |
365 | params => { |
352 | params => { |
366 | target => "<self> slashes his wrist and bleeds all over you.", |
353 | target => "<self> slashes G<his|her> wrist and bleeds all over you.", |
367 | other => "<self> slashes his wrist and bleeds all over <other>.", |
354 | other => "<self> slashes G<his|her> wrist and bleeds all over <other>.", |
368 | self => "You slash your wrist and bleed all over <other>", |
355 | self => "You slash your wrist and bleed all over <other>", |
369 | }, |
356 | }, |
370 | self => { |
357 | self => { |
371 | other => "<self> performs some satanic ritual while wiping his blood on himself.", |
358 | other => "<self> performs some satanic ritual while wiping G<his|her> blood on G<him|her>self.", |
372 | self => "Very impressive! You wipe your blood all over yourself.", |
359 | self => "Very impressive! You wipe your blood all over yourself.", |
373 | }, |
360 | }, |
374 | }, |
361 | }, |
375 | twiddle => { |
362 | twiddle => { |
376 | noparams => { |
363 | noparams => { |
377 | other => "<self> patiently twiddles his thumbs.", |
364 | other => "<self> patiently twiddles G<his|her> thumbs.", |
378 | self => "You patiently twiddle your thumbs.", |
365 | self => "You patiently twiddle your thumbs.", |
379 | }, |
366 | }, |
380 | params => { |
367 | params => { |
381 | }, |
368 | }, |
382 | self => { |
369 | self => { |
383 | }, |
370 | }, |
384 | }, |
371 | }, |
385 | spit => { |
372 | spit => { |
386 | noparams => { |
373 | noparams => { |
387 | other => "<self> spits over his left shoulder.", |
374 | other => "<self> spits over G<his|her> left shoulder.", |
388 | self => "You spit over your left shoulder.", |
375 | self => "You spit over your left shoulder.", |
389 | }, |
376 | }, |
390 | params => { |
377 | params => { |
391 | target => "<self> spits in your face!", |
378 | target => "<self> spits in your face!", |
392 | other => "<self> spits in <other>'s face.", |
379 | other => "<self> spits in <other>'s face.", |
393 | self => "You spit on <other>.", |
380 | self => "You spit on <other>.", |
394 | }, |
381 | }, |
395 | self => { |
382 | self => { |
396 | other => "<self> drools all over himself.", |
383 | other => "<self> drools all over G<him|her>self.", |
397 | self => "You drool all over yourself.", |
384 | self => "You drool all over yourself.", |
398 | }, |
385 | }, |
399 | }, |
386 | }, |
400 | glare => { |
387 | glare => { |
401 | noparams => { |
388 | noparams => { |
402 | other => "<self> glares around him.", |
389 | other => "<self> glares around G<him|her>.", |
403 | self => "You glare at nothing in particular.", |
390 | self => "You glare at nothing in particular.", |
404 | }, |
391 | }, |
405 | params => { |
392 | params => { |
406 | target => "<self> glares icily at you, you feel cold to your bones.", |
393 | target => "<self> glares icily at you, you feel cold to your bones.", |
407 | other => "<self> glares at <other>.", |
394 | other => "<self> glares at <other>.", |
408 | self => "You glare icily at <other>.", |
395 | self => "You glare icily at <other>.", |
409 | }, |
396 | }, |
410 | self => { |
397 | self => { |
411 | other => "<self> glares at his feet, what is bothering him?", |
398 | other => "<self> glares at G<his|her> feet, what is bothering G<him|her>?", |
412 | self => "You glare icily at your feet, they are suddenly very cold.", |
399 | self => "You glare icily at your feet, they are suddenly very cold.", |
413 | }, |
400 | }, |
414 | }, |
401 | }, |
415 | bow => { |
402 | bow => { |
416 | noparams => { |
403 | noparams => { |
… | |
… | |
421 | target => "<self> bows before you.", |
408 | target => "<self> bows before you.", |
422 | other => "<self> bows before <other>.", |
409 | other => "<self> bows before <other>.", |
423 | self => "You bow before <other>.", |
410 | self => "You bow before <other>.", |
424 | }, |
411 | }, |
425 | self => { |
412 | self => { |
426 | other => "<self> folds up like a jackknife and kisses his own toes.", |
413 | other => "<self> folds up like a jackknife and kisses G<his|her> own toes.", |
427 | self => "You kiss your toes.", |
414 | self => "You kiss your toes.", |
428 | }, |
415 | }, |
429 | }, |
416 | }, |
430 | dance => { |
417 | dance => { |
431 | noparams => { |
418 | noparams => { |
432 | other => "<self> expresses himself through interpretive dance.", |
419 | other => "<self> expresses G<him|her>self through interpretive dance.", |
433 | self => "You dance with glee.", |
420 | self => "You dance with glee.", |
434 | }, |
421 | }, |
435 | params => { |
422 | params => { |
436 | target => "<self> grabs you, and begins dancing!", |
423 | target => "<self> grabs you, and begins dancing!", |
437 | other => "Yipe! <self> and <other> are doing the Macarena!", |
424 | other => "Yipe! <self> and <other> are doing the Macarena!", |
438 | self => "You grab <other> and begin doing the Cha-Cha!", |
425 | self => "You grab <other> and begin doing the Cha-Cha!", |
439 | }, |
426 | }, |
440 | self => { |
427 | self => { |
441 | other => "<self> embraces himself and begins to dance!", |
428 | other => "<self> embraces G<him|her>self and begins to dance!", |
442 | self => "You skip and dance around by yourself.", |
429 | self => "You skip and dance around by yourself.", |
443 | }, |
430 | }, |
444 | }, |
431 | }, |
445 | snore => { |
432 | snore => { |
446 | noparams => { |
433 | noparams => { |
… | |
… | |
462 | self => { |
449 | self => { |
463 | }, |
450 | }, |
464 | }, |
451 | }, |
465 | snap => { |
452 | snap => { |
466 | noparams => { |
453 | noparams => { |
467 | other => "<self> snaps his fingers.", |
454 | other => "<self> snaps G<his|her> fingers.", |
468 | self => "PRONTO! you snap your fingers.", |
455 | self => "PRONTO! you snap your fingers.", |
469 | }, |
456 | }, |
470 | params => { |
457 | params => { |
471 | }, |
458 | }, |
472 | self => { |
459 | self => { |
… | |
… | |
481 | target => "<self> waves goodbye to you. Have a good journey.", |
468 | target => "<self> waves goodbye to you. Have a good journey.", |
482 | other => "<self> waves goodbye to <other>.", |
469 | other => "<self> waves goodbye to <other>.", |
483 | self => "You wave goodbye to <other>.", |
470 | self => "You wave goodbye to <other>.", |
484 | }, |
471 | }, |
485 | self => { |
472 | self => { |
486 | other => "<self> waves goodbye to himself.", |
473 | other => "<self> waves goodbye to G<him|her>self.", |
487 | self => "Are you going on adventures as well??", |
474 | self => "Are you going on adventures as well??", |
488 | }, |
475 | }, |
489 | }, |
476 | }, |
490 | smile => { |
477 | smile => { |
491 | noparams => { |
478 | noparams => { |
… | |
… | |
505 | other => "<self> sneezes.", |
492 | other => "<self> sneezes.", |
506 | self => "Gesundheit!", |
493 | self => "Gesundheit!", |
507 | }, |
494 | }, |
508 | params => { |
495 | params => { |
509 | target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.", |
496 | target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.", |
510 | other => "<self> sneezes on <other> and a film of snot covers him.", |
497 | other => "<self> sneezes on <other> and a film of snot covers G<him|her>.", |
511 | self => "You sneeze at <other> and a film of snot shoots onto him.", |
498 | self => "You sneeze at <other> and a film of snot shoots onto G<him|her>.", |
512 | }, |
499 | }, |
513 | self => { |
500 | self => { |
514 | other => "<self> sneezes, and covers himself in a slimy substance.", |
501 | other => "<self> sneezes, and covers G<him|her>self in a slimy substance.", |
515 | self => "You sneeze on yourself, what a mess!", |
502 | self => "You sneeze on yourself, what a mess!", |
516 | }, |
503 | }, |
517 | }, |
504 | }, |
518 | bounce => { |
505 | bounce => { |
519 | noparams => { |
506 | noparams => { |
… | |
… | |
528 | self => { |
515 | self => { |
529 | }, |
516 | }, |
530 | }, |
517 | }, |
531 | shake => { |
518 | shake => { |
532 | noparams => { |
519 | noparams => { |
533 | other => "<self> shakes his head.", |
520 | other => "<self> shakes G<his|her> head.", |
534 | self => "You shake your head.", |
521 | self => "You shake your head.", |
535 | }, |
522 | }, |
536 | params => { |
523 | params => { |
537 | target => "<self> shakes your hand.", |
524 | target => "<self> shakes your hand.", |
538 | other => "<self> shakes <other>'s hand.", |
525 | other => "<self> shakes <other>'s hand.", |
… | |
… | |
543 | self => "You are shaken by yourself.", |
530 | self => "You are shaken by yourself.", |
544 | }, |
531 | }, |
545 | }, |
532 | }, |
546 | lick => { |
533 | lick => { |
547 | noparams => { |
534 | noparams => { |
548 | other => "<self> licks his mouth and smiles.", |
535 | other => "<self> licks G<his|her> mouth and smiles.", |
549 | self => "You lick your mouth and smile.", |
536 | self => "You lick your mouth and smile.", |
550 | }, |
537 | }, |
551 | params => { |
538 | params => { |
552 | target => "<self> licks you.", |
539 | target => "<self> licks you.", |
553 | other => "<self> licks <other>.", |
540 | other => "<self> licks <other>.", |
554 | self => "You lick <other>.", |
541 | self => "You lick <other>.", |
555 | }, |
542 | }, |
556 | self => { |
543 | self => { |
557 | other => "<self> licks himself - YUCK.", |
544 | other => "<self> licks G<him|her>self - YUCK.", |
558 | self => "You lick yourself.", |
545 | self => "You lick yourself.", |
559 | }, |
546 | }, |
560 | }, |
547 | }, |
561 | flip => { |
548 | flip => { |
562 | noparams => { |
549 | noparams => { |
… | |
… | |
568 | self => { |
555 | self => { |
569 | }, |
556 | }, |
570 | }, |
557 | }, |
571 | think => { |
558 | think => { |
572 | noparams => { |
559 | noparams => { |
573 | other => "<self> closes his eyes and thinks really hard.", |
560 | other => "<self> closes G<his|her> eyes and thinks really hard.", |
574 | self => "Anything in particular that you'd care to think about?", |
561 | self => "Anything in particular that you'd care to think about?", |
575 | }, |
562 | }, |
576 | params => { |
563 | params => { |
577 | }, |
564 | }, |
578 | self => { |
565 | self => { |
… | |
… | |
642 | target => "<self> cries on your shoulder.", |
629 | target => "<self> cries on your shoulder.", |
643 | other => "<self> cries on <other>'s shoulder.", |
630 | other => "<self> cries on <other>'s shoulder.", |
644 | self => "You cry on <other>'s shoulder.", |
631 | self => "You cry on <other>'s shoulder.", |
645 | }, |
632 | }, |
646 | self => { |
633 | self => { |
647 | other => "<self> sobs quietly to himself.", |
634 | other => "<self> sobs quietly to G<him|her>self.", |
648 | self => "You cry to yourself.", |
635 | self => "You cry to yourself.", |
649 | }, |
636 | }, |
650 | }, |
637 | }, |
651 | sulk => { |
638 | sulk => { |
652 | noparams => { |
639 | noparams => { |
… | |
… | |
666 | params => { |
653 | params => { |
667 | target => "<self> whistles at <other>.", |
654 | target => "<self> whistles at <other>.", |
668 | self => "You whistle at <other>.", |
655 | self => "You whistle at <other>.", |
669 | }, |
656 | }, |
670 | self => { |
657 | self => { |
671 | other => "<self> whistles to himself in boredom.", |
658 | other => "<self> whistles to G<him|her>self in boredom.", |
672 | self => "You whistle while you work.", |
659 | self => "You whistle while you work.", |
673 | }, |
660 | }, |
674 | }, |
661 | }, |
675 | groan => { |
662 | groan => { |
676 | noparams => { |
663 | noparams => { |
… | |
… | |
722 | |
709 | |
723 | $emote{other} ||= "You look away from <self>."; |
710 | $emote{other} ||= "You look away from <self>."; |
724 | $emote{self} ||= "My god! Is that LEGAL?"; |
711 | $emote{self} ||= "My god! Is that LEGAL?"; |
725 | |
712 | |
726 | $emote{other} =~ s/<self>/$name/; |
713 | $emote{other} =~ s/<self>/$name/; |
|
|
714 | |
|
|
715 | $_ = $pl->expand_cfpod ($_) |
|
|
716 | for values %emote; |
727 | |
717 | |
728 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
718 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
729 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
719 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
730 | |
720 | |
731 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
721 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
732 | } elsif ($tname) { |
722 | } elsif ($tname) { |
733 | my $target = cf::player::find $tname |
723 | my $target = cf::player::find $tname |
734 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
724 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
735 | |
725 | |
736 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
726 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
… | |
… | |
742 | $emote{self} =~ s/<other>/$tname/; |
732 | $emote{self} =~ s/<other>/$tname/; |
743 | $emote{target} =~ s/<self>/$name/; |
733 | $emote{target} =~ s/<self>/$name/; |
744 | $emote{other} =~ s/<other>/$tname/; |
734 | $emote{other} =~ s/<other>/$tname/; |
745 | $emote{other} =~ s/<self>/$name/; |
735 | $emote{other} =~ s/<self>/$name/; |
746 | |
736 | |
|
|
737 | $_ = $pl->expand_cfpod ($_) |
|
|
738 | for values %emote; |
|
|
739 | |
747 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
740 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
748 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
741 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
749 | |
742 | |
750 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY, "msg_shout"; |
743 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_shout"; |
751 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
744 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
752 | } else { |
745 | } else { |
753 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
746 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
754 | |
747 | |
755 | $emote{other} ||= "<self> dances with glee."; |
748 | $emote{other} ||= "<self> dances with glee."; |
756 | $emote{self} ||= "You are a nut."; |
749 | $emote{self} ||= "You are a nut."; |
757 | |
750 | |
758 | $emote{other} =~ s/<self>/$name/; |
751 | $emote{other} =~ s/<self>/$name/; |
759 | |
752 | |
|
|
753 | $_ = $pl->expand_cfpod ($_) |
|
|
754 | for values %emote; |
|
|
755 | |
760 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
756 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
761 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
757 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
762 | |
758 | |
763 | $pl->send_msg ($cf::CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
759 | $pl->send_msg ($cf::CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
764 | } |
760 | } |
765 | }; |
761 | }; |
766 | }; |
762 | }; |
767 | } |
763 | } |
768 | |
764 | |
… | |
… | |
850 | |
846 | |
851 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
847 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
852 | send_irc ("[%s] %s", $name, $msg); |
848 | send_irc ("[%s] %s", $name, $msg); |
853 | |
849 | |
854 | send_msg $_, $cf::CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" |
850 | send_msg $_, $cf::CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" |
855 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
851 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
856 | |
852 | |
857 | } else { |
853 | } else { |
858 | $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
854 | $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
859 | } |
855 | } |
860 | }; |
856 | }; |
… | |
… | |
874 | |
870 | |
875 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
871 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
876 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
872 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
877 | |
873 | |
878 | send_msg $_, $cf::CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout" |
874 | send_msg $_, $cf::CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout" |
879 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
875 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
880 | |
876 | |
881 | } else { |
877 | } else { |
882 | $pl->send_msg ($cf::CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
878 | $pl->send_msg ($cf::CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
883 | } |
879 | } |
884 | }; |
880 | }; |
… | |
… | |
929 | |
925 | |
930 | cf::register_command ignore => sub { |
926 | cf::register_command ignore => sub { |
931 | my ($pl, $args) = @_; |
927 | my ($pl, $args) = @_; |
932 | my ($target, $type, $timeout) = split /\s+/, $args; |
928 | my ($target, $type, $timeout) = split /\s+/, $args; |
933 | |
929 | |
|
|
930 | cf::async { |
934 | if ($args eq "list") { |
931 | if ($args eq "list") { |
935 | clean_timeouts $pl; |
932 | clean_timeouts $pl; |
936 | |
933 | |
937 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
934 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
938 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
935 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
939 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
936 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
940 | $pl->message ((join ", ", @ignored_tell), cf::NDI_REPLY); |
937 | $pl->message ((join ", ", @ignored_tell), cf::NDI_REPLY); |
941 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
938 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
942 | $pl->message ((join ", ", @ignored_shout), cf::NDI_REPLY); |
939 | $pl->message ((join ", ", @ignored_shout), cf::NDI_REPLY); |
943 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_REPLY); |
940 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_REPLY); |
|
|
941 | } else { |
|
|
942 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
|
|
943 | } |
|
|
944 | |
|
|
945 | } elsif ($target && $type) { |
|
|
946 | $timeout ne "" or $timeout = 24; |
|
|
947 | my $absolute_timeout = time + $timeout * 3600; |
|
|
948 | |
|
|
949 | if (cf::player::exists $target) { |
|
|
950 | if ($type eq "tell") { |
|
|
951 | $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
952 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
|
|
953 | } elsif ($type eq "shout") { |
|
|
954 | $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
955 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
|
|
956 | } elsif ($type eq "all") { |
|
|
957 | $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
958 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
|
|
959 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
|
|
960 | } else { |
|
|
961 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
|
|
962 | } |
|
|
963 | } else { |
|
|
964 | $pl->message ("No such player: $target", cf::NDI_REPLY); |
|
|
965 | } |
|
|
966 | |
944 | } else { |
967 | } else { |
945 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
968 | $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
|
|
969 | . "will ignore a player for <timeout> hours.\n" |
|
|
970 | . "Usage: ignore list\n" |
|
|
971 | . "will show you a list of players currently ignored.", cf::NDI_REPLY); |
946 | } |
972 | } |
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_REPLY); |
|
|
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_REPLY); |
|
|
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_REPLY); |
|
|
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_REPLY); |
|
|
966 | } |
|
|
967 | } else { |
|
|
968 | $pl->message ("No such player: $target", cf::NDI_REPLY); |
|
|
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_REPLY); |
|
|
976 | } |
973 | }; |
977 | }; |
974 | }; |
978 | |
975 | |
979 | cf::register_command unignore => sub { |
976 | cf::register_command unignore => sub { |
980 | my ($pl, $args) = @_; |
977 | my ($pl, $args) = @_; |
981 | my ($target, $type) = split /\s+/, $args; |
978 | my ($target, $type) = split /\s+/, $args; |
982 | |
979 | |
|
|
980 | cf::async { |
983 | if ($args eq "") { |
981 | if ($args eq "") { |
984 | if ($pl->{ext_ignore_tell}) { |
982 | if ($pl->{ext_ignore_tell}) { |
985 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
983 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
986 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_REPLY); |
984 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_REPLY); |
987 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
985 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
988 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_REPLY); |
986 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_REPLY); |
989 | } else { |
|
|
990 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
|
|
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_REPLY); |
|
|
996 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
997 | } elsif ($type eq "shout") { |
|
|
998 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_REPLY); |
|
|
999 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
1000 | } elsif ($type eq "all") { |
|
|
1001 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_REPLY); |
|
|
1002 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
1003 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
1004 | } else { |
987 | } else { |
1005 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
988 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
1006 | } |
989 | } |
1007 | } else { |
990 | } else { |
|
|
991 | if (cf::player::exists $target) { |
|
|
992 | if ($type eq "tell") { |
|
|
993 | $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_REPLY); |
|
|
994 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
995 | } elsif ($type eq "shout") { |
|
|
996 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_REPLY); |
|
|
997 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
998 | } elsif ($type eq "all") { |
|
|
999 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_REPLY); |
|
|
1000 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
1001 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
1002 | } else { |
|
|
1003 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
|
|
1004 | } |
|
|
1005 | } else { |
1008 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_REPLY); |
1006 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_REPLY); |
|
|
1007 | } |
1009 | } |
1008 | } |
1010 | } |
1009 | }; |
1011 | }; |
1010 | }; |
1012 | |
1011 | |