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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines