Mercurial > eagle-eye
annotate enemy.pl @ 261:2488d31240b7
next to CITY tag.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 19 Nov 2008 12:24:14 +0800 |
parents | 5f9bb3042d0c |
children | 3730817e3079 |
rev | line source |
---|---|
8
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
1 #!/usr/bin/perl |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
2 use strict; |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
3 use Ikariam; |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
4 use Data::Dumper; |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
5 |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
6 package main; |
18 | 7 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/; |
8 my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/; | |
8
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
9 |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
10 if($#ARGV != 0) { |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
11 die("Usage: $0 nickname\n"); |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
12 } |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
13 |
38
0863b32e1a05
counting for the capture we can get from the enemy
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
27
diff
changeset
|
14 # system('perl scores.pl ' . $ARGV[0]); |
27
dd85b55eec2a
implemented basic inference engine.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
20
diff
changeset
|
15 |
8
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
16 Ikariam::User->has_many(cities => 'Ikariam::Cities'); |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
17 my ($u) = Ikariam::User->search('name' => $ARGV[0]); |
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
18 if(defined($u)) { |
18 | 19 foreach my $i (qw/name score trader_score_secondary army_score_main ally/) { |
20 printf("%s: %s\n", $i, $u->get($i)); | |
21 } | |
22 printf("\nCities\n"); | |
23 # print Dumper($u->_data_hash); | |
24 foreach my $city ($u->cities) { | |
25 my $island = Ikariam::Island->retrieve($city->island); | |
44 | 26 my $capture = $city->citylevel * ($city->citylevel - 1) * $u->trader_score_secondary / 10000; |
38
0863b32e1a05
counting for the capture we can get from the enemy
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
27
diff
changeset
|
27 |
18 | 28 printf("Name: %s\n", $city->cityname); |
20
5635e75c92d0
the user profile is also cached for 1 hour.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
18
diff
changeset
|
29 if(defined($city->status)) |
5635e75c92d0
the user profile is also cached for 1 hour.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
18
diff
changeset
|
30 { |
5635e75c92d0
the user profile is also cached for 1 hour.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
18
diff
changeset
|
31 printf("Status: <<<%s>>>\n", $city->status); |
5635e75c92d0
the user profile is also cached for 1 hour.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
18
diff
changeset
|
32 } |
18 | 33 printf("Level: %s\n", $city->citylevel); |
34 printf("Island: %s\n", $island->name); | |
78
4120f560f214
fixed the server name.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
44
diff
changeset
|
35 printf("Location: [%s:%s] http://%s/index.php?view=island&id=%s&selectCity=%d\n", |
4120f560f214
fixed the server name.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
44
diff
changeset
|
36 $island->x, $island->y, $::server, $island->id, $city->cityId); |
18 | 37 printf("Tradegood: %s\n", $tradegoodText[$island->tradegood]); |
38
0863b32e1a05
counting for the capture we can get from the enemy
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
27
diff
changeset
|
38 printf("Wonder: %s\n", $wonderText[$island->wonder]); |
44 | 39 printf("capture score: %d\n\n", $capture); |
18 | 40 # print Dumper($island->_data_hash); |
41 # print Dumper($city->_data_hash); | |
8
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
42 } |
97
5f9bb3042d0c
refined the output.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
78
diff
changeset
|
43 print "-"x80 . "\n"; |
8
e4b3168d0319
implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff
changeset
|
44 } |