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