diff 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
line wrap: on
line diff
--- a/enemy.pl	Thu Oct 16 21:40:14 2008 +0800
+++ b/enemy.pl	Thu Oct 16 21:42:16 2008 +0800
@@ -11,7 +11,7 @@
     die("Usage: $0 nickname\n");
 }
 
-system('perl scores.pl ' . $ARGV[0]);
+# system('perl scores.pl ' . $ARGV[0]);
 
 Ikariam::User->has_many(cities => 'Ikariam::Cities');
 my ($u) = Ikariam::User->search('name' => $ARGV[0]);
@@ -23,6 +23,8 @@
     # print Dumper($u->_data_hash);
     foreach my $city ($u->cities) {
         my $island = Ikariam::Island->retrieve($city->island);
+        my $robbery = $city->citylevel * ($city->citylevel - 1) * $u->trader_score_secondary / 10000;
+
         printf("Name: %s\n", $city->cityname);
         if(defined($city->status))
         {
@@ -30,9 +32,11 @@
         }
         printf("Level: %s\n", $city->citylevel);
         printf("Island: %s\n", $island->name);
-        printf("Location: [%s:%s] http://s2.ikariam.tw/index.php?view=island&id=%s\n", $island->x, $island->y, $island->id);
+        printf("Location: [%s:%s] http://s2.ikariam.tw/index.php?view=island&id=%s&selectCity=%d\n", 
+            $island->x, $island->y, $island->id, $city->cityId);
         printf("Tradegood: %s\n", $tradegoodText[$island->tradegood]);
-        printf("Wonder: %s\n\n", $wonderText[$island->wonder]);
+        printf("Wonder: %s\n", $wonderText[$island->wonder]);
+        printf("Robbery score: %d\n\n", $robbery);
         # print Dumper($island->_data_hash);
         # print Dumper($city->_data_hash);
     }