comparison Ikariam.pm @ 143:bfa78302cf09

ignore some combat reports, which is not finished.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 31 Oct 2008 12:47:34 +0800
parents 3756298f8e4b
children aad08889ddb3 00a21f73e906
comparison
equal deleted inserted replaced
142:9b8aa30a532c 143:bfa78302cf09
584 my $href = $extractor->find('//td[@class="battle"]/a/@href'); 584 my $href = $extractor->find('//td[@class="battle"]/a/@href');
585 if($href =~ /index\.php\?view=island&id=(\d+)&selectCity=(\d+)/) { 585 if($href =~ /index\.php\?view=island&id=(\d+)&selectCity=(\d+)/) {
586 $report{island} = $1; 586 $report{island} = $1;
587 $report{city} = $2; 587 $report{city} = $2;
588 } else { 588 } else {
589 die ($href); 589 warn ("can not read combat reprot $combatId");
590 warn ($href);
591 return undef;
590 } 592 }
591 $report{gold} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="gold"]'); 593 $report{gold} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="gold"]');
592 $report{wood} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="wood"]'); 594 $report{wood} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="wood"]');
593 $report{crystal} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="glass"]'); 595 $report{crystal} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="glass"]');
594 $report{wine} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="wine"]'); 596 $report{wine} = $extractor->find('//div[@id="troopsReport"]//ul[@class="resources"]/li[@class="wine"]');
629 $report->set('date', $unixtime); 631 $report->set('date', $unixtime);
630 } 632 }
631 $report->set('time', time); 633 $report->set('time', time);
632 634
633 $report->update(); 635 $report->update();
636 } else {
637 # for some reason, we can not read the report.
638 next;
634 } 639 }
635 } else { 640 } else {
636 # we have found the report we like to know, exit the function. 641 # we have found the report we like to know, exit the function.
637 return; 642 return;
638 } 643 }