Mercurial > eagle-eye
comparison scan.pl @ 232:978a949602e5
Auto-update Scientists numbers for Academy.
Refined the rules for safehouse, the safe house must be same or higher level then Town Hall.
Make people very happy, when the townHall is less then 16.
Build museum first then tavern
THG: changed warfare.pl
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Thu, 06 Nov 2008 20:31:05 +0800 |
parents | 541bc1fba446 |
children | 1a7b2d42fcbf |
comparison
equal
deleted
inserted
replaced
231:c0b9604b0be9 | 232:978a949602e5 |
---|---|
74 $ally = Ikariam::Ally->insert($h_ally); | 74 $ally = Ikariam::Ally->insert($h_ally); |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 our $i = new Ikariam($::server, $::user, $::pass); | |
80 | |
81 if($#ARGV == 1) { | |
82 $i->login; | |
83 my @islands = $i->viewWorldMap($ARGV[0], $ARGV[1]); | |
84 saveIslands(@islands); | |
85 $i->logout; | |
86 } elsif($#ARGV == 0) { | |
87 $i->login; | |
88 my $island = $ARGV[0]; | |
89 my @cities = $i->viewIsland($island); | |
90 saveCities($island, @cities); | |
91 $i->logout; | |
92 } elsif($#ARGV == -1) { | |
93 $i->login; | |
94 my $cities = $i->check; | |
95 foreach my $cityId (keys(%$cities)) { | |
96 printf("%s %s\n", $cities->{$cityId}->{island}->{x}, $cities->{$cityId}->{island}->{y}); | |
97 my @islands = $i->viewWorldMap( $cities->{$cityId}->{island}->{x}, $cities->{$cityId}->{island}->{y}); | |
98 saveIslands(@islands); | |
99 } | |
100 $i->logout; | |
101 } else { | |
102 die("Usage: $0\nUsage: $0 x y\n"); | |
103 } | |
104 | |
105 sub saveIslands { | 79 sub saveIslands { |
106 my @islands = @_; | 80 my @islands = @_; |
107 | 81 |
108 foreach my $h_island (@islands) | 82 foreach my $h_island (@islands) |
109 { | 83 { |
119 } | 93 } |
120 | 94 |
121 # scanning the island | 95 # scanning the island |
122 if($island->time le (time - 30*60*6)) | 96 if($island->time le (time - 30*60*6)) |
123 { | 97 { |
124 my @cities = $i->viewIsland($h_island->{id}); | 98 my @cities = $::i->viewIsland($h_island->{id}); |
125 saveCities($h_island->{id}, @cities); | 99 saveCities($h_island->{id}, @cities); |
126 | 100 |
127 $island->set('time', time); | 101 $island->set('time', time); |
128 } | 102 } |
129 $island->update(); | 103 $island->update(); |
130 | 104 |
131 } | 105 } |
132 } | 106 } |
133 # $i->getCityInfo(); | 107 |
108 | |
109 local $SIG{ALRM} = sub { die "timeout\n" }; | |
110 alarm 3; | |
111 our $i = new Ikariam($::server, $::user, $::pass); | |
112 | |
113 if($#ARGV == 1) { | |
114 $i->login; | |
115 my @islands = $i->viewWorldMap($ARGV[0], $ARGV[1]); | |
116 saveIslands(@islands); | |
117 $i->logout; | |
118 } elsif($#ARGV == 0) { | |
119 $i->login; | |
120 my $island = $ARGV[0]; | |
121 my @cities = $i->viewIsland($island); | |
122 saveCities($island, @cities); | |
123 $i->logout; | |
124 } elsif($#ARGV == -1) { | |
125 $i->login; | |
126 my $cities = $i->check; | |
127 # random | |
128 foreach my $cityId (keys(%$cities)) { | |
129 printf("%s %s\n", $cities->{$cityId}->{island}->{x}, $cities->{$cityId}->{island}->{y}); | |
130 my @islands = $i->viewWorldMap( $cities->{$cityId}->{island}->{x}, $cities->{$cityId}->{island}->{y}); | |
131 saveIslands(@islands); | |
132 } | |
133 $i->logout; | |
134 } else { | |
135 die("Usage: $0\nUsage: $0 x y\n"); | |
136 } |