Mercurial > eagle-eye
diff agent.pl @ 79:9d92e8c12f58
rewrited the code in XPath.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 24 Oct 2008 21:46:33 +0800 |
parents | 27b16506231f |
children | 7ab5fc8c847c |
line wrap: on
line diff
--- a/agent.pl Thu Oct 23 15:51:20 2008 +0800 +++ b/agent.pl Fri Oct 24 21:46:33 2008 +0800 @@ -18,7 +18,8 @@ sub is_attacked { my ($self, $city) = @_; - return ($city->{force}->{attacks} > 0 ) ? 1 : 0; + # XXX + return ($city->{wars}->{attacks} > 0 ) ? 1 : 0; } sub is_constructing { @@ -171,7 +172,6 @@ our $i = new Ikariam($::server, $::user, $::pass); $i->login; my $cities = $i->check; - my $rules = Ikariam::Cities::Rules->new; my $tree = LoadFile('building.yaml'); # print Dumper($tree); @@ -181,7 +181,8 @@ $cities->{$cityId}->{name}, $::server, $cityId); printf("construction: %s\n", $cities->{$cityId}->{construction}); - foreach my $thing (qw/resources space force buildings citizens army fleet/) { + # foreach my $thing (qw/resources space wars buildings citizens army fleet/) { + foreach my $thing (qw/resources space buildings citizens army fleet/) { printf("<%s>\n", uc($thing)); foreach my $i (keys(%{$cities->{$cityId}->{$thing}})) { printf("%s %s, ", $i, $cities->{$cityId}->{$thing}->{$i}); @@ -207,7 +208,7 @@ } } # Debug - # print(Dumper($cities->{$cityId}->{parse_path})); + print(Dumper($cities->{$cityId}->{parse_path})); } $i->logout; @@ -218,6 +219,6 @@ my ($func, $param) = split(/_/,$action); printf('$i->%s("%s", %s);'. "\n\n", $func, $param, $cityId); - eval(sprintf('$i->%s("%s", %s);', $func, $param, $cityId)); - warn $@ if $@; + # eval(sprintf('$i->%s("%s", %s);', $func, $param, $cityId)); + # warn $@ if $@; }