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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines