Mercurial > eagle-eye
comparison 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 |
comparison
equal
deleted
inserted
replaced
290:2cdf6c6bfd0e | 295:15c288dd7dc5 |
---|---|
349 } | 349 } |
350 | 350 |
351 return @cities; | 351 return @cities; |
352 } | 352 } |
353 | 353 |
354 sub switchCityBySafehouseLevel { | |
355 my $self = shift; | |
356 } | |
357 | |
358 sub viewSendSpy { | |
359 my $self = shift; | |
360 my $cityId = shift; | |
361 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=sendSpy&destinationCityId=%d', $self->{server}, $cityId)); | |
362 return Ikariam::Extractor->new(content => $res->content)->find(sprintf('//div[@class="percentage"]/text()')); | |
363 } | |
364 | |
354 sub increaseTransporter { | 365 sub increaseTransporter { |
355 my $self = shift; | 366 my $self = shift; |
356 my $param = shift; | 367 my $param = shift; |
357 my $cityId = shift; | 368 my $cityId = shift; |
358 | 369 |
853 if($locations[$_] eq 'safehouse') { | 864 if($locations[$_] eq 'safehouse') { |
854 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=safehouse&id=%d&position=%d', $self->{server}, $cityId, $_ )); | 865 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=safehouse&id=%d&position=%d', $self->{server}, $cityId, $_ )); |
855 my $extractor = Ikariam::Extractor->new(content => $res->content); | 866 my $extractor = Ikariam::Extractor->new(content => $res->content); |
856 foreach (1..25) { | 867 foreach (1..25) { |
857 my @links = $extractor->find(sprintf('//div[@class="spyinfo" and position() = %d]//a/@href', $_)); | 868 my @links = $extractor->find(sprintf('//div[@class="spyinfo" and position() = %d]//a/@href', $_)); |
858 last if($#links < 0); | |
859 if ($links[0] =~ /id=(\d+)/) { | 869 if ($links[0] =~ /id=(\d+)/) { |
860 $data->{$1}->{city} = $self->readCity($1); | 870 $data->{$1}->{city} = $self->readCity($1); |
861 @{$data->{$1}->{risks}} = Ikariam::Extractor->new(content => $self->{mech}->get($links[1])->content)->find('//div[@class="missionRisk"]'); | 871 @{$data->{$1}->{risks}} = Ikariam::Extractor->new(content => $self->{mech}->get($links[1])->content)->find('//div[@class="missionRisk"]'); |
862 } | 872 } |
863 } | 873 } |