comparison enemy.pl @ 38:0863b32e1a05

counting for the capture we can get from the enemy
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 16 Oct 2008 21:42:16 +0800
parents dd85b55eec2a
children 4f7bca0d6190
comparison
equal deleted inserted replaced
37:7d1e353520ca 38:0863b32e1a05
9 9
10 if($#ARGV != 0) { 10 if($#ARGV != 0) {
11 die("Usage: $0 nickname\n"); 11 die("Usage: $0 nickname\n");
12 } 12 }
13 13
14 system('perl scores.pl ' . $ARGV[0]); 14 # system('perl scores.pl ' . $ARGV[0]);
15 15
16 Ikariam::User->has_many(cities => 'Ikariam::Cities'); 16 Ikariam::User->has_many(cities => 'Ikariam::Cities');
17 my ($u) = Ikariam::User->search('name' => $ARGV[0]); 17 my ($u) = Ikariam::User->search('name' => $ARGV[0]);
18 if(defined($u)) { 18 if(defined($u)) {
19 foreach my $i (qw/name score trader_score_secondary army_score_main ally/) { 19 foreach my $i (qw/name score trader_score_secondary army_score_main ally/) {
21 } 21 }
22 printf("\nCities\n"); 22 printf("\nCities\n");
23 # print Dumper($u->_data_hash); 23 # print Dumper($u->_data_hash);
24 foreach my $city ($u->cities) { 24 foreach my $city ($u->cities) {
25 my $island = Ikariam::Island->retrieve($city->island); 25 my $island = Ikariam::Island->retrieve($city->island);
26 my $robbery = $city->citylevel * ($city->citylevel - 1) * $u->trader_score_secondary / 10000;
27
26 printf("Name: %s\n", $city->cityname); 28 printf("Name: %s\n", $city->cityname);
27 if(defined($city->status)) 29 if(defined($city->status))
28 { 30 {
29 printf("Status: <<<%s>>>\n", $city->status); 31 printf("Status: <<<%s>>>\n", $city->status);
30 } 32 }
31 printf("Level: %s\n", $city->citylevel); 33 printf("Level: %s\n", $city->citylevel);
32 printf("Island: %s\n", $island->name); 34 printf("Island: %s\n", $island->name);
33 printf("Location: [%s:%s] http://s2.ikariam.tw/index.php?view=island&id=%s\n", $island->x, $island->y, $island->id); 35 printf("Location: [%s:%s] http://s2.ikariam.tw/index.php?view=island&id=%s&selectCity=%d\n",
36 $island->x, $island->y, $island->id, $city->cityId);
34 printf("Tradegood: %s\n", $tradegoodText[$island->tradegood]); 37 printf("Tradegood: %s\n", $tradegoodText[$island->tradegood]);
35 printf("Wonder: %s\n\n", $wonderText[$island->wonder]); 38 printf("Wonder: %s\n", $wonderText[$island->wonder]);
39 printf("Robbery score: %d\n\n", $robbery);
36 # print Dumper($island->_data_hash); 40 # print Dumper($island->_data_hash);
37 # print Dumper($city->_data_hash); 41 # print Dumper($city->_data_hash);
38 } 42 }
39 } 43 }