Mercurial > eagle-eye
comparison 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 |
comparison
equal
deleted
inserted
replaced
14:8b7bc598ba06 | 15:e68f4cadfabd |
---|---|
13 AND cities.island == island.id | 13 AND cities.island == island.id |
14 AND island.x <= ? | 14 AND island.x <= ? |
15 AND island.x >= ? | 15 AND island.x >= ? |
16 AND island.y <= ? | 16 AND island.y <= ? |
17 AND island.y >= ? | 17 AND island.y >= ? |
18 AND user.status = 'i' | 18 AND cities.status = 'i' |
19 } | 19 } |
20 ); | 20 ); |
21 Ikariam::User->set_sql(sheeps => qq { | 21 Ikariam::User->set_sql(sheeps => qq { |
22 SELECT user.id | 22 SELECT user.id |
23 FROM user, cities, island | 23 FROM user, cities, island |
36 die("Usage: $0 x y\n"); | 36 die("Usage: $0 x y\n"); |
37 } | 37 } |
38 my ($x, $y) = @ARGV; | 38 my ($x, $y) = @ARGV; |
39 | 39 |
40 listSheeps(Ikariam::User->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6))); | 40 listSheeps(Ikariam::User->search_sheeps(($x + 6), ($x - 6), ($y + 6), ($y - 6))); |
41 listSheeps(Ikariam::User->search_inactivity(($x + 6), ($x - 6), ($y + 6), ($y - 6))); | 41 # listSheeps(Ikariam::User->search_inactivity(($x + 6), ($x - 6), ($y + 6), ($y - 6))); |
42 | 42 |
43 sub listSheeps | 43 sub listSheeps |
44 { | 44 { |
45 my @sheeps = @_; | 45 my @sheeps = @_; |
46 | 46 |
47 my $s; | 47 my $s; |
48 foreach my $sheep (sort (@sheeps)) { | 48 foreach my $sheep (sort (@sheeps)) { |
49 # avoid duplicate | 49 # avoid duplicate |
50 next if($sheep->id == $s); $s = $sheep->id; | 50 next if($sheep->id == $s); $s = $sheep->id; |
51 | 51 |
52 # 假期模式 | |
53 next if($sheep->status eq 'v'); | |
54 | 52 |
55 # 查聯盟數量 | 53 # 查聯盟數量 |
56 my $members = 1; | 54 my $members = 1; |
57 unless ($sheep->status eq 'i' || $sheep->allyId == '0') { | 55 unless ($sheep->allyId == '0') { |
58 $members = Ikariam::User->search(allyId => $sheep->allyId)->count(); | 56 $members = Ikariam::User->search(allyId => $sheep->allyId)->count(); |
59 next if($members > 3); | |
60 } | 57 } |
61 | 58 |
62 # print Dumper($sheep->_data_hash); | |
63 foreach my $c ($sheep->cities) { | 59 foreach my $c ($sheep->cities) { |
64 # print Dumper($c->_data_hash); | |
65 | 60 |
66 print("!") if ($c->status eq 'i'); | 61 # 假期模式 |
62 next if($c->status eq 'v'); | |
67 | 63 |
68 printf("%d,%d,%d,%s of %s (%d),", $sheep->trader_score_secondary, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members); | 64 unless($c->status eq 'i') { |
65 next if($members > 3); | |
66 } | |
67 | |
68 printf("%d %s %d,%d,%s of %s (%d),", | |
69 $sheep->trader_score_secondary, $c->status, $sheep->score, $sheep->army_score_main, $sheep->name, $sheep->ally, $members); | |
69 | 70 |
70 my $island = Ikariam::Island->retrieve($c->island); | 71 my $island = Ikariam::Island->retrieve($c->island); |
71 printf("%s,%d,[%d,%d],http://s2.ikariam.tw/index.php?view=island&id=%d\n", $c->cityname, $c->citylevel, | 72 printf("%s,%d,[%d,%d],http://s2.ikariam.tw/index.php?view=island&id=%d\n", $c->cityname, $c->citylevel, |
72 $island->x, $island->y, | 73 $island->x, $island->y, |
73 $island->id); | 74 $island->id); |