diff warfare.pl @ 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 592d3b3b7898
children c86e2182d3b8
line wrap: on
line diff
--- 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);
         # }