… | |
… | |
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 | }, |
… | |
… | |
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$/) { |
… | |
… | |
201 | $cnt++; |
204 | $cnt++; |
202 | } |
205 | } |
203 | } |
206 | } |
204 | |
207 | |
205 | if ($cnt) { |
208 | if ($cnt) { |
206 | $who->reply ($npc, $cnt == 1 ? "Here is your pakage." : "Here are your packages."); |
209 | $who->reply ($npc, $cnt == 1 ? "Here is your package." : "Here are your packages."); |
207 | } else { |
210 | } else { |
208 | $who->reply ($npc, "Sorry, no deliverys for you sir."); |
211 | $who->reply ($npc, "Sorry, no deliveries for you sir."); |
209 | } |
212 | } |
210 | } |
213 | } |
211 | |
214 | |
212 | } elsif ($cmd eq 'send') { |
215 | } elsif ($cmd eq 'send') { |
213 | unless ($arguments =~ /^\S+$/) { |
216 | unless ($arguments =~ /^\S+$/) { |
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"); |