changeset 102:94c9cde99e19

check the ally by right phe ally page, not counting the members we scanned.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 29 Oct 2008 12:07:19 +0800
parents 592d3b3b7898
children 6804e9c3c589
files sheep.pl
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sheep.pl	Wed Oct 29 12:05:36 2008 +0800
+++ b/sheep.pl	Wed Oct 29 12:07:19 2008 +0800
@@ -11,6 +11,7 @@
 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/;
 
 Ikariam::User->has_many(cities => 'Ikariam::Cities');
+Ikariam::User->has_a(ally => 'Ikariam::Ally');
 Ikariam::User->set_sql(inactivity => qq {
     SELECT user.id 
       FROM user, cities, island
@@ -47,7 +48,9 @@
         # 查聯盟數量
         my $members = 1;
         unless ($sheep->allyId == '0') {
-            $members = Ikariam::User->search(allyId => $sheep->allyId)->count();
+            my $ally = $sheep->ally;
+            $members = $ally->members;
+            # Ikariam::User->search(allyId => $sheep->allyId)->count();
         }
 
         foreach my $c ($sheep->cities) {
@@ -57,6 +60,7 @@
 
             unless($c->status eq 'i') {
                 # Ignore 聯盟人數大於五
+                # TODO 應該依照影響力來分
                 next if($members > 5);
             }
 
@@ -65,7 +69,7 @@
             # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000
             my $capture = $c->citylevel * ($c->citylevel - 1) * $sheep->trader_score_secondary / 10000;
 
-            next if($capture < 100);
+            next if($capture < 200);
 
             $line = sprintf("%d %s score %d army %d %s/%s(%d),", 
                 $capture,