Mercurial > eagle-eye
annotate ally.pl @ 376:6ca0677a361e
refiend output format and fixed timing issue.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Tue, 14 Apr 2009 17:02:17 +0800 |
parents | dd3d76f43999 |
children |
rev | line source |
---|---|
21
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
1 #!/usr/bin/perl |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
2 use strict; |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
3 use Ikariam; |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
4 use Data::Dumper; |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
5 use List::Util qw[min max]; |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
6 |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
7 package main; |
23
54ab0becd730
implemented a prototype for collecting account status.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
21
diff
changeset
|
8 # my $users = Ikariam::User->search(ally => 'WMeMe'); |
54ab0becd730
implemented a prototype for collecting account status.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
21
diff
changeset
|
9 |
21
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
10 Ikariam::Cities->set_sql(ally => qq { |
373
dd3d76f43999
update script for collecting ally information.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
169
diff
changeset
|
11 SELECT cities.cityId |
dd3d76f43999
update script for collecting ally information.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
169
diff
changeset
|
12 FROM cities |
dd3d76f43999
update script for collecting ally information.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
169
diff
changeset
|
13 WHERE cities.ally == ? |
21
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
14 }); |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
15 |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
16 Ikariam::Island->has_many(cities => 'Ikariam::Cities'); |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
17 Ikariam::Island->set_sql(ally => qq { |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
18 SELECT island.id |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
19 FROM island, cities |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
20 WHERE cities.island == island.id |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
21 AND cities.ally == ? |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
22 }); |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
23 |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
24 die("Usage: $0\nUsage: $0 ally\n") unless ($#ARGV == 0); |
d5e02a25b000
map generator for ally
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
25 |
373
dd3d76f43999
update script for collecting ally information.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
169
diff
changeset
|
26 my @cities = Ikariam::Cities->search_ally($ARGV[0]); |
dd3d76f43999
update script for collecting ally information.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
169
diff
changeset
|
27 print Dumper(@cities); |