Mercurial > eagle-eye
comparison Ikariam.pm @ 174:0cfc7a19a4d2
branch merged
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sun, 02 Nov 2008 04:12:23 +0800 |
parents | e8a244ce5a1d 2efa901871e5 |
children | 8afd380c20ac 2362c8c8909e |
comparison
equal
deleted
inserted
replaced
173:e8a244ce5a1d | 174:0cfc7a19a4d2 |
---|---|
464 } | 464 } |
465 | 465 |
466 sub plunderCity { | 466 sub plunderCity { |
467 my $self = shift; | 467 my $self = shift; |
468 my $cityId = shift; | 468 my $cityId = shift; |
469 $self->{mech}->get(sprintf("http://%s/index.php?view=plunder&destinationCityId=%d", $self->{server}, $cityId)); | 469 my $res = $self->{mech}->get(sprintf("http://%s/index.php?view=plunder&destinationCityId=%d", $self->{server}, $cityId)); |
470 $self->{mech}->submit_form( | 470 |
471 form_number => 1, | 471 # check peace treaty |
472 fields => { | 472 my $treaty = Ikariam::Extractor->new(content => $res->content)->find('//div[@class="warning"]'); |
473 cargo_army_302 => '2', | 473 if(!defined($treaty)) { |
474 } | 474 $self->{mech}->submit_form( |
475 ); | 475 form_number => 1, |
476 fields => { | |
477 cargo_army_302 => '2', | |
478 } | |
479 ); | |
480 } else { | |
481 warn ($treaty); | |
482 } | |
476 } | 483 } |
477 | 484 |
478 sub changeCity { | 485 sub changeCity { |
479 my $self = shift; | 486 my $self = shift; |
480 my $cityId = shift; | 487 my $cityId = shift; |