Mercurial > eagle-eye
comparison warfare.pl @ 104:b369fe3c1992
fixed typo and war counting
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 29 Oct 2008 15:08:34 +0800 |
parents | 592d3b3b7898 |
children | c86e2182d3b8 |
comparison
equal
deleted
inserted
replaced
103:6804e9c3c589 | 104:b369fe3c1992 |
---|---|
17 SELECT cities.cityId | 17 SELECT cities.cityId |
18 FROM user, cities | 18 FROM user, cities |
19 WHERE user.id == cities.user | 19 WHERE user.id == cities.user |
20 AND user.army_score_main == 0 | 20 AND user.army_score_main == 0 |
21 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? ) | 21 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? ) |
22 ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC LIMIT 10 | 22 ORDER BY cities.citylevel * (cities.citylevel - 1) * user.trader_score_secondary / 10000 DESC LIMIT 30 |
23 } | 23 } |
24 ); | 24 ); |
25 Ikariam::Report->set_sql(attack => qq { | 25 Ikariam::Report->set_sql(attack => qq { |
26 SELECT report.id | 26 SELECT report.id |
27 FROM report | 27 FROM report |
73 } | 73 } |
74 | 74 |
75 # check if we over-attacked | 75 # check if we over-attacked |
76 my $c = Ikariam::Report->search_attack($city->cityId, time - 24*60*60 - 7*60*60)->count(); | 76 my $c = Ikariam::Report->search_attack($city->cityId, time - 24*60*60 - 7*60*60)->count(); |
77 # check the current plunders | 77 # check the current plunders |
78 foreach ($self->{ikariam}->{'military'}->{'homeland'}) { | 78 foreach (@{$self->{ikariam}->{'military'}->{'homeland'}}) { |
79 $c++ if($_{to} eq $city->cityId); | 79 printf(Dumper($_)); |
80 $c++ if($_->{to} eq $city->cityId); | |
80 } | 81 } |
81 next if($c >= 4); | 82 next if($c >= 4); |
82 | 83 |
83 # { | 84 # { |
84 # if(1) { | 85 # if(1) { |
85 my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; | 86 my $capture = $city->citylevel * ($city->citylevel - 1) * $sheep->trader_score_secondary / 10000; |
86 my $line = sprintf("%d %s [%d,%d] %s %s/%s", | 87 my $line = sprintf("%d %s [%d,%d] %s (%d) %s/%s", |
87 $capture, $city->status, | 88 $capture, $city->status, |
88 $island->x, $island->y, | 89 $island->x, $island->y, |
89 $city->cityname, | 90 $city->cityname, $city->cityId, |
90 $sheep->name, $sheep->ally); | 91 $sheep->name, $sheep->ally); |
91 printf("%s\n", $line); | 92 printf("%s\n", $line); |
92 # } | 93 # } |
93 return $city->cityId; | 94 return $city->cityId; |
94 } | 95 } |