# HG changeset patch # User "Rex Tsai " # Date 1234382364 -28800 # Node ID 824f949bc484a223d830efed7afa14431c1761cc # Parent 025a36717f2c53eca2645a033123d4adbf2e200a we attack zero army victim every 3 days diff -r 025a36717f2c -r 824f949bc484 Ikariam.pm --- a/Ikariam.pm Thu Feb 12 03:25:32 2009 +0800 +++ b/Ikariam.pm Thu Feb 12 03:59:24 2009 +0800 @@ -852,22 +852,24 @@ $self->{'military'}->{wars} = 0; $self->{'military'}->{attack} = 0; +# FIXME, we don't if there is a attack. foreach (qw/homeland elsewhere/) { $self->{'military'}->{$_} = (); - my $result = $extractor->{doc}->find(sprintf('//div[@id="%s"]//ul[@id="battleReports"]/li[@class="enroute"]', $_)); + my $result = $extractor->{doc}->find(sprintf('//table[@class="locationEvents"]//tr[position() > 1]', $_)); foreach my $div ( @$result ) { my $extractor = new Ikariam::Extractor(content => $div->toString(1)); - my $f = $extractor->find('//div[@class="report"]/a[1]/@href'); - my $t = $extractor->find('//div[@class="report"]/a[2]/@href'); + my $f = $extractor->find('//td[4]/a/@href'); + my $t = $extractor->find('//td[8]/a/@href'); $f = $1 if($f =~ /\?view=island&cityId=(\d+)/); $t = $1 if($t =~ /\?view=island&cityId=(\d+)/); push @{$self->{'military'}->{$_}}, { from => $f, to => $t}; - if($_ eq 'homeland') { - $self->{'military'}->{wars}++; - } else { - $self->{'military'}->{attack}++; - } + +# if($_ eq 'homeland') { +# $self->{'military'}->{wars}++; +# } else { +# $self->{'military'}->{attack}++; +# } } } } diff -r 025a36717f2c -r 824f949bc484 warfare.pl --- a/warfare.pl Thu Feb 12 03:25:32 2009 +0800 +++ b/warfare.pl Thu Feb 12 03:59:24 2009 +0800 @@ -108,7 +108,7 @@ } # check if we over-attacked - my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 - 7*60*60)->count(); + my $c = Ikariam::Report->search_victim($city->cityId, time - 24*60*60 * 3)->count(); # check the current plunders foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) { # counting for both leaving and coming back. @@ -117,7 +117,7 @@ # we don't attack same city twice at same time. next CITY if($_->{to} == $city->cityId); } - next CITY if($c >= 1); + next CITY if($c ge 1); my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; next if($capture < 1500);