Mercurial > eagle-eye
comparison Ikariam.pm @ 29:dbec53e754e3
added rule_building
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 10 Oct 2008 05:15:40 +0800 |
parents | 99723b8f348b |
children | de5de6d472f9 |
comparison
equal
deleted
inserted
replaced
28:99723b8f348b | 29:dbec53e754e3 |
---|---|
269 foreach my $good (qw/wood wine marble crystal sulfur/) { | 269 foreach my $good (qw/wood wine marble crystal sulfur/) { |
270 my ($elem) = $html->getElementsByAttribute("id", "value_" . $good); | 270 my ($elem) = $html->getElementsByAttribute("id", "value_" . $good); |
271 $self->{'cities'}->{$cityId}->{$good} = $elem->innerText(); | 271 $self->{'cities'}->{$cityId}->{$good} = $elem->innerText(); |
272 $self->{'cities'}->{$cityId}->{$good} =~ s/,//g; | 272 $self->{'cities'}->{$cityId}->{$good} =~ s/,//g; |
273 } | 273 } |
274 | |
275 # search locations | |
276 foreach my $i (0..14) { | |
277 my ($elem) = $html->getElementsByAttribute("id", "position" . $i); | |
278 my $building = $elem->getAttribute('class'); | |
279 if ($building ne "buildingGround land") { | |
280 $self->{'cities'}->{$cityId}->{locations}[$i] = $building; | |
281 my $span = getElementsByAttribute($elem, "class", "textLabel"); | |
282 my (undef, undef, $level) = split(/ /, $span->innerText()); | |
283 $self->{'cities'}->{$cityId}->{buildings}->{$building} = $level; | |
284 } | |
285 } | |
286 | |
287 # $res = $self->{mech}->get(sprintf('http://%s/index.php?view=townHall&id=%d', $self->{server}, $cityId)); | |
288 # gunzip \$res->content => \$content | |
289 # or die "gunzip failed: $GunzipError\n"; | |
290 | |
291 | |
274 | 292 |
275 # check townHall | 293 # check townHall |
276 $res = $self->{mech}->get(sprintf('http://%s/index.php?view=townHall&id=%d', $self->{server}, $cityId)); | 294 $res = $self->{mech}->get(sprintf('http://%s/index.php?view=townHall&id=%d', $self->{server}, $cityId)); |
277 gunzip \$res->content => \$content | 295 gunzip \$res->content => \$content |
278 or die "gunzip failed: $GunzipError\n"; | 296 or die "gunzip failed: $GunzipError\n"; |
312 | 330 |
313 # <li class="incomegold incomegold_negative"> | 331 # <li class="incomegold incomegold_negative"> |
314 # <li class="incomegold incomegold_positive"> | 332 # <li class="incomegold incomegold_positive"> |
315 # <span class="value">-178</span> | 333 # <span class="value">-178</span> |
316 | 334 |
317 # <li class="corruption"> | |
318 # <span class="textLabel">腐敗: </span> | |
319 # <span class="value positive"> | |
320 # <span title="目前腐敗程度">33%</span> | |
321 # </span> | |
322 # </li> | |
323 my ($elem) = $html->getElementsByAttribute("title", "目前腐敗程度"); | 335 my ($elem) = $html->getElementsByAttribute("title", "目前腐敗程度"); |
324 if(defined($elem)) { | 336 if(defined($elem)) { |
325 $self->{'cities'}->{$cityId}->{corruption} = $elem->innerText(); | 337 $self->{'cities'}->{$cityId}->{corruption} = $elem->innerText(); |
326 $self->{'cities'}->{$cityId}->{corruption} =~ s/%//g; | 338 $self->{'cities'}->{$cityId}->{corruption} =~ s/%//g; |
327 } | 339 } |