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