… | |
… | |
19 | literacy => [ |
19 | literacy => [ |
20 | 1000, 'scroll_literacy', |
20 | 1000, 'scroll_literacy', |
21 | sub { $_[0]->value (1000 * $price_fact) } |
21 | sub { $_[0]->value (1000 * $price_fact) } |
22 | ], |
22 | ], |
23 | mailscroll => [ |
23 | mailscroll => [ |
24 | 1, 'scroll', |
24 | 1, 'mailscroll_empty', |
25 | sub { |
25 | sub { |
26 | $_[0]->name ("mailscroll T: $_[2] F: $_[1]"); |
26 | $_[0]->name ("mailscroll T: $_[2] F: $_[1]"); |
27 | $_[0]->name_pl ("mailscrolls T: $_[2] F: $_[1]"); |
27 | $_[0]->name_pl ("mailscrolls T: $_[2] F: $_[1]"); |
28 | $_[0]->value (1 * $price_fact); |
28 | $_[0]->value (1 * $price_fact); |
29 | }, |
29 | }, |
… | |
… | |
68 | |
68 | |
69 | sub create_object { |
69 | sub create_object { |
70 | my ($name, $map, $x, $y, $cb, @a) = @_; |
70 | my ($name, $map, $x, $y, $cb, @a) = @_; |
71 | my $o = cf::object::new $name; |
71 | my $o = cf::object::new $name; |
72 | my $r = $cb->($o, @a); |
72 | my $r = $cb->($o, @a); |
73 | $map->insert_object ($o, $x, $y); |
73 | $map->insert ($o, $x, $y); |
74 | $r |
74 | $r |
75 | } |
75 | } |
76 | |
76 | |
77 | # this handler notifies the player of new mail |
77 | # this handler notifies the player of new mail |
78 | cf::player->attach ( |
78 | cf::player->attach ( |
… | |
… | |
185 | $who->reply ($npc, "Here is your $cmd"); |
185 | $who->reply ($npc, "Here is your $cmd"); |
186 | } |
186 | } |
187 | |
187 | |
188 | } elsif ($cmd eq 'receive') { |
188 | } elsif ($cmd eq 'receive') { |
189 | cf::async { |
189 | cf::async { |
|
|
190 | $Coro::current->{desc} = "ipo receive"; |
|
|
191 | |
190 | my $storage = cf::map::find ("/planes/IPO_storage"); |
192 | my $storage = cf::map::find ("/planes/IPO_storage"); |
191 | unless ($storage) { |
193 | unless ($storage) { |
192 | $who->reply ($npc, "Sorry, our package delivery service is currently in strike. Please come back later."); |
194 | $who->reply ($npc, "Sorry, our package delivery service is currently in strike. Please come back later."); |
193 | return 1; |
195 | return 1; |
194 | } |
196 | } |
|
|
197 | $storage->load; |
195 | |
198 | |
196 | my $plname = $who->name; |
199 | my $plname = $who->name; |
197 | my $cnt; |
200 | my $cnt; |
198 | for ($storage->at (2, 2)) { |
201 | for ($storage->at (2, 2)) { |
199 | if ($_->name () =~ /^\S+ F: \S+ T: \Q$plname\E$/) { |
202 | if ($_->name () =~ /^\S+ F: \S+ T: \Q$plname\E$/) { |
… | |
… | |
214 | $who->reply ($npc, "Send to who?"); |
217 | $who->reply ($npc, "Send to who?"); |
215 | return 1; |
218 | return 1; |
216 | } |
219 | } |
217 | |
220 | |
218 | cf::async { |
221 | cf::async { |
|
|
222 | $Coro::current->{desc} = "ipo send"; |
|
|
223 | |
219 | my $storage = cf::map::find ("/planes/IPO_storage"); |
224 | my $storage = cf::map::find ("/planes/IPO_storage"); |
220 | unless ($storage) { |
225 | unless ($storage) { |
221 | $who->reply ($npc, "Sorry, our package delivery service is currently in strike. Please come back later."); |
226 | $who->reply ($npc, "Sorry, our package delivery service is currently in strike. Please come back later."); |
222 | return 1; |
227 | return 1; |
223 | } |
228 | } |
|
|
229 | $storage->load; |
224 | |
230 | |
225 | my $cnt; |
231 | my $cnt; |
226 | for ($who->inv) { |
232 | for ($who->inv) { |
227 | if ($_->name () =~ /^(bag|package|carton) T: \Q$arguments\E F: (\S+)$/) { |
233 | if ($_->name () =~ /^(bag|package|carton) T: \Q$arguments\E F: (\S+)$/) { |
228 | $_->name ("$1 F: $2 T: $arguments"); |
234 | $_->name ("$1 F: $2 T: $arguments"); |
229 | $_->teleport ($storage, 2, 2); |
235 | $storage->insert ($_, 2, 2); |
|
|
236 | $who->esrv_del_item ($_->count); |
230 | $cnt++; |
237 | $cnt++; |
231 | } |
238 | } |
232 | } |
239 | } |
233 | |
240 | |
234 | if ($cnt) { |
241 | if ($cnt) { |