# HG changeset patch # User "Rex Tsai " # Date 1225653463 -28800 # Node ID dbdd7dcc91c6e2a50eb30598ffb98203089bf501 # Parent ad88b3c92383bf5c94dad8fc97a41f913f6fb274 fixed for friendly troop and corruption diff -r ad88b3c92383 -r dbdd7dcc91c6 Ikariam.pm --- a/Ikariam.pm Mon Nov 03 02:00:29 2008 +0800 +++ b/Ikariam.pm Mon Nov 03 03:17:43 2008 +0800 @@ -972,7 +972,6 @@ # MilitaryAdvisor $self->checkMilitaryAdvisorMilitaryMovements(); $self->checkMilitaryAdvisorCombatReports(); - $self->checkFriends(); $self->{'research'} = $self->checkResearch((keys(%{$self->{'cities'}}))[0]); # alerts @@ -988,6 +987,7 @@ $self->checkArmies($cityId); $self->checkTavern($cityId); } + # $self->checkFriends(); return $self->{'cities'}; } diff -r ad88b3c92383 -r dbdd7dcc91c6 agent.pl --- a/agent.pl Mon Nov 03 02:00:29 2008 +0800 +++ b/agent.pl Mon Nov 03 03:17:43 2008 +0800 @@ -47,10 +47,11 @@ sub is_warehouse_enougn_for_governorsresidence { my ($self, $city) = @_; - my @warehouse = (qw/undef 0 4 9 16 18 19 20 21 22 23 24 25/); + my @warehouse = (qw/undef undef 0 4 9 16 18 19 20 21 22 23 24 25/); my @cities = keys(%{$self->{ikariam}->{cities}}); - return ($city->{buildings}->{warehouse} < $warehouse[$#cities]) ? 0 : 1; + Carp::carp(sprintf("Required warehouse level %s, current is %s only\n", $warehouse[$#cities], $city->{buildings}->{warehouse})); + return ($city->{buildings}->{warehouse} > $warehouse[$#cities]) ? 0 : 1; } sub is_corruption { @@ -236,7 +237,7 @@ sub is_barracks_upgrading { my ($self, $city) = @_; - return $::i->is_barracks_upgrading($city->{id}); + return $self->{ikariam}->is_barracks_upgrading($city->{id}); } sub is_army_trainning { @@ -263,7 +264,8 @@ # navy sub is_navyExpenditure_available { - my ($self, $cityId) = @_; + my ($self, $city) = @_; + my $cityId = $city->{id}; # move this to somewhere else. my $workersRatio = { @@ -290,7 +292,9 @@ # army sub is_milityExpenditure_available { - my ($self, $cityId) = @_; + my ($self, $city) = @_; + my $cityId = $city->{id}; + # move this to somewhere else. my $workersRatio = { 'citizens' => 0.4, @@ -358,7 +362,6 @@ } DumpFile("army-dump.yaml", $cities); - # build and upgrade for cities $tree = LoadFile('city.yaml'); $cities->{$cityId}->{parse_path} = []; diff -r ad88b3c92383 -r dbdd7dcc91c6 military.yaml --- a/military.yaml Mon Nov 03 02:00:29 2008 +0800 +++ b/military.yaml Mon Nov 03 03:17:43 2008 +0800 @@ -8,7 +8,9 @@ - is_shipyard_level_enough: 0: - is_constructing: - 0: build_shipyard + 0: + - is_any_corruption: + 0: build_shipyard 1: - is_shipyard_upgrading: 0: @@ -28,7 +30,9 @@ - is_barracks_level_enough: 0: - is_constructing: - 0: build_barracks + 0: + - is_any_corruption: + 0: build_barracks 1: - is_barracks_upgrading: 0: diff -r ad88b3c92383 -r dbdd7dcc91c6 warfare.pl --- a/warfare.pl Mon Nov 03 02:00:29 2008 +0800 +++ b/warfare.pl Mon Nov 03 03:17:43 2008 +0800 @@ -143,6 +143,7 @@ $i->login; my $cities = $i->check; $i->checkMilitaryAdvisorCombatReports(); +$i->checkFriends(); foreach my $cityId (keys(%$cities)) { print Dump($i->{'military'});