Mercurial > eagle-eye
comparison sheep.pl @ 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 | 6527b4b20d60 |
children | 21df8eb17a52 |
comparison
equal
deleted
inserted
replaced
101:592d3b3b7898 | 102:94c9cde99e19 |
---|---|
9 my $army_score_main = ($mime->army_score_main / 3); | 9 my $army_score_main = ($mime->army_score_main / 3); |
10 | 10 |
11 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/; | 11 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/; |
12 | 12 |
13 Ikariam::User->has_many(cities => 'Ikariam::Cities'); | 13 Ikariam::User->has_many(cities => 'Ikariam::Cities'); |
14 Ikariam::User->has_a(ally => 'Ikariam::Ally'); | |
14 Ikariam::User->set_sql(inactivity => qq { | 15 Ikariam::User->set_sql(inactivity => qq { |
15 SELECT user.id | 16 SELECT user.id |
16 FROM user, cities, island | 17 FROM user, cities, island |
17 WHERE user.id == cities.user | 18 WHERE user.id == cities.user |
18 AND cities.island == island.id | 19 AND cities.island == island.id |
45 next if($sheep->id == $s); $s = $sheep->id; | 46 next if($sheep->id == $s); $s = $sheep->id; |
46 | 47 |
47 # 查聯盟數量 | 48 # 查聯盟數量 |
48 my $members = 1; | 49 my $members = 1; |
49 unless ($sheep->allyId == '0') { | 50 unless ($sheep->allyId == '0') { |
50 $members = Ikariam::User->search(allyId => $sheep->allyId)->count(); | 51 my $ally = $sheep->ally; |
52 $members = $ally->members; | |
53 # Ikariam::User->search(allyId => $sheep->allyId)->count(); | |
51 } | 54 } |
52 | 55 |
53 foreach my $c ($sheep->cities) { | 56 foreach my $c ($sheep->cities) { |
54 my $line = ""; | 57 my $line = ""; |
55 # Ignore 假期模式 | 58 # Ignore 假期模式 |
56 next if($c->status eq 'v'); | 59 next if($c->status eq 'v'); |
57 | 60 |
58 unless($c->status eq 'i') { | 61 unless($c->status eq 'i') { |
59 # Ignore 聯盟人數大於五 | 62 # Ignore 聯盟人數大於五 |
63 # TODO 應該依照影響力來分 | |
60 next if($members > 5); | 64 next if($members > 5); |
61 } | 65 } |
62 | 66 |
63 my $island = Ikariam::Island->retrieve($c->island); | 67 my $island = Ikariam::Island->retrieve($c->island); |
64 | 68 |
65 # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000 | 69 # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000 |
66 my $capture = $c->citylevel * ($c->citylevel - 1) * $sheep->trader_score_secondary / 10000; | 70 my $capture = $c->citylevel * ($c->citylevel - 1) * $sheep->trader_score_secondary / 10000; |
67 | 71 |
68 next if($capture < 100); | 72 next if($capture < 200); |
69 | 73 |
70 $line = sprintf("%d %s score %d army %d %s/%s(%d),", | 74 $line = sprintf("%d %s score %d army %d %s/%s(%d),", |
71 $capture, | 75 $capture, |
72 $c->status, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members); | 76 $c->status, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members); |
73 | 77 |