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