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 | { |
… | |
… | |
70 | on_login => sub { |
56 | on_login => sub { |
71 | my ($pl) = @_; |
57 | my ($pl) = @_; |
72 | |
58 | |
73 | clean_timeouts $pl->ob; |
59 | clean_timeouts $pl->ob; |
74 | |
60 | |
75 | $pl->send_msg ($SAY_CHANNEL); |
61 | $pl->send_msg ($cf::SAY_CHANNEL); |
76 | $pl->send_msg ($CHAT_CHANNEL); |
62 | $pl->send_msg ($cf::CHAT_CHANNEL); |
77 | }, |
63 | }, |
78 | ); |
64 | ); |
79 | |
65 | |
|
|
66 | # TODO: remove once safe |
80 | cf::register_command listen => sub { |
67 | cf::register_command listen => sub { |
81 | my ($pl, $msg) = @_; |
|
|
82 | my $player = cf::player::find_active $pl->name; |
|
|
83 | |
|
|
84 | if ($msg ne "") { |
|
|
85 | $msg = 10 if $msg > 10; |
|
|
86 | |
|
|
87 | my $prev_listen = $player->listening; |
|
|
88 | $player->listening ($msg); |
|
|
89 | if ($prev_listen == $player->listening) { |
|
|
90 | $pl->message ("Your verbose level stays at $prev_listen.", cf::NDI_REPLY); |
|
|
91 | } else { |
|
|
92 | $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_REPLY); |
|
|
93 | } |
|
|
94 | } else { |
|
|
95 | $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_REPLY); |
|
|
96 | } |
|
|
97 | }; |
68 | }; |
98 | |
69 | |
99 | cf::register_command cointoss => sub { |
70 | cf::register_command cointoss => sub { |
100 | my ($ob, $msg) = @_; |
71 | my ($ob, $msg) = @_; |
101 | |
72 | |
102 | my $pl = $ob->contr; |
73 | my $pl = $ob->contr; |
103 | my $name = $ob->name; |
74 | my $name = $ob->name; |
104 | |
75 | |
105 | my $coin = int rand 2 ? "Heads" : "Tails"; |
76 | my $coin = int rand 2 ? "Heads" : "Tails"; |
106 | |
77 | |
107 | send_msg $_, $SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" |
78 | send_msg $_, $cf::SAY_CHANNEL => "$name flips a coin.... $coin!", cf::NDI_GREY, "msg_say" |
108 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
79 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
109 | |
80 | |
110 | $pl->send_msg ($SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
81 | $pl->send_msg ($cf::SAY_CHANNEL => "You flip a coin.... $coin!", cf::NDI_GREY | cf::NDI_REPLY); |
111 | }; |
82 | }; |
112 | |
83 | |
113 | cf::register_command orcknuckle => sub { |
84 | cf::register_command orcknuckle => sub { |
114 | my ($ob, $msg) = @_; |
85 | my ($ob, $msg) = @_; |
115 | |
86 | |
… | |
… | |
118 | |
89 | |
119 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
90 | my @orcknuckle = ("beholder", "ghost", "knight", "princess", "dragon", "orc"); |
120 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
91 | my ($i, $j, $k, $l) = (rand 5, rand 5, rand 5, rand 6); |
121 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
92 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
122 | |
93 | |
123 | send_msg $_, $SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" |
94 | send_msg $_, $cf::SAY_CHANNEL => "$name throws his orc-knuckles and rolls $result!", cf::NDI_GREY, "msg_say" |
124 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
95 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl} cf::player::list; |
125 | |
96 | |
126 | $pl->send_msg ($SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
97 | $pl->send_msg ($cf::SAY_CHANNEL => "You roll $result!", cf::NDI_GREY | cf::NDI_REPLY); |
127 | }; |
98 | }; |
128 | |
99 | |
129 | my $emotes = { |
100 | my $emotes = { |
130 | growl => { |
101 | growl => { |
131 | noparams => { |
102 | noparams => { |
… | |
… | |
177 | self => { |
148 | self => { |
178 | }, |
149 | }, |
179 | }, |
150 | }, |
180 | scream => { |
151 | scream => { |
181 | noparams => { |
152 | noparams => { |
182 | other => "<self> screams at the top of his lungs!", |
153 | other => "<self> screams at the top of G<his|her> lungs!", |
183 | self => "ARRRRRRRRRRGH!!!!!", |
154 | self => "ARRRRRRRRRRGH!!!!!", |
184 | }, |
155 | }, |
185 | params => { |
156 | params => { |
186 | }, |
157 | }, |
187 | self => { |
158 | self => { |
… | |
… | |
196 | target => "<self> pukes on your clothes!", |
167 | target => "<self> pukes on your clothes!", |
197 | other => "<self> pukes on <other>.", |
168 | other => "<self> pukes on <other>.", |
198 | self => "You puke on <other>.", |
169 | self => "You puke on <other>.", |
199 | }, |
170 | }, |
200 | self => { |
171 | self => { |
201 | other => "<self> pukes on his clothes.", |
172 | other => "<self> pukes on G<his|her> clothes.", |
202 | self => "You puke on yourself.", |
173 | self => "You puke on yourself.", |
203 | }, |
174 | }, |
204 | }, |
175 | }, |
205 | strut => { |
176 | strut => { |
206 | noparams => { |
177 | noparams => { |
… | |
… | |
255 | self => "You kiss <other>.", |
226 | self => "You kiss <other>.", |
256 | }, |
227 | }, |
257 | self => { |
228 | self => { |
258 | }, |
229 | }, |
259 | }, |
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 | }, |
260 | wink => { |
244 | wink => { |
261 | noparams => { |
245 | noparams => { |
262 | other => "<self> winks suggestively.", |
246 | other => "<self> winks suggestively.", |
263 | self => "Have you got something in your eye?", |
247 | self => "Have you got something in your eye?", |
264 | }, |
248 | }, |
… | |
… | |
266 | target => "<self> winks at you.", |
250 | target => "<self> winks at you.", |
267 | other => "<self> winks at <other>.", |
251 | other => "<self> winks at <other>.", |
268 | self => "You wink suggestively at <other>.", |
252 | self => "You wink suggestively at <other>.", |
269 | }, |
253 | }, |
270 | self => { |
254 | self => { |
271 | other => "<self> winks at himself - something strange is going on...", |
255 | other => "<self> winks at G<him|her>self - something strange is going on...", |
272 | self => "You wink at yourself?? What are you up to?", |
256 | self => "You wink at yourself?? What are you up to?", |
273 | }, |
257 | }, |
274 | }, |
258 | }, |
275 | pout => { |
259 | pout => { |
276 | noparams => { |
260 | noparams => { |
… | |
… | |
282 | self => { |
266 | self => { |
283 | }, |
267 | }, |
284 | }, |
268 | }, |
285 | cackle => { |
269 | cackle => { |
286 | noparams => { |
270 | noparams => { |
287 | 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!", |
288 | self => "You cackle gleefully.", |
272 | self => "You cackle gleefully.", |
289 | }, |
273 | }, |
290 | params => { |
274 | params => { |
291 | }, |
275 | }, |
292 | self => { |
276 | self => { |
… | |
… | |
301 | target => "<self> sniffs you.", |
285 | target => "<self> sniffs you.", |
302 | other => "<self> sniffs <other>", |
286 | other => "<self> sniffs <other>", |
303 | self => "You sniff <other>.", |
287 | self => "You sniff <other>.", |
304 | }, |
288 | }, |
305 | self => { |
289 | self => { |
306 | other => "<self> sniffs himself.", |
290 | other => "<self> sniffs G<him|her>self.", |
307 | self => "You sniff yourself.", |
291 | self => "You sniff yourself.", |
308 | }, |
292 | }, |
309 | }, |
293 | }, |
310 | nod => { |
294 | nod => { |
311 | noparams => { |
295 | noparams => { |
312 | other => "<self> nods solemnly.", |
296 | other => "<self> nods solemnly.", |
313 | self => "You nod solemnly.", |
297 | self => "You nod solemnly.", |
314 | }, |
298 | }, |
315 | params => { |
299 | params => { |
316 | target => "<self> nods solemnly to you.", |
300 | target => "<self> nods solemnly at you.", |
317 | other => "<self> nods solemnly to <other>.", |
301 | other => "<self> nods solemnly at <other>.", |
318 | self => "You nod solemnly to <other>.", |
302 | self => "You nod solemnly at <other>.", |
319 | }, |
303 | }, |
320 | self => { |
304 | self => { |
321 | }, |
305 | }, |
322 | }, |
306 | }, |
323 | frown => { |
307 | frown => { |
… | |
… | |
329 | target => "<self> frowns darkly at you.", |
313 | target => "<self> frowns darkly at you.", |
330 | other => "<self> frowns darkly at <other>.", |
314 | other => "<self> frowns darkly at <other>.", |
331 | self => "You frown darkly at <other>.", |
315 | self => "You frown darkly at <other>.", |
332 | }, |
316 | }, |
333 | self => { |
317 | self => { |
334 | other => "<self> frowns at himself.", |
318 | other => "<self> frowns at G<him|her>self.", |
335 | self => "You frown at yourself.", |
319 | self => "You frown at yourself.", |
336 | }, |
320 | }, |
337 | }, |
321 | }, |
338 | snicker => { |
322 | snicker => { |
339 | noparams => { |
323 | noparams => { |
… | |
… | |
362 | noparams => { |
346 | noparams => { |
363 | 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?", |
364 | self => "You bleed all over your nice new armour.", |
348 | self => "You bleed all over your nice new armour.", |
365 | }, |
349 | }, |
366 | params => { |
350 | params => { |
367 | target => "<self> slashes his wrist and bleeds all over you.", |
351 | target => "<self> slashes G<his|her> wrist and bleeds all over you.", |
368 | other => "<self> slashes his wrist and bleeds all over <other>.", |
352 | other => "<self> slashes G<his|her> wrist and bleeds all over <other>.", |
369 | self => "You slash your wrist and bleed all over <other>", |
353 | self => "You slash your wrist and bleed all over <other>", |
370 | }, |
354 | }, |
371 | self => { |
355 | self => { |
372 | 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.", |
373 | self => "Very impressive! You wipe your blood all over yourself.", |
357 | self => "Very impressive! You wipe your blood all over yourself.", |
374 | }, |
358 | }, |
375 | }, |
359 | }, |
376 | twiddle => { |
360 | twiddle => { |
377 | noparams => { |
361 | noparams => { |
378 | other => "<self> patiently twiddles his thumbs.", |
362 | other => "<self> patiently twiddles G<his|her> thumbs.", |
379 | self => "You patiently twiddle your thumbs.", |
363 | self => "You patiently twiddle your thumbs.", |
380 | }, |
364 | }, |
381 | params => { |
365 | params => { |
382 | }, |
366 | }, |
383 | self => { |
367 | self => { |
384 | }, |
368 | }, |
385 | }, |
369 | }, |
386 | spit => { |
370 | spit => { |
387 | noparams => { |
371 | noparams => { |
388 | other => "<self> spits over his left shoulder.", |
372 | other => "<self> spits over G<his|her> left shoulder.", |
389 | self => "You spit over your left shoulder.", |
373 | self => "You spit over your left shoulder.", |
390 | }, |
374 | }, |
391 | params => { |
375 | params => { |
392 | target => "<self> spits in your face!", |
376 | target => "<self> spits in your face!", |
393 | other => "<self> spits in <other>'s face.", |
377 | other => "<self> spits in <other>'s face.", |
394 | self => "You spit on <other>.", |
378 | self => "You spit on <other>.", |
395 | }, |
379 | }, |
396 | self => { |
380 | self => { |
397 | other => "<self> drools all over himself.", |
381 | other => "<self> drools all over G<him|her>self.", |
398 | self => "You drool all over yourself.", |
382 | self => "You drool all over yourself.", |
399 | }, |
383 | }, |
400 | }, |
384 | }, |
401 | glare => { |
385 | glare => { |
402 | noparams => { |
386 | noparams => { |
403 | other => "<self> glares around him.", |
387 | other => "<self> glares around G<him|her>.", |
404 | self => "You glare at nothing in particular.", |
388 | self => "You glare at nothing in particular.", |
405 | }, |
389 | }, |
406 | params => { |
390 | params => { |
407 | 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.", |
408 | other => "<self> glares at <other>.", |
392 | other => "<self> glares at <other>.", |
409 | self => "You glare icily at <other>.", |
393 | self => "You glare icily at <other>.", |
410 | }, |
394 | }, |
411 | self => { |
395 | self => { |
412 | 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>?", |
413 | 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.", |
414 | }, |
398 | }, |
415 | }, |
399 | }, |
416 | bow => { |
400 | bow => { |
417 | noparams => { |
401 | noparams => { |
… | |
… | |
422 | target => "<self> bows before you.", |
406 | target => "<self> bows before you.", |
423 | other => "<self> bows before <other>.", |
407 | other => "<self> bows before <other>.", |
424 | self => "You bow before <other>.", |
408 | self => "You bow before <other>.", |
425 | }, |
409 | }, |
426 | self => { |
410 | self => { |
427 | 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.", |
428 | self => "You kiss your toes.", |
412 | self => "You kiss your toes.", |
429 | }, |
413 | }, |
430 | }, |
414 | }, |
431 | dance => { |
415 | dance => { |
432 | noparams => { |
416 | noparams => { |
433 | other => "<self> expresses himself through interpretive dance.", |
417 | other => "<self> expresses G<him|her>self through interpretive dance.", |
434 | self => "You dance with glee.", |
418 | self => "You dance with glee.", |
435 | }, |
419 | }, |
436 | params => { |
420 | params => { |
437 | target => "<self> grabs you, and begins dancing!", |
421 | target => "<self> grabs you, and begins dancing!", |
438 | other => "Yipe! <self> and <other> are doing the Macarena!", |
422 | other => "Yipe! <self> and <other> are doing the Macarena!", |
439 | self => "You grab <other> and begin doing the Cha-Cha!", |
423 | self => "You grab <other> and begin doing the Cha-Cha!", |
440 | }, |
424 | }, |
441 | self => { |
425 | self => { |
442 | other => "<self> embraces himself and begins to dance!", |
426 | other => "<self> embraces G<him|her>self and begins to dance!", |
443 | self => "You skip and dance around by yourself.", |
427 | self => "You skip and dance around by yourself.", |
444 | }, |
428 | }, |
445 | }, |
429 | }, |
446 | snore => { |
430 | snore => { |
447 | noparams => { |
431 | noparams => { |
… | |
… | |
463 | self => { |
447 | self => { |
464 | }, |
448 | }, |
465 | }, |
449 | }, |
466 | snap => { |
450 | snap => { |
467 | noparams => { |
451 | noparams => { |
468 | other => "<self> snaps his fingers.", |
452 | other => "<self> snaps G<his|her> fingers.", |
469 | self => "PRONTO! you snap your fingers.", |
453 | self => "PRONTO! you snap your fingers.", |
470 | }, |
454 | }, |
471 | params => { |
455 | params => { |
472 | }, |
456 | }, |
473 | self => { |
457 | self => { |
… | |
… | |
482 | target => "<self> waves goodbye to you. Have a good journey.", |
466 | target => "<self> waves goodbye to you. Have a good journey.", |
483 | other => "<self> waves goodbye to <other>.", |
467 | other => "<self> waves goodbye to <other>.", |
484 | self => "You wave goodbye to <other>.", |
468 | self => "You wave goodbye to <other>.", |
485 | }, |
469 | }, |
486 | self => { |
470 | self => { |
487 | other => "<self> waves goodbye to himself.", |
471 | other => "<self> waves goodbye to G<him|her>self.", |
488 | self => "Are you going on adventures as well??", |
472 | self => "Are you going on adventures as well??", |
489 | }, |
473 | }, |
490 | }, |
474 | }, |
491 | smile => { |
475 | smile => { |
492 | noparams => { |
476 | noparams => { |
… | |
… | |
506 | other => "<self> sneezes.", |
490 | other => "<self> sneezes.", |
507 | self => "Gesundheit!", |
491 | self => "Gesundheit!", |
508 | }, |
492 | }, |
509 | params => { |
493 | params => { |
510 | 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.", |
511 | 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>.", |
512 | 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>.", |
513 | }, |
497 | }, |
514 | self => { |
498 | self => { |
515 | other => "<self> sneezes, and covers himself in a slimy substance.", |
499 | other => "<self> sneezes, and covers G<him|her>self in a slimy substance.", |
516 | self => "You sneeze on yourself, what a mess!", |
500 | self => "You sneeze on yourself, what a mess!", |
517 | }, |
501 | }, |
518 | }, |
502 | }, |
519 | bounce => { |
503 | bounce => { |
520 | noparams => { |
504 | noparams => { |
… | |
… | |
529 | self => { |
513 | self => { |
530 | }, |
514 | }, |
531 | }, |
515 | }, |
532 | shake => { |
516 | shake => { |
533 | noparams => { |
517 | noparams => { |
534 | other => "<self> shakes his head.", |
518 | other => "<self> shakes G<his|her> head.", |
535 | self => "You shake your head.", |
519 | self => "You shake your head.", |
536 | }, |
520 | }, |
537 | params => { |
521 | params => { |
538 | target => "<self> shakes your hand.", |
522 | target => "<self> shakes your hand.", |
539 | other => "<self> shakes <other>'s hand.", |
523 | other => "<self> shakes <other>'s hand.", |
… | |
… | |
544 | self => "You are shaken by yourself.", |
528 | self => "You are shaken by yourself.", |
545 | }, |
529 | }, |
546 | }, |
530 | }, |
547 | lick => { |
531 | lick => { |
548 | noparams => { |
532 | noparams => { |
549 | other => "<self> licks his mouth and smiles.", |
533 | other => "<self> licks G<his|her> mouth and smiles.", |
550 | self => "You lick your mouth and smile.", |
534 | self => "You lick your mouth and smile.", |
551 | }, |
535 | }, |
552 | params => { |
536 | params => { |
553 | target => "<self> licks you.", |
537 | target => "<self> licks you.", |
554 | other => "<self> licks <other>.", |
538 | other => "<self> licks <other>.", |
555 | self => "You lick <other>.", |
539 | self => "You lick <other>.", |
556 | }, |
540 | }, |
557 | self => { |
541 | self => { |
558 | other => "<self> licks himself - YUCK.", |
542 | other => "<self> licks G<him|her>self - YUCK.", |
559 | self => "You lick yourself.", |
543 | self => "You lick yourself.", |
560 | }, |
544 | }, |
561 | }, |
545 | }, |
562 | flip => { |
546 | flip => { |
563 | noparams => { |
547 | noparams => { |
… | |
… | |
569 | self => { |
553 | self => { |
570 | }, |
554 | }, |
571 | }, |
555 | }, |
572 | think => { |
556 | think => { |
573 | noparams => { |
557 | noparams => { |
574 | other => "<self> closes his eyes and thinks really hard.", |
558 | other => "<self> closes G<his|her> eyes and thinks really hard.", |
575 | self => "Anything in particular that you'd care to think about?", |
559 | self => "Anything in particular that you'd care to think about?", |
576 | }, |
560 | }, |
577 | params => { |
561 | params => { |
578 | }, |
562 | }, |
579 | self => { |
563 | self => { |
… | |
… | |
643 | target => "<self> cries on your shoulder.", |
627 | target => "<self> cries on your shoulder.", |
644 | other => "<self> cries on <other>'s shoulder.", |
628 | other => "<self> cries on <other>'s shoulder.", |
645 | self => "You cry on <other>'s shoulder.", |
629 | self => "You cry on <other>'s shoulder.", |
646 | }, |
630 | }, |
647 | self => { |
631 | self => { |
648 | other => "<self> sobs quietly to himself.", |
632 | other => "<self> sobs quietly to G<him|her>self.", |
649 | self => "You cry to yourself.", |
633 | self => "You cry to yourself.", |
650 | }, |
634 | }, |
651 | }, |
635 | }, |
652 | sulk => { |
636 | sulk => { |
653 | noparams => { |
637 | noparams => { |
… | |
… | |
667 | params => { |
651 | params => { |
668 | target => "<self> whistles at <other>.", |
652 | target => "<self> whistles at <other>.", |
669 | self => "You whistle at <other>.", |
653 | self => "You whistle at <other>.", |
670 | }, |
654 | }, |
671 | self => { |
655 | self => { |
672 | other => "<self> whistles to himself in boredom.", |
656 | other => "<self> whistles to G<him|her>self in boredom.", |
673 | self => "You whistle while you work.", |
657 | self => "You whistle while you work.", |
674 | }, |
658 | }, |
675 | }, |
659 | }, |
676 | groan => { |
660 | groan => { |
677 | noparams => { |
661 | noparams => { |
… | |
… | |
723 | |
707 | |
724 | $emote{other} ||= "You look away from <self>."; |
708 | $emote{other} ||= "You look away from <self>."; |
725 | $emote{self} ||= "My god! Is that LEGAL?"; |
709 | $emote{self} ||= "My god! Is that LEGAL?"; |
726 | |
710 | |
727 | $emote{other} =~ s/<self>/$name/; |
711 | $emote{other} =~ s/<self>/$name/; |
|
|
712 | |
|
|
713 | $_ = $pl->expand_cfpod ($_) |
|
|
714 | for values %emote; |
728 | |
715 | |
729 | send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
716 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
730 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
717 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $ob} cf::player::list; |
731 | |
718 | |
732 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
719 | $pl->send_msg ($emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
733 | } elsif ($tname) { |
720 | } elsif ($tname) { |
734 | my $target = cf::player::find $tname |
721 | my $target = cf::player::find $tname |
735 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
722 | or return send_msg $pl, tell_channel $tname, "$tname is not around.", cf::NDI_DK_ORANGE | cf::NDI_REPLY, "msg_chat"; |
736 | |
723 | |
737 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
724 | my %emote = %{ $emotes->{$emotion}->{params} || {} }; |
738 | |
725 | |
739 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
726 | $emote{other} ||= "<self> is eyeing <other> quizzically."; |
740 | $emote{self} ||= "You are still nuts."; |
727 | $emote{self} ||= "You are still nuts."; |
741 | $emote{target} ||= "You get the distinct feeling that <other> is nuts."; |
728 | $emote{target} ||= "You get the distinct feeling that <self> is nuts."; |
742 | |
729 | |
743 | $emote{self} =~ s/<other>/$tname/; |
730 | $emote{self} =~ s/<other>/$tname/; |
744 | $emote{target} =~ s/<self>/$name/; |
731 | $emote{target} =~ s/<self>/$name/; |
745 | $emote{other} =~ s/<other>/$tname/; |
732 | $emote{other} =~ s/<other>/$tname/; |
746 | $emote{other} =~ s/<self>/$name/; |
733 | $emote{other} =~ s/<self>/$name/; |
747 | |
734 | |
|
|
735 | $_ = $pl->expand_cfpod ($_) |
|
|
736 | for values %emote; |
|
|
737 | |
748 | send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
738 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
749 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
739 | for grep { $_ != $pl && $_ != $target && $ob->on_same_map_as ($_->ob) } cf::player::list; |
750 | |
740 | |
751 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY, "msg_shout"; |
741 | send_msg $target, tell_channel $name, $emote{target}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_shout"; |
752 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
742 | $pl->send_msg (tell_channel $tname, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
753 | } else { |
743 | } else { |
754 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
744 | my %emote = %{ $emotes->{$emotion}->{noparams} || {} }; |
755 | |
745 | |
756 | $emote{other} ||= "<self> dances with glee."; |
746 | $emote{other} ||= "<self> dances with glee."; |
757 | $emote{self} ||= "You are a nut."; |
747 | $emote{self} ||= "You are a nut."; |
758 | |
748 | |
759 | $emote{other} =~ s/<self>/$name/; |
749 | $emote{other} =~ s/<self>/$name/; |
760 | |
750 | |
|
|
751 | $_ = $pl->expand_cfpod ($_) |
|
|
752 | for values %emote; |
|
|
753 | |
761 | send_msg $_, $CHAT_CHANNEL, $emote{other}, cf::NDI_GREY, "msg_chat" |
754 | send_msg $_, $cf::CHAT_CHANNEL, $emote{other}, cf::NDI_GREY | cf::NDI_VERBATIM, "msg_chat" |
762 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
755 | for grep { $ob->on_same_map_as ($_->ob) && $_ != $pl } cf::player::list; |
763 | |
756 | |
764 | $pl->send_msg ($CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY); |
757 | $pl->send_msg ($cf::CHAT_CHANNEL, $emote{self}, cf::NDI_GREY | cf::NDI_REPLY | cf::NDI_VERBATIM); |
765 | } |
758 | } |
766 | }; |
759 | }; |
767 | }; |
760 | }; |
768 | } |
761 | } |
769 | |
762 | |
770 | cf::register_command me => sub { |
763 | cf::register_command me => sub { |
771 | my ($pl, $msg) = @_; |
764 | my ($pl, $msg) = @_; |
772 | |
765 | |
773 | my $name = $pl->name; |
766 | my $name = $pl->name; |
774 | |
767 | |
775 | send_msg $pl, $SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say" |
768 | send_msg $_, $cf::SAY_CHANNEL => "* $name $msg", cf::NDI_GREY | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_say" |
776 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
769 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
777 | }; |
770 | }; |
778 | |
771 | |
779 | cf::register_command say => sub { |
772 | cf::register_command say => sub { |
780 | my ($ob, $msg) = @_; |
773 | my ($ob, $msg) = @_; |
… | |
… | |
785 | |
778 | |
786 | if ($msg) { |
779 | if ($msg) { |
787 | my $name = $ob->name; |
780 | my $name = $ob->name; |
788 | 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; |
789 | |
782 | |
790 | send_msg $_, $SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY | ($_ == $ob->contr ? cf::NDI_REPLY : 0), "msg_say" |
783 | send_msg $_, $cf::SAY_CHANNEL => "$name says: $msg", cf::NDI_GREY, "msg_say" |
791 | 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); |
792 | |
786 | |
793 | # npcs, magic_ears etc. |
787 | # npcs, magic_ears etc. |
794 | # first find all objects and their first-level inventories |
788 | # first find all objects and their first-level inventories |
795 | # within a 5x5 square that have something resembling |
789 | # within a 5x5 square that have something resembling |
796 | # dialogue or support on_say. |
790 | # dialogue or support on_say. |
797 | 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); |
798 | |
792 | |
799 | for my $npc ( |
793 | for my $npc ( |
800 | 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, |
801 | map +($_, $_->inv), |
795 | map +($_, $_->inv), |
802 | grep $_, |
796 | grep $_, |
803 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
797 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
804 | 0..24 |
798 | 0..24 |
805 | ) { |
799 | ) { |
… | |
… | |
810 | my ($reply, @kw) = $dialog->tell ($msg); |
804 | my ($reply, @kw) = $dialog->tell ($msg); |
811 | |
805 | |
812 | if (defined $reply) { |
806 | if (defined $reply) { |
813 | if ($npc->type == cf::MAGIC_EAR) { |
807 | if ($npc->type == cf::MAGIC_EAR) { |
814 | if (length $reply) { |
808 | if (length $reply) { |
815 | send_msg $_, $SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" |
809 | send_msg $_, $cf::SAY_CHANNEL => $reply, cf::NDI_BROWN, "msg_say" |
816 | for @plonmap; |
810 | for @plonmap; |
817 | } |
811 | } |
818 | $npc->use_trigger; |
812 | $npc->use_trigger; |
819 | } else { |
813 | } else { |
820 | if (length $reply) { |
814 | if (length $reply) { |
821 | send_msg $_, $SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" |
815 | send_msg $_, $cf::SAY_CHANNEL => $npc->name . " says: $reply", cf::NDI_BROWN, "msg_say" |
822 | for @plonmap; |
816 | for @plonmap; |
823 | } |
817 | } |
824 | } |
818 | } |
825 | } |
819 | } |
826 | |
820 | |
827 | if (@kw) { |
821 | if (@kw) { |
828 | $_->send_msg ($SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) |
822 | $_->send_msg ($cf::SAY_CHANNEL => "[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN) |
829 | for @plonmap; |
823 | for @plonmap; |
830 | } |
824 | } |
831 | } |
825 | } |
832 | |
826 | |
833 | } else { |
827 | } else { |
834 | $ob->send_msg ($SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY); |
828 | $ob->send_msg ($cf::SAY_CHANNEL => "What do you want to say?", cf::NDI_GREY | cf::NDI_REPLY); |
835 | } |
829 | } |
836 | }; |
830 | }; |
837 | |
831 | |
838 | cf::register_command chat => sub { |
832 | cf::register_command chat => sub { |
839 | my ($ob, $msg) = @_; |
833 | my ($ob, $msg) = @_; |
… | |
… | |
849 | my $NOW = time; |
843 | my $NOW = time; |
850 | |
844 | |
851 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
845 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
852 | send_irc ("[%s] %s", $name, $msg); |
846 | send_irc ("[%s] %s", $name, $msg); |
853 | |
847 | |
854 | send_msg $_, $CHAT_CHANNEL => "$name chats: $msg", cf::NDI_BLUE | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_chat" |
848 | 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; |
849 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
856 | |
850 | |
857 | } else { |
851 | } else { |
858 | $pl->send_msg ($CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
852 | $pl->send_msg ($cf::CHAT_CHANNEL => "Chat what?", cf::NDI_BLUE | cf::NDI_DEF | cf::NDI_REPLY); |
859 | } |
853 | } |
860 | }; |
854 | }; |
861 | |
855 | |
862 | cf::register_command shout => sub { |
856 | cf::register_command shout => sub { |
863 | my ($ob, $msg) = @_; |
857 | my ($ob, $msg) = @_; |
… | |
… | |
873 | my $name = $ob->name; |
867 | my $name = $ob->name; |
874 | |
868 | |
875 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
869 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
876 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
870 | send_irc ("\007\0034{%s} %s\n", $name, $msg); |
877 | |
871 | |
878 | send_msg $_, $CHAT_CHANNEL => "$name shouts: $msg", cf::NDI_RED | cf::NDI_DEF | ($_ == $pl ? cf::NDI_REPLY : 0), "msg_shout" |
872 | 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; |
873 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW } cf::player::list; |
880 | |
874 | |
881 | } else { |
875 | } else { |
882 | $pl->send_msg ($CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
876 | $pl->send_msg ($cf::CHAT_CHANNEL => "Shout what?", cf::NDI_RED | cf::NDI_DEF | cf::NDI_REPLY); |
883 | } |
877 | } |
884 | }; |
878 | }; |
885 | |
879 | |
886 | cf::register_command tell => sub { |
880 | cf::register_command tell => sub { |
887 | my ($ob, $args) = @_; |
881 | my ($ob, $args) = @_; |