--- deliantra/server/ext/ipo.ext 2007/06/19 20:39:30 1.7 +++ deliantra/server/ext/ipo.ext 2008/04/24 11:05:51 1.14 @@ -14,18 +14,18 @@ my %prices = ( pen => [ 40, 'stylus', - sub { $_[0]->name ('IPO Writing Pen'); $_[0]->value (40 * $price_fact); } + sub { $_[0]->name ('IPO Writing Pen'); $_[0]->value (0); } ], literacy => [ 1000, 'scroll_literacy', - sub { $_[0]->value (1000 * $price_fact) } + sub { $_[0]->value (0) } ], mailscroll => [ - 1, 'scroll', + 1, 'mailscroll_empty', sub { $_[0]->name ("mailscroll T: $_[2] F: $_[1]"); $_[0]->name_pl ("mailscrolls T: $_[2] F: $_[1]"); - $_[0]->value (1 * $price_fact); + $_[0]->value (0); }, 'plarg' ], @@ -70,7 +70,7 @@ my ($name, $map, $x, $y, $cb, @a) = @_; my $o = cf::object::new $name; my $r = $cb->($o, @a); - $map->insert_object ($o, $x, $y); + $map->insert ($o, $x, $y); $r } @@ -177,21 +177,29 @@ return 1; } - $who->pay_amount ($pr->[0] * $price_fact); - if ($pr->[3] && not cf::player::exists $arguments) { - $who->reply ($npc, "Sorry, there is no '$arguments'"); + if ($who->pay_amount ($pr->[0] * $price_fact)) { + cf::async { + if ($pr->[3] && not cf::player::exists $arguments) { + $who->reply ($npc, "Sorry, there is no '$arguments'"); + } else { + create_object ($pr->[1], $who->map, $x, $y, $pr->[2], $who->name, $arguments); + $who->reply ($npc, "Here is your $cmd"); + } + } } else { - create_object ($pr->[1], $who->map, $x, $y, $pr->[2], $who->name, $arguments); - $who->reply ($npc, "Here is your $cmd"); + $who->reply ($npc, "Sorry, you don't have enough money."); } } elsif ($cmd eq 'receive') { cf::async { + $Coro::current->{desc} = "ipo receive"; + my $storage = cf::map::find ("/planes/IPO_storage"); unless ($storage) { $who->reply ($npc, "Sorry, our package delivery service is currently in strike. Please come back later."); return 1; } + $storage->load; my $plname = $who->name; my $cnt; @@ -216,17 +224,20 @@ } cf::async { + $Coro::current->{desc} = "ipo send"; + my $storage = cf::map::find ("/planes/IPO_storage"); unless ($storage) { $who->reply ($npc, "Sorry, our package delivery service is currently in strike. Please come back later."); return 1; } + $storage->load; my $cnt; for ($who->inv) { if ($_->name () =~ /^(bag|package|carton) T: \Q$arguments\E F: (\S+)$/) { $_->name ("$1 F: $2 T: $arguments"); - $_->teleport ($storage, 2, 2); + $storage->insert ($_, 2, 2); $cnt++; } }