# HG changeset patch # User "Rex Tsai " # Date 1225264114 -28800 # Node ID b369fe3c199244915bf57a233972c89807c6a2fa # Parent 6804e9c3c589fb0105683faab0ca40028cd13f60 fixed typo and war counting diff -r 6804e9c3c589 -r b369fe3c1992 Ikariam.pm --- a/Ikariam.pm Wed Oct 29 12:34:18 2008 +0800 +++ b/Ikariam.pm Wed Oct 29 15:08:34 2008 +0800 @@ -512,8 +512,8 @@ my $result = $extractor->{doc}->find(sprintf('//div[@id="%s"]//ul[@id="battleReports"]/li[@class="enroute"]', $_)); 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 $t = $extractor->find('//div[@class="report"]/a[1]/@href'); + my $f = $extractor->find('//div[@class="report"]/a[2]/@href'); $f = $1 if($f =~ /\?view=island&cityId=(\d+)/); $t = $1 if($t =~ /\?view=island&cityId=(\d+)/); diff -r 6804e9c3c589 -r b369fe3c1992 warfare.pl --- a/warfare.pl Wed Oct 29 12:34:18 2008 +0800 +++ b/warfare.pl Wed Oct 29 15:08:34 2008 +0800 @@ -19,7 +19,7 @@ WHERE user.id == cities.user AND user.army_score_main == 0 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? ) - ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC LIMIT 10 + ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC LIMIT 30 } ); Ikariam::Report->set_sql(attack => qq { @@ -75,18 +75,19 @@ # check if we over-attacked my $c = Ikariam::Report->search_attack($city->cityId, time - 24*60*60 - 7*60*60)->count(); # check the current plunders - foreach ($self->{ikariam}->{'military'}->{'homeland'}) { - $c++ if($_{to} eq $city->cityId); + foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) { + printf(Dumper($_)); + $c++ if($_->{to} eq $city->cityId); } next if($c >= 4); - + # { # if(1) { my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; - my $line = sprintf("%d %s [%d,%d] %s %s/%s", + my $line = sprintf("%d %s [%d,%d] %s (%d) %s/%s", $capture, $city->status, $island->x, $island->y, - $city->cityname, + $city->cityname, $city->cityId, $sheep->name, $sheep->ally); printf("%s\n", $line); # }