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