diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index be138db1..ba2db3fb 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -371,7 +371,8 @@ around get_status => sub { } # empires who have disabled the option, don't see incoming ships $out->{skip_incoming_ships} = $empire->skip_incoming_ships; - if (not $empire->skip_incoming_ships) { + if (1) { +# if (not $empire->skip_incoming_ships) { my $now = time; my $foreign_bodies; -- 2.51.2 From da11f7ba0ec87a0a63ac81f925119da3a7e07c9f Mon Sep 17 00:00:00 2001 From: Ian Docherty Date: Tue, 31 Jul 2012 07:50:41 -0400 Subject: [PATCH 2/9] Updated version and changes.txt --- lib/Lacuna.pm | 2 +- var/www/public/changes.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Lacuna.pm b/lib/Lacuna.pm index 27085fcf..412cbf0c 100644 --- a/lib/Lacuna.pm +++ b/lib/Lacuna.pm @@ -7,7 +7,7 @@ use Config::JSON; useall __PACKAGE__; -our $VERSION = 3.0864; +our $VERSION = 3.0865; my $config = Config::JSON->new('/data/Lacuna-Server/etc/lacuna.conf'); my $db = Lacuna::DB->connect($config->get('db/dsn'),$config->get('db/username'),$config->get('db/password'), { mysql_enable_utf8 => 1}); diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index fcb1795f..56ef2ba9 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,3 +1,6 @@ +3.0865: + - Mod: Removed option to disable display of incoming ships. (To see if it fixes some resource issues) + 3.0864: - Mod: LCOT cheaper to build, longer to build, and spy proofed. -- 2.51.2 From 1d008245295d82833f358b5b3400816c73259b72 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Wed, 1 Aug 2012 09:25:02 -0600 Subject: [PATCH 3/9] People have poor email reading skills. --- var/messages/tutorial/counter_spy.txt | 2 +- var/www/public/changes.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/var/messages/tutorial/counter_spy.txt b/var/messages/tutorial/counter_spy.txt index a2f36f25..e7d39668 100644 --- a/var/messages/tutorial/counter_spy.txt +++ b/var/messages/tutorial/counter_spy.txt @@ -9,5 +9,5 @@ Regards, Not Tou Re Ell (I'm evil, you just don't know it yet!) Lacuna Expanse Corp -Task: Train another spy and assign them duties. +Task: Train another spy and assign them to Counter Espionage. Reward: Free resources. diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 56ef2ba9..4f4d1288 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,5 +1,6 @@ 3.0865: - Mod: Removed option to disable display of incoming ships. (To see if it fixes some resource issues) + - Mod: Attempt to make Counter Espionage tutorial message clearer since people can't read. 3.0864: - Mod: LCOT cheaper to build, longer to build, and spy proofed. -- 2.51.2 From 20b811e1032c0b73e0efc91c50cd7fa02016ed73 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Thu, 2 Aug 2012 16:08:24 -0600 Subject: [PATCH 4/9] Fixed Stockpile downgrade and demolish checks. --- lib/Lacuna/DB/Result/Building/Stockpile.pm | 14 +++++++------- var/www/public/changes.txt | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Lacuna/DB/Result/Building/Stockpile.pm b/lib/Lacuna/DB/Result/Building/Stockpile.pm index 8294dc6c..70c79699 100644 --- a/lib/Lacuna/DB/Result/Building/Stockpile.pm +++ b/lib/Lacuna/DB/Result/Building/Stockpile.pm @@ -52,15 +52,15 @@ use constant water_storage => 300; before 'can_downgrade' => sub { my $self = shift; - my $max_level = 15; + my $max_level = 15 + int(($self->level-1)/3); if ($self->body->empire->university_level > 25) { $max_level += ($self->body->empire->university_level - 25); } foreach my $building (@{$self->body->building_cache}) { - if ($building->level > $max_level + (($self->level - 1)/3) && + if ($building->level > $max_level && 'Resources' ~~ [$building->build_tags] && - ( !('Storage' ~~ [$self->build_tags]) || - $self->isa('Lacuna::DB::Result::Building::Waste::Exchanger'))) { + ( !('Storage' ~~ [$building->build_tags]) || + $building->isa('Lacuna::DB::Result::Building::Waste::Exchanger'))) { confess [1013, 'You have to downgrade your level '. $building->level.' '.$building->name.' to level '. $max_level.' before you can downgrade the Stockpile.']; @@ -75,10 +75,10 @@ before 'can_demolish' => sub { $max_level += ($self->body->empire->university_level - 25); } foreach my $building (@{$self->body->building_cache}) { - if ($building->level > $max_level + (($self->level - 1)/3) && + if ($building->level > $max_level && 'Resources' ~~ [$building->build_tags] && - ( !('Storage' ~~ [$self->build_tags]) || - $self->isa('Lacuna::DB::Result::Building::Waste::Exchanger'))) { + ( !('Storage' ~~ [$building->build_tags]) || + $building->isa('Lacuna::DB::Result::Building::Waste::Exchanger'))) { confess [1013, 'You have to downgrade your level '. $building->level.' '.$building->name. ' to level '.$max_level. diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 4f4d1288..9e33e3f7 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -1,6 +1,7 @@ 3.0865: - Mod: Removed option to disable display of incoming ships. (To see if it fixes some resource issues) - - Mod: Attempt to make Counter Espionage tutorial message clearer since people can't read. + - Mod: Attempt to make Counter Espionage tutorial message clearer since people don't read the entire email. + - Fix: Stockpile wasn't checking levels properly on downgrade and demolish. 3.0864: - Mod: LCOT cheaper to build, longer to build, and spy proofed. -- 2.51.2 From 76ee26d4d697c420c544a3be2e158074e58110f5 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Thu, 2 Aug 2012 16:47:10 -0600 Subject: [PATCH 5/9] Slightly clearer text. --- var/messages/tutorial/counter_spy.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/var/messages/tutorial/counter_spy.txt b/var/messages/tutorial/counter_spy.txt index e7d39668..12b2601e 100644 --- a/var/messages/tutorial/counter_spy.txt +++ b/var/messages/tutorial/counter_spy.txt @@ -9,5 +9,5 @@ Regards, Not Tou Re Ell (I'm evil, you just don't know it yet!) Lacuna Expanse Corp -Task: Train another spy and assign them to Counter Espionage. +Task: Train another spy and assign both of them to Counter Espionage. Reward: Free resources. -- 2.51.2 From 51ef17151528e950f44370468d2ac3fc26f0ef0b Mon Sep 17 00:00:00 2001 From: lemming552 Date: Wed, 8 Aug 2012 19:55:09 -0600 Subject: [PATCH 6/9] Fixed BHG related supply chain. --- lib/Lacuna/RPC/Building/BlackHoleGenerator.pm | 30 ++++++++++--------- var/www/public/changes.txt | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm b/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm index e51320b5..839fd651 100644 --- a/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm +++ b/lib/Lacuna/RPC/Building/BlackHoleGenerator.pm @@ -482,16 +482,6 @@ sub bhg_swap { star_id => $new_data->{star_id}, orbit => $new_data->{orbit}, }); - my $waste_chain = Lacuna->db->resultset('Lacuna::DB::Result::WasteChain') - ->search({ planet_id => $body->id }); - if ($waste_chain->count > 0) { - while (my $chain = $waste_chain->next) { - $chain->update({ - star_id => $new_data->{star_id} - }); - } - $body->recalc_chains; - } unless ($new_data->{type} eq "empty") { $target->update({ @@ -502,17 +492,29 @@ sub bhg_swap { star_id => $old_data->{star_id}, orbit => $old_data->{orbit}, }); - $waste_chain = Lacuna->db->resultset('Lacuna::DB::Result::WasteChain') + my $target_waste = Lacuna->db->resultset('Lacuna::DB::Result::WasteChain') ->search({ planet_id => $target->id }); - if ($waste_chain->count > 0) { - while (my $chain = $waste_chain->next) { + if ($target_waste->count > 0) { + while (my $chain = $target_waste->next) { $chain->update({ star_id => $old_data->{star_id} }); } - $target->recalc_chains; + } + $target->recalc_chains; # Recalc all chains + } + + my $waste_chain = Lacuna->db->resultset('Lacuna::DB::Result::WasteChain') + ->search({ planet_id => $body->id }); + if ($waste_chain->count > 0) { + while (my $chain = $waste_chain->next) { + $chain->update({ + star_id => $new_data->{star_id} + }); } } + $body->recalc_chains; # Recalc all chains + return { id => $body->id, message => "Swapped Places", diff --git a/var/www/public/changes.txt b/var/www/public/changes.txt index 9e33e3f7..1009dfe3 100644 --- a/var/www/public/changes.txt +++ b/var/www/public/changes.txt @@ -2,6 +2,7 @@ - Mod: Removed option to disable display of incoming ships. (To see if it fixes some resource issues) - Mod: Attempt to make Counter Espionage tutorial message clearer since people don't read the entire email. - Fix: Stockpile wasn't checking levels properly on downgrade and demolish. + - Fix: Chains were being recalculated at the wrong time if a swap was being done with it's target. 3.0864: - Mod: LCOT cheaper to build, longer to build, and spy proofed. -- 2.51.2 From 29ba5a0018c7c81105cc7c74f55d604e6dc08037 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Sun, 12 Aug 2012 14:47:23 -0600 Subject: [PATCH 7/9] summarize_server.pl taken out of run_hourly.sh --- bin/run_hourly.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/run_hourly.sh b/bin/run_hourly.sh index 90c1a47c..026802e8 100755 --- a/bin/run_hourly.sh +++ b/bin/run_hourly.sh @@ -3,7 +3,7 @@ export PATH=/data/apps/bin:$PATH cd /data/Lacuna-Server/bin perl clean_up_empires.pl >>/tmp/hourly.log 2>>/tmp/hourly.log perl sanitize_ss.pl >>/tmp/hourly.log 2>>/tmp/hourly.log -perl summarize_server.pl >>/tmp/hourly.log 2>>/tmp/hourly.log +# perl summarize_server.pl >>/tmp/hourly.log 2>>/tmp/hourly.log perl summarize_economy.pl >>/tmp/hourly.log 2>>/tmp/hourly.log perl generate_news_feeds.pl >>/tmp/news_feeds.log 2>>/tmp/news_feeds.log perl tick_spies.pl >>/tmp/hourly.log 2>>/tmp/hourly.log -- 2.51.2 From bd21ce7eb14e6bbcf1c16d86203851ed071ea087 Mon Sep 17 00:00:00 2001 From: ysth Date: Sun, 12 Aug 2012 18:25:51 -0700 Subject: [PATCH 8/9] Allow assigning a spy that hasn't been ticked yet --- lib/Lacuna/DB/Result/Spies.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Lacuna/DB/Result/Spies.pm b/lib/Lacuna/DB/Result/Spies.pm index 7299a6d4..eb3e1453 100644 --- a/lib/Lacuna/DB/Result/Spies.pm +++ b/lib/Lacuna/DB/Result/Spies.pm @@ -380,6 +380,8 @@ use constant assignments => ( sub assign { my ($self, $assignment) = @_; + my $is_available = $self->is_available; + # determine mission my $mission; foreach my $possible (@{$self->get_possible_assignments}) { @@ -387,7 +389,7 @@ sub assign { $mission = $possible; } } - if (!$mission->{skill} || !$self->is_available) { + if (!$mission->{skill} || !$is_available) { return { result =>'Failure', reason => random_element(['I am busy just now.','It will have to wait.','Can\'t right now.','Maybe later.','Negative.']) }; } -- 2.51.2 From 0e6c1451999de92887e5fc76524e2e526e9172e7 Mon Sep 17 00:00:00 2001 From: lemming552 Date: Thu, 16 Aug 2012 18:34:32 -0600 Subject: [PATCH 9/9] Some checks. --- bin/tick_planets.pl | 5 +++-- lib/Lacuna/DB/Result/Map/Body/Planet.pm | 26 ++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/bin/tick_planets.pl b/bin/tick_planets.pl index 4f61a3a2..7e475390 100644 --- a/bin/tick_planets.pl +++ b/bin/tick_planets.pl @@ -5,6 +5,7 @@ use Lacuna::DB; use Lacuna; use Lacuna::Util qw(randint format_date); use Getopt::Long; +use utf8; $|=1; our $quiet; GetOptions( @@ -21,14 +22,14 @@ our $db = Lacuna->db; out('Ticking planets'); my $planets_rs = $db->resultset('Lacuna::DB::Result::Map::Body')->search({empire_id => {'!=' => 0}}); while (my $planet = $planets_rs->next) { - out('Ticking '.$planet->name); + out('Ticking '.$planet->name.' : '.$planet->id); eval{$planet->tick}; my $reason = $@; if (ref $reason eq 'ARRAY' && $reason->[0] eq -1) { # this is an expected exception, it means one of the roles took over } elsif ( ref $reason eq 'ARRAY') { - out('Ticking '.$planet->name); + out('Ticking '.$planet->name); out(sprintf("Ticking %s resulted in errno: %d, %s\n", $planet->name, $reason->[0], $reason->[1])); } elsif ( $reason ) { diff --git a/lib/Lacuna/DB/Result/Map/Body/Planet.pm b/lib/Lacuna/DB/Result/Map/Body/Planet.pm index ba2db3fb..247d8702 100644 --- a/lib/Lacuna/DB/Result/Map/Body/Planet.pm +++ b/lib/Lacuna/DB/Result/Map/Body/Planet.pm @@ -784,29 +784,29 @@ sub has_room_in_build_queue { use constant operating_resource_names => qw(food_hour energy_hour ore_hour water_hour); has future_operating_resources => ( - is => 'rw', - clearer => 'clear_future_operating_resources', - lazy => 1, - default => sub { + is => 'rw', + clearer => 'clear_future_operating_resources', + lazy => 1, + default => sub { my $self = shift; - # get current + # get current my %future; foreach my $method ($self->operating_resource_names) { - $future{$method} = $self->$method; + $future{$method} = $self->$method; } - # adjust for what's already in build queue + # adjust for what's already in build queue my @queued_builds = @{$self->builds}; foreach my $build (@queued_builds) { - my $other = $build->stats_after_upgrade; - foreach my $method ($self->operating_resource_names) { - $future{$method} += $other->{$method} - $build->$method; - } + my $other = $build->stats_after_upgrade; + foreach my $method ($self->operating_resource_names) { + $future{$method} += $other->{$method} - $build->$method; + } } return \%future; }, - ); +); sub has_resources_to_operate { my ($self, $building) = @_; @@ -1286,7 +1286,7 @@ sub tick { return undef; } else { - $cache->set('ticking',$self->id, 1, 60); + $cache->set('ticking',$self->id, 1, 300); } my $now = DateTime->now;