diff sheep.pl @ 15:e68f4cadfabd

fixed the 假期模式
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 08 Oct 2008 12:56:40 +0800
parents e21b8f303c6a
children fd44e3a1f800
line wrap: on
line diff
--- a/sheep.pl	Wed Oct 08 12:18:50 2008 +0800
+++ b/sheep.pl	Wed Oct 08 12:56:40 2008 +0800
@@ -15,7 +15,7 @@
         AND island.x >= ?
         AND island.y <= ?
         AND island.y >= ?
-        AND user.status = 'i'
+        AND cities.status = 'i'
     }
 );
 Ikariam::User->set_sql(sheeps => qq {
@@ -38,7 +38,7 @@
 my ($x, $y) = @ARGV;
 
 listSheeps(Ikariam::User->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6)));
-listSheeps(Ikariam::User->search_inactivity(($x + 6), ($x - 6), ($y + 6), ($y - 6)));
+# listSheeps(Ikariam::User->search_inactivity(($x + 6), ($x - 6), ($y + 6), ($y - 6)));
 
 sub listSheeps
 {
@@ -49,23 +49,24 @@
         # avoid duplicate
         next if($sheep->id == $s); $s = $sheep->id;
 
-        # 假期模式
-        next if($sheep->status eq 'v');
 
         # 查聯盟數量
         my $members = 1;
-        unless ($sheep->status eq 'i' || $sheep->allyId == '0') {
+        unless ($sheep->allyId == '0') {
             $members = Ikariam::User->search(allyId => $sheep->allyId)->count();
-            next if($members > 3);
         }
 
-        # print Dumper($sheep->_data_hash);
         foreach my $c ($sheep->cities) {
-            # print Dumper($c->_data_hash);
+
+            # 假期模式
+            next if($c->status eq 'v');
 
-            print("!") if ($c->status eq 'i');
+            unless($c->status eq 'i') {
+                next if($members > 3);
+            }
 
-            printf("%d,%d,%d,%s of %s (%d),", $sheep->trader_score_secondary, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members);
+            printf("%d %s %d,%d,%s of %s (%d),", 
+                $sheep->trader_score_secondary, $c->status, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members);
 
             my $island = Ikariam::Island->retrieve($c->island);
             printf("%s,%d,[%d,%d],http://s2.ikariam.tw/index.php?view=island&id=%d\n", $c->cityname, $c->citylevel,