Mercurial > eagle-eye
diff sheep.pl @ 95:6527b4b20d60
refiend the army score filtering
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Mon, 27 Oct 2008 12:14:11 +0800 |
parents | 27b16506231f |
children | 94c9cde99e19 |
line wrap: on
line diff
--- a/sheep.pl Mon Oct 27 11:31:21 2008 +0800 +++ b/sheep.pl Mon Oct 27 12:14:11 2008 +0800 @@ -4,6 +4,10 @@ use Data::Dumper; package main; +my $mime = Ikariam::User->retrieve ('name' => $::user); +# only challenge the small victims +my $army_score_main = ($mime->army_score_main / 3); + my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/; Ikariam::User->has_many(cities => 'Ikariam::Cities'); @@ -19,38 +23,17 @@ AND cities.status = 'i' } ); -#Ikariam::User->set_sql(sheeps => qq { -# SELECT user.id -# FROM user, cities, island -# WHERE user.id == cities.user -# AND cities.island == island.id -# AND island.x <= ? -# AND island.x >= ? -# AND island.y <= ? -# AND island.y >= ? -# AND user.trader_score_secondary >= 50000 -# AND user.army_score_main <= 100 -# } -#); Ikariam::User->set_sql(sheeps => qq { SELECT user.id FROM user, cities WHERE user.id == cities.user - AND user.trader_score_secondary >= 200 - AND user.army_score_main <= 100 + AND user.trader_score_secondary >= user.army_score_main*3 + 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 >= ? ) } ); -if($#ARGV != 1) { - die("Usage: $0 x y\n"); -} -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))); - sub listSheeps { my @sheeps = @_; @@ -73,6 +56,7 @@ next if($c->status eq 'v'); unless($c->status eq 'i') { + # Ignore 聯盟人數大於五 next if($members > 5); } @@ -100,4 +84,12 @@ } } } -# find_or_create + +__MAIN__: + +if($#ARGV != 1) { die("Usage: $0 x y\n"); } +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))); +