Mercurial > eagle-eye
annotate scan.pl @ 238:1a7b2d42fcbf
fixed the stupid timeout and cache timing
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Fri, 07 Nov 2008 11:30:11 +0800 |
parents | 978a949602e5 |
children | 38e1a82627a9 |
rev | line source |
---|---|
0
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
1 #!/usr/bin/perl |
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
2 use strict; |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
3 use Data::Dumper; |
238
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
4 use Carp; |
0
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
5 use Ikariam; |
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
6 |
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
7 package main; |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
8 |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
9 sub saveCities |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
10 { |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
11 my ($island, @cities) = @_; |
0
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
12 |
48
96ee35378696
modified for searching configuration files
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
41
diff
changeset
|
13 if ($#cities == -1) { |
96ee35378696
modified for searching configuration files
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
41
diff
changeset
|
14 warn ("empty cities list.\n"); |
96ee35378696
modified for searching configuration files
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
41
diff
changeset
|
15 return; |
96ee35378696
modified for searching configuration files
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
41
diff
changeset
|
16 } |
25
51a35c3d057e
cached 12 hours for user account.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
22
diff
changeset
|
17 |
121
0bab14dddf60
fixed the timestamp for scanning
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
99
diff
changeset
|
18 foreach my $h_city (@cities) { |
238
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
19 Carp::carp(sprintf("checking %s\n", $h_city->{'cityname'})); |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
20 $h_city->{island} = $island; |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
21 $h_city->{'time'} = time; |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
22 my $c = Ikariam::Cities->retrieve($h_city->{cityId}); |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
23 if(defined($c)) { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
24 foreach (keys(%$h_city)) { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
25 $c->set($_ => $h_city->{$_}); |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
26 } |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
27 } else { |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
28 $c = Ikariam::Cities->insert($h_city); |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
29 } |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
30 $c->update(); |
36
704d76b67670
fixed the island cache problem
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
25
diff
changeset
|
31 |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
32 my $user = Ikariam::User->retrieve($h_city->{'user'}); |
238
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
33 next if (defined($user) && defined($user->time) && $user->time gt (time - 30*60)); |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
34 |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
35 saveUser($h_city->{owner}); |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
36 } |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
37 } |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
38 |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
39 sub saveUser |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
40 { |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
41 my $userName = shift; |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
42 my $users; |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
43 |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
44 foreach my $x (qw/score army_score_main trader_score_secondary/) { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
45 $users = $::i->viewScore($x, $userName, 0); |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
46 |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
47 foreach my $h_user (values(%{$users})) { |
238
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
48 Carp::croak(sprintf("Saving user %s\n", $h_user->{'name'})); |
88
0fa9cd836e1e
rewrited the viewIsland function.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
48
diff
changeset
|
49 $h_user->{'time'} = time; |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
50 |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
51 my $user = Ikariam::User->retrieve($h_user->{'id'}); |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
52 if(defined($user)) { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
53 foreach (keys(%$h_user)) { $user->set($_ => $h_user->{$_}); } |
88
0fa9cd836e1e
rewrited the viewIsland function.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
48
diff
changeset
|
54 } else { |
0fa9cd836e1e
rewrited the viewIsland function.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
48
diff
changeset
|
55 $user = Ikariam::User->insert($h_user); |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
56 } |
88
0fa9cd836e1e
rewrited the viewIsland function.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
48
diff
changeset
|
57 $user->update(); |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
58 saveAlly($h_user->{allyId}); |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
59 } |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
60 } |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
61 } |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
62 |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
63 sub saveAlly |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
64 { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
65 my $allyId = shift; |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
66 return unless (defined($allyId) && $allyId ne '0'); |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
67 |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
68 # Save for member of ally |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
69 my $ally = Ikariam::Ally->retrieve($allyId); |
211
541bc1fba446
update very 30 minutes.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
206
diff
changeset
|
70 if(!defined($ally) || $ally->time le (time - 30*60*1)) { |
98
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
71 my $h_ally = $::i->viewAlly($allyId); |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
72 $h_ally->{'time'} = time; |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
73 if(defined($ally)) { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
74 foreach (keys(%$h_ally)) { $ally->set($_ => $h_ally->{$_}); } |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
75 } else { |
34749e907405
we now scan for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
89
diff
changeset
|
76 $ally = Ikariam::Ally->insert($h_ally); |
14
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
77 } |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
78 } |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
79 } |
8b7bc598ba06
we now also save user's profile when scanning islands.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
10
diff
changeset
|
80 |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
81 sub saveIslands { |
141
0da6658697df
fixed the param of islands
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
140
diff
changeset
|
82 my @islands = @_; |
18 | 83 |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
84 foreach my $h_island (@islands) |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
85 { |
206
b7af307a222d
added build safehouse
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
141
diff
changeset
|
86 # printf("checking island %d\n", $h_island->{id}); |
0
abaee7064429
new scanning prototype.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
87 |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
88 my $island; |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
89 if($island = Ikariam::Island->retrieve($h_island->{id})) { |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
90 foreach my $i (keys(%$h_island)) { |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
91 $island->set($i => $h_island->{$i}); |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
92 } |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
93 } else { |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
94 $island = Ikariam::Island->insert($h_island); |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
95 } |
16
59f2c435760c
implemented cached by timing.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
14
diff
changeset
|
96 |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
97 # scanning the island |
238
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
98 # 10 minutes cache. |
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
99 if($island->time le (time - 60*10)) |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
100 { |
232
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
101 my @cities = $::i->viewIsland($h_island->{id}); |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
102 saveCities($h_island->{id}, @cities); |
36
704d76b67670
fixed the island cache problem
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
25
diff
changeset
|
103 |
140
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
104 $island->set('time', time); |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
105 } |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
106 $island->update(); |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
107 |
124fc7abda39
scan all the islands nearby our own cities.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
123
diff
changeset
|
108 } |
10
f590b5ea5e55
fixed bug of sheep.pl
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
8
diff
changeset
|
109 } |
232
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
110 |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
111 |
238
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
112 # local $SIG{ALRM} = sub { die "timeout\n" }; |
1a7b2d42fcbf
fixed the stupid timeout and cache timing
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
232
diff
changeset
|
113 # alarm 3; |
232
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
114 our $i = new Ikariam($::server, $::user, $::pass); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
115 |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
116 if($#ARGV == 1) { |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
117 $i->login; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
118 my @islands = $i->viewWorldMap($ARGV[0], $ARGV[1]); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
119 saveIslands(@islands); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
120 $i->logout; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
121 } elsif($#ARGV == 0) { |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
122 $i->login; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
123 my $island = $ARGV[0]; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
124 my @cities = $i->viewIsland($island); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
125 saveCities($island, @cities); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
126 $i->logout; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
127 } elsif($#ARGV == -1) { |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
128 $i->login; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
129 my $cities = $i->check; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
130 # random |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
131 foreach my $cityId (keys(%$cities)) { |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
132 printf("%s %s\n", $cities->{$cityId}->{island}->{x}, $cities->{$cityId}->{island}->{y}); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
133 my @islands = $i->viewWorldMap( $cities->{$cityId}->{island}->{x}, $cities->{$cityId}->{island}->{y}); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
134 saveIslands(@islands); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
135 } |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
136 $i->logout; |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
137 } else { |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
138 die("Usage: $0\nUsage: $0 x y\n"); |
978a949602e5
Auto-update Scientists numbers for Academy.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
211
diff
changeset
|
139 } |