comparison sheep.pl @ 142:9b8aa30a532c

counting members by ally
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 10:53:14 +0800
parents 21df8eb17a52
children 937fc672df56
comparison
equal deleted inserted replaced
141:0da6658697df 142:9b8aa30a532c
46 next if($sheep->id == $s); $s = $sheep->id; 46 next if($sheep->id == $s); $s = $sheep->id;
47 47
48 # 查聯盟數量 48 # 查聯盟數量
49 my $members = 1; 49 my $members = 1;
50 unless ($sheep->allyId == '0') { 50 unless ($sheep->allyId == '0') {
51 my $ally = $sheep->ally; 51 unless (!defined($sheep->allyId) || $sheep->allyId == 0) {
52 $members = $ally->members; 52 my $ally = Ikariam::Ally->retrieve($sheep->allyId);
53 # Ikariam::User->search(allyId => $sheep->allyId)->count(); 53 $members = $ally->members;
54 }
54 } 55 }
55 56
56 foreach my $c ($sheep->cities) { 57 foreach my $c ($sheep->cities) {
57 my $line = ""; 58 my $line = "";
58 # Ignore 假期模式 59 # Ignore 假期模式
59 next if($c->status eq 'v'); 60 next if($c->status eq 'v');
60 61
61 unless($c->status eq 'i') { 62 unless($c->status eq 'i') {
62 # Ignore 聯盟人數大於五 63 # Ignore 聯盟人數大於五
63 # TODO 應該依照影響力來分 64 # TODO 應該依照影響力來分
64 next if($members > 5); 65 next if($members > 10);
65 } 66 }
66 67
67 my $island = Ikariam::Island->retrieve($c->island); 68 my $island = Ikariam::Island->retrieve($c->island);
68 69
69 # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000 70 # 所得金錢 = 對方城鎮等級x(對方城鎮等級-1)x對方金錢/10000