ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/ipo.ext
(Generate patch)

Comparing deliantra/server/ext/ipo.ext (file contents):
Revision 1.11 by root, Sun Sep 30 16:24:29 2007 UTC vs.
Revision 1.15 by root, Mon Sep 22 01:33:09 2008 UTC

12 12
13# prices in plat. 13# prices in plat.
14my %prices = ( 14my %prices = (
15 pen => [ 15 pen => [
16 40, 'stylus', 16 40, 'stylus',
17 sub { $_[0]->name ('IPO Writing Pen'); $_[0]->value (40 * $price_fact); } 17 sub { $_[0]->name ('IPO Writing Pen'); $_[0]->value (0); }
18 ], 18 ],
19 literacy => [ 19 literacy => [
20 1000, 'scroll_literacy', 20 1000, 'scroll_literacy',
21 sub { $_[0]->value (1000 * $price_fact) } 21 sub { $_[0]->value (0) }
22 ], 22 ],
23 mailscroll => [ 23 mailscroll => [
24 1, 'mailscroll_empty', 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 (0);
29 }, 29 },
30 'plarg' 30 'plarg'
31 ], 31 ],
32 bag => [ 1, 'r_sack', sub { set_package (@_, bag => 5000) }, 'plarg' ], 32 bag => [ 1, 'r_sack', sub { set_package (@_, bag => 5000) }, 'plarg' ],
33 package => [ 5, 'r_sack', sub { set_package (@_, package => 50000) }, 'plarg' ], 33 package => [ 5, 'r_sack', sub { set_package (@_, package => 50000) }, 'plarg' ],
175 if (my $pr = $prices{$cmd}) { 175 if (my $pr = $prices{$cmd}) {
176 if ($cmd eq 'mailwarning' and !$who->flag (cf::FLAG_WIZ)) { 176 if ($cmd eq 'mailwarning' and !$who->flag (cf::FLAG_WIZ)) {
177 return 1; 177 return 1;
178 } 178 }
179 179
180 $who->pay_amount ($pr->[0] * $price_fact); 180 if ($who->pay_amount ($pr->[0] * $price_fact)) {
181 cf::async {
181 if ($pr->[3] && not cf::player::exists $arguments) { 182 if ($pr->[3] && not cf::player::exists $arguments) {
182 $who->reply ($npc, "Sorry, there is no '$arguments'"); 183 $who->reply ($npc, "Sorry, there is no '$arguments'");
184 } else {
185 create_object ($pr->[1], $who->map, $x, $y, $pr->[2], $who->name, $arguments);
186 $who->reply ($npc, "Here is your $cmd");
187 }
188 }
183 } else { 189 } else {
184 create_object ($pr->[1], $who->map, $x, $y, $pr->[2], $who->name, $arguments); 190 $who->reply ($npc, "Sorry, you don't have enough money.");
185 $who->reply ($npc, "Here is your $cmd");
186 } 191 }
187 192
188 } elsif ($cmd eq 'receive') { 193 } elsif ($cmd eq 'receive') {
189 cf::async { 194 cf::async {
190 $Coro::current->{desc} = "ipo receive"; 195 $Coro::current->{desc} = "ipo receive";
231 my $cnt; 236 my $cnt;
232 for ($who->inv) { 237 for ($who->inv) {
233 if ($_->name () =~ /^(bag|package|carton) T: \Q$arguments\E F: (\S+)$/) { 238 if ($_->name () =~ /^(bag|package|carton) T: \Q$arguments\E F: (\S+)$/) {
234 $_->name ("$1 F: $2 T: $arguments"); 239 $_->name ("$1 F: $2 T: $arguments");
235 $storage->insert ($_, 2, 2); 240 $storage->insert ($_, 2, 2);
236 $who->esrv_del_item ($_->count);
237 $cnt++; 241 $cnt++;
238 } 242 }
239 } 243 }
240 244
241 if ($cnt) { 245 if ($cnt) {
249 253
250 } else { 254 } else {
251 $who->reply ($npc, 255 $who->reply ($npc,
252 sprintf "How can I help you?\n" 256 sprintf "How can I help you?\n"
253 . "Here is a quick list of commands I understand:\n\n" 257 . "Here is a quick list of commands I understand:\n\n"
254 . "- pen (%s platinum)\n" 258 . " - pen (%s platinum)\n"
255 . "- literacy (%s platinum)\n" 259 . " - literacy (%s platinum)\n"
256 . "- mailscroll <friend> (%s platinum)\n" 260 . " - mailscroll <friend> (%s platinum)\n"
257 . "- bag <friend> (%s platinum)\n" 261 . " - bag <friend> (%s platinum)\n"
258 . "- package <friend> (%s platinum)\n" 262 . " - package <friend> (%s platinum)\n"
259 . "- carton <friend> (%s platinum)\n" 263 . " - carton <friend> (%s platinum)\n"
260 . "- send <friend> (send bags/packages/cartons)\n" 264 . " - send <friend> (send bags/packages/cartons)\n"
261 . "- receive (to receive packages for you)\n" 265 . " - receive (to receive packages for you)\n"
262 . ($who->flag (cf::FLAG_WIZ) ? "- mailwarning <player>" : ""), 266 . ($who->flag (cf::FLAG_WIZ) ? " - mailwarning <player>\n" : ""),
263 40, 1000, 1, 1, 5, 10 267 40, 1000, 1, 1, 5, 10
264 ); 268 );
265 } 269 }
266 1 270 1
267}; 271};
291} 295}
292 296
293sub send_mail { 297sub send_mail {
294 my ($type, $toname, $fromname, $message) = @_; 298 my ($type, $toname, $fromname, $message) = @_;
295 my $time = strftime ("%a, %d %b %Y %H:%M:%S CEST", localtime (time)); 299 my $time = strftime ("%a, %d %b %Y %H:%M:%S CEST", localtime (time));
296 my $msg = "From: $fromname\nTo: $toname\nDate: $time\n\n$message\n"; 300 my $msg = "From: $fromname\rTo: $toname\rDate: $time\n\n$message\n";
297 store_mail ($type, $toname, $fromname, $msg); 301 store_mail ($type, $toname, $fromname, $msg);
298} 302}
299 303
3001; 3041;
305

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines