ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/chat.ext
(Generate patch)

Comparing deliantra/server/ext/chat.ext (file contents):
Revision 1.4 by pippijn, Wed Feb 28 19:13:23 2007 UTC vs.
Revision 1.10 by pippijn, Thu Mar 1 13:14:10 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines