annotate spy.pl @ 333:2ca2c4c49901

fixed travel time
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 12 Feb 2009 02:47:58 +0800
parents ff8db948e1a1
children 8a69b96be376
rev   line source
284
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
1 #!/usr/bin/perl
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
2
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
3 use strict;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
4 use Ikariam;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
5 use Data::Dumper;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
6 use Decision::ParseTree q{ParseTree};
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
7 use YAML qw/LoadFile Dump DumpFile/;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
8
305
ff8db948e1a1 list user and city name
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 298
diff changeset
9 Ikariam::Cities->has_a(user => 'Ikariam::User');
ff8db948e1a1 list user and city name
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 298
diff changeset
10
284
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
11 our $i = new Ikariam($::server, $::user, $::pass);
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
12 $i->login;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
13 # $i->check();
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
14 foreach (glob("city-*-dump.yaml")) {
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
15 my $city = LoadFile($_);
298
b3b845d30d4b new cache mechanism
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 284
diff changeset
16 # $i->{'cities'}->{$city->{id}} = $city;
284
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
17 my $spydata = $i->checkSafeHouse($city->{id});
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
18 foreach (keys(%{$spydata})) {
305
ff8db948e1a1 list user and city name
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 298
diff changeset
19 my $city = Ikariam::Cities->retrieve($_);
ff8db948e1a1 list user and city name
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 298
diff changeset
20 my $user = $city->user;
ff8db948e1a1 list user and city name
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 298
diff changeset
21 printf("%s %s\n", $user->name, $city->cityname);
284
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
22 DumpFile("spy-$_-dump.yaml", $spydata->{$_});
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
23 }
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
24 }
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
25 $i->logout;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
26