changeset 104:b369fe3c1992

fixed typo and war counting
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 29 Oct 2008 15:08:34 +0800
parents 6804e9c3c589
children c86e2182d3b8
files Ikariam.pm warfare.pl
diffstat 2 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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+)/);
 
--- 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);
         # }