1 | #! perl |
1 | #! perl # depends=irc |
2 | #CONVERSION: PARTIAL |
2 | #CONVERSION: PARTIAL |
3 | |
3 | |
4 | # implement a replacement for the built-in say/chat/shout/tell/reply commands |
4 | # implement a replacement for the built-in say/chat/shout/tell/reply commands |
5 | # adds ignore/unignore functionality |
5 | # adds ignore/unignore functionality |
6 | |
6 | |
… | |
… | |
32 | clean_timeouts $pl->ob; |
32 | clean_timeouts $pl->ob; |
33 | }, |
33 | }, |
34 | ); |
34 | ); |
35 | |
35 | |
36 | cf::register_command listen => sub { |
36 | cf::register_command listen => sub { |
37 | my ($who, $msg) = @_; |
37 | my ($pl, $msg) = @_; |
38 | my $player = cf::player::find_active $who->name; |
38 | my $player = cf::player::find_active $pl->name; |
39 | |
39 | |
40 | if ($msg ne "") { |
40 | if ($msg ne "") { |
|
|
41 | $msg = 10 if $msg > 10; |
|
|
42 | |
41 | my $prev_listen = $player->listening; |
43 | my $prev_listen = $player->listening; |
42 | $player->listening ($msg); |
44 | $player->listening ($msg); |
43 | if ($prev_listen == $player->listening) { |
45 | if ($prev_listen == $player->listening) { |
44 | $who->message ("Your verbose level stayed $prev_listen.", cf::NDI_UNIQUE); |
46 | $pl->message ("Your verbose level stayed $prev_listen.", cf::NDI_UNIQUE); |
45 | } else { |
47 | } else { |
46 | $who->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_UNIQUE); |
48 | $pl->message ("Your verbose level is now " . $player->listening . ". (previously: $prev_listen)", cf::NDI_UNIQUE); |
47 | } |
49 | } |
48 | } else { |
50 | } else { |
49 | $who->message ("Your verbose level is " . $player->listening . ".", cf::NDI_UNIQUE); |
51 | $pl->message ("Your verbose level is " . $player->listening . ".", cf::NDI_UNIQUE); |
50 | } |
52 | } |
51 | }; |
53 | }; |
52 | |
54 | |
|
|
55 | cf::register_command cointoss => sub { |
|
|
56 | my ($pl, $msg) = @_; |
|
|
57 | |
|
|
58 | my $name = $pl->name; |
|
|
59 | |
|
|
60 | if (int rand 2) { |
|
|
61 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
|
|
62 | next |
|
|
63 | if $other->ob == $pl; |
|
|
64 | $other->ob->message ("$name flips a coin.... Heads!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
65 | } |
|
|
66 | |
|
|
67 | $pl->message ("You flip a coin.... Heads!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
68 | } else { |
|
|
69 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
|
|
70 | next |
|
|
71 | if $other->ob == $pl; |
|
|
72 | $other->ob->message ("$name flips a coin.... Tails!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
73 | } |
|
|
74 | |
|
|
75 | $pl->message ("You flip a coin.... Tails!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
76 | } |
|
|
77 | }; |
|
|
78 | |
|
|
79 | cf::register_command orcknuckle => sub { |
|
|
80 | my ($pl, $msg) = @_; |
|
|
81 | my @orcknuckle = ("none", "beholder", "ghost", "knight", "princess", "dragon", "orc"); |
|
|
82 | |
|
|
83 | my $name = $pl->name; |
|
|
84 | |
|
|
85 | my ($i, $j, $k, $l) = ((int rand 5) + 1, (int rand 5) + 1, (int rand 5) + 1, (int rand 6) + 1); |
|
|
86 | my $result = "$orcknuckle[$i], $orcknuckle[$j], $orcknuckle[$k], $orcknuckle[$l]"; |
|
|
87 | |
|
|
88 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
|
|
89 | next |
|
|
90 | if $other->ob == $pl; |
|
|
91 | $other->ob->message ("$name rolls $result!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
92 | } |
|
|
93 | |
|
|
94 | $pl->message ("You roll $result!", cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
95 | }; |
|
|
96 | |
|
|
97 | my $emotes = { |
|
|
98 | growl => { |
|
|
99 | noparams => { |
|
|
100 | other => "<self> growls.", |
|
|
101 | self => "Grrrrrrrrr....", |
|
|
102 | }, |
|
|
103 | params => { |
|
|
104 | }, |
|
|
105 | self => { |
|
|
106 | }, |
|
|
107 | }, |
|
|
108 | giggle => { |
|
|
109 | noparams => { |
|
|
110 | other => "<self> giggles.", |
|
|
111 | self => "You giggle.", |
|
|
112 | }, |
|
|
113 | params => { |
|
|
114 | }, |
|
|
115 | self => { |
|
|
116 | }, |
|
|
117 | }, |
|
|
118 | shiver => { |
|
|
119 | noparams => { |
|
|
120 | other => "<self> shivers uncomfortably.", |
|
|
121 | self => "Brrrrrrrrr.", |
|
|
122 | }, |
|
|
123 | params => { |
|
|
124 | }, |
|
|
125 | self => { |
|
|
126 | }, |
|
|
127 | }, |
|
|
128 | chuckle => { |
|
|
129 | noparams => { |
|
|
130 | other => "<self> chuckles politely.", |
|
|
131 | self => "You chuckle politely", |
|
|
132 | }, |
|
|
133 | params => { |
|
|
134 | }, |
|
|
135 | self => { |
|
|
136 | }, |
|
|
137 | }, |
|
|
138 | sigh => { |
|
|
139 | noparams => { |
|
|
140 | other => "<self> sighs loudly.", |
|
|
141 | self => "You sigh.", |
|
|
142 | }, |
|
|
143 | params => { |
|
|
144 | }, |
|
|
145 | self => { |
|
|
146 | }, |
|
|
147 | }, |
|
|
148 | scream => { |
|
|
149 | noparams => { |
|
|
150 | other => "<self> screams at the top of his lungs!", |
|
|
151 | self => "ARRRRRRRRRRGH!!!!!", |
|
|
152 | }, |
|
|
153 | params => { |
|
|
154 | }, |
|
|
155 | self => { |
|
|
156 | }, |
|
|
157 | }, |
|
|
158 | puke => { |
|
|
159 | noparams => { |
|
|
160 | other => "<self> pukes.", |
|
|
161 | self => "Bleaaaaaghhhhhhh!", |
|
|
162 | }, |
|
|
163 | params => { |
|
|
164 | target => "<self> pukes on your clothes!", |
|
|
165 | other => "<self> pukes on <other>.", |
|
|
166 | self => "You puke on <other>.", |
|
|
167 | }, |
|
|
168 | self => { |
|
|
169 | other => "<self> pukes on his clothes.", |
|
|
170 | self => "You puke on yourself.", |
|
|
171 | }, |
|
|
172 | }, |
|
|
173 | strut => { |
|
|
174 | noparams => { |
|
|
175 | other => "<self> struts proudly.", |
|
|
176 | self => "Strut your stuff.", |
|
|
177 | }, |
|
|
178 | params => { |
|
|
179 | }, |
|
|
180 | self => { |
|
|
181 | }, |
|
|
182 | }, |
|
|
183 | cringe => { |
|
|
184 | noparams => { |
|
|
185 | other => "<self> cringes in terror!", |
|
|
186 | self => "You cringe in terror.", |
|
|
187 | }, |
|
|
188 | params => { |
|
|
189 | target => "<self> cringes away from <other> in mortal terror.", |
|
|
190 | self => "You cringe away from <other>.", |
|
|
191 | }, |
|
|
192 | self => { |
|
|
193 | }, |
|
|
194 | }, |
|
|
195 | hiccup => { |
|
|
196 | noparams => { |
|
|
197 | other => "<self> hiccups.", |
|
|
198 | self => "*HIC*", |
|
|
199 | }, |
|
|
200 | params => { |
|
|
201 | }, |
|
|
202 | self => { |
|
|
203 | }, |
|
|
204 | }, |
|
|
205 | clap => { |
|
|
206 | noparams => { |
|
|
207 | other => "<self> gives a round of applause.", |
|
|
208 | self => "Clap, clap, clap.", |
|
|
209 | }, |
|
|
210 | params => { |
|
|
211 | }, |
|
|
212 | self => { |
|
|
213 | }, |
|
|
214 | }, |
|
|
215 | kiss => { |
|
|
216 | noparams => { |
|
|
217 | other => "<self> makes a weird facial contortion", |
|
|
218 | self => "All the lonely people..", |
|
|
219 | }, |
|
|
220 | params => { |
|
|
221 | target => "<self> kisses you.", |
|
|
222 | other => "<self> kisses <other>.", |
|
|
223 | self => "You kiss <other>.", |
|
|
224 | }, |
|
|
225 | self => { |
|
|
226 | }, |
|
|
227 | }, |
|
|
228 | wink => { |
|
|
229 | noparams => { |
|
|
230 | other => "<self> winks suggestively.", |
|
|
231 | self => "Have you got something in your eye?", |
|
|
232 | }, |
|
|
233 | params => { |
|
|
234 | target => "<self> winks at you.", |
|
|
235 | other => "<self> winks at <other>.", |
|
|
236 | self => "You wink suggestively at <other>.", |
|
|
237 | }, |
|
|
238 | self => { |
|
|
239 | other => "<self> winks at himself - something strange is going on...", |
|
|
240 | self => "You wink at yourself?? What are you up to?", |
|
|
241 | }, |
|
|
242 | }, |
|
|
243 | pout => { |
|
|
244 | noparams => { |
|
|
245 | other => "<self> pouts.", |
|
|
246 | self => "Aww, don't take it so hard.", |
|
|
247 | }, |
|
|
248 | params => { |
|
|
249 | }, |
|
|
250 | self => { |
|
|
251 | }, |
|
|
252 | }, |
|
|
253 | cackle => { |
|
|
254 | noparams => { |
|
|
255 | other => "<self> throws back his head and cackles with insane glee!", |
|
|
256 | self => "You cackle gleefully.", |
|
|
257 | }, |
|
|
258 | params => { |
|
|
259 | }, |
|
|
260 | self => { |
|
|
261 | }, |
|
|
262 | }, |
|
|
263 | sniff => { |
|
|
264 | noparams => { |
|
|
265 | other => "<self> sniffs sadly.", |
|
|
266 | self => "You sniff sadly. *SNIFF*", |
|
|
267 | }, |
|
|
268 | params => { |
|
|
269 | target => "<self> sniffs you.", |
|
|
270 | other => "<self> sniffs <other>", |
|
|
271 | self => "You sniff <other>.", |
|
|
272 | }, |
|
|
273 | self => { |
|
|
274 | other => "<self> sniffs himself.", |
|
|
275 | self => "You sniff yourself.", |
|
|
276 | }, |
|
|
277 | }, |
|
|
278 | nod => { |
|
|
279 | noparams => { |
|
|
280 | other => "<self> nods solemnly.", |
|
|
281 | self => "You nod solemnly.", |
|
|
282 | }, |
|
|
283 | params => { |
|
|
284 | target => "<self> nods solemnly to you.", |
|
|
285 | other => "<self> nods solemnly to <other>.", |
|
|
286 | self => "You nod solemnly to <other>.", |
|
|
287 | }, |
|
|
288 | self => { |
|
|
289 | }, |
|
|
290 | }, |
|
|
291 | frown => { |
|
|
292 | noparams => { |
|
|
293 | other => "<self> frowns.", |
|
|
294 | self => "What's bothering you?", |
|
|
295 | }, |
|
|
296 | params => { |
|
|
297 | target => "<self> frowns darkly at you.", |
|
|
298 | other => "<self> frowns darkly at <other>.", |
|
|
299 | self => "You frown darkly at <other>.", |
|
|
300 | }, |
|
|
301 | self => { |
|
|
302 | other => "<self> frowns at himself.", |
|
|
303 | self => "You frown at yourself.", |
|
|
304 | }, |
|
|
305 | }, |
|
|
306 | snicker => { |
|
|
307 | noparams => { |
|
|
308 | other => "<self> snickers softly.", |
|
|
309 | self => "You snicker softly.", |
|
|
310 | }, |
|
|
311 | params => { |
|
|
312 | }, |
|
|
313 | self => { |
|
|
314 | }, |
|
|
315 | }, |
|
|
316 | shrug => { |
|
|
317 | noparams => { |
|
|
318 | other => "<self> shrugs helplessly.", |
|
|
319 | self => "You shrug.", |
|
|
320 | }, |
|
|
321 | params => { |
|
|
322 | target => "<self> shrugs at you.", |
|
|
323 | other => "<self> shrugs at <other>.", |
|
|
324 | self => "You shrug at <other>.", |
|
|
325 | }, |
|
|
326 | self => { |
|
|
327 | }, |
|
|
328 | }, |
|
|
329 | bleed => { |
|
|
330 | noparams => { |
|
|
331 | other => "<self> is bleeding all over the carpet - got a spare tourniquet?", |
|
|
332 | self => "You bleed all over your nice new armour.", |
|
|
333 | }, |
|
|
334 | params => { |
|
|
335 | target => "<self> slashes his wrist and bleeds all over you.", |
|
|
336 | other => "<self> slashes his wrist and bleeds all over <other>.", |
|
|
337 | self => "You slash your wrist and bleed all over <other>", |
|
|
338 | }, |
|
|
339 | self => { |
|
|
340 | other => "<self> performs some satanic ritual while wiping his blood on himself.", |
|
|
341 | self => "Very impressive! You wipe your blood all over yourself.", |
|
|
342 | }, |
|
|
343 | }, |
|
|
344 | twiddle => { |
|
|
345 | noparams => { |
|
|
346 | other => "<self> patiently twiddles his thumbs.", |
|
|
347 | self => "You patiently twiddle your thumbs.", |
|
|
348 | }, |
|
|
349 | params => { |
|
|
350 | }, |
|
|
351 | self => { |
|
|
352 | }, |
|
|
353 | }, |
|
|
354 | spit => { |
|
|
355 | noparams => { |
|
|
356 | other => "<self> spits over his left shoulder.", |
|
|
357 | self => "You spit over your left shoulder.", |
|
|
358 | }, |
|
|
359 | params => { |
|
|
360 | target => "<self> spits in your face!", |
|
|
361 | other => "<self> spits in <other>'s face.", |
|
|
362 | self => "You spit on <other>.", |
|
|
363 | }, |
|
|
364 | self => { |
|
|
365 | other => "<self> drools all over himself.", |
|
|
366 | self => "You drool all over yourself.", |
|
|
367 | }, |
|
|
368 | }, |
|
|
369 | glare => { |
|
|
370 | noparams => { |
|
|
371 | other => "<self> glares around him.", |
|
|
372 | self => "You glare at nothing in particular.", |
|
|
373 | }, |
|
|
374 | params => { |
|
|
375 | target => "<self> glares icily at you, you feel cold to your bones.", |
|
|
376 | other => "<self> glares at <other>.", |
|
|
377 | self => "You glare icily at <other>.", |
|
|
378 | }, |
|
|
379 | self => { |
|
|
380 | other => "<self> glares at his feet, what is bothering him?", |
|
|
381 | self => "You glare icily at your feet, they are suddenly very cold.", |
|
|
382 | }, |
|
|
383 | }, |
|
|
384 | bow => { |
|
|
385 | noparams => { |
|
|
386 | other => "<self> bows deeply.", |
|
|
387 | self => "You bow deeply.", |
|
|
388 | }, |
|
|
389 | params => { |
|
|
390 | target => "<self> bows before you.", |
|
|
391 | other => "<self> bows before <other>.", |
|
|
392 | self => "You bow before <other>.", |
|
|
393 | }, |
|
|
394 | self => { |
|
|
395 | other => "<self> folds up like a jackknife and kisses his own toes.", |
|
|
396 | self => "You kiss your toes.", |
|
|
397 | }, |
|
|
398 | }, |
|
|
399 | dance => { |
|
|
400 | noparams => { |
|
|
401 | other => "<self> expresses himself through interpretive dance.", |
|
|
402 | self => "You dance with glee.", |
|
|
403 | }, |
|
|
404 | params => { |
|
|
405 | target => "<self> grabs you, and begins dancing!", |
|
|
406 | other => "Yipe! <self> and <other> are doing the Macarena!", |
|
|
407 | self => "You grab <other> and begin doing the Cha-Cha!", |
|
|
408 | }, |
|
|
409 | self => { |
|
|
410 | other => "<self> embraces himself and begins to dance!", |
|
|
411 | self => "You skip and dance around by yourself.", |
|
|
412 | }, |
|
|
413 | }, |
|
|
414 | snore => { |
|
|
415 | noparams => { |
|
|
416 | other => "<self> snores loudly.", |
|
|
417 | self => "Zzzzzzzzzzzzzzz.", |
|
|
418 | }, |
|
|
419 | params => { |
|
|
420 | }, |
|
|
421 | self => { |
|
|
422 | }, |
|
|
423 | }, |
|
|
424 | blush => { |
|
|
425 | noparams => { |
|
|
426 | other => "<self> blushes.", |
|
|
427 | self => "Your cheeks are burning.", |
|
|
428 | }, |
|
|
429 | params => { |
|
|
430 | }, |
|
|
431 | self => { |
|
|
432 | }, |
|
|
433 | }, |
|
|
434 | snap => { |
|
|
435 | noparams => { |
|
|
436 | other => "<self> snaps his fingers.", |
|
|
437 | self => "PRONTO! you snap your fingers.", |
|
|
438 | }, |
|
|
439 | params => { |
|
|
440 | }, |
|
|
441 | self => { |
|
|
442 | }, |
|
|
443 | }, |
|
|
444 | wave => { |
|
|
445 | noparams => { |
|
|
446 | other => "<self> waves happily.", |
|
|
447 | self => "You wave.", |
|
|
448 | }, |
|
|
449 | params => { |
|
|
450 | target => "<self> waves goodbye to you. Have a good journey.", |
|
|
451 | other => "<self> waves goodbye to <other>.", |
|
|
452 | self => "You wave goodbye to <other>.", |
|
|
453 | }, |
|
|
454 | self => { |
|
|
455 | other => "<self> waves goodbye to himself.", |
|
|
456 | self => "Are you going on adventures as well??", |
|
|
457 | }, |
|
|
458 | }, |
|
|
459 | smile => { |
|
|
460 | noparams => { |
|
|
461 | other => "<self> smiles happily.", |
|
|
462 | self => "You smile happily.", |
|
|
463 | }, |
|
|
464 | params => { |
|
|
465 | target => "<self> smiles at you.", |
|
|
466 | other => "<self> beams a smile at <other>.", |
|
|
467 | self => "You smile at <other>.", |
|
|
468 | }, |
|
|
469 | self => { |
|
|
470 | }, |
|
|
471 | }, |
|
|
472 | sneeze => { |
|
|
473 | noparams => { |
|
|
474 | other => "<self> sneezes.", |
|
|
475 | self => "Gesundheit!", |
|
|
476 | }, |
|
|
477 | params => { |
|
|
478 | target => "<self> sneezes on you, you feel the snot cover you. EEEEEEW.", |
|
|
479 | other => "<self> sneezes on <other> and a film of snot covers him.", |
|
|
480 | self => "You sneeze at <other> and a film of snot shoots onto him.", |
|
|
481 | }, |
|
|
482 | self => { |
|
|
483 | other => "<self> sneezes, and covers himself in a slimy substance.", |
|
|
484 | self => "You sneeze on yourself, what a mess!", |
|
|
485 | }, |
|
|
486 | }, |
|
|
487 | bounce => { |
|
|
488 | noparams => { |
|
|
489 | other => "<self> bounces around.", |
|
|
490 | self => "BOIINNNNNNGG!", |
|
|
491 | }, |
|
|
492 | params => { |
|
|
493 | target => "<self> bounces around the room with you.", |
|
|
494 | other => "<self> bounces around the room with <other>.", |
|
|
495 | self => "You bounce around the room with <other>.", |
|
|
496 | }, |
|
|
497 | self => { |
|
|
498 | }, |
|
|
499 | }, |
|
|
500 | shake => { |
|
|
501 | noparams => { |
|
|
502 | other => "<self> shakes his head.", |
|
|
503 | self => "You shake your head.", |
|
|
504 | }, |
|
|
505 | params => { |
|
|
506 | target => "<self> shakes your hand.", |
|
|
507 | other => "<self> shakes <other>'s hand.", |
|
|
508 | self => "You shake <other>'s hand.", |
|
|
509 | }, |
|
|
510 | self => { |
|
|
511 | other => "<self> shakes and quivers like a bowlful of jelly.", |
|
|
512 | self => "You are shaken by yourself.", |
|
|
513 | }, |
|
|
514 | }, |
|
|
515 | lick => { |
|
|
516 | noparams => { |
|
|
517 | other => "<self> licks his mouth and smiles.", |
|
|
518 | self => "You lick your mouth and smile.", |
|
|
519 | }, |
|
|
520 | params => { |
|
|
521 | target => "<self> licks you.", |
|
|
522 | other => "<self> licks <other>.", |
|
|
523 | self => "You lick <other>.", |
|
|
524 | }, |
|
|
525 | self => { |
|
|
526 | other => "<self> licks himself - YUCK.", |
|
|
527 | self => "You lick yourself.", |
|
|
528 | }, |
|
|
529 | }, |
|
|
530 | flip => { |
|
|
531 | noparams => { |
|
|
532 | other => "<self> flips head over heels.", |
|
|
533 | self => "You flip head over heels.", |
|
|
534 | }, |
|
|
535 | params => { |
|
|
536 | }, |
|
|
537 | self => { |
|
|
538 | }, |
|
|
539 | }, |
|
|
540 | think => { |
|
|
541 | noparams => { |
|
|
542 | other => "<self> closes his eyes and thinks really hard.", |
|
|
543 | self => "Anything in particular that you'd care to think about?", |
|
|
544 | }, |
|
|
545 | params => { |
|
|
546 | }, |
|
|
547 | self => { |
|
|
548 | }, |
|
|
549 | }, |
|
|
550 | yawn => { |
|
|
551 | noparams => { |
|
|
552 | other => "<self> yawns sleepily.", |
|
|
553 | self => "You open up your yap and let out a big breeze of stale air.", |
|
|
554 | }, |
|
|
555 | params => { |
|
|
556 | }, |
|
|
557 | self => { |
|
|
558 | }, |
|
|
559 | }, |
|
|
560 | laugh => { |
|
|
561 | noparams => { |
|
|
562 | other => "<self> falls down laughing.", |
|
|
563 | self => "You fall down laughing.", |
|
|
564 | }, |
|
|
565 | params => { |
|
|
566 | target => "<self> looks at you and falls down on the ground laughing.", |
|
|
567 | other => "<self> looks at <other> and falls down on the ground laughing.", |
|
|
568 | self => "You take one look at <other> and fall down laughing.", |
|
|
569 | }, |
|
|
570 | self => { |
|
|
571 | other => "<self> is laughing at something.", |
|
|
572 | self => "Laugh at yourself all you want, the others won't understand.", |
|
|
573 | }, |
|
|
574 | }, |
|
|
575 | burp => { |
|
|
576 | noparams => { |
|
|
577 | other => "<self> burps loudly.", |
|
|
578 | self => "You burp loudly.", |
|
|
579 | }, |
|
|
580 | params => { |
|
|
581 | }, |
|
|
582 | self => { |
|
|
583 | }, |
|
|
584 | }, |
|
|
585 | gasp => { |
|
|
586 | noparams => { |
|
|
587 | other => "<self> gasps in astonishment.", |
|
|
588 | self => "You gasp in astonishment.", |
|
|
589 | }, |
|
|
590 | params => { |
|
|
591 | }, |
|
|
592 | self => { |
|
|
593 | }, |
|
|
594 | }, |
|
|
595 | smirk => { |
|
|
596 | noparams => { |
|
|
597 | other => "<self> smirks.", |
|
|
598 | self => "You smirk.", |
|
|
599 | }, |
|
|
600 | params => { |
|
|
601 | }, |
|
|
602 | self => { |
|
|
603 | }, |
|
|
604 | }, |
|
|
605 | cry => { |
|
|
606 | noparams => { |
|
|
607 | other => "<self> bursts into tears.", |
|
|
608 | self => "Waaaaaaahhh..", |
|
|
609 | }, |
|
|
610 | params => { |
|
|
611 | target => "<self> cries on your shoulder.", |
|
|
612 | other => "<self> cries on <other>'s shoulder.", |
|
|
613 | self => "You cry on <other>'s shoulder.", |
|
|
614 | }, |
|
|
615 | self => { |
|
|
616 | other => "<self> sobs quietly to himself.", |
|
|
617 | self => "You cry to yourself.", |
|
|
618 | }, |
|
|
619 | }, |
|
|
620 | sulk => { |
|
|
621 | noparams => { |
|
|
622 | other => "<self> sulks in the corner.", |
|
|
623 | self => "You sulk.", |
|
|
624 | }, |
|
|
625 | params => { |
|
|
626 | }, |
|
|
627 | self => { |
|
|
628 | }, |
|
|
629 | }, |
|
|
630 | whistle => { |
|
|
631 | noparams => { |
|
|
632 | other => "<self> whistles appreciatively.", |
|
|
633 | self => "You whistle appreciatively.", |
|
|
634 | }, |
|
|
635 | params => { |
|
|
636 | target => "<self> whistles at <other>.", |
|
|
637 | self => "You whistle at <other>.", |
|
|
638 | }, |
|
|
639 | self => { |
|
|
640 | other => "<self> whistles to himself in boredom.", |
|
|
641 | self => "You whistle while you work.", |
|
|
642 | }, |
|
|
643 | }, |
|
|
644 | groan => { |
|
|
645 | noparams => { |
|
|
646 | other => "<self> groans loudly.", |
|
|
647 | self => "You groan loudly.", |
|
|
648 | }, |
|
|
649 | params => { |
|
|
650 | }, |
|
|
651 | self => { |
|
|
652 | }, |
|
|
653 | }, |
|
|
654 | cough => { |
|
|
655 | noparams => { |
|
|
656 | other => "<self> coughs loudly.", |
|
|
657 | self => "Yuck, try to cover your mouth next time!", |
|
|
658 | }, |
|
|
659 | params => { |
|
|
660 | }, |
|
|
661 | self => { |
|
|
662 | }, |
|
|
663 | }, |
|
|
664 | grin => { |
|
|
665 | noparams => { |
|
|
666 | other => "<self> grins evilly.", |
|
|
667 | self => "You grin evilly.", |
|
|
668 | }, |
|
|
669 | params => { |
|
|
670 | target => "<self> grins evilly at you.", |
|
|
671 | other => "<self> grins evilly at <other>.", |
|
|
672 | self => "You grin at <other>.", |
|
|
673 | }, |
|
|
674 | self => { |
|
|
675 | }, |
|
|
676 | }, |
|
|
677 | }; |
|
|
678 | |
|
|
679 | for my $emotion (keys %$emotes) { |
|
|
680 | cf::register_command $emotion => sub { |
|
|
681 | my ($pl, $tname) = @_; |
|
|
682 | |
|
|
683 | cf::async { |
|
|
684 | my $name = $pl->name; |
|
|
685 | |
|
|
686 | if ($tname eq $name) { |
|
|
687 | my $emote = $emotes->{$emotion}->{self}; |
|
|
688 | |
|
|
689 | $emote->{other} = "You look away from <self>." |
|
|
690 | if !$emote->{other}; |
|
|
691 | $emote->{self} = "My god! Is that LEGAL?" |
|
|
692 | if !$emote->{self}; |
|
|
693 | |
|
|
694 | $emote->{other} =~ s/<self>/$name/; |
|
|
695 | |
|
|
696 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
|
|
697 | next |
|
|
698 | if $other->ob == $pl; |
|
|
699 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
700 | } |
|
|
701 | |
|
|
702 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
703 | } elsif ($tname) { |
|
|
704 | my $target = cf::player::find $tname |
|
|
705 | or return $pl->reply (undef, "$tname is not around."); |
|
|
706 | |
|
|
707 | my $emote = $emotes->{$emotion}->{params}; |
|
|
708 | |
|
|
709 | $emote->{other} = "<self> is eyeing <other> quizzically." |
|
|
710 | if !$emote->{other}; |
|
|
711 | $emote->{self} = "You are still nuts." |
|
|
712 | if !$emote->{self}; |
|
|
713 | $emote->{target} = "You get the distinct feeling that <other> is nuts." |
|
|
714 | if !$emote->{target}; |
|
|
715 | |
|
|
716 | $emote->{self} =~ s/<other>/$tname/; |
|
|
717 | $emote->{target} =~ s/<self>/$name/; |
|
|
718 | $emote->{other} =~ s/<other>/$tname/; |
|
|
719 | $emote->{other} =~ s/<self>/$name/; |
|
|
720 | |
|
|
721 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
|
|
722 | next |
|
|
723 | if $other->ob == $pl or $other == $target; |
|
|
724 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
725 | } |
|
|
726 | |
|
|
727 | $target->ob->message ($emote->{target}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
728 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
729 | } else { |
|
|
730 | my $emote = $emotes->{$emotion}->{noparams}; |
|
|
731 | $emote->{other} =~ s/<self>/$name/; |
|
|
732 | |
|
|
733 | $emote->{other} = "<self> dances with glee." |
|
|
734 | if !$emote->{other}; |
|
|
735 | $emote->{self} = "You are a nut." |
|
|
736 | if !$emote->{self}; |
|
|
737 | |
|
|
738 | for my $other ( grep { $pl->on_same_map_as ($_->ob) } cf::player::list ) { |
|
|
739 | next |
|
|
740 | if $other->ob == $pl; |
|
|
741 | $other->ob->message ($emote->{other}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
742 | } |
|
|
743 | |
|
|
744 | $pl->message ($emote->{self}, cf::NDI_GREY | cf::NDI_UNIQUE); |
|
|
745 | } |
|
|
746 | }; |
|
|
747 | }; |
|
|
748 | } |
|
|
749 | |
|
|
750 | cf::register_command me => sub { |
|
|
751 | my ($pl, $msg) = @_; |
|
|
752 | |
|
|
753 | my $name = $pl->name; |
|
|
754 | |
|
|
755 | $_->ob->message ("* $name $msg", cf::NDI_GREY | cf::NDI_UNIQUE) |
|
|
756 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
|
|
757 | }; |
|
|
758 | |
53 | cf::register_command say => sub { |
759 | cf::register_command say => sub { |
54 | my ($who, $msg) = @_; |
760 | my ($pl, $msg) = @_; |
55 | |
761 | |
56 | utf8::decode $msg; |
762 | utf8::decode $msg; |
57 | |
763 | |
58 | return if $who->contr->invoke (cf::EVENT_PLAYER_SAY, $msg); |
764 | return if $pl->contr->invoke (cf::EVENT_PLAYER_SAY, $msg); |
59 | |
765 | |
60 | if ($msg) { |
766 | if ($msg) { |
61 | my $name = $who->name; |
767 | my $name = $pl->name; |
62 | |
768 | |
63 | utf8::encode $msg; # ->message not yet utf8-ified |
|
|
64 | $_->ob->message ("$name says: $msg", cf::NDI_GREY | cf::NDI_UNIQUE) |
769 | $_->ob->message ("$name says: $msg", cf::NDI_GREY | cf::NDI_UNIQUE) |
65 | for grep $who->on_same_map_as ($_->ob), cf::player::list; |
770 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
66 | utf8::decode $msg; |
|
|
67 | |
771 | |
68 | # npcs, magic_ears etc. |
772 | # npcs, magic_ears etc. |
69 | # first find all objects and theirt-level inventories |
773 | # first find all objects and their first-level inventories |
70 | # within a 5x5 square # that have something resembling |
774 | # within a 5x5 square that have something resembling |
71 | # dialogue or support on_say. |
775 | # dialogue or support on_say. |
72 | my ($map, $x, $y) = ($who->map, $who->x - 2, $who->y - 2); |
776 | my ($map, $x, $y) = ($pl->map, $pl->x - 2, $pl->y - 2); |
73 | |
777 | |
74 | for my $npc ( |
778 | for my $npc ( |
75 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $who->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, |
779 | grep +($_->invoke (cf::EVENT_OBJECT_SAY, $pl->contr, $msg) && return) || NPC_Dialogue::has_dialogue $_, |
76 | map +($_, $_->inv), |
780 | map +($_, $_->inv), |
77 | grep $_, |
781 | grep $_, |
78 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
782 | map $map->at ($x + $_ % 5, $y + (int $_ / 5)), |
79 | 0..24 |
783 | 0..24 |
80 | ) { |
784 | ) { |
81 | # if some listener teleported us somewhere else, stop right here |
785 | # if some listener teleported us somewhere else, stop right here |
82 | last unless $map->path == $who->map->path; |
786 | last unless $map->path == $pl->map->path; |
83 | |
787 | |
84 | my $dialog = new NPC_Dialogue ob => $who, npc => $npc; |
788 | my $dialog = new NPC_Dialogue ob => $pl, npc => $npc; |
85 | my ($reply, @kw) = $dialog->tell ($msg); |
789 | my ($reply, @kw) = $dialog->tell ($msg); |
86 | |
790 | |
87 | if (defined $reply) { |
791 | if (defined $reply) { |
88 | if ($npc->type == cf::MAGIC_EAR) { |
792 | if ($npc->type == cf::MAGIC_EAR) { |
89 | if (length $reply) { |
793 | if (length $reply) { |
90 | $_->ob->message ($reply, cf::NDI_BROWN | cf::NDI_UNIQUE) |
794 | $_->ob->message ($reply, cf::NDI_BROWN | cf::NDI_UNIQUE) |
91 | for grep $who->on_same_map_as ($_->ob), cf::player::list; |
795 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
92 | } |
796 | } |
93 | $npc->use_trigger; |
797 | $npc->use_trigger; |
94 | } else { |
798 | } else { |
95 | if (length $reply) { |
799 | if (length $reply) { |
96 | $_->ob->message ($npc->name . " says: $reply", cf::NDI_BROWN | cf::NDI_UNIQUE) |
800 | $_->ob->message ($npc->name . " says: $reply", cf::NDI_BROWN | cf::NDI_UNIQUE) |
97 | for grep $who->on_same_map_as ($_->ob), cf::player::list; |
801 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
98 | } |
802 | } |
99 | } |
803 | } |
100 | } |
804 | } |
101 | |
805 | |
102 | if (@kw) { |
806 | if (@kw) { |
103 | $_->ob->message ("[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN | cf::NDI_UNIQUE) |
807 | $_->ob->message ("[further topics: " . (join ", ", @kw) . "]", cf::NDI_BROWN | cf::NDI_UNIQUE) |
104 | for grep $who->on_same_map_as ($_->ob), cf::player::list; |
808 | for grep $pl->on_same_map_as ($_->ob), cf::player::list; |
105 | } |
809 | } |
106 | } |
810 | } |
107 | |
811 | |
108 | } else { |
812 | } else { |
109 | $who->message ("What do you want to say?", cf::NDI_UNIQUE); |
813 | $pl->message ("What do you want to say?", cf::NDI_UNIQUE); |
110 | } |
814 | } |
111 | }; |
815 | }; |
112 | |
816 | |
113 | cf::register_command chat => sub { |
817 | cf::register_command chat => sub { |
114 | my ($who, $msg) = @_; |
818 | my ($pl, $msg) = @_; |
115 | |
819 | |
116 | utf8::decode $msg; |
820 | utf8::decode $msg; |
117 | |
821 | |
118 | return if $who->contr->invoke (cf::EVENT_PLAYER_CHAT, $msg); |
822 | return if $pl->contr->invoke (cf::EVENT_PLAYER_CHAT, $msg); |
119 | |
823 | |
120 | if ($msg) { |
824 | if ($msg) { |
121 | my $name = $who->name; |
825 | my $name = $pl->name; |
122 | my $NOW = time; |
826 | my $NOW = time; |
123 | |
827 | |
124 | utf8::encode $msg; # ->message not yet utf8-ified |
|
|
125 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
828 | cf::LOG cf::llevDebug, sprintf "QBERT [%s] %s\n", $name, $msg; |
126 | ext::schmorp_irc::do_notice (sprintf "[%s] %s", $name, $msg); |
829 | ext::irc::do_notice (sprintf "[%s] %s", $name, $msg); |
127 | |
830 | |
128 | $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) |
831 | $_->ob->message ("$name chats: $msg", cf::NDI_BLUE) |
129 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
832 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 10 } cf::player::list; |
130 | |
833 | |
131 | } else { |
834 | } else { |
132 | $who->message ("Chat what?", cf::NDI_UNIQUE); |
835 | $pl->message ("Chat what?", cf::NDI_UNIQUE); |
133 | } |
836 | } |
134 | }; |
837 | }; |
135 | |
838 | |
136 | cf::register_command shout => sub { |
839 | cf::register_command shout => sub { |
137 | my ($who, $msg) = @_; |
840 | my ($pl, $msg) = @_; |
138 | |
841 | |
139 | utf8::decode $msg; |
842 | utf8::decode $msg; |
140 | |
843 | |
141 | return if $who->contr->invoke (cf::EVENT_PLAYER_SHOUT, $msg); |
844 | return if $pl->contr->invoke (cf::EVENT_PLAYER_SHOUT, $msg); |
142 | |
845 | |
143 | if ($msg) { |
846 | if ($msg) { |
144 | my $NOW = time; |
847 | my $NOW = time; |
145 | my $name = $who->name; |
848 | my $name = $pl->name; |
146 | |
849 | |
147 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
850 | cf::LOG cf::llevDebug, sprintf "QBERT {%s} %s\n", $name, $msg; |
148 | ext::schmorp_irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); |
851 | ext::irc::do_notice (sprintf "\007\0034{%s} %s\n", $name, $msg); |
149 | |
852 | |
150 | utf8::encode $msg; # ->message not yet utf8-ified |
|
|
151 | $_->ob->message ("$name shouts: $msg", cf::NDI_RED) |
853 | $_->ob->message ("$name shouts: $msg", cf::NDI_RED) |
152 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
854 | for grep { $_->ob->{ext_ignore_shout}{$name} < $NOW && $_->listening >= 2 } cf::player::list; |
153 | |
855 | |
154 | } else { |
856 | } else { |
155 | $who->message ("Shout what?", cf::NDI_UNIQUE); |
857 | $pl->message ("Shout what?", cf::NDI_UNIQUE); |
156 | } |
858 | } |
157 | |
|
|
158 | }; |
859 | }; |
159 | |
860 | |
160 | cf::register_command tell => sub { |
861 | cf::register_command tell => sub { |
161 | my ($who, $args) = @_; |
862 | my ($pl, $args) = @_; |
162 | my ($target, $msg) = split /\s+/, $args, 2; |
863 | my ($target, $msg) = split /\s+/, $args, 2; |
163 | |
864 | |
164 | utf8::decode $msg; |
865 | utf8::decode $msg; |
165 | |
866 | |
166 | return if $who->contr->invoke (cf::EVENT_PLAYER_TELL, $target, $msg); |
867 | return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $target, $msg); |
167 | |
868 | |
168 | my $name = $who->name; |
869 | my $name = $pl->name; |
169 | |
870 | |
170 | if ($target =~ /irc\//) { |
871 | if ($target =~ /irc\//) { |
171 | my (undef, $nick) = split /\//, $target, 2; |
872 | my (undef, $nick) = split /\//, $target, 2; |
172 | $who->message ("You tell $target: $args"); |
873 | $pl->message ("You tell $target: $args"); |
173 | ext::schmorp_irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); |
874 | ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $msg); |
174 | } elsif (my $other = cf::player::find_active $target) { |
875 | } elsif (my $other = cf::player::find_active $target) { |
175 | |
876 | |
176 | if ($msg) { |
877 | if ($msg) { |
177 | if ($target eq $name) { |
878 | if ($target eq $name) { |
178 | $who->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
879 | $pl->message ("You are talking to yourself, you freak!", cf::NDI_UNIQUE); |
179 | } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { |
880 | } elsif ($other->ob->{ext_ignore_tell}{$name} >= time) { |
180 | $who->message ("$target ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
881 | $pl->message ("$target ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
181 | } else { |
882 | } else { |
182 | utf8::encode $msg; # ->message not yet utf8-ified |
883 | return if $other->invoke (cf::EVENT_PLAYER_TOLD, $pl->contr, $msg); |
183 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
884 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $target, $msg; |
184 | |
885 | |
185 | $who->message ("You tell $target: $msg"); |
886 | $pl->message ("You tell $target: $msg"); |
186 | $other->ob->message ("$name tells you: $msg"); |
887 | $other->ob->message ("$name tells you: $msg"); |
187 | $other->ob->{ext_last_tell} = $name; |
888 | $other->ob->{ext_last_tell} = $name; |
188 | } |
889 | } |
189 | } else { |
890 | } else { |
190 | $who->message ("What do you want to tell $target?", cf::NDI_UNIQUE); |
891 | $pl->message ("What do you want to tell $target?", cf::NDI_UNIQUE); |
191 | } |
892 | } |
192 | |
893 | |
193 | } else { |
894 | } else { |
194 | $who->message ("No such player. Your message: $msg", cf::NDI_UNIQUE); |
895 | $pl->message ("No such player. Your message: $msg", cf::NDI_UNIQUE); |
195 | } |
896 | } |
196 | }; |
897 | }; |
197 | |
898 | |
198 | cf::register_command reply => sub { |
899 | cf::register_command reply => sub { |
199 | my ($who, $args) = @_; |
900 | my ($pl, $args) = @_; |
200 | my $name = $who->name; |
901 | my $name = $pl->name; |
201 | |
902 | |
202 | utf8::decode $args; |
903 | utf8::decode $args; |
203 | |
904 | |
204 | return if $who->contr->invoke (cf::EVENT_PLAYER_TELL, $who->{ext_last_tell}, $args); |
905 | return if $pl->contr->invoke (cf::EVENT_PLAYER_TELL, $pl->{ext_last_tell}, $args); |
205 | |
906 | |
206 | if ($who->{ext_last_tell} =~ /irc\//) { |
907 | if ($pl->{ext_last_tell} =~ /irc\//) { |
207 | my (undef, $nick) = split /\//, $who->{ext_last_tell}, 2; |
908 | my (undef, $nick) = split /\//, $pl->{ext_last_tell}, 2; |
208 | $who->message ("You tell " . $who->{ext_last_tell} . ": $args"); |
909 | $pl->message ("You tell " . $pl->{ext_last_tell} . ": $args"); |
209 | ext::schmorp_irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); |
910 | ext::irc::do_notice (sprintf "(%s) %s: %s\n", $name, $nick, $args); |
210 | } elsif (my $other = cf::player::find_active $who->{ext_last_tell}) { |
911 | } elsif (my $other = cf::player::find_active $pl->{ext_last_tell}) { |
211 | |
912 | |
212 | if ($args) { |
913 | if ($args) { |
213 | $other->ob->{ext_ignore_tell}{$name} >= time |
914 | $other->ob->{ext_ignore_tell}{$name} >= time |
214 | or delete $other->ob->{ext_ignore_tell}{$name}; |
915 | or delete $other->ob->{ext_ignore_tell}{$name}; |
215 | |
916 | |
216 | if ($other->ob->{ext_ignore_tell}{$name} < time) { |
917 | if ($other->ob->{ext_ignore_tell}{$name} < time) { |
217 | utf8::encode $args; # ->message not yet utf8-ified |
|
|
218 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $other->ob->name, $args; |
918 | cf::LOG cf::llevDebug, sprintf "TELL [%s>%s] %s\n", $name, $other->ob->name, $args; |
219 | |
919 | |
220 | $who->message ("You tell " . $other->ob->name . ": $args"); |
920 | $pl->message ("You tell " . $other->ob->name . ": $args"); |
221 | $other->ob->message ("$name tells you: $args"); |
921 | $other->ob->message ("$name tells you: $args"); |
222 | $who->{ext_last_tell} = $other->ob->name; |
922 | $pl->{ext_last_tell} = $other->ob->name; |
223 | } else { |
923 | } else { |
224 | $who->message ($other->ob->name . " ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
924 | $pl->message ($other->ob->name . " ignores what you say. Give up on it.", cf::NDI_UNIQUE); |
225 | } |
925 | } |
226 | } else { |
926 | } else { |
227 | $who->message ("What do you want to tell ".$other->ob->name."?", cf::NDI_UNIQUE); |
927 | $pl->message ("What do you want to tell ".$other->ob->name."?", cf::NDI_UNIQUE); |
228 | } |
928 | } |
229 | |
929 | |
230 | } else { |
930 | } else { |
231 | $who->message ("Can't reply, player left. Your message: $args".$who->{ext_last_tell}, cf::NDI_UNIQUE); |
931 | $pl->message ("Can't reply, player left. Your message: $args".$pl->{ext_last_tell}, cf::NDI_UNIQUE); |
232 | } |
932 | } |
233 | }; |
933 | }; |
234 | |
934 | |
235 | cf::register_command ignore => sub { |
935 | cf::register_command ignore => sub { |
236 | my ($who, $args) = @_; |
936 | my ($pl, $args) = @_; |
237 | my ($target, $type, $timeout) = split /\s+/, $args; |
937 | my ($target, $type, $timeout) = split /\s+/, $args; |
238 | |
938 | |
239 | if ($args eq "list") { |
939 | if ($args eq "list") { |
240 | clean_timeouts $who; |
940 | clean_timeouts $pl; |
241 | |
941 | |
242 | if ((my @ignored_tell = sort keys %{$who->{ext_ignore_tell}}) |
942 | if ((my @ignored_tell = sort keys %{$pl->{ext_ignore_tell}}) |
243 | + (my @ignored_shout = sort keys %{$who->{ext_ignore_shout}})) { |
943 | + (my @ignored_shout = sort keys %{$pl->{ext_ignore_shout}})) { |
244 | $who->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); |
944 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); |
245 | $who->message ((join ", ", @ignored_tell), cf::NDI_UNIQUE); |
945 | $pl->message ((join ", ", @ignored_tell), cf::NDI_UNIQUE); |
246 | $who->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); |
946 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); |
247 | $who->message ((join ", ", @ignored_shout), cf::NDI_UNIQUE); |
947 | $pl->message ((join ", ", @ignored_shout), cf::NDI_UNIQUE); |
248 | $who->message ("To stop ignoring one, use unignore.", cf::NDI_UNIQUE); |
948 | $pl->message ("To stop ignoring one, use unignore.", cf::NDI_UNIQUE); |
249 | } else { |
949 | } else { |
250 | $who->message ("Not ignoring anyone", cf::NDI_UNIQUE); |
950 | $pl->message ("Not ignoring anyone", cf::NDI_UNIQUE); |
251 | } |
951 | } |
252 | |
952 | |
253 | } elsif ($target && $type) { |
953 | } elsif ($target && $type) { |
254 | |
954 | |
255 | $timeout ne "" or $timeout = 24; |
955 | $timeout ne "" or $timeout = 24; |
256 | my $absolute_timeout = time + $timeout * 3600; |
956 | my $absolute_timeout = time + $timeout * 3600; |
257 | |
957 | |
258 | if (cf::player::exists $target) { |
958 | if (cf::player::exists $target) { |
259 | if ($type eq "tell") { |
959 | if ($type eq "tell") { |
260 | $who->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_UNIQUE); |
960 | $pl->message ("Now ignoring private messages from $target for $timeout hours.", cf::NDI_UNIQUE); |
261 | $who->{ext_ignore_tell}{$target} = $absolute_timeout; |
961 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
262 | } elsif ($type eq "shout") { |
962 | } elsif ($type eq "shout") { |
263 | $who->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_UNIQUE); |
963 | $pl->message ("Now ignoring shouts from $target for $timeout hours.", cf::NDI_UNIQUE); |
264 | $who->{ext_ignore_shout}{$target} = $absolute_timeout; |
964 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
265 | } elsif ($type eq "all") { |
965 | } elsif ($type eq "all") { |
266 | $who->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_UNIQUE); |
966 | $pl->message ("Now ignoring everything from $target for $timeout hours.", cf::NDI_UNIQUE); |
267 | $who->{ext_ignore_tell}{$target} = $absolute_timeout; |
967 | $pl->{ext_ignore_tell}{$target} = $absolute_timeout; |
268 | $who->{ext_ignore_shout}{$target} = $absolute_timeout; |
968 | $pl->{ext_ignore_shout}{$target} = $absolute_timeout; |
269 | } else { |
969 | } else { |
270 | $who->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); |
970 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); |
271 | } |
971 | } |
272 | } else { |
972 | } else { |
273 | $who->message ("No such player: $target", cf::NDI_UNIQUE); |
973 | $pl->message ("No such player: $target", cf::NDI_UNIQUE); |
274 | } |
974 | } |
275 | |
975 | |
276 | } else { |
976 | } else { |
277 | $who->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
977 | $pl->message ("Usage: ignore <player> <tell|shout|all> <timeout>\n" |
278 | . "will ignore a player for <timeout> hours.\n" |
978 | . "will ignore a player for <timeout> hours.\n" |
279 | . "Usage: ignore list\n" |
979 | . "Usage: ignore list\n" |
280 | . "will show you a list of players currently ignored.", cf::NDI_UNIQUE); |
980 | . "will show you a list of players currently ignored.", cf::NDI_UNIQUE); |
281 | } |
981 | } |
282 | }; |
982 | }; |
283 | |
983 | |
284 | cf::register_command unignore => sub { |
984 | cf::register_command unignore => sub { |
285 | my ($who, $args) = @_; |
985 | my ($pl, $args) = @_; |
286 | my ($target, $type) = split /\s+/, $args; |
986 | my ($target, $type) = split /\s+/, $args; |
287 | |
987 | |
288 | if ($args eq "") { |
988 | if ($args eq "") { |
289 | if ($who->{ext_ignore_tell}) { |
989 | if ($pl->{ext_ignore_tell}) { |
290 | $who->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); |
990 | $pl->message ("Currently ignoring private messages from: ", cf::NDI_UNIQUE); |
291 | $who->message ((join ", ", sort keys %{ $who->{ext_ignore_tell} }), cf::NDI_UNIQUE); |
991 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_tell} }), cf::NDI_UNIQUE); |
292 | $who->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); |
992 | $pl->message ("Currently ignoring shouts from: ", cf::NDI_UNIQUE); |
293 | $who->message ((join ", ", sort keys %{ $who->{ext_ignore_shout} }), cf::NDI_UNIQUE); |
993 | $pl->message ((join ", ", sort keys %{ $pl->{ext_ignore_shout} }), cf::NDI_UNIQUE); |
294 | } else { |
994 | } else { |
295 | $who->message ("Not ignoring anyone", cf::NDI_UNIQUE); |
995 | $pl->message ("Not ignoring anyone", cf::NDI_UNIQUE); |
296 | } |
996 | } |
297 | } else { |
997 | } else { |
298 | if (cf::player::exists $target) { |
998 | if (cf::player::exists $target) { |
299 | if ($type eq "tell") { |
999 | if ($type eq "tell") { |
300 | $who->message ("Not ignoring private messages from $target anymore.", cf::NDI_UNIQUE); |
1000 | $pl->message ("Not ignoring private messages from $target anymore.", cf::NDI_UNIQUE); |
301 | delete $who->{ext_ignore_tell} {$target}; |
1001 | delete $pl->{ext_ignore_tell} {$target}; |
302 | } elsif ($type eq "shout") { |
1002 | } elsif ($type eq "shout") { |
303 | $who->message ("Not ignoring shouts from $target anymore.", cf::NDI_UNIQUE); |
1003 | $pl->message ("Not ignoring shouts from $target anymore.", cf::NDI_UNIQUE); |
304 | delete $who->{ext_ignore_shout}{$target}; |
1004 | delete $pl->{ext_ignore_shout}{$target}; |
305 | } elsif ($type eq "all") { |
1005 | } elsif ($type eq "all") { |
306 | $who->message ("Not ignoring anything from $target anymore.", cf::NDI_UNIQUE); |
1006 | $pl->message ("Not ignoring anything from $target anymore.", cf::NDI_UNIQUE); |
307 | delete $who->{ext_ignore_tell} {$target}; |
1007 | delete $pl->{ext_ignore_tell} {$target}; |
308 | delete $who->{ext_ignore_shout}{$target}; |
1008 | delete $pl->{ext_ignore_shout}{$target}; |
309 | } else { |
1009 | } else { |
310 | $who->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); |
1010 | $pl->message ("You need to specify tell, shout or all.", cf::NDI_UNIQUE); |
311 | } |
1011 | } |
312 | } else { |
1012 | } else { |
313 | $who->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); |
1013 | $pl->message ("No such player or ambiguous name: $target", cf::NDI_UNIQUE); |
314 | } |
1014 | } |
315 | } |
1015 | } |
316 | }; |
1016 | }; |
317 | |
1017 | |
318 | cf::register_command seen => sub { |
|
|
319 | my ($who, $args) = @_; |
|
|
320 | |
|
|
321 | if (my ($login) = $args =~ /(\S+)/) { |
|
|
322 | if ($login eq $who->name) { |
|
|
323 | $who->message ("Very funny, $login. Ha. Ha.", cf::NDI_UNIQUE); |
|
|
324 | } elsif (cf::player::find_active $login) { |
|
|
325 | $who->message ("$login is right here on this server!", cf::NDI_UNIQUE); |
|
|
326 | } elsif (cf::player::exists $login |
|
|
327 | and stat sprintf "%s/%s/%s/%s.pl", cf::localdir, cf::playerdir, ($login) x 2) { |
|
|
328 | my $time = (stat _)[9]; |
|
|
329 | |
|
|
330 | $who->message ("$login was last seen here " |
|
|
331 | . (POSIX::strftime "%Y-%m-%d %H:%M:%S +0000", gmtime $time) |
|
|
332 | . " which was " . (int +(time - $time) / 3600) . " hours ago.", cf::NDI_UNIQUE); |
|
|
333 | } else { |
|
|
334 | $who->message ("No player named $login is known to me.", cf::NDI_UNIQUE); |
|
|
335 | } |
|
|
336 | } else { |
|
|
337 | $who->message ("Usage: seen <player>", cf::NDI_UNIQUE); |
|
|
338 | } |
|
|
339 | }; |
|
|
340 | |
|
|