Mercurial > eagle-eye
diff 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 |
line wrap: on
line diff
--- a/Ikariam.pm Fri Oct 10 04:42:05 2008 +0800 +++ b/Ikariam.pm Fri Oct 10 05:15:40 2008 +0800 @@ -272,6 +272,24 @@ $self->{'cities'}->{$cityId}->{$good} =~ s/,//g; } + # search locations + foreach my $i (0..14) { + my ($elem) = $html->getElementsByAttribute("id", "position" . $i); + my $building = $elem->getAttribute('class'); + if ($building ne "buildingGround land") { + $self->{'cities'}->{$cityId}->{locations}[$i] = $building; + my $span = getElementsByAttribute($elem, "class", "textLabel"); + my (undef, undef, $level) = split(/ /, $span->innerText()); + $self->{'cities'}->{$cityId}->{buildings}->{$building} = $level; + } + } + + # $res = $self->{mech}->get(sprintf('http://%s/index.php?view=townHall&id=%d', $self->{server}, $cityId)); + # gunzip \$res->content => \$content + # or die "gunzip failed: $GunzipError\n"; + + + # check townHall $res = $self->{mech}->get(sprintf('http://%s/index.php?view=townHall&id=%d', $self->{server}, $cityId)); gunzip \$res->content => \$content @@ -314,12 +332,6 @@ # <li class="incomegold incomegold_positive"> # <span class="value">-178</span> - # <li class="corruption"> - # <span class="textLabel">腐敗: </span> - # <span class="value positive"> - # <span title="目前腐敗程度">33%</span> - # </span> - # </li> my ($elem) = $html->getElementsByAttribute("title", "目前腐敗程度"); if(defined($elem)) { $self->{'cities'}->{$cityId}->{corruption} = $elem->innerText();