1 | #! perl # depends=irc mandatory |
1 | #! perl # depends=irc mandatory |
2 | |
2 | |
3 | # 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 |
4 | # adds ignore/unignore functionality |
4 | # adds ignore/unignore functionality |
5 | |
5 | |
6 | use NPC_Dialogue; |
6 | use NPC_Dialogue; |
7 | use POSIX (); # for strftime only |
7 | use POSIX (); # for strftime only |
8 | |
|
|
9 | our $SAY_CHANNEL = { |
|
|
10 | id => "say", |
|
|
11 | title => "Map", |
|
|
12 | reply => "say ", |
|
|
13 | tooltip => "Things said to and replied from npcs near you and other players on the same map only.", |
|
|
14 | }; |
|
|
15 | |
|
|
16 | our $CHAT_CHANNEL = { |
|
|
17 | id => "chat", |
|
|
18 | title => "Chat", |
|
|
19 | reply => "chat ", |
|
|
20 | tooltip => "Player chat and shouts, global to the server.", |
|
|
21 | }; |
|
|
22 | |
8 | |
23 | sub tell_channel($) { |
9 | sub tell_channel($) { |
24 | my ($target) = @_; |
10 | my ($target) = @_; |
25 | |
11 | |
26 | { |
12 | { |
27 | id => "tell-$target", |
13 | id => "tell-$target", |
28 | title => "$target", |
14 | title => "$target", |
29 | reply => "tell $target ", |
15 | reply => "tell $target ", |
30 | tooltip => "Private messages from/to $target", |
16 | tooltip => "Private messages from/to $target", |
31 | } |
17 | } |
|
|
18 | } |
|
|
19 | |
|
|
20 | sub 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 | () |
32 | } |
25 | } |
33 | |
26 | |
34 | sub clean_timeouts($) { |
27 | sub clean_timeouts($) { |
35 | my ($player) = @_; |
28 | my ($player) = @_; |
36 | my $NOW = time; |
29 | my $NOW = time; |
… | |
… | |
61 | cf::player->attach ( |
54 | cf::player->attach ( |
62 | prio => -1000, |
55 | prio => -1000, |
63 | on_login => sub { |
56 | on_login => sub { |
64 | my ($pl) = @_; |
57 | my ($pl) = @_; |
65 | |
58 | |
|
|
59 | cf::async { |
66 | clean_timeouts $pl->ob; |
60 | clean_timeouts $pl->ob; |
|
|
61 | }; |
|
|
62 | |
67 | $pl->send_msg ($SAY_CHANNEL); |
63 | $pl->send_msg ($cf::SAY_CHANNEL); |
68 | $pl->send_msg ($CHAT_CHANNEL); |
64 | $pl->send_msg ($cf::CHAT_CHANNEL); |
69 | }, |
65 | }, |
70 | ); |
66 | ); |
71 | |
67 | |
|
|
68 | # TODO: remove once safe |
72 | cf::register_command listen => sub { |
69 | cf::register_command listen => sub { |
73 | my ($pl, $msg) = @_; |
|
|
74 | my $player = cf::player::find_active $pl->name; |
|
|
75 | |
|
|
76 | if ($msg ne "") { |
|
|
77 | $msg = 10 if $msg > 10; |
|
|
78 | |
|
|
79 | my $prev_listen = $player->listening; |
|
|
80 | $player->listening ($msg); |
|
|
81 | if ($prev_listen == $player->listening) { |
|
|
82 | $pl->message ("Your verbose level stays at $prev_listen.", cf::NDI_REPLY); |
|
|
83 | } else { |
|
|
84 | $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_REPLY); |
|
|
85 | } |
|
|
86 | } else { |
|
|
87 | $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_REPLY); |
|
|
88 | } |
|
|
89 | }; |
70 | }; |
90 | |
71 | |
91 | cf::register_command cointoss => sub { |
72 | cf::register_command cointoss => sub { |
92 | my ($ob, $msg) = @_; |
73 | my ($ob, $msg) = @_; |
93 | |
74 | |
94 | my $pl = $ob->contr; |
75 | my $pl = $ob->contr; |
95 | my $name = $ob->name; |
76 | my $name = $ob->name; |
96 | |
77 | |
97 | my $coin = int rand 2 ? "Heads" : "Tails"; |
78 | my $coin = int rand 2 ? "Heads" : "Tails"; |
98 | |
79 | |
99 | $_->send_msg ($SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY) |
80 | send_msg $_, $cf::SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" |
100 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
81 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
101 | |
82 | |
102 | $pl->send_msg ($SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
83 | $pl->send_msg ($cf::SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
103 | }; |
84 | }; |
104 | |
85 | |
105 | cf::register_command orcknuckle => sub { |
86 | cf::register_command orcknuckle => sub { |
106 | my ($ob, $msg) = @_; |
87 | my ($ob, $msg) = @_; |
107 | |
88 | |
… | |
… | |
110 | |
91 | |
111 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
92 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
112 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
93 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
113 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
94 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
114 | |
95 | |
115 | $_->send_msg ($SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY) |
96 | send_msg $_, $cf::SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" |
116 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
97 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
117 | |
98 | |
118 | $pl->send_msg ($SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
99 | $pl->send_msg ($cf::SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
119 | }; |
100 | }; |
120 | |
101 | |
121 | my $emotes = { |
102 | my $emotes = { |
122 | growl => { |
103 | growl => { |
123 | noparams => { |
104 | noparams => { |
… | |
… | |
169 | self => { |
150 | self => { |
170 | }, |
151 | }, |
171 | }, |
152 | }, |
172 | scream => { |
153 | scream => { |
173 | noparams => { |
154 | noparams => { |
174 | other => "<self> screams at the top of his lungs!", |
155 | other => "<self> screams at the top of G<his|her> lungs!", |
175 | self => "ARRRRRRRRRRGH!!!!!", |
156 | self => "ARRRRRRRRRRGH!!!!!", |
176 | }, |
157 | }, |
177 | params => { |
158 | params => { |
178 | }, |
159 | }, |
179 | self => { |
160 | self => { |
… | |
… | |
188 | target => "<self> pukes on your clothes!", |
169 | target => "<self> pukes on your clothes!", |
189 | other => "<self> pukes on <other>.", |
170 | other => "<self> pukes on <other>.", |
190 | self => "You puke on <other>.", |
171 | self => "You puke on <other>.", |
191 | }, |
172 | }, |
192 | self => { |
173 | self => { |
193 | other => "<self> pukes on his clothes.", |
174 | other => "<self> pukes on G<his|her> clothes.", |
194 | self => "You puke on yourself.", |
175 | self => "You puke on yourself.", |
195 | }, |
176 | }, |
196 | }, |
177 | }, |
197 | strut => { |
178 | strut => { |
198 | noparams => { |
179 | noparams => { |
… | |
… | |
247 | self => "You kiss <other>.", |
228 | self => "You kiss <other>.", |
248 | }, |
229 | }, |
249 | self => { |
230 | self => { |
250 | }, |
231 | }, |
251 | }, |
232 | }, |
|
|
233 | smother => { |
|
|
234 | noparams => { |
|
|
235 | other => "<self> makes weird facial contortions", |
|
|
236 | self => "All the lonely people..", |
|
|
237 | }, |
|
|
238 | params => { |
|
|
239 | target => "<self> smothers you with kisses.", |
|
|
240 | other => "<self> smothers <other> with kisses.", |
|
|
241 | self => "You smother <other> with kisses.", |
|
|
242 | }, |
|
|
243 | self => { |
|
|
244 | }, |
|
|
245 | }, |
252 | wink => { |
246 | wink => { |
253 | noparams => { |
247 | noparams => { |
254 | other => "<self> winks suggestively.", |
248 | other => "<self> winks suggestively.", |
255 | self => "Have you got something in your eye?", |
249 | self => "Have you got something in your eye?", |
256 | }, |
250 | }, |
… | |
… | |
258 | target => "<self> winks at you.", |
252 | target => "<self> winks at you.", |
259 | other => "<self> winks at <other>.", |
253 | other => "<self> winks at <other>.", |
260 | self => "You wink suggestively at <other>.", |
254 | self => "You wink suggestively at <other>.", |
261 | }, |
255 | }, |
262 | self => { |
256 | self => { |
263 | other => "<self> winks at himself - something strange is going on...", |
257 | other => "<self> winks at G<him|her>self - something strange is going on...", |
264 | self => "You wink at yourself?? What are you up to?", |
258 | self => "You wink at yourself?? What are you up to?", |
265 | }, |
259 | }, |
266 | }, |
260 | }, |
267 | pout => { |
261 | pout => { |
268 | noparams => { |
262 | noparams => { |
… | |
… | |
274 | self => { |
268 | self => { |
275 | }, |
269 | }, |
276 | }, |
270 | }, |
277 | cackle => { |
271 | cackle => { |
278 | noparams => { |
272 | noparams => { |
279 | 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!", |
280 | self => "You cackle gleefully.", |
274 | self => "You cackle gleefully.", |
281 | }, |
275 | }, |
282 | params => { |
276 | params => { |
283 | }, |
277 | }, |
284 | self => { |
278 | self => { |
… | |
… | |
293 | target => "<self> sniffs you.", |
287 | target => "<self> sniffs you.", |
294 | other => "<self> sniffs <other>", |
288 | other => "<self> sniffs <other>", |
295 | self => "You sniff <other>.", |
289 | self => "You sniff <other>.", |
296 | }, |
290 | }, |
297 | self => { |
291 | self => { |
298 | other => "<self> sniffs himself.", |
292 | other => "<self> sniffs G<him|her>self.", |
299 | self => "You sniff yourself.", |
293 | self => "You sniff yourself.", |
300 | }, |
294 | }, |
301 | }, |
295 | }, |
302 | nod => { |
296 | nod => { |
303 | noparams => { |
297 | noparams => { |
304 | other => "<self> nods solemnly.", |
298 | other => "<self> nods solemnly.", |
305 | self => "You nod solemnly.", |
299 | self => "You nod solemnly.", |
306 | }, |
300 | }, |
307 | params => { |
301 | params => { |
308 | target => "<self> nods solemnly to you.", |
302 | target => "<self> nods solemnly at you.", |
309 | other => "<self> nods solemnly to <other>.", |
303 | other => "<self> nods solemnly at <other>.", |
310 | self => "You nod solemnly to <other>.", |
304 | self => "You nod solemnly at <other>.", |
311 | }, |
305 | }, |
312 | self => { |
306 | self => { |
313 | }, |
307 | }, |
314 | }, |
308 | }, |
315 | frown => { |
309 | frown => { |
… | |
… | |
321 | target => "<self> frowns darkly at you.", |
315 | target => "<self> frowns darkly at you.", |
322 | other => "<self> frowns darkly at <other>.", |
316 | other => "<self> frowns darkly at <other>.", |
323 | self => "You frown darkly at <other>.", |
317 | self => "You frown darkly at <other>.", |
324 | }, |
318 | }, |
325 | self => { |
319 | self => { |
326 | other => "<self> frowns at himself.", |
320 | other => "<self> frowns at G<him|her>self.", |
327 | self => "You frown at yourself.", |
321 | self => "You frown at yourself.", |
328 | }, |
322 | }, |
329 | }, |
323 | }, |
330 | snicker => { |
324 | snicker => { |
331 | noparams => { |
325 | noparams => { |
… | |
… | |
354 | noparams => { |
348 | noparams => { |
355 | 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?", |
356 | self => "You bleed all over your nice new armour.", |
350 | self => "You bleed all over your nice new armour.", |
357 | }, |
351 | }, |
358 | params => { |
352 | params => { |
359 | target => "<self> slashes his wrist and bleeds all over you.", |
353 | target => "<self> slashes G<his|her> wrist and bleeds all over you.", |
360 | other => "<self> slashes his wrist and bleeds all over <other>.", |
354 | other => "<self> slashes G<his|her> wrist and bleeds all over <other>.", |
361 | self => "You slash your wrist and bleed all over <other>", |
355 | self => "You slash your wrist and bleed all over <other>", |
362 | }, |
356 | }, |
363 | self => { |
357 | self => { |
364 | 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.", |
365 | self => "Very impressive! You wipe your blood all over yourself.", |
359 | self => "Very impressive! You wipe your blood all over yourself.", |
366 | }, |
360 | }, |
367 | }, |
361 | }, |
368 | twiddle => { |
362 | twiddle => { |
369 | noparams => { |
363 | noparams => { |
370 | other => "<self> patiently twiddles his thumbs.", |
364 | other => "<self> patiently twiddles G<his|her> thumbs.", |
371 | self => "You patiently twiddle your thumbs.", |
365 | self => "You patiently twiddle your thumbs.", |
372 | }, |
366 | }, |
373 | params => { |
367 | params => { |
374 | }, |
368 | }, |
375 | self => { |
369 | self => { |
376 | }, |
370 | }, |
377 | }, |
371 | }, |
378 | spit => { |
372 | spit => { |
379 | noparams => { |
373 | noparams => { |
380 | other => "<self> spits over his left shoulder.", |
374 | other => "<self> spits over G<his|her> left shoulder.", |
381 | self => "You spit over your left shoulder.", |
375 | self => "You spit over your left shoulder.", |
382 | }, |
376 | }, |
383 | params => { |
377 | params => { |
384 | target => "<self> spits in your face!", |
378 | target => "<self> spits in your face!", |
385 | other => "<self> spits in <other>'s face.", |
379 | other => "<self> spits in <other>'s face.", |
386 | self => "You spit on <other>.", |
380 | self => "You spit on <other>.", |
387 | }, |
381 | }, |
388 | self => { |
382 | self => { |
389 | other => "<self> drools all over himself.", |
383 | other => "<self> drools all over G<him|her>self.", |
390 | self => "You drool all over yourself.", |
384 | self => "You drool all over yourself.", |
391 | }, |
385 | }, |
392 | }, |
386 | }, |
393 | glare => { |
387 | glare => { |
394 | noparams => { |
388 | noparams => { |
395 | other => "<self> glares around him.", |
389 | other => "<self> glares around G<him|her>.", |
396 | self => "You glare at nothing in particular.", |
390 | self => "You glare at nothing in particular.", |
397 | }, |
391 | }, |
398 | params => { |
392 | params => { |
399 | 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.", |
400 | other => "<self> glares at <other>.", |
394 | other => "<self> glares at <other>.", |
401 | self => "You glare icily at <other>.", |
395 | self => "You glare icily at <other>.", |
402 | }, |
396 | }, |
403 | self => { |
397 | self => { |
404 | 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>?", |
405 | 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.", |
406 | }, |
400 | }, |
407 | }, |
401 | }, |
408 | bow => { |
402 | bow => { |
409 | noparams => { |
403 | noparams => { |
… | |
… | |
414 | target => "<self> bows before you.", |
408 | target => "<self> bows before you.", |
415 | other => "<self> bows before <other>.", |
409 | other => "<self> bows before <other>.", |
416 | self => "You bow before <other>.", |
410 | self => "You bow before <other>.", |
417 | }, |
411 | }, |
418 | self => { |
412 | self => { |
419 | 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.", |
420 | self => "You kiss your toes.", |
414 | self => "You kiss your toes.", |
421 | }, |
415 | }, |
422 | }, |
416 | }, |
423 | dance => { |
417 | dance => { |
424 | noparams => { |
418 | noparams => { |
425 | other => "<self> expresses himself through interpretive dance.", |
419 | other => "<self> expresses G<him|her>self through interpretive dance.", |
426 | self => "You dance with glee.", |
420 | self => "You dance with glee.", |
427 | }, |
421 | }, |
428 | params => { |
422 | params => { |
429 | target => "<self> grabs you, and begins dancing!", |
423 | target => "<self> grabs you, and begins dancing!", |
430 | other => "Yipe! <self> and <other> are doing the Macarena!", |
424 | other => "Yipe! <self> and <other> are doing the Macarena!", |
431 | self => "You grab <other> and begin doing the Cha-Cha!", |
425 | self => "You grab <other> and begin doing the Cha-Cha!", |
432 | }, |
426 | }, |
433 | self => { |
427 | self => { |
434 | other => "<self> embraces himself and begins to dance!", |
428 | other => "<self> embraces G<him|her>self and begins to dance!", |
435 | self => "You skip and dance around by yourself.", |
429 | self => "You skip and dance around by yourself.", |
436 | }, |
430 | }, |
437 | }, |
431 | }, |
438 | snore => { |
432 | snore => { |
439 | noparams => { |
433 | noparams => { |
… | |
… | |
455 | self => { |
449 | self => { |
456 | }, |
450 | }, |
457 | }, |
451 | }, |
458 | snap => { |
452 | snap => { |
459 | noparams => { |
453 | noparams => { |
460 | other => "<self> snaps his fingers.", |
454 | other => "<self> snaps G<his|her> fingers.", |
461 | self => "PRONTO! you snap your fingers.", |
455 | self => "PRONTO! you snap your fingers.", |
462 | }, |
456 | }, |
463 | params => { |
457 | params => { |
464 | }, |
458 | }, |
465 | self => { |
459 | self => { |
… | |
… | |
474 | target => "<self> waves goodbye to you. Have a good journey.", |
468 | target => "<self> waves goodbye to you. Have a good journey.", |
475 | other => "<self> waves goodbye to <other>.", |
469 | other => "<self> waves goodbye to <other>.", |
476 | self => "You wave goodbye to <other>.", |
470 | self => "You wave goodbye to <other>.", |
477 | }, |
471 | }, |
478 | self => { |
472 | self => { |
479 | other => "<self> waves goodbye to himself.", |
473 | other => "<self> waves goodbye to G<him|her>self.", |
480 | self => "Are you going on adventures as well??", |
474 | self => "Are you going on adventures as well??", |
481 | }, |
475 | }, |
482 | }, |
476 | }, |
483 | smile => { |
477 | smile => { |
484 | noparams => { |
478 | noparams => { |
… | |
… | |
498 | other => "<self> sneezes.", |
492 | other => "<self> sneezes.", |
499 | self => "Gesundheit!", |
493 | self => "Gesundheit!", |
500 | }, |
494 | }, |
501 | params => { |
495 | params => { |
502 | 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.", |
503 | 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>.", |
504 | 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>.", |
505 | }, |
499 | }, |
506 | self => { |
500 | self => { |
507 | other => "<self> sneezes, and covers himself in a slimy substance.", |
501 | other => "<self> sneezes, and covers G<him|her>self in a slimy substance.", |
508 | self => "You sneeze on yourself, what a mess!", |
502 | self => "You sneeze on yourself, what a mess!", |
509 | }, |
503 | }, |
510 | }, |
504 | }, |
511 | bounce => { |
505 | bounce => { |
512 | noparams => { |
506 | noparams => { |
… | |
… | |
521 | self => { |
515 | self => { |
522 | }, |
516 | }, |
523 | }, |
517 | }, |
524 | shake => { |
518 | shake => { |
525 | noparams => { |
519 | noparams => { |
526 | other => "<self> shakes his head.", |
520 | other => "<self> shakes G<his|her> head.", |
527 | self => "You shake your head.", |
521 | self => "You shake your head.", |
528 | }, |
522 | }, |
529 | params => { |
523 | params => { |
530 | target => "<self> shakes your hand.", |
524 | target => "<self> shakes your hand.", |
531 | other => "<self> shakes <other>'s hand.", |
525 | other => "<self> shakes <other>'s hand.", |
… | |
… | |
536 | self => "You are shaken by yourself.", |
530 | self => "You are shaken by yourself.", |
537 | }, |
531 | }, |
538 | }, |
532 | }, |
539 | lick => { |
533 | lick => { |
540 | noparams => { |
534 | noparams => { |
541 | other => "<self> licks his mouth and smiles.", |
535 | other => "<self> licks G<his|her> mouth and smiles.", |
542 | self => "You lick your mouth and smile.", |
536 | self => "You lick your mouth and smile.", |
543 | }, |
537 | }, |
544 | params => { |
538 | params => { |
545 | target => "<self> licks you.", |
539 | target => "<self> licks you.", |
546 | other => "<self> licks <other>.", |
540 | other => "<self> licks <other>.", |
547 | self => "You lick <other>.", |
541 | self => "You lick <other>.", |
548 | }, |
542 | }, |
549 | self => { |
543 | self => { |
550 | other => "<self> licks himself - YUCK.", |
544 | other => "<self> licks G<him|her>self - YUCK.", |
551 | self => "You lick yourself.", |
545 | self => "You lick yourself.", |
552 | }, |
546 | }, |
553 | }, |
547 | }, |
554 | flip => { |
548 | flip => { |
555 | noparams => { |
549 | noparams => { |
… | |
… | |
561 | self => { |
555 | self => { |
562 | }, |
556 | }, |
563 | }, |
557 | }, |
564 | think => { |
558 | think => { |
565 | noparams => { |
559 | noparams => { |
566 | other => "<self> closes his eyes and thinks really hard.", |
560 | other => "<self> closes G<his|her> eyes and thinks really hard.", |
567 | self => "Anything in particular that you'd care to think about?", |
561 | self => "Anything in particular that you'd care to think about?", |
568 | }, |
562 | }, |
569 | params => { |
563 | params => { |
570 | }, |
564 | }, |
571 | self => { |
565 | self => { |
… | |
… | |
635 | target => "<self> cries on your shoulder.", |
629 | target => "<self> cries on your shoulder.", |
636 | other => "<self> cries on <other>'s shoulder.", |
630 | other => "<self> cries on <other>'s shoulder.", |
637 | self => "You cry on <other>'s shoulder.", |
631 | self => "You cry on <other>'s shoulder.", |
638 | }, |
632 | }, |
639 | self => { |
633 | self => { |
640 | other => "<self> sobs quietly to himself.", |
634 | other => "<self> sobs quietly to G<him|her>self.", |
641 | self => "You cry to yourself.", |
635 | self => "You cry to yourself.", |
642 | }, |
636 | }, |
643 | }, |
637 | }, |
644 | sulk => { |
638 | sulk => { |
645 | noparams => { |
639 | noparams => { |
… | |
… | |
659 | params => { |
653 | params => { |
660 | target => "<self> whistles at <other>.", |
654 | target => "<self> whistles at <other>.", |
661 | self => "You whistle at <other>.", |
655 | self => "You whistle at <other>.", |
662 | }, |
656 | }, |
663 | self => { |
657 | self => { |
664 | other => "<self> whistles to himself in boredom.", |
658 | other => "<self> whistles to G<him|her>self in boredom.", |
665 | self => "You whistle while you work.", |
659 | self => "You whistle while you work.", |
666 | }, |
660 | }, |
667 | }, |
661 | }, |
668 | groan => { |
662 | groan => { |
669 | noparams => { |
663 | noparams => { |
… | |
… | |
706 | |
700 | |
707 | my $pl = $ob->contr; |
701 | my $pl = $ob->contr; |
708 | |
702 | |
709 | cf::async { |
703 | cf::async { |
710 | my $name = $ob->name; |
704 | my $name = $ob->name; |
|
|
705 | $Coro::current->{desc} = "emote handler for $name"; |
711 | |
706 | |
712 | if ($tname eq $name) { |
707 | if ($tname eq $name) { |
713 | my %emote = %{ $emotes->{$emotion}->{self} || {} }; |
708 | my %emote = %{ $emotes->{$emotion}->{self} || {} }; |
714 | |
709 | |
715 | $emote{other} ||= "You look away from <self>."; |
710 | $emote{other} ||= "You look away from <self>."; |
716 | $emote{self} ||= "My god! Is that LEGAL?"; |
711 | $emote{self} ||= "My god! Is that LEGAL?"; |
717 | |
712 | |
718 | $emote{other} =~ s/<self>/$name/; |
713 | $emote{other} =~ s/<self>/$name/; |
|
|
714 | |
|
|
715 | $_ = $pl->expand_cfpod ($_) |
|
|
716 | for values %emote; |
719 | |
717 | |
720 | $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) |
718 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
721 | 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; |
722 | |
720 | |
723 | $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); |
724 | } elsif ($tname) { |
722 | } elsif ($tname) { |
725 | my $target = cf::player::find $tname |
723 | my $target = cf::player::find $tname |
726 | or return $pl->send_msg (tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY); |
724 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
727 | |
725 | |
728 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
726 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
729 | |
727 | |
730 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
728 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
731 | $emote{self} ||= "You are still nuts."; |
729 | $emote{self} ||= "You are still nuts."; |
732 | $emote{target} ||= "You get the distinct feeling that <other> is nuts."; |
730 | $emote{target} ||= "You get the distinct feeling that <self> is nuts."; |
733 | |
731 | |
734 | $emote{self} =~ s/<other>/$tname/; |
732 | $emote{self} =~ s/<other>/$tname/; |
735 | $emote{target} =~ s/<self>/$name/; |
733 | $emote{target} =~ s/<self>/$name/; |
736 | $emote{other} =~ s/<other>/$tname/; |
734 | $emote{other} =~ s/<other>/$tname/; |
737 | $emote{other} =~ s/<self>/$name/; |
735 | $emote{other} =~ s/<self>/$name/; |
738 | |
736 | |
739 | $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) |
737 | $_ = $pl->expand_cfpod ($_) |
|
|
738 | for values %emote; |
|
|
739 | |
|
|
740 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
740 | 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; |
741 | |
742 | |
742 | $target->send_msg (tell_channel $name, $emote{target}, cf::NDI_GREY); |
743 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_shout"; |
743 | $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); |
744 | } else { |
745 | } else { |
745 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
746 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
746 | |
747 | |
747 | $emote{other} ||= "<self> dances with glee."; |
748 | $emote{other} ||= "<self> dances with glee."; |
748 | $emote{self} ||= "You are a nut."; |
749 | $emote{self} ||= "You are a nut."; |
749 | |
750 | |
750 | $emote{other} =~ s/<self>/$name/; |
751 | $emote{other} =~ s/<self>/$name/; |
751 | |
752 | |
752 | $_->send_msg ($CHAT_CHANNEL, $emote{other}, cf::NDI_GREY) |
753 | $_ = $pl->expand_cfpod ($_) |
|
|
754 | for values %emote; |
|
|
755 | |
|
|
756 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
753 | 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; |
754 | |
758 | |
755 | $pl->send_msg ($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); |
756 | } |
760 | } |
757 | }; |
761 | }; |
758 | }; |
762 | }; |
759 | } |
763 | } |
760 | |
764 | |
761 | cf::register_command me => sub { |
765 | cf::register_command me => sub { |
762 | my ($pl, $msg) = @_; |
766 | my ($pl, $msg) = @_; |
763 | |
767 | |
764 | my $name = $pl->name; |
768 | my $name = $pl->name; |
765 | |
769 | |
766 | $_->send_msg ($SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) |
770 | send_msg $_, $cf::SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say" |
767 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
771 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
768 | }; |
772 | }; |
769 | |
773 | |
770 | cf::register_command say => sub { |
774 | cf::register_command say => sub { |
771 | my ($ob, $msg) = @_; |
775 | my ($ob, $msg) = @_; |
… | |
… | |
776 | |
780 | |
777 | if ($msg) { |
781 | if ($msg) { |
778 | my $name = $ob->name; |
782 | my $name = $ob->name; |
779 | my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; |
783 | my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; |
780 | |
784 | |
|
|
785 | send_msg $_, $cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, "msg_say" |
|
|
786 | for grep $_ != $ob->contr, @plonmap; |
781 | $_->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | ($_ == $ob->contr ? cf::NDI_REPLY : 0)) |
787 | $ob->contr->send_msg ($cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | cf::NDI_REPLY); |
782 | for @plonmap; |
|
|
783 | |
788 | |
784 | # npcs, magic_ears etc. |
789 | # npcs, magic_ears etc. |
785 | # first find all objects and their first-level inventories |
790 | # first find all objects and their first-level inventories |
786 | # within a 5x5 square that have something resembling |
791 | # within a 5x5 square that have something resembling |
787 | # dialogue or support on_say. |
792 | # dialogue or support on_say. |
788 | my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); |
793 | my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); |
789 | |
794 | |
790 | for my $npc ( |
795 | for my $npc ( |
791 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, |
796 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || $_->has_dialogue, |
792 | map +($_, $_->inv), |
797 | map +($_, $_->inv), |
793 | grep $_, |
798 | grep $_, |
794 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
799 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
795 | 0..24 |
800 | 0..24 |
796 | ) { |
801 | ) { |
… | |
… | |
800 | my $dialog = new NPC_Dialogue pl => $ob->contr, npc => $npc; |
805 | my $dialog = new NPC_Dialogue pl => $ob->contr, npc => $npc; |
801 | my ($reply, @kw) = $dialog->tell ($msg); |
806 | my ($reply, @kw) = $dialog->tell ($msg); |
802 | |
807 | |
803 | if (defined $reply) { |
808 | if (defined $reply) { |
804 | if ($npc->type == cf::MAGIC_EAR) { |
809 | if ($npc->type == cf::MAGIC_EAR) { |
805 | if (length $reply) { |
|
|
806 | $_->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) |
810 | send_msg $_, $cf::SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" |
807 | for @plonmap; |
811 | for @plonmap; |
808 | } |
|
|
809 | $npc->use_trigger; |
|
|
810 | } else { |
812 | } else { |
811 | if (length $reply) { |
|
|
812 | $_->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) |
813 | send_msg $_, $cf::SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" |
813 | for @plonmap; |
814 | for @plonmap; |
814 | } |
|
|
815 | } |
815 | } |
816 | } |
816 | } |
817 | |
817 | |
818 | if (@kw) { |
818 | if (@kw) { |
819 | $_->send_msg ($SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) |
819 | $_->send_msg ($cf::SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) |
820 | for @plonmap; |
820 | for @plonmap; |
821 | } |
821 | } |
822 | } |
822 | } |
823 | |
823 | |
824 | } else { |
824 | } else { |
825 | $ob->send_msg ($SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY); |
825 | $ob->send_msg ($cf::SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY); |
826 | } |
826 | } |
827 | }; |
827 | }; |
828 | |
828 | |
829 | cf::register_command chat => sub { |
829 | cf::register_command chat => sub { |
830 | my ($ob, $msg) = @_; |
830 | my ($ob, $msg) = @_; |
… | |
… | |
840 | my $NOW = time; |
840 | my $NOW = time; |
841 | |
841 | |
842 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
842 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
843 | send_irc ("[%s] %s", $name, $msg); |
843 | send_irc ("[%s] %s", $name, $msg); |
844 | |
844 | |
845 | $_->send_msg ($CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) |
845 | send_msg $_, $cf::CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" |
846 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
846 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
847 | |
847 | |
848 | } else { |
848 | } else { |
849 | $pl->send_msg ($CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
849 | $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
850 | } |
850 | } |
851 | }; |
851 | }; |
852 | |
852 | |
853 | cf::register_command shout => sub { |
853 | cf::register_command shout => sub { |
854 | my ($ob, $msg) = @_; |
854 | my ($ob, $msg) = @_; |
… | |
… | |
864 | my $name = $ob->name; |
864 | my $name = $ob->name; |
865 | |
865 | |
866 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
866 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
867 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
867 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
868 | |
868 | |
869 | $_->send_msg ($CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0)) |
869 | 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; |
870 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
871 | |
871 | |
872 | } else { |
872 | } else { |
873 | $pl->send_msg ($CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
873 | $pl->send_msg ($cf::CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
874 | } |
874 | } |
875 | }; |
875 | }; |
876 | |
876 | |
877 | cf::register_command tell => sub { |
877 | cf::register_command tell => sub { |
878 | my ($ob, $args) = @_; |
878 | my ($ob, $args) = @_; |
… | |
… | |
905 | } else { |
905 | } else { |
906 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg); |
906 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg); |
907 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
907 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
908 | |
908 | |
909 | $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
909 | $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
910 | $other->send_msg ($other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF); |
910 | send_msg $other, $other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF, "msg_tell"; |
911 | } |
911 | } |
912 | } else { |
912 | } else { |
913 | $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
913 | $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
914 | } |
914 | } |
915 | |
915 | |
… | |
… | |
920 | |
920 | |
921 | cf::register_command ignore => sub { |
921 | cf::register_command ignore => sub { |
922 | my ($pl, $args) = @_; |
922 | my ($pl, $args) = @_; |
923 | my ($target, $type, $timeout) = split /\s+/, $args; |
923 | my ($target, $type, $timeout) = split /\s+/, $args; |
924 | |
924 | |
|
|
925 | cf::async { |
925 | if ($args eq "list") { |
926 | if ($args eq "list") { |
926 | clean_timeouts $pl; |
927 | clean_timeouts $pl; |
927 | |
928 | |
928 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
929 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
929 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
930 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
930 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
931 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
931 | $pl->message ((join ", ", @ignored_tell), cf::NDI_REPLY); |
932 | $pl->message ((join ", ", @ignored_tell), cf::NDI_REPLY); |
932 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
933 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
933 | $pl->message ((join ", ", @ignored_shout), cf::NDI_REPLY); |
934 | $pl->message ((join ", ", @ignored_shout), cf::NDI_REPLY); |
934 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_REPLY); |
935 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_REPLY); |
|
|
936 | } else { |
|
|
937 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
|
|
938 | } |
|
|
939 | |
|
|
940 | } elsif ($target && $type) { |
|
|
941 | $timeout ne "" or $timeout = 24; |
|
|
942 | my $absolute_timeout = time + $timeout * 3600; |
|
|
943 | |
|
|
944 | if (cf::player::exists $target) { |
|
|
945 | if ($type eq "tell") { |
|
|
946 | $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
947 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
|
|
948 | } elsif ($type eq "shout") { |
|
|
949 | $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
950 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
|
|
951 | } elsif ($type eq "all") { |
|
|
952 | $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
953 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
|
|
954 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
|
|
955 | } else { |
|
|
956 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
|
|
957 | } |
|
|
958 | } else { |
|
|
959 | $pl->message ("No such player: $target", cf::NDI_REPLY); |
|
|
960 | } |
|
|
961 | |
935 | } else { |
962 | } else { |
936 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
963 | $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
|
|
964 | . "will ignore a player for <timeout> hours.\n" |
|
|
965 | . "Usage: ignore list\n" |
|
|
966 | . "will show you a list of players currently ignored.", cf::NDI_REPLY); |
937 | } |
967 | } |
938 | |
|
|
939 | } elsif ($target && $type) { |
|
|
940 | |
|
|
941 | $timeout ne "" or $timeout = 24; |
|
|
942 | my $absolute_timeout = time + $timeout * 3600; |
|
|
943 | |
|
|
944 | if (cf::player::exists $target) { |
|
|
945 | if ($type eq "tell") { |
|
|
946 | $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
947 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
|
|
948 | } elsif ($type eq "shout") { |
|
|
949 | $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
950 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
|
|
951 | } elsif ($type eq "all") { |
|
|
952 | $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_REPLY); |
|
|
953 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
|
|
954 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
|
|
955 | } else { |
|
|
956 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
|
|
957 | } |
|
|
958 | } else { |
|
|
959 | $pl->message ("No such player: $target", cf::NDI_REPLY); |
|
|
960 | } |
|
|
961 | |
|
|
962 | } else { |
|
|
963 | $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
|
|
964 | . "will ignore a player for <timeout> hours.\n" |
|
|
965 | . "Usage: ignore list\n" |
|
|
966 | . "will show you a list of players currently ignored.", cf::NDI_REPLY); |
|
|
967 | } |
968 | }; |
968 | }; |
969 | }; |
969 | |
970 | |
970 | cf::register_command unignore => sub { |
971 | cf::register_command unignore => sub { |
971 | my ($pl, $args) = @_; |
972 | my ($pl, $args) = @_; |
972 | my ($target, $type) = split /\s+/, $args; |
973 | my ($target, $type) = split /\s+/, $args; |
973 | |
974 | |
|
|
975 | cf::async { |
974 | if ($args eq "") { |
976 | if ($args eq "") { |
975 | if ($pl->{ext_ignore_tell}) { |
977 | if ($pl->{ext_ignore_tell}) { |
976 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
978 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
977 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_REPLY); |
979 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_REPLY); |
978 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
980 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
979 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_REPLY); |
981 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_REPLY); |
980 | } else { |
|
|
981 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
|
|
982 | } |
|
|
983 | } else { |
|
|
984 | if (cf::player::exists $target) { |
|
|
985 | if ($type eq "tell") { |
|
|
986 | $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_REPLY); |
|
|
987 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
988 | } elsif ($type eq "shout") { |
|
|
989 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_REPLY); |
|
|
990 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
991 | } elsif ($type eq "all") { |
|
|
992 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_REPLY); |
|
|
993 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
994 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
995 | } else { |
982 | } else { |
996 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
983 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
997 | } |
984 | } |
998 | } else { |
985 | } else { |
|
|
986 | if (cf::player::exists $target) { |
|
|
987 | if ($type eq "tell") { |
|
|
988 | $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_REPLY); |
|
|
989 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
990 | } elsif ($type eq "shout") { |
|
|
991 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_REPLY); |
|
|
992 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
993 | } elsif ($type eq "all") { |
|
|
994 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_REPLY); |
|
|
995 | delete $pl->{ext_ignore_tell} {$target}; |
|
|
996 | delete $pl->{ext_ignore_shout}{$target}; |
|
|
997 | } else { |
|
|
998 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
|
|
999 | } |
|
|
1000 | } else { |
999 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_REPLY); |
1001 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_REPLY); |
|
|
1002 | } |
1000 | } |
1003 | } |
1001 | } |
1004 | }; |
1002 | }; |
1005 | }; |
1003 | |
1006 | |