comparison Ikariam.pm @ 80:7ab5fc8c847c

added some memo of TODO
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 24 Oct 2008 21:56:03 +0800
parents 9d92e8c12f58
children d57920014cb4
comparison
equal deleted inserted replaced
79:9d92e8c12f58 80:7ab5fc8c847c
342 sub increaseTransporter { 342 sub increaseTransporter {
343 my $self = shift; 343 my $self = shift;
344 my $param = shift; 344 my $param = shift;
345 my $cityId = shift; 345 my $cityId = shift;
346 346
347 # TODO: 應該扣除買船之黃金, 以免誤計
348 # TODO: 加上所有之船隻
349 # my @cargoCost = qw/160 244 396 812 1240 1272 1832 1888 3848 3972 5204 5384 6868 7120 8864 9200 11268 11712 14108 14680 23320 24288 28664 29880 34956 36468 42348 44212 51024 53308 61236 64024 73096 76468 87020 91088 103224 116524 122072 137432 180060 202132 211964 237444 249108 278276 292076 306623 321963 338138 355198 373191 392171 412195 433320 455612 479135 503962 530166 557828 587031 617863 650420 684802 721113 759466 799981 842783 888005 935790 986286 1039654 1096062 1155689 1218724 1285369 1355837 1430353 1509159 1592508 1680670 1773932 1872597 1976989 2087448 2204338 2328045 2458976 2597567 2744276 2899594 3064040 3238163 3422550 3617820 3824635 4043693 4275738 4521561 4782000 5057946 5350345 5660202 5988585 6336630 6705540 7096598 7511164 7950683 8416694 8910828 9434823 9990523 10579889 11205006 11868090 12571498 13317734 14109462 14949514/;
350 # $city->{transporters}->{sum}
351
352 # TODO: 找買船最便宜之城市
347 my @locations = @{$self->{'cities'}->{$cityId}->{locations}}; 353 my @locations = @{$self->{'cities'}->{$cityId}->{locations}};
348 foreach (1..2) { 354 foreach (1..2) {
349 if($locations[$_] eq 'port') { 355 if($locations[$_] eq 'port') {
350 my $res = $self->{mech}->get(sprintf('http://%s/index.php?action=CityScreen&function=increaseTransporter&id=%s&position=%s', 356 my $res = $self->{mech}->get(sprintf('http://%s/index.php?action=CityScreen&function=increaseTransporter&id=%s&position=%s',
351 $self->{server}, $cityId, $_)); 357 $self->{server}, $cityId, $_));
502 my $content; 508 my $content;
503 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=militaryAdvisorCombatReports', $self->{server})); 509 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=militaryAdvisorCombatReports', $self->{server}));
504 gunzip \$res->content => \$content 510 gunzip \$res->content => \$content
505 or die "gunzip failed: $GunzipError\n"; 511 or die "gunzip failed: $GunzipError\n";
506 512
507 open(OUT,">foo.html");
508 print OUT $content;
509 close(OUT);
510
511 # TODO 513 # TODO
512 # $self->{'cities'}->{$cityId}->{force}->{attacks} = $1 if($content =~ /敵人攻擊: (\d+)/); 514 # military
513 # $self->{'cities'}->{$cityId}->{force}->{wars} = $1 if($content =~ /我方軍隊行程: (\d+)/); 515 $self->{'military'}->{wars}->{attacks} = 0;
516 $self->{'military'}->{wars}->{wars} = 0;
517 # $self->{'cities'}->{$cityId}->{wars}->{attacks} = $1 if($content =~ /敵人攻擊: (\d+)/);
518 # $self->{'cities'}->{$cityId}->{wars}->{wars} = $1 if($content =~ /我方軍隊行程: (\d+)/);
514 519
515 # list down reports. 520 # list down reports.
516 # /index.php?view=militaryAdvisorReportView&amp;combatId=1887662 521 # /index.php?view=militaryAdvisorReportView&amp;combatId=1887662
517 # //form[@id='finishedReports']//a 522 # //form[@id='finishedReports']//a
518 } 523 }