diff Ikariam.pm @ 295:15c288dd7dc5

checking spy risks
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 07 Dec 2008 15:10:14 +0800
parents 24de33db8284
children 1d0a55318262
line wrap: on
line diff
--- a/Ikariam.pm	Fri Dec 05 20:22:20 2008 +0800
+++ b/Ikariam.pm	Sun Dec 07 15:10:14 2008 +0800
@@ -351,6 +351,17 @@
     return @cities;
 }
 
+sub switchCityBySafehouseLevel {
+    my $self = shift;
+}
+
+sub viewSendSpy {
+    my $self = shift;
+    my $cityId = shift;
+    my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=sendSpy&destinationCityId=%d', $self->{server}, $cityId));
+    return Ikariam::Extractor->new(content => $res->content)->find(sprintf('//div[@class="percentage"]/text()'));
+}
+
 sub increaseTransporter {
     my $self = shift;
     my $param = shift;
@@ -855,7 +866,6 @@
             my $extractor = Ikariam::Extractor->new(content => $res->content);
             foreach (1..25) {
                 my @links = $extractor->find(sprintf('//div[@class="spyinfo" and position() = %d]//a/@href', $_));
-                last if($#links < 0);
                 if ($links[0] =~ /id=(\d+)/) {
                     $data->{$1}->{city} = $self->readCity($1);
                     @{$data->{$1}->{risks}} = Ikariam::Extractor->new(content => $self->{mech}->get($links[1])->content)->find('//div[@class="missionRisk"]');