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 | |
7 | use NPC_Dialogue; |
6 | use NPC_Dialogue; |
8 | use POSIX (); # for strftime only |
7 | use POSIX (); # for strftime only |
9 | |
8 | |
10 | our $SAY_CHANNEL = { |
9 | sub tell_channel($) { |
11 | id => "say", |
10 | my ($target) = @_; |
12 | title => "Map", |
|
|
13 | reply => "say ", |
|
|
14 | tooltip => "Things said to and replied from npcs near you and other players on the same map only.", |
|
|
15 | }; |
|
|
16 | |
11 | |
17 | our $CHAT_CHANNEL = { |
12 | { |
18 | id => "chat", |
13 | id => "tell-$target", |
19 | title => "Chat", |
14 | title => "$target", |
20 | reply => "chat ", |
15 | reply => "tell $target ", |
21 | tooltip => "Player chat and shouts, global to the server.", |
16 | tooltip => "Private messages from/to $target", |
22 | }; |
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 | () |
|
|
25 | } |
23 | |
26 | |
24 | sub clean_timeouts($) { |
27 | sub clean_timeouts($) { |
25 | my ($player) = @_; |
28 | my ($player) = @_; |
26 | my $NOW = time; |
29 | my $NOW = time; |
27 | |
30 | |
28 | for my $hash (@$player{qw(ext_ignore_shout ext_ignore_tell)}) { |
31 | for my $hash (@$player{qw(ext_ignore_shout ext_ignore_tell)}) { |
29 | while (my ($k, $v) = each %$hash) { |
32 | while (my ($k, $v) = each %$hash) { |
30 | if ($v < $NOW) { |
33 | if ($v < $NOW) { |
31 | $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); |
32 | delete $hash->{$k}; |
35 | delete $hash->{$k}; |
33 | } elsif (!cf::player::exists $k) { |
36 | } elsif (!cf::player::exists $k) { |
34 | $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); |
35 | delete $hash->{$k}; |
38 | delete $hash->{$k}; |
36 | } |
39 | } |
37 | } |
40 | } |
38 | } |
41 | } |
39 | } |
42 | } |
… | |
… | |
52 | prio => -1000, |
55 | prio => -1000, |
53 | on_login => sub { |
56 | on_login => sub { |
54 | my ($pl) = @_; |
57 | my ($pl) = @_; |
55 | |
58 | |
56 | clean_timeouts $pl->ob; |
59 | clean_timeouts $pl->ob; |
|
|
60 | |
57 | $pl->ns->send_msg ($SAY_CHANNEL); |
61 | $pl->send_msg ($cf::SAY_CHANNEL); |
58 | $pl->ns->send_msg ($CHAT_CHANNEL); |
62 | $pl->send_msg ($cf::CHAT_CHANNEL); |
59 | }, |
63 | }, |
60 | ); |
64 | ); |
61 | |
65 | |
|
|
66 | # TODO: remove once safe |
62 | cf::register_command listen => sub { |
67 | cf::register_command listen => sub { |
63 | my ($pl, $msg) = @_; |
|
|
64 | my $player = cf::player::find_active $pl->name; |
|
|
65 | |
|
|
66 | if ($msg ne "") { |
|
|
67 | $msg = 10 if $msg > 10; |
|
|
68 | |
|
|
69 | my $prev_listen = $player->listening; |
|
|
70 | $player->listening ($msg); |
|
|
71 | if ($prev_listen == $player->listening) { |
|
|
72 | $pl->message ("Your verbose level stays at $prev_listen.", cf::NDI_UNIQUE); |
|
|
73 | } else { |
|
|
74 | $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_UNIQUE); |
|
|
75 | } |
|
|
76 | } else { |
|
|
77 | $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_UNIQUE); |
|
|
78 | } |
|
|
79 | }; |
68 | }; |
80 | |
69 | |
81 | cf::register_command cointoss => sub { |
70 | cf::register_command cointoss => sub { |
82 | my ($pl, $msg) = @_; |
71 | my ($ob, $msg) = @_; |
83 | |
72 | |
|
|
73 | my $pl = $ob->contr; |
84 | my $name = $pl->name; |
74 | my $name = $ob->name; |
|
|
75 | |
85 | my $coin = int rand 2 ? "Heads" : "Tails"; |
76 | my $coin = int rand 2 ? "Heads" : "Tails"; |
86 | |
77 | |
|
|
78 | send_msg $_, $cf::SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" |
87 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
79 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
88 | next |
|
|
89 | if $other->ob == $pl; |
|
|
90 | $other->ob->message ("$name flips a coin.... $coin!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
91 | } |
|
|
92 | |
80 | |
93 | $pl->message ("You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_UNIQUE); |
81 | $pl->send_msg ($cf::SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
94 | }; |
82 | }; |
95 | |
83 | |
96 | cf::register_command orcknuckle => sub { |
84 | cf::register_command orcknuckle => sub { |
97 | my ($pl, $msg) = @_; |
85 | my ($ob, $msg) = @_; |
|
|
86 | |
|
|
87 | my $pl = $ob->contr; |
|
|
88 | my $name = $ob->name; |
|
|
89 | |
98 | my @orcknuckle = ("none", "beholder", "ghost", "knight", "princess", "dragon", "orc"); |
90 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
99 | |
91 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
100 | my $name = $pl->name; |
|
|
101 | |
|
|
102 | my ($i, $j, $k, $l) = ((int rand 5) + 1, (int rand 5) + 1, (int rand 5) + 1, (int rand 6) + 1); |
|
|
103 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
92 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
104 | |
93 | |
|
|
94 | send_msg $_, $cf::SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" |
105 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
95 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
106 | next |
|
|
107 | if $other->ob == $pl; |
|
|
108 | $other->ob->message ("$name rolls $result!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
109 | } |
96 | |
110 | |
|
|
111 | $pl->message ("You roll $result!", cf::NDI_GREY | cf::NDI_UNIQUE); |
97 | $pl->send_msg ($cf::SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
112 | }; |
98 | }; |
113 | |
99 | |
114 | my $emotes = { |
100 | my $emotes = { |
115 | growl => { |
101 | growl => { |
116 | noparams => { |
102 | noparams => { |
… | |
… | |
162 | self => { |
148 | self => { |
163 | }, |
149 | }, |
164 | }, |
150 | }, |
165 | scream => { |
151 | scream => { |
166 | noparams => { |
152 | noparams => { |
167 | other => "<self> screams at the top of his lungs!", |
153 | other => "<self> screams at the top of G<his|her> lungs!", |
168 | self => "ARRRRRRRRRRGH!!!!!", |
154 | self => "ARRRRRRRRRRGH!!!!!", |
169 | }, |
155 | }, |
170 | params => { |
156 | params => { |
171 | }, |
157 | }, |
172 | self => { |
158 | self => { |
… | |
… | |
181 | target => "<self> pukes on your clothes!", |
167 | target => "<self> pukes on your clothes!", |
182 | other => "<self> pukes on <other>.", |
168 | other => "<self> pukes on <other>.", |
183 | self => "You puke on <other>.", |
169 | self => "You puke on <other>.", |
184 | }, |
170 | }, |
185 | self => { |
171 | self => { |
186 | other => "<self> pukes on his clothes.", |
172 | other => "<self> pukes on G<his|her> clothes.", |
187 | self => "You puke on yourself.", |
173 | self => "You puke on yourself.", |
188 | }, |
174 | }, |
189 | }, |
175 | }, |
190 | strut => { |
176 | strut => { |
191 | noparams => { |
177 | noparams => { |
… | |
… | |
240 | self => "You kiss <other>.", |
226 | self => "You kiss <other>.", |
241 | }, |
227 | }, |
242 | self => { |
228 | self => { |
243 | }, |
229 | }, |
244 | }, |
230 | }, |
|
|
231 | smother => { |
|
|
232 | noparams => { |
|
|
233 | other => "<self> makes weird facial contortions", |
|
|
234 | self => "All the lonely people..", |
|
|
235 | }, |
|
|
236 | params => { |
|
|
237 | target => "<self> smothers you with kisses.", |
|
|
238 | other => "<self> smothers <other> with kisses.", |
|
|
239 | self => "You smother <other> with kisses.", |
|
|
240 | }, |
|
|
241 | self => { |
|
|
242 | }, |
|
|
243 | }, |
245 | wink => { |
244 | wink => { |
246 | noparams => { |
245 | noparams => { |
247 | other => "<self> winks suggestively.", |
246 | other => "<self> winks suggestively.", |
248 | self => "Have you got something in your eye?", |
247 | self => "Have you got something in your eye?", |
249 | }, |
248 | }, |
… | |
… | |
251 | target => "<self> winks at you.", |
250 | target => "<self> winks at you.", |
252 | other => "<self> winks at <other>.", |
251 | other => "<self> winks at <other>.", |
253 | self => "You wink suggestively at <other>.", |
252 | self => "You wink suggestively at <other>.", |
254 | }, |
253 | }, |
255 | self => { |
254 | self => { |
256 | other => "<self> winks at himself - something strange is going on...", |
255 | other => "<self> winks at G<him|her>self - something strange is going on...", |
257 | self => "You wink at yourself?? What are you up to?", |
256 | self => "You wink at yourself?? What are you up to?", |
258 | }, |
257 | }, |
259 | }, |
258 | }, |
260 | pout => { |
259 | pout => { |
261 | noparams => { |
260 | noparams => { |
… | |
… | |
267 | self => { |
266 | self => { |
268 | }, |
267 | }, |
269 | }, |
268 | }, |
270 | cackle => { |
269 | cackle => { |
271 | noparams => { |
270 | noparams => { |
272 | other => "<self> throws back his head and cackles with insane glee!", |
271 | other => "<self> throws back G<his|her> head and cackles with insane glee!", |
273 | self => "You cackle gleefully.", |
272 | self => "You cackle gleefully.", |
274 | }, |
273 | }, |
275 | params => { |
274 | params => { |
276 | }, |
275 | }, |
277 | self => { |
276 | self => { |
… | |
… | |
286 | target => "<self> sniffs you.", |
285 | target => "<self> sniffs you.", |
287 | other => "<self> sniffs <other>", |
286 | other => "<self> sniffs <other>", |
288 | self => "You sniff <other>.", |
287 | self => "You sniff <other>.", |
289 | }, |
288 | }, |
290 | self => { |
289 | self => { |
291 | other => "<self> sniffs himself.", |
290 | other => "<self> sniffs G<him|her>self.", |
292 | self => "You sniff yourself.", |
291 | self => "You sniff yourself.", |
293 | }, |
292 | }, |
294 | }, |
293 | }, |
295 | nod => { |
294 | nod => { |
296 | noparams => { |
295 | noparams => { |
297 | other => "<self> nods solemnly.", |
296 | other => "<self> nods solemnly.", |
298 | self => "You nod solemnly.", |
297 | self => "You nod solemnly.", |
299 | }, |
298 | }, |
300 | params => { |
299 | params => { |
301 | target => "<self> nods solemnly to you.", |
300 | target => "<self> nods solemnly at you.", |
302 | other => "<self> nods solemnly to <other>.", |
301 | other => "<self> nods solemnly at <other>.", |
303 | self => "You nod solemnly to <other>.", |
302 | self => "You nod solemnly at <other>.", |
304 | }, |
303 | }, |
305 | self => { |
304 | self => { |
306 | }, |
305 | }, |
307 | }, |
306 | }, |
308 | frown => { |
307 | frown => { |
… | |
… | |
314 | target => "<self> frowns darkly at you.", |
313 | target => "<self> frowns darkly at you.", |
315 | other => "<self> frowns darkly at <other>.", |
314 | other => "<self> frowns darkly at <other>.", |
316 | self => "You frown darkly at <other>.", |
315 | self => "You frown darkly at <other>.", |
317 | }, |
316 | }, |
318 | self => { |
317 | self => { |
319 | other => "<self> frowns at himself.", |
318 | other => "<self> frowns at G<him|her>self.", |
320 | self => "You frown at yourself.", |
319 | self => "You frown at yourself.", |
321 | }, |
320 | }, |
322 | }, |
321 | }, |
323 | snicker => { |
322 | snicker => { |
324 | noparams => { |
323 | noparams => { |
… | |
… | |
347 | noparams => { |
346 | noparams => { |
348 | other => "<self> is bleeding all over the carpet - got a spare tourniquet?", |
347 | other => "<self> is bleeding all over the carpet - got a spare tourniquet?", |
349 | self => "You bleed all over your nice new armour.", |
348 | self => "You bleed all over your nice new armour.", |
350 | }, |
349 | }, |
351 | params => { |
350 | params => { |
352 | target => "<self> slashes his wrist and bleeds all over you.", |
351 | target => "<self> slashes G<his|her> wrist and bleeds all over you.", |
353 | other => "<self> slashes his wrist and bleeds all over <other>.", |
352 | other => "<self> slashes G<his|her> wrist and bleeds all over <other>.", |
354 | self => "You slash your wrist and bleed all over <other>", |
353 | self => "You slash your wrist and bleed all over <other>", |
355 | }, |
354 | }, |
356 | self => { |
355 | self => { |
357 | other => "<self> performs some satanic ritual while wiping his blood on himself.", |
356 | other => "<self> performs some satanic ritual while wiping G<his|her> blood on G<him|her>self.", |
358 | self => "Very impressive! You wipe your blood all over yourself.", |
357 | self => "Very impressive! You wipe your blood all over yourself.", |
359 | }, |
358 | }, |
360 | }, |
359 | }, |
361 | twiddle => { |
360 | twiddle => { |
362 | noparams => { |
361 | noparams => { |
363 | other => "<self> patiently twiddles his thumbs.", |
362 | other => "<self> patiently twiddles G<his|her> thumbs.", |
364 | self => "You patiently twiddle your thumbs.", |
363 | self => "You patiently twiddle your thumbs.", |
365 | }, |
364 | }, |
366 | params => { |
365 | params => { |
367 | }, |
366 | }, |
368 | self => { |
367 | self => { |
369 | }, |
368 | }, |
370 | }, |
369 | }, |
371 | spit => { |
370 | spit => { |
372 | noparams => { |
371 | noparams => { |
373 | other => "<self> spits over his left shoulder.", |
372 | other => "<self> spits over G<his|her> left shoulder.", |
374 | self => "You spit over your left shoulder.", |
373 | self => "You spit over your left shoulder.", |
375 | }, |
374 | }, |
376 | params => { |
375 | params => { |
377 | target => "<self> spits in your face!", |
376 | target => "<self> spits in your face!", |
378 | other => "<self> spits in <other>'s face.", |
377 | other => "<self> spits in <other>'s face.", |
379 | self => "You spit on <other>.", |
378 | self => "You spit on <other>.", |
380 | }, |
379 | }, |
381 | self => { |
380 | self => { |
382 | other => "<self> drools all over himself.", |
381 | other => "<self> drools all over G<him|her>self.", |
383 | self => "You drool all over yourself.", |
382 | self => "You drool all over yourself.", |
384 | }, |
383 | }, |
385 | }, |
384 | }, |
386 | glare => { |
385 | glare => { |
387 | noparams => { |
386 | noparams => { |
388 | other => "<self> glares around him.", |
387 | other => "<self> glares around G<him|her>.", |
389 | self => "You glare at nothing in particular.", |
388 | self => "You glare at nothing in particular.", |
390 | }, |
389 | }, |
391 | params => { |
390 | params => { |
392 | target => "<self> glares icily at you, you feel cold to your bones.", |
391 | target => "<self> glares icily at you, you feel cold to your bones.", |
393 | other => "<self> glares at <other>.", |
392 | other => "<self> glares at <other>.", |
394 | self => "You glare icily at <other>.", |
393 | self => "You glare icily at <other>.", |
395 | }, |
394 | }, |
396 | self => { |
395 | self => { |
397 | other => "<self> glares at his feet, what is bothering him?", |
396 | other => "<self> glares at G<his|her> feet, what is bothering G<him|her>?", |
398 | self => "You glare icily at your feet, they are suddenly very cold.", |
397 | self => "You glare icily at your feet, they are suddenly very cold.", |
399 | }, |
398 | }, |
400 | }, |
399 | }, |
401 | bow => { |
400 | bow => { |
402 | noparams => { |
401 | noparams => { |
… | |
… | |
407 | target => "<self> bows before you.", |
406 | target => "<self> bows before you.", |
408 | other => "<self> bows before <other>.", |
407 | other => "<self> bows before <other>.", |
409 | self => "You bow before <other>.", |
408 | self => "You bow before <other>.", |
410 | }, |
409 | }, |
411 | self => { |
410 | self => { |
412 | other => "<self> folds up like a jackknife and kisses his own toes.", |
411 | other => "<self> folds up like a jackknife and kisses G<his|her> own toes.", |
413 | self => "You kiss your toes.", |
412 | self => "You kiss your toes.", |
414 | }, |
413 | }, |
415 | }, |
414 | }, |
416 | dance => { |
415 | dance => { |
417 | noparams => { |
416 | noparams => { |
418 | other => "<self> expresses himself through interpretive dance.", |
417 | other => "<self> expresses G<him|her>self through interpretive dance.", |
419 | self => "You dance with glee.", |
418 | self => "You dance with glee.", |
420 | }, |
419 | }, |
421 | params => { |
420 | params => { |
422 | target => "<self> grabs you, and begins dancing!", |
421 | target => "<self> grabs you, and begins dancing!", |
423 | other => "Yipe! <self> and <other> are doing the Macarena!", |
422 | other => "Yipe! <self> and <other> are doing the Macarena!", |
424 | self => "You grab <other> and begin doing the Cha-Cha!", |
423 | self => "You grab <other> and begin doing the Cha-Cha!", |
425 | }, |
424 | }, |
426 | self => { |
425 | self => { |
427 | other => "<self> embraces himself and begins to dance!", |
426 | other => "<self> embraces G<him|her>self and begins to dance!", |
428 | self => "You skip and dance around by yourself.", |
427 | self => "You skip and dance around by yourself.", |
429 | }, |
428 | }, |
430 | }, |
429 | }, |
431 | snore => { |
430 | snore => { |
432 | noparams => { |
431 | noparams => { |
… | |
… | |
448 | self => { |
447 | self => { |
449 | }, |
448 | }, |
450 | }, |
449 | }, |
451 | snap => { |
450 | snap => { |
452 | noparams => { |
451 | noparams => { |
453 | other => "<self> snaps his fingers.", |
452 | other => "<self> snaps G<his|her> fingers.", |
454 | self => "PRONTO! you snap your fingers.", |
453 | self => "PRONTO! you snap your fingers.", |
455 | }, |
454 | }, |
456 | params => { |
455 | params => { |
457 | }, |
456 | }, |
458 | self => { |
457 | self => { |
… | |
… | |
467 | target => "<self> waves goodbye to you. Have a good journey.", |
466 | target => "<self> waves goodbye to you. Have a good journey.", |
468 | other => "<self> waves goodbye to <other>.", |
467 | other => "<self> waves goodbye to <other>.", |
469 | self => "You wave goodbye to <other>.", |
468 | self => "You wave goodbye to <other>.", |
470 | }, |
469 | }, |
471 | self => { |
470 | self => { |
472 | other => "<self> waves goodbye to himself.", |
471 | other => "<self> waves goodbye to G<him|her>self.", |
473 | self => "Are you going on adventures as well??", |
472 | self => "Are you going on adventures as well??", |
474 | }, |
473 | }, |
475 | }, |
474 | }, |
476 | smile => { |
475 | smile => { |
477 | noparams => { |
476 | noparams => { |
… | |
… | |
491 | other => "<self> sneezes.", |
490 | other => "<self> sneezes.", |
492 | self => "Gesundheit!", |
491 | self => "Gesundheit!", |
493 | }, |
492 | }, |
494 | params => { |
493 | params => { |
495 | target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.", |
494 | target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.", |
496 | other => "<self> sneezes on <other> and a film of snot covers him.", |
495 | other => "<self> sneezes on <other> and a film of snot covers G<him|her>.", |
497 | self => "You sneeze at <other> and a film of snot shoots onto him.", |
496 | self => "You sneeze at <other> and a film of snot shoots onto G<him|her>.", |
498 | }, |
497 | }, |
499 | self => { |
498 | self => { |
500 | other => "<self> sneezes, and covers himself in a slimy substance.", |
499 | other => "<self> sneezes, and covers G<him|her>self in a slimy substance.", |
501 | self => "You sneeze on yourself, what a mess!", |
500 | self => "You sneeze on yourself, what a mess!", |
502 | }, |
501 | }, |
503 | }, |
502 | }, |
504 | bounce => { |
503 | bounce => { |
505 | noparams => { |
504 | noparams => { |
… | |
… | |
514 | self => { |
513 | self => { |
515 | }, |
514 | }, |
516 | }, |
515 | }, |
517 | shake => { |
516 | shake => { |
518 | noparams => { |
517 | noparams => { |
519 | other => "<self> shakes his head.", |
518 | other => "<self> shakes G<his|her> head.", |
520 | self => "You shake your head.", |
519 | self => "You shake your head.", |
521 | }, |
520 | }, |
522 | params => { |
521 | params => { |
523 | target => "<self> shakes your hand.", |
522 | target => "<self> shakes your hand.", |
524 | other => "<self> shakes <other>'s hand.", |
523 | other => "<self> shakes <other>'s hand.", |
… | |
… | |
529 | self => "You are shaken by yourself.", |
528 | self => "You are shaken by yourself.", |
530 | }, |
529 | }, |
531 | }, |
530 | }, |
532 | lick => { |
531 | lick => { |
533 | noparams => { |
532 | noparams => { |
534 | other => "<self> licks his mouth and smiles.", |
533 | other => "<self> licks G<his|her> mouth and smiles.", |
535 | self => "You lick your mouth and smile.", |
534 | self => "You lick your mouth and smile.", |
536 | }, |
535 | }, |
537 | params => { |
536 | params => { |
538 | target => "<self> licks you.", |
537 | target => "<self> licks you.", |
539 | other => "<self> licks <other>.", |
538 | other => "<self> licks <other>.", |
540 | self => "You lick <other>.", |
539 | self => "You lick <other>.", |
541 | }, |
540 | }, |
542 | self => { |
541 | self => { |
543 | other => "<self> licks himself - YUCK.", |
542 | other => "<self> licks G<him|her>self - YUCK.", |
544 | self => "You lick yourself.", |
543 | self => "You lick yourself.", |
545 | }, |
544 | }, |
546 | }, |
545 | }, |
547 | flip => { |
546 | flip => { |
548 | noparams => { |
547 | noparams => { |
… | |
… | |
554 | self => { |
553 | self => { |
555 | }, |
554 | }, |
556 | }, |
555 | }, |
557 | think => { |
556 | think => { |
558 | noparams => { |
557 | noparams => { |
559 | other => "<self> closes his eyes and thinks really hard.", |
558 | other => "<self> closes G<his|her> eyes and thinks really hard.", |
560 | self => "Anything in particular that you'd care to think about?", |
559 | self => "Anything in particular that you'd care to think about?", |
561 | }, |
560 | }, |
562 | params => { |
561 | params => { |
563 | }, |
562 | }, |
564 | self => { |
563 | self => { |
… | |
… | |
628 | target => "<self> cries on your shoulder.", |
627 | target => "<self> cries on your shoulder.", |
629 | other => "<self> cries on <other>'s shoulder.", |
628 | other => "<self> cries on <other>'s shoulder.", |
630 | self => "You cry on <other>'s shoulder.", |
629 | self => "You cry on <other>'s shoulder.", |
631 | }, |
630 | }, |
632 | self => { |
631 | self => { |
633 | other => "<self> sobs quietly to himself.", |
632 | other => "<self> sobs quietly to G<him|her>self.", |
634 | self => "You cry to yourself.", |
633 | self => "You cry to yourself.", |
635 | }, |
634 | }, |
636 | }, |
635 | }, |
637 | sulk => { |
636 | sulk => { |
638 | noparams => { |
637 | noparams => { |
… | |
… | |
652 | params => { |
651 | params => { |
653 | target => "<self> whistles at <other>.", |
652 | target => "<self> whistles at <other>.", |
654 | self => "You whistle at <other>.", |
653 | self => "You whistle at <other>.", |
655 | }, |
654 | }, |
656 | self => { |
655 | self => { |
657 | other => "<self> whistles to himself in boredom.", |
656 | other => "<self> whistles to G<him|her>self in boredom.", |
658 | self => "You whistle while you work.", |
657 | self => "You whistle while you work.", |
659 | }, |
658 | }, |
660 | }, |
659 | }, |
661 | groan => { |
660 | groan => { |
662 | noparams => { |
661 | noparams => { |
… | |
… | |
693 | }, |
692 | }, |
694 | }; |
693 | }; |
695 | |
694 | |
696 | for my $emotion (keys %$emotes) { |
695 | for my $emotion (keys %$emotes) { |
697 | cf::register_command $emotion => sub { |
696 | cf::register_command $emotion => sub { |
698 | my ($pl, $tname) = @_; |
697 | my ($ob, $tname) = @_; |
|
|
698 | |
|
|
699 | my $pl = $ob->contr; |
699 | |
700 | |
700 | cf::async { |
701 | cf::async { |
701 | my $name = $pl->name; |
702 | my $name = $ob->name; |
|
|
703 | $Coro::current->{desc} = "emote handler for $name"; |
702 | |
704 | |
703 | if ($tname eq $name) { |
705 | if ($tname eq $name) { |
704 | my $emote = $emotes->{$emotion}->{self}; |
706 | my %emote = %{ $emotes->{$emotion}->{self} || {} }; |
705 | |
707 | |
706 | $emote->{other} = "You look away from <self>." |
708 | $emote{other} ||= "You look away from <self>."; |
707 | if !$emote->{other}; |
|
|
708 | $emote->{self} = "My god! Is that LEGAL?" |
709 | $emote{self} ||= "My god! Is that LEGAL?"; |
709 | if !$emote->{self}; |
|
|
710 | |
710 | |
711 | $emote->{other} =~ s/<self>/$name/; |
711 | $emote{other} =~ s/<self>/$name/; |
|
|
712 | |
|
|
713 | $_ = $pl->expand_cfpod ($_) |
|
|
714 | for values %emote; |
712 | |
715 | |
|
|
716 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
713 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
717 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
714 | next |
|
|
715 | if $other->ob == $pl; |
|
|
716 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
717 | } |
|
|
718 | |
718 | |
719 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
719 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
720 | } elsif ($tname) { |
720 | } elsif ($tname) { |
721 | my $target = cf::player::find $tname |
721 | my $target = cf::player::find $tname |
722 | or return $pl->reply (undef, "$tname is not around."); |
722 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
723 | |
723 | |
724 | my $emote = $emotes->{$emotion}->{params}; |
724 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
725 | |
725 | |
726 | $emote->{other} = "<self> is eyeing <other> quizzically." |
726 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
727 | if !$emote->{other}; |
|
|
728 | $emote->{self} = "You are still nuts." |
727 | $emote{self} ||= "You are still nuts."; |
729 | if !$emote->{self}; |
|
|
730 | $emote->{target} = "You get the distinct feeling that <other> is nuts." |
728 | $emote{target} ||= "You get the distinct feeling that <self> is nuts."; |
731 | if !$emote->{target}; |
|
|
732 | |
729 | |
733 | $emote->{self} =~ s/<other>/$tname/; |
730 | $emote{self} =~ s/<other>/$tname/; |
734 | $emote->{target} =~ s/<self>/$name/; |
731 | $emote{target} =~ s/<self>/$name/; |
735 | $emote->{other} =~ s/<other>/$tname/; |
732 | $emote{other} =~ s/<other>/$tname/; |
736 | $emote->{other} =~ s/<self>/$name/; |
733 | $emote{other} =~ s/<self>/$name/; |
737 | |
734 | |
738 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
735 | $_ = $pl->expand_cfpod ($_) |
739 | next |
736 | for values %emote; |
740 | if $other->ob == $pl or $other == $target; |
|
|
741 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
742 | } |
|
|
743 | |
737 | |
744 | $target->ob->message ($emote->{target}, cf::NDI_GREY | cf::NDI_UNIQUE); |
738 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
745 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
739 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
|
|
740 | |
|
|
741 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_shout"; |
|
|
742 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
746 | } else { |
743 | } else { |
747 | my $emote = $emotes->{$emotion}->{noparams}; |
744 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
748 | $emote->{other} =~ s/<self>/$name/; |
|
|
749 | |
745 | |
750 | $emote->{other} = "<self> dances with glee." |
746 | $emote{other} ||= "<self> dances with glee."; |
751 | if !$emote->{other}; |
|
|
752 | $emote->{self} = "You are a nut." |
747 | $emote{self} ||= "You are a nut."; |
753 | if !$emote->{self}; |
|
|
754 | |
748 | |
|
|
749 | $emote{other} =~ s/<self>/$name/; |
|
|
750 | |
|
|
751 | $_ = $pl->expand_cfpod ($_) |
|
|
752 | for values %emote; |
|
|
753 | |
|
|
754 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
755 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
755 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
756 | next |
|
|
757 | if $other->ob == $pl; |
|
|
758 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
759 | } |
|
|
760 | |
756 | |
761 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
757 | $pl->send_msg ($cf::CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
762 | } |
758 | } |
763 | }; |
759 | }; |
764 | }; |
760 | }; |
765 | } |
761 | } |
766 | |
762 | |
767 | cf::register_command me => sub { |
763 | cf::register_command me => sub { |
768 | my ($pl, $msg) = @_; |
764 | my ($pl, $msg) = @_; |
769 | |
765 | |
770 | my $name = $pl->name; |
766 | my $name = $pl->name; |
771 | |
767 | |
772 | $_->ns->send_msg ($SAY_CHANNEL => "* $name $msg", cf::NDI_GREY, $_ == $pl ? (reply => 1) : ()) |
768 | send_msg $_, $cf::SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say" |
773 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
769 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
774 | }; |
770 | }; |
775 | |
771 | |
776 | cf::register_command say => sub { |
772 | cf::register_command say => sub { |
777 | my ($ob, $msg) = @_; |
773 | my ($ob, $msg) = @_; |
… | |
… | |
782 | |
778 | |
783 | if ($msg) { |
779 | if ($msg) { |
784 | my $name = $ob->name; |
780 | my $name = $ob->name; |
785 | my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; |
781 | my @plonmap = grep $ob->on_same_map_as ($_->ob), cf::player::list; |
786 | |
782 | |
787 | $_->ns->send_msg ($SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, $_ == $ob ? (reply => 1) : ()) |
783 | send_msg $_, $cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, "msg_say" |
788 | for @plonmap; |
784 | for grep $_ != $ob->contr, @plonmap; |
|
|
785 | $ob->contr->send_msg ($cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | cf::NDI_REPLY); |
789 | |
786 | |
790 | # npcs, magic_ears etc. |
787 | # npcs, magic_ears etc. |
791 | # first find all objects and their first-level inventories |
788 | # first find all objects and their first-level inventories |
792 | # within a 5x5 square that have something resembling |
789 | # within a 5x5 square that have something resembling |
793 | # dialogue or support on_say. |
790 | # dialogue or support on_say. |
794 | my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); |
791 | my ($map, $x, $y) = ($ob->map, $ob->x - 2, $ob->y - 2); |
795 | |
792 | |
796 | for my $npc ( |
793 | for my $npc ( |
797 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, |
794 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $ob->contr, $msg) && return) || $_->has_dialogue, |
798 | map +($_, $_->inv), |
795 | map +($_, $_->inv), |
799 | grep $_, |
796 | grep $_, |
800 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
797 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
801 | 0..24 |
798 | 0..24 |
802 | ) { |
799 | ) { |
… | |
… | |
807 | my ($reply, @kw) = $dialog->tell ($msg); |
804 | my ($reply, @kw) = $dialog->tell ($msg); |
808 | |
805 | |
809 | if (defined $reply) { |
806 | if (defined $reply) { |
810 | if ($npc->type == cf::MAGIC_EAR) { |
807 | if ($npc->type == cf::MAGIC_EAR) { |
811 | if (length $reply) { |
808 | if (length $reply) { |
812 | $_->ns->send_msg ($SAY_CHANNEL => $reply, cf::NDI_BROWN) |
809 | send_msg $_, $cf::SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" |
813 | for @plonmap; |
810 | for @plonmap; |
814 | } |
811 | } |
815 | $npc->use_trigger; |
812 | $npc->use_trigger; |
816 | } else { |
813 | } else { |
817 | if (length $reply) { |
814 | if (length $reply) { |
818 | $_->ns->send_msg ($SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN) |
815 | send_msg $_, $cf::SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" |
819 | for @plonmap; |
816 | for @plonmap; |
820 | } |
817 | } |
821 | } |
818 | } |
822 | } |
819 | } |
823 | |
820 | |
824 | if (@kw) { |
821 | if (@kw) { |
825 | $_->ns->send_msg ($SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) |
822 | $_->send_msg ($cf::SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) |
826 | for @plonmap; |
823 | for @plonmap; |
827 | } |
824 | } |
828 | } |
825 | } |
829 | |
826 | |
830 | } else { |
827 | } else { |
831 | $ob->contr->ns->send_msg ($SAY_CHANNEL => "What do you want to say?", 0, reply => 1); |
828 | $ob->send_msg ($cf::SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY); |
832 | } |
829 | } |
833 | }; |
830 | }; |
834 | |
831 | |
835 | cf::register_command chat => sub { |
832 | cf::register_command chat => sub { |
836 | my ($ob, $msg) = @_; |
833 | my ($ob, $msg) = @_; |
… | |
… | |
846 | my $NOW = time; |
843 | my $NOW = time; |
847 | |
844 | |
848 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
845 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
849 | send_irc ("[%s] %s", $name, $msg); |
846 | send_irc ("[%s] %s", $name, $msg); |
850 | |
847 | |
851 | $_->ns->send_msg ($CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE, $_ == $pl ? (reply => 1) : ()) |
848 | send_msg $_, $cf::CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" |
852 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
849 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
853 | |
850 | |
854 | } else { |
851 | } else { |
855 | $pl->ns->send_msg ($CHAT_CHANNEL => "Chat what?"); |
852 | $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
856 | } |
853 | } |
857 | }; |
854 | }; |
858 | |
855 | |
859 | cf::register_command shout => sub { |
856 | cf::register_command shout => sub { |
860 | my ($ob, $msg) = @_; |
857 | my ($ob, $msg) = @_; |
… | |
… | |
870 | my $name = $ob->name; |
867 | my $name = $ob->name; |
871 | |
868 | |
872 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
869 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
873 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
870 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
874 | |
871 | |
875 | $_->ns->send_msg ($CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED, $_ == $pl ? (reply => 1) : ()) |
872 | send_msg $_, $cf::CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout" |
876 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
873 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
877 | |
874 | |
878 | } else { |
875 | } else { |
879 | $pl->ns->send_msg ($CHAT_CHANNEL => "Shout what?"); |
876 | $pl->send_msg ($cf::CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
880 | } |
877 | } |
881 | }; |
878 | }; |
882 | |
879 | |
883 | cf::register_command tell => sub { |
880 | cf::register_command tell => sub { |
884 | my ($ob, $args) = @_; |
881 | my ($ob, $args) = @_; |
… | |
… | |
891 | or return; |
888 | or return; |
892 | my $name = $ob->name; |
889 | my $name = $ob->name; |
893 | |
890 | |
894 | return if $pl->invoke (cf::EVENT_PLAYER_TELL, $target, $msg); |
891 | return if $pl->invoke (cf::EVENT_PLAYER_TELL, $target, $msg); |
895 | |
892 | |
896 | my $pl_channel = { |
893 | my $pl_channel = tell_channel $target; |
897 | id => "tell-$target", |
|
|
898 | title => "$target", |
|
|
899 | reply => "tell $target ", |
|
|
900 | tooltip => "Private messages from/to $target", |
|
|
901 | }; |
|
|
902 | |
894 | |
903 | if ($target =~ /irc\//) { |
895 | if ($target =~ /irc\//) { |
904 | my (undef, $nick) = split /\//, $target, 2; |
896 | my (undef, $nick) = split /\//, $target, 2; |
905 | $ns->send_msg ($pl_channel => "You tell $target: $args", reply => 1); |
897 | $ns->send_msg ($pl_channel => "You tell $target: $args", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
906 | send_irc ("(%s) %s: %s\n", $name, $nick, $msg); |
898 | send_irc ("(%s) %s: %s\n", $name, $nick, $msg); |
|
|
899 | |
907 | } elsif (my $other = cf::player::find_active $target) { |
900 | } elsif (my $other = cf::player::find_active $target) { |
908 | my $other_channel = { |
901 | my $other_channel = tell_channel $name; |
909 | id => "tell-$name", |
|
|
910 | title => "$name", |
|
|
911 | reply => "tell $name ", |
|
|
912 | tooltip => "Private messages from/to $name", |
|
|
913 | }; |
|
|
914 | |
902 | |
915 | if ($msg) { |
903 | if ($msg) { |
916 | if ($target eq $name) { |
904 | if ($target eq $name) { |
917 | $ns->send_msg ($pl_channel => "You are talking to yourself, you freak!", reply => 1); |
905 | $ns->send_msg ($pl_channel => "You are talking to yourself, you freak!", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
918 | } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { |
906 | } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { |
919 | $ns->send_msg ($pl_channel => "$target ignores what you say. Give up on it.", reply => 1); |
907 | $ns->send_msg ($pl_channel => "$target ignores what you say. Give up on it.", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
920 | } else { |
908 | } else { |
921 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg); |
909 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl, $msg); |
922 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
910 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
923 | |
911 | |
924 | $ns->send_msg ($pl_channel => "You tell $target: $msg", reply => 1); |
912 | $ns->send_msg ($pl_channel => "You tell $target: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
925 | $other->ns->send_msg ($other_channel => "$name tells you: $msg"); |
913 | send_msg $other, $other_channel => "$name tells you: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF, "msg_tell"; |
926 | } |
914 | } |
927 | } else { |
915 | } else { |
928 | $ns->send_msg ($pl_channel => "What do you want to tell $target?"); |
916 | $ns->send_msg ($pl_channel => "What do you want to tell $target?", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
929 | } |
917 | } |
930 | |
918 | |
931 | } else { |
919 | } else { |
932 | $ns->send_msg ($pl_channel => "No such player. Your message: $msg"); |
920 | $ns->send_msg ($pl_channel => "No such player. Your message: $msg", cf::NDI_DK_ORANGE | cf::NDI_DEF | cf::NDI_REPLY); |
933 | } |
921 | } |
934 | }; |
922 | }; |
935 | |
923 | |
936 | cf::register_command ignore => sub { |
924 | cf::register_command ignore => sub { |
937 | my ($pl, $args) = @_; |
925 | my ($pl, $args) = @_; |
… | |
… | |
940 | if ($args eq "list") { |
928 | if ($args eq "list") { |
941 | clean_timeouts $pl; |
929 | clean_timeouts $pl; |
942 | |
930 | |
943 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
931 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
944 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
932 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
945 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); |
933 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
946 | $pl->message ((join ", ", @ignored_tell), cf::NDI_UNIQUE); |
934 | $pl->message ((join ", ", @ignored_tell), cf::NDI_REPLY); |
947 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); |
935 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
948 | $pl->message ((join ", ", @ignored_shout), cf::NDI_UNIQUE); |
936 | $pl->message ((join ", ", @ignored_shout), cf::NDI_REPLY); |
949 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_UNIQUE); |
937 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_REPLY); |
950 | } else { |
938 | } else { |
951 | $pl->message ("Not ignoring anyone", cf::NDI_UNIQUE); |
939 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
952 | } |
940 | } |
953 | |
941 | |
954 | } elsif ($target && $type) { |
942 | } elsif ($target && $type) { |
955 | |
943 | |
956 | $timeout ne "" or $timeout = 24; |
944 | $timeout ne "" or $timeout = 24; |
957 | my $absolute_timeout = time + $timeout * 3600; |
945 | my $absolute_timeout = time + $timeout * 3600; |
958 | |
946 | |
959 | if (cf::player::exists $target) { |
947 | if (cf::player::exists $target) { |
960 | if ($type eq "tell") { |
948 | if ($type eq "tell") { |
961 | $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_UNIQUE); |
949 | $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_REPLY); |
962 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
950 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
963 | } elsif ($type eq "shout") { |
951 | } elsif ($type eq "shout") { |
964 | $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_UNIQUE); |
952 | $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_REPLY); |
965 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
953 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
966 | } elsif ($type eq "all") { |
954 | } elsif ($type eq "all") { |
967 | $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_UNIQUE); |
955 | $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_REPLY); |
968 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
956 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
969 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
957 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
970 | } else { |
958 | } else { |
971 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); |
959 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
972 | } |
960 | } |
973 | } else { |
961 | } else { |
974 | $pl->message ("No such player: $target", cf::NDI_UNIQUE); |
962 | $pl->message ("No such player: $target", cf::NDI_REPLY); |
975 | } |
963 | } |
976 | |
964 | |
977 | } else { |
965 | } else { |
978 | $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
966 | $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
979 | . "will ignore a player for <timeout> hours.\n" |
967 | . "will ignore a player for <timeout> hours.\n" |
980 | . "Usage: ignore list\n" |
968 | . "Usage: ignore list\n" |
981 | . "will show you a list of players currently ignored.", cf::NDI_UNIQUE); |
969 | . "will show you a list of players currently ignored.", cf::NDI_REPLY); |
982 | } |
970 | } |
983 | }; |
971 | }; |
984 | |
972 | |
985 | cf::register_command unignore => sub { |
973 | cf::register_command unignore => sub { |
986 | my ($pl, $args) = @_; |
974 | my ($pl, $args) = @_; |
987 | my ($target, $type) = split /\s+/, $args; |
975 | my ($target, $type) = split /\s+/, $args; |
988 | |
976 | |
989 | if ($args eq "") { |
977 | if ($args eq "") { |
990 | if ($pl->{ext_ignore_tell}) { |
978 | if ($pl->{ext_ignore_tell}) { |
991 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); |
979 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_REPLY); |
992 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_UNIQUE); |
980 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_REPLY); |
993 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); |
981 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_REPLY); |
994 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_UNIQUE); |
982 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_REPLY); |
995 | } else { |
983 | } else { |
996 | $pl->message ("Not ignoring anyone", cf::NDI_UNIQUE); |
984 | $pl->message ("Not ignoring anyone", cf::NDI_REPLY); |
997 | } |
985 | } |
998 | } else { |
986 | } else { |
999 | if (cf::player::exists $target) { |
987 | if (cf::player::exists $target) { |
1000 | if ($type eq "tell") { |
988 | if ($type eq "tell") { |
1001 | $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_UNIQUE); |
989 | $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_REPLY); |
1002 | delete $pl->{ext_ignore_tell} {$target}; |
990 | delete $pl->{ext_ignore_tell} {$target}; |
1003 | } elsif ($type eq "shout") { |
991 | } elsif ($type eq "shout") { |
1004 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_UNIQUE); |
992 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_REPLY); |
1005 | delete $pl->{ext_ignore_shout}{$target}; |
993 | delete $pl->{ext_ignore_shout}{$target}; |
1006 | } elsif ($type eq "all") { |
994 | } elsif ($type eq "all") { |
1007 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_UNIQUE); |
995 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_REPLY); |
1008 | delete $pl->{ext_ignore_tell} {$target}; |
996 | delete $pl->{ext_ignore_tell} {$target}; |
1009 | delete $pl->{ext_ignore_shout}{$target}; |
997 | delete $pl->{ext_ignore_shout}{$target}; |
1010 | } else { |
998 | } else { |
1011 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); |
999 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_REPLY); |
1012 | } |
1000 | } |
1013 | } else { |
1001 | } else { |
1014 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); |
1002 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_REPLY); |
1015 | } |
1003 | } |
1016 | } |
1004 | } |
1017 | }; |
1005 | }; |
1018 | |
1006 | |