diff Ikariam.pm @ 338:824f949bc484

we attack zero army victim every 3 days
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 12 Feb 2009 03:59:24 +0800
parents 6eac624efc80
children 4bea7db828eb
line wrap: on
line diff
--- a/Ikariam.pm	Thu Feb 12 03:25:32 2009 +0800
+++ b/Ikariam.pm	Thu Feb 12 03:59:24 2009 +0800
@@ -852,22 +852,24 @@
     $self->{'military'}->{wars} = 0;
     $self->{'military'}->{attack} = 0;
 
+# FIXME, we don't if there is a attack.
     foreach (qw/homeland elsewhere/) {
         $self->{'military'}->{$_} = ();
-        my $result = $extractor->{doc}->find(sprintf('//div[@id="%s"]//ul[@id="battleReports"]/li[@class="enroute"]', $_));
+        my $result = $extractor->{doc}->find(sprintf('//table[@class="locationEvents"]//tr[position() > 1]', $_));
         foreach my $div ( @$result ) {
             my $extractor = new Ikariam::Extractor(content => $div->toString(1));
-            my $f = $extractor->find('//div[@class="report"]/a[1]/@href');
-            my $t = $extractor->find('//div[@class="report"]/a[2]/@href');
+            my $f = $extractor->find('//td[4]/a/@href');
+            my $t = $extractor->find('//td[8]/a/@href');
             $f = $1 if($f =~ /\?view=island&cityId=(\d+)/);
             $t = $1 if($t =~ /\?view=island&cityId=(\d+)/);
 
             push @{$self->{'military'}->{$_}}, { from => $f, to => $t};
-            if($_ eq 'homeland') {
-                $self->{'military'}->{wars}++;
-            } else {
-                $self->{'military'}->{attack}++;
-            }
+
+#            if($_ eq 'homeland') {
+#                $self->{'military'}->{wars}++;
+#            } else {
+#                $self->{'military'}->{attack}++;
+#            }
         }
     }
 }