Mercurial > eagle-eye
diff Ikariam.pm @ 34:91e387b51aa0
added more rules checking
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sat, 11 Oct 2008 05:19:43 +0800 |
parents | de5de6d472f9 |
children | 7d1e353520ca |
line wrap: on
line diff
--- a/Ikariam.pm Sat Oct 11 05:19:29 2008 +0800 +++ b/Ikariam.pm Sat Oct 11 05:19:43 2008 +0800 @@ -259,8 +259,8 @@ my @elems; my ($elem) = $html->getElementsByAttribute("id", "value_gold"); - $self->{'cities'}->{$cityId}->{gold} = $elem->innerText(); - $self->{'cities'}->{$cityId}->{gold} =~ s/,//g; + $self->{'cities'}->{$cityId}->{resources}->{gold} = $elem->innerText(); + $self->{'cities'}->{$cityId}->{resources}->{gold} =~ s/,//g; my ($elem) = $html->getElementsByAttribute("class", "city"); $self->{'cities'}->{$cityId}->{name} = $elem->innerText(); @@ -272,8 +272,8 @@ # check goods foreach my $good (qw/wood wine marble crystal sulfur/) { my ($elem) = $html->getElementsByAttribute("id", "value_" . $good); - $self->{'cities'}->{$cityId}->{$good} = $elem->innerText(); - $self->{'cities'}->{$cityId}->{$good} =~ s/,//g; + $self->{'cities'}->{$cityId}->{resources}->{$good} = $elem->innerText(); + $self->{'cities'}->{$cityId}->{resources}->{$good} =~ s/,//g; } # search locations @@ -288,11 +288,14 @@ } } - # $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"; + $res = $self->{mech}->get(sprintf('http://%s/index.php?view=militaryAdvisorMilitaryMovements', $self->{server}, $cityId)); + gunzip \$res->content => \$content + or die "gunzip failed: $GunzipError\n"; - + $self->{'cities'}->{$cityId}->{force}->{attacks} = $1 if($content =~ /敵人攻擊: (\d+)/); + $self->{'cities'}->{$cityId}->{force}->{wars} = $1 if($content =~ /我方軍隊行程: (\d+)/); + # if($content =~ /更新戰鬥報告: (\d+)/); + # if($content =~ /新的戰鬥報告: (\d+)/); # check townHall $res = $self->{mech}->get(sprintf('http://%s/index.php?view=townHall&id=%d', $self->{server}, $cityId));