changeset 361:81a2aeaf6bf7

refined sheep finder for 0.3.0
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Mon, 23 Feb 2009 16:26:30 +0800
parents 26f52b25aa06
children 7f38a5cb769e
files sheep.pl
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/sheep.pl	Mon Feb 23 16:25:02 2009 +0800
+++ b/sheep.pl	Mon Feb 23 16:26:30 2009 +0800
@@ -6,11 +6,11 @@
 package main;
 my $mime = Ikariam::User->retrieve ('name' => $::user);
 my $myAlly = undef;
-$myAlly = Ikariam::Ally->retrieve($mime->allyId)
-    if(defined($mime->allyId) && $mime->allyId ne '0');
+$myAlly = Ikariam::Ally->retrieve($mime->allyId) if(defined($mime->allyId) && $mime->allyId ne '0');
 
 # only challenge the small victims
-my $army_score_main = ($mime->army_score_main / 3);
+# my $army_score_main = ($mime->army_score_main / 3);
+my $army_score_main = $mime->army_score_main;
 
 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/;
 
@@ -33,8 +33,7 @@
         SELECT user.id 
           FROM user, cities 
          WHERE user.id == cities.user 
-           AND user.trader_score_secondary >= user.army_score_main*3
-           AND user.army_score_main <= $army_score_main
+         AND user.army_score_main <= $army_score_main
            AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? )
     }
 );
@@ -75,11 +74,11 @@
 #                }
 #            }
 
-            next if($c->citylevel le 5);
-            next if($c->risk ge 50);
+            next if($mime->allyId ==  $sheep->allyId);
+            next if($c->citylevel <= 5);
+            next if($c->risk >= 50);
             my $island = Ikariam::Island->retrieve($c->island);
 
-
             $line = sprintf("%d %s score %d army %d risk %d %s/%s,", 
                 travelTime($::x, $::y, $island->x, $island->y),
                 # $capture,