From 484a6619b36f562d4b1faac13cadc8d48371f3ac Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 14 Jan 2011 17:05:49 -0600 Subject: [PATCH] removed old trade --- bin/clean_up_market.pl | 18 --- lib/Lacuna/DB/Result/Building/Trade.pm | 25 ---- lib/Lacuna/DB/Result/Building/Transporter.pm | 15 -- lib/Lacuna/DB/Result/Trades.pm | 59 -------- lib/Lacuna/RPC/Building/Trade.pm | 139 +------------------ lib/Lacuna/RPC/Building/Transporter.pm | 114 +-------------- lib/Lacuna/Role/Trader.pm | 22 --- lib/Lacuna/Role/TraderRpc.pm | 65 --------- t/Trade.t | 20 +-- t/Transporter.t | 21 +-- var/www/public/changes.txt | 2 + 11 files changed, 6 insertions(+), 494 deletions(-) delete mode 100644 lib/Lacuna/DB/Result/Trades.pm diff --git a/bin/clean_up_market.pl b/bin/clean_up_market.pl index e56683b2..40742f3e 100644 --- a/bin/clean_up_market.pl +++ b/bin/clean_up_market.pl @@ -37,24 +37,6 @@ foreach my $id (@to_be_deleted) { } -# whole section deprecated -out('Deleting Outdated Trades'); -$market = $db->resultset('Lacuna::DB::Result::Trades'); -@to_be_deleted = $market->search({ date_offered => { '<' => $date_ended }})->get_column('id')->all; -foreach my $id (@to_be_deleted) { - out('Withdrawing '.$id); - my $trade = $market->find($id); - next unless defined $trade; - $trade->body->empire->send_predefined_message( - filename => 'trade_withdrawn.txt', - params => [$trade->offer_description, $trade->ask_description], - tags => ['Alert'], - ); - $trade->withdraw; -} - - - my $finish = time; out('Finished'); out((($finish - $start)/60)." minutes have elapsed"); diff --git a/lib/Lacuna/DB/Result/Building/Trade.pm b/lib/Lacuna/DB/Result/Building/Trade.pm index 664a1a45..7528d67b 100644 --- a/lib/Lacuna/DB/Result/Building/Trade.pm +++ b/lib/Lacuna/DB/Result/Building/Trade.pm @@ -44,31 +44,6 @@ use constant water_consumption => 5; use constant waste_production => 1; - -sub add_trade { #deprecated - my ($self, $offer, $ask, $options) = @_; - my $ship = $self->next_available_trade_ship($options->{ship_id}); - unless (defined $ship) { - confess [1011, "You do not have any ships available that can carry trade goods."]; - } - unless ($self->level > $self->my_trades->count) { - confess [1009, "This Trade Ministry can only support ".$self->level." trades at one time."]; - } - $ask = $self->structure_ask($ask); - $offer = $self->structure_offer($offer, $ship->hold_size, $ship); - $ship->task('Waiting On Trade'); - $ship->update; - my %trade = ( - %{$ask}, - %{$offer}, - ship_id => $ship->id, - body_id => $self->body_id, - transfer_type => $self->transfer_type, - ); - return Lacuna->db->resultset('Lacuna::DB::Result::Trades')->new(\%trade)->insert; -} - - sub add_to_market { my ($self, $offer, $ask, $options) = @_; my $ship = $self->next_available_trade_ship($options->{ship_id}); diff --git a/lib/Lacuna/DB/Result/Building/Transporter.pm b/lib/Lacuna/DB/Result/Building/Transporter.pm index bfba1a13..c2a919fa 100644 --- a/lib/Lacuna/DB/Result/Building/Transporter.pm +++ b/lib/Lacuna/DB/Result/Building/Transporter.pm @@ -45,21 +45,6 @@ use constant max_instances_per_planet => 1; use constant waste_production => 1; -sub add_trade { #deprecated - my ($self, $offer, $ask) = @_; - unless ($self->level > $self->my_trades->count) { - confess [1009, "This Subspace Transporter can only support ".$self->level." trades at one time."]; - } - $ask = $self->structure_ask($ask); - $offer = $self->structure_offer($offer, $self->determine_available_cargo_space); - my %trade = ( - %{$ask}, - %{$offer}, - body_id => $self->body_id, - transfer_type => $self->transfer_type, - ); - return Lacuna->db->resultset('Lacuna::DB::Result::Trades')->new(\%trade)->insert; -} sub add_to_market { diff --git a/lib/Lacuna/DB/Result/Trades.pm b/lib/Lacuna/DB/Result/Trades.pm deleted file mode 100644 index 154b1fba..00000000 --- a/lib/Lacuna/DB/Result/Trades.pm +++ /dev/null @@ -1,59 +0,0 @@ -package Lacuna::DB::Result::Trades; - -use Moose; -use utf8; -no warnings qw(uninitialized); -extends 'Lacuna::DB::Result'; -use Lacuna::Util qw(format_date); -use Lacuna::Constants qw(FOOD_TYPES ORE_TYPES); - -__PACKAGE__->table('trades'); -__PACKAGE__->add_columns( - date_offered => { data_type => 'datetime', is_nullable => 0, set_on_create => 1 }, - body_id => { data_type => 'int', size => 11, is_nullable => 0 }, - transfer_type => { data_type => 'varchar', size => 16, is_nullable => 0 }, # zone | transporter - ship_id => { data_type => 'int', size => 11, is_nullable => 1 }, - ask_description => { data_type => 'varchar', size => 30, is_nullable => 0 }, # 100 Corn, 500 Bauxite - ask_type => { data_type => 'varchar', size => 11, is_nullable => 0 }, # ore, bauxite, water, energy, food, waste, essentia - ask_quantity => { data_type => 'int', size => 11, default_value => 1 }, - payload => { data_type => 'mediumblob', is_nullable => 1, 'serializer_class' => 'JSON' }, - offer_cargo_space_needed=> { data_type => 'int', size => 11, default_value => 0 }, - offer_description => { data_type => 'varchar', size => 100, is_nullable => 0 }, # 1000 Corn, Empire Name Prisoner, Colony Ship (Speed: 12, Cargo: 0), etc - offer_object_id => { data_type => 'int', size => 11, is_nullable => 1 }, - offer_type => { data_type => 'varchar', size => 11, is_nullable => 0 }, # ship, ore, water, energy, food, waste, essentia, prisoner, glyph, plan - offer_sub_type => { data_type => 'varchar', size => 30, is_nullable => 1 }, # corn, human, colony_ship, etc - offer_quantity => { data_type => 'int', size => 11, default_value => 1 }, - offer_rank_1 => { data_type => 'int', default_value => 0 }, - offer_rank_2 => { data_type => 'int', default_value => 0 }, -); - -__PACKAGE__->belongs_to('body', 'Lacuna::DB::Result::Map::Body', 'body_id'); - -sub sqlt_deploy_hook { - my ($self, $sqlt_table) = @_; - $sqlt_table->add_index(name => 'idx_trade_sorting', fields => ['transfer_type','offer_type','offer_sub_type','offer_quantity','offer_rank_1','offer_rank_2']); -} - -with 'Lacuna::Role::Container'; - -sub date_offered_formatted { - my $self = shift; - return format_date($self->date_offered); -} - -sub withdraw { - my ($self, $body) = @_; - $body ||= $self->body; - $self->unload($body); - if ($self->ship_id) { - my $ship = Lacuna->db->resultset('Lacuna::DB::Result::Ships')->find($self->ship_id); - $ship->land->update if defined $ship; - } - elsif ($self->transfer_type eq 'transporter') { - $body->empire->add_essentia(1, 'Withdrew Transporter Trade')->update; - } - $self->delete; -} - -no Moose; -__PACKAGE__->meta->make_immutable(inline_constructor => 0); diff --git a/lib/Lacuna/RPC/Building/Trade.pm b/lib/Lacuna/RPC/Building/Trade.pm index ec90b018..22e71a36 100644 --- a/lib/Lacuna/RPC/Building/Trade.pm +++ b/lib/Lacuna/RPC/Building/Trade.pm @@ -52,39 +52,6 @@ sub push_items { }; } -sub add_trade { # deprecated - my ($self, $session_id, $building_id, $offer, $ask, $options) = @_; - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - my $trade = $building->add_trade($offer, $ask, $options); - return { - trade_id => $trade->id, - status => $self->format_status($empire, $building->body), - }; -} - -sub withdraw_trade { - my ($self, $session_id, $building_id, $trade_id) = @_; - unless ($trade_id) { - confess [1002, 'You have not specified a trade to withdraw.']; - } - my $cache = Lacuna->cache; - if ($cache->get('trade_lock', $trade_id)) { - confess [1013, 'A buyer has placed an offer on this trade. Please wait a few moments and try again.']; - } - $cache->set('trade_lock',$trade_id,1,5); - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - my $trade = $building->trades->find($trade_id); - unless (defined $trade) { - confess [1002, 'Could not find that trade. Perhaps it has already been accepted.']; - } - $trade->withdraw($building->body); - return { - status => $self->format_status($empire, $building->body), - }; -} - sub withdraw_from_market { my ($self, $session_id, $building_id, $trade_id) = @_; unless ($trade_id) { @@ -107,110 +74,6 @@ sub withdraw_from_market { }; } -sub accept_trade { # deprecated - my ($self, $session_id, $building_id, $trade_id, $guid, $solution, $options) = @_; - unless ($trade_id) { - confess [1002, 'You have not specified a trade to accept.']; - } - my $cache = Lacuna->cache; - if ($cache->get('trade_lock', $trade_id)) { - confess [1013, 'Another buyer has placed an offer on this trade. Please wait a few moments and try again.']; - } - $cache->set('trade_lock',$trade_id,1,5); - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - $building->validate_captcha($empire, $guid, $solution, $trade_id); - my $ship = $building->next_available_trade_ship($options->{ship_id}); - unless (defined $ship) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You do not have a ship available to transport cargo.']; - } - my $trade = $building->trades->find($trade_id); - unless (defined $trade) { - $cache->delete('trade_lock',$trade_id); - confess [1002, 'Could not find that trade. Perhaps it has already been accepted.']; - } - unless ($ship->hold_size >= $trade->ask_quantity) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You need a cargo ship with a hold size of at least '.$trade->ask_quantity.'.']; - } - my $offer_ship = Lacuna->db->resultset('Lacuna::DB::Result::Ships')->find($trade->ship_id); - unless (defined $offer_ship) { - $trade->withdraw; - confess [1009, 'Trade no longer available.']; - } - - my $body = $building->body; - if ($trade->ask_type eq 'essentia') { - unless ($empire->essentia >= $trade->ask_quantity) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You need at least '.$trade->ask_quantity.' essentia to make this trade.'] - } - $empire->spend_essentia($trade->ask_quantity, 'Trade Price')->update; - $ship->send( - target => $trade->body, - payload => { essentia => $trade->ask_quantity }, - ); - } - else { - unless ($body->type_stored($trade->ask_type) >= $trade->ask_quantity) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You need at least '.$trade->ask_quantity.' '.$trade->ask_type.' to make this trade.']; - } - $body->spend_type($trade->ask_type, $trade->ask_quantity); - $body->update; - $ship->send( - target => $trade->body, - payload => { resources => { $trade->ask_type => $trade->ask_quantity }} - ) - } - my $cargo_log = Lacuna->db->resultset('Lacuna::DB::Result::Log::Cargo'); - $cargo_log->new({ - message => 'trade ministry offer accepted', - body_id => $trade->body_id, - data => $trade->payload, - object_type => ref($trade), - object_id => $trade->id, - })->insert; - $cargo_log->new({ - message => 'trade ministry ask accepted', - body_id => $trade->body_id, - data => {$trade->ask_type => $trade->ask_quantity}, - object_type => ref($trade), - object_id => $trade->id, - })->insert; - $cargo_log->new({ - message => 'send ask', - body_id => $ship->foreign_body_id, - data => $ship->payload, - object_type => ref($ship), - object_id => $ship->id, - })->insert; - - $offer_ship->send( - target => $body, - payload => $trade->payload, - ); - $cargo_log->new({ - message => 'send offer', - body_id => $offer_ship->foreign_body_id, - data => $offer_ship->payload, - object_type => ref($offer_ship), - object_id => $offer_ship->id, - })->insert; - - $trade->body->empire->send_predefined_message( - tags => ['Alert'], - filename => 'trade_accepted.txt', - params => [$trade->offer_description, $trade->ask_description], - ); - $trade->delete; - - return { - status => $self->format_status($empire, $building->body), - }; -} - sub accept_from_market { my ($self, $session_id, $building_id, $trade_id, $guid, $solution) = @_; @@ -288,7 +151,7 @@ sub add_to_market { -__PACKAGE__->register_rpc_method_names(qw(report_abuse view_my_market view_market accept_from_market withdraw_from_market add_to_market push_items get_trade_ships get_stored_resources add_trade withdraw_trade accept_trade view_my_trades view_available_trades get_ships get_prisoners get_plans get_glyphs)); +__PACKAGE__->register_rpc_method_names(qw(report_abuse view_my_market view_market accept_from_market withdraw_from_market add_to_market push_items get_trade_ships get_stored_resources get_ships get_prisoners get_plans get_glyphs)); no Moose; diff --git a/lib/Lacuna/RPC/Building/Transporter.pm b/lib/Lacuna/RPC/Building/Transporter.pm index c63e633c..a7d75ea7 100644 --- a/lib/Lacuna/RPC/Building/Transporter.pm +++ b/lib/Lacuna/RPC/Building/Transporter.pm @@ -52,22 +52,6 @@ sub push_items { }; } -sub add_trade { #deprecated - my ($self, $session_id, $building_id, $offer, $ask) = @_; - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - unless ($empire->essentia >= 1) { - confess [1011, "You need 1 essentia to make a trade using the Subspace Transporter."]; - } - my $trade = $building->add_trade($offer, $ask); - $empire->spend_essentia(1, 'Offered Transporter Trade')->update; - return { - trade_id => $trade->id, - status => $self->format_status($empire, $building->body), - }; -} - - sub add_to_market { my ($self, $session_id, $building_id, $offer, $ask) = @_; my $empire = $self->get_empire_by_session($session_id); @@ -83,28 +67,6 @@ sub add_to_market { }; } -sub withdraw_trade { - my ($self, $session_id, $building_id, $trade_id) = @_; - unless ($trade_id) { - confess [1002, 'You have not specified a trade to withdraw.']; - } - my $cache = Lacuna->cache; - if ($cache->get('trade_lock', $trade_id)) { - confess [1013, 'A buyer has placed an offer on this trade. Please wait a few moments and try again.']; - } - $cache->set('trade_lock',$trade_id,5); - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - my $trade = $building->trades->find($trade_id); - unless (defined $trade) { - confess [1002, 'Could not find that trade. Perhaps it has already been accepted.']; - } - $trade->withdraw($building->body); - return { - status => $self->format_status($empire, $building->body), - }; -} - sub withdraw_from_market { my ($self, $session_id, $building_id, $trade_id) = @_; unless ($trade_id) { @@ -127,80 +89,6 @@ sub withdraw_from_market { }; } -sub accept_trade { # deprecated - my ($self, $session_id, $building_id, $trade_id, $guid, $solution) = @_; - unless ($trade_id) { - confess [1002, 'You have not specified a trade to accept.']; - } - my $cache = Lacuna->cache; - if ($cache->get('trade_lock', $trade_id)) { - confess [1013, 'Another buyer has placed an offer on this trade. Please wait a few moments and try again.']; - } - $cache->set('trade_lock',$trade_id,1,5); - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - $building->validate_captcha($empire, $guid, $solution, $trade_id); - my $trade = $building->trades->find($trade_id); - unless (defined $trade) { - $cache->delete('trade_lock',$trade_id); - confess [1002, 'Could not find that trade. Perhaps it has already been accepted.']; - } - unless ($building->determine_available_cargo_space >= $trade->ask_quantity) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'This transporter has a maximum load size of '.$building->determine_available_cargo_space.'.']; - } - my $body = $building->body; - if ($trade->ask_type eq 'essentia') { - unless ($empire->essentia >= $trade->ask_quantity + 1) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You need '.($trade->ask_quantity + 1).' essentia to make this trade.'] - } - $empire->spend_essentia($trade->ask_quantity + 1, 'Trade Price and Transporter Cost')->update; - $trade->body->empire->add_essentia($trade->ask_quantity, 'Trade Income')->update; - } - else { - unless ($empire->essentia >= 1) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You need 1 essentia to make this trade.']; - } - unless ($body->type_stored($trade->ask_type) >= $trade->ask_quantity) { - $cache->delete('trade_lock',$trade_id); - confess [1011, 'You need '.$trade->ask_quantity.' '.$trade->ask_type.' to make this trade.']; - } - $empire->spend_essentia(1, 'Transporter Cost')->update; - $body->spend_type($trade->ask_type, $trade->ask_quantity); - $trade->body->add_type($trade->ask_type, $trade->ask_quantity); - } - my $cargo_log = Lacuna->db->resultset('Lacuna::DB::Result::Log::Cargo'); - $cargo_log->new({ - message => 'transporter offer accepted', - body_id => $trade->body_id, - data => $trade->payload, - object_type => ref($trade), - object_id => $trade->id, - })->insert; - $cargo_log->new({ - message => 'transporter ask accepted', - body_id => $trade->body_id, - data => {$trade->ask_type => $trade->ask_quantity}, - object_type => ref($trade), - object_id => $trade->id, - })->insert; - $trade->unload($body); - $trade->body->empire->send_predefined_message( - tags => ['Alert'], - filename => 'trade_accepted.txt', - params => [$trade->offer_description, $trade->ask_description], - ); - $trade->delete; - $body->update; - $trade->body->update; - return { - status => $self->format_status($empire, $building->body), - }; -} - - sub accept_from_market { my ($self, $session_id, $building_id, $trade_id, $guid, $solution) = @_; unless ($trade_id) { @@ -263,7 +151,7 @@ sub trade_one_for_one { }; } -__PACKAGE__->register_rpc_method_names(qw(report_abuse view_my_market view_market accept_from_market withdraw_from_market add_to_market push_items trade_one_for_one get_stored_resources add_trade withdraw_trade accept_trade view_my_trades view_available_trades get_ships get_prisoners get_plans get_glyphs)); +__PACKAGE__->register_rpc_method_names(qw(report_abuse view_my_market view_market accept_from_market withdraw_from_market add_to_market push_items trade_one_for_one get_stored_resources get_ships get_prisoners get_plans get_glyphs)); no Moose; __PACKAGE__->meta->make_immutable; diff --git a/lib/Lacuna/Role/Trader.pm b/lib/Lacuna/Role/Trader.pm index 70b4b743..58df4384 100644 --- a/lib/Lacuna/Role/Trader.pm +++ b/lib/Lacuna/Role/Trader.pm @@ -40,33 +40,11 @@ sub market { return Lacuna->db->resultset('Lacuna::DB::Result::Market'); } -sub trades { # deprecated - return Lacuna->db->resultset('Lacuna::DB::Result::Trades'); -} - -sub my_trades { #deprecated - my $self = shift; - return $self->trades->search({body_id => $self->body_id, transfer_type => $self->transfer_type}, {order_by => ['date_offered']}); -} - sub my_market { my $self = shift; return $self->market->search({body_id => $self->body_id, transfer_type => $self->transfer_type}); } -sub available_trades { # deprecated - my $self = shift; - return $self->trades->search( - { - body_id => {'!=' => $self->body_id}, - transfer_type => $self->transfer_type, - }, - { - order_by => {-desc => ['offer_sub_type','offer_quantity','offer_rank_1','offer_rank_2','offer_description'] } - } - ) -} - sub available_market { my $self = shift; return $self->market->search( diff --git a/lib/Lacuna/Role/TraderRpc.pm b/lib/Lacuna/Role/TraderRpc.pm index a07e2254..e092d9ac 100644 --- a/lib/Lacuna/Role/TraderRpc.pm +++ b/lib/Lacuna/Role/TraderRpc.pm @@ -5,71 +5,6 @@ use feature "switch"; use Lacuna::Constants qw(ORE_TYPES FOOD_TYPES); use Lacuna::Util qw(randint); -sub view_my_trades { - my ($self, $session_id, $building_id, $page_number) = @_; - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - $page_number ||=1; - my $my_trades = $building->my_trades->search(undef, { rows => 25, page => $page_number }); - my @trades; - while (my $trade = $my_trades->next) { - push @trades, { - id => $trade->id, - date_offered => $trade->date_offered_formatted, - ask_description => $trade->ask_description, - ask_type => $trade->ask_type, - ask_quantity => $trade->ask_quantity, - offer_description => $trade->offer_description, - offer_type => $trade->offer_sub_type, - offer_quantity => $trade->offer_quantity, - }; - } - return { - trades => \@trades, - trade_count => $my_trades->pager->total_entries, - page_number => $page_number, - status => $self->format_status($empire, $building->body), - }; -} - -sub view_available_trades { # deprecated - my ($self, $session_id, $building_id, $page_number) = @_; - my $empire = $self->get_empire_by_session($session_id); - my $building = $self->get_building($empire, $building_id); - $page_number ||=1; - my $all_trades = $building->available_trades->search( - undef, - { rows => 25, page => $page_number, join => 'body' } - ); - my @trades; - while (my $trade = $all_trades->next) { - push @trades, { - id => $trade->id, - date_offered => $trade->date_offered_formatted, - ask_description => $trade->ask_description, - ask_type => $trade->ask_type, - ask_quantity => $trade->ask_quantity, - offer_description => $trade->offer_description, - offer_type => $trade->offer_sub_type, - offer_quantity => $trade->offer_quantity, - body => { - id => $trade->body_id, - }, - empire => { - id => $trade->body->empire->id, - name => $trade->body->empire->name, - }, - }; - } - return { - trades => \@trades, - trade_count => $all_trades->pager->total_entries, - page_number => $page_number, - captcha => $building->assign_captcha($empire), - status => $self->format_status($empire, $building->body), - }; -} - sub view_my_market { my ($self, $session_id, $building_id, $page_number) = @_; my $empire = $self->get_empire_by_session($session_id); diff --git a/t/Trade.t b/t/Trade.t index ae3266a2..4d37147c 100644 --- a/t/Trade.t +++ b/t/Trade.t @@ -1,5 +1,5 @@ use lib '../lib'; -use Test::More tests => 18; +use Test::More tests => 12; use Test::Deep; use Data::Dumper; use 5.010; @@ -27,15 +27,6 @@ ok($result->{result}{building}{id}, "built a trade ministry"); my $trade = $tester->get_building($result->{result}{building}{id}); $trade->finish_upgrade; -$result = $tester->post('trade', 'view_my_trades', [$session_id, $trade->id]); -ok(exists $result->{result}, 'can call view_my_trades'); - -$result = $tester->post('trade', 'get_stored_resources', [$session_id, $trade->id]); -ok(exists $result->{result}, 'can call get_stored_resources'); - -$result = $tester->post('trade', 'view_available_trades', [$session_id, $trade->id]); -ok(exists $result->{result}, 'can call view_available_trades'); - $result = $tester->post('trade', 'get_trade_ships', [$session_id, $trade->id]); ok(exists $result->{result}, 'can call get_trade_ships'); @@ -51,15 +42,6 @@ ok(exists $result->{result}, 'can call get_plans'); $result = $tester->post('trade', 'get_glyphs', [$session_id, $trade->id]); ok(exists $result->{result}, 'can call get_glyphs'); -$result = $tester->post('trade', 'add_trade', [$session_id, $trade->id]); # no ships -is($result->{error}{code}, 1011, 'can call add_trade'); - -$result = $tester->post('trade', 'accept_trade', [$session_id, $trade->id]); -is($result->{error}{code}, 1002, 'can call accept_trade'); - -$result = $tester->post('trade', 'withdraw_trade', [$session_id, $trade->id]); -is($result->{error}{code}, 1002, 'can call withdraw_trade'); - $result = $tester->post('trade', 'push_items', [$session_id, $trade->id]); is($result->{error}{code}, 1002, 'can call push_items'); diff --git a/t/Transporter.t b/t/Transporter.t index 0cddb0f2..fe909ed7 100644 --- a/t/Transporter.t +++ b/t/Transporter.t @@ -1,5 +1,5 @@ use lib '../lib'; -use Test::More tests => 18; +use Test::More tests => 12; use Test::Deep; use Data::Dumper; use 5.010; @@ -20,15 +20,6 @@ ok($result->{result}{building}{id}, "built a transporter"); my $transporter = $tester->get_building($result->{result}{building}{id}); $transporter->finish_upgrade; -$result = $tester->post('transporter', 'view_my_trades', [$session_id, $transporter->id]); -ok(exists $result->{result}, 'can call view_my_trades'); - -$result = $tester->post('transporter', 'get_stored_resources', [$session_id, $transporter->id]); -ok(exists $result->{result}, 'can call get_stored_resources'); - -$result = $tester->post('transporter', 'view_available_trades', [$session_id, $transporter->id]); -ok(exists $result->{result}, 'can call view_available_trades'); - $result = $tester->post('transporter', 'get_ships', [$session_id, $transporter->id]); ok(exists $result->{result}, 'can call get_ships'); @@ -41,22 +32,12 @@ ok(exists $result->{result}, 'can call get_plans'); $result = $tester->post('transporter', 'get_glyphs', [$session_id, $transporter->id]); ok(exists $result->{result}, 'can call get_glyphs'); -$result = $tester->post('transporter', 'add_trade', [$session_id, $transporter->id]); # no ships -is($result->{error}{code}, 1013, 'can call add_trade'); - -$result = $tester->post('transporter', 'accept_trade', [$session_id, $transporter->id]); -is($result->{error}{code}, 1002, 'can call accept_trade'); - -$result = $tester->post('transporter', 'withdraw_trade', [$session_id, $transporter->id]); -is($result->{error}{code}, 1002, 'can call withdraw_trade'); - $result = $tester->post('transporter', 'push_items', [$session_id, $transporter->id]); is($result->{error}{code}, 1002, 'can call push_items'); $result = $tester->post('transporter', 'trade_one_for_one', [$session_id, $transporter->id, 'algae', 'energy', 10]); ok(exists $result->{result}, 'can call trade_one_for_one'); - $result = $tester->post('transporter', 'add_to_market', [$session_id, $transporter->id, [{ type => 'algae', quantity => 100000}], 1]); is($result->{error}{code}, 1011, 'can call add_to_market'); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 9a221795..03202abc 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -2,6 +2,8 @@ - Fixed counter intel reports being signed by wrong agent. - Identifying buildings that don't use a plot in get_builable() by no_plot_use = 1. - Fixed a bug where space port wouldn't be able to see a ship's path if it couldn't also see the type. + - Fixed a bug where Gas Giants didn't display properly the level of ore they were producing. + - Removed old trade system. 2.4300 - Added Trelvestian AI. -- 2.54.0