comparison enemy.pl @ 286:2ddd2bd21ef2

list spydata when check enemies
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 04 Dec 2008 21:54:00 +0800
parents 2590bcd517a5
children 986a75252cb3
comparison
equal deleted inserted replaced
285:c864134ebe3e 286:2ddd2bd21ef2
1 #!/usr/bin/perl 1 #!/usr/bin/perl
2 use strict; 2 use strict;
3 use Ikariam; 3 use Ikariam;
4 use Data::Dumper; 4 use Data::Dumper;
5 use YAML qw/LoadFile/; 5 use YAML qw/Dump LoadFile/;
6 use POSIX qw(strftime); 6 use POSIX qw(strftime);
7 7
8 package main; 8 package main;
9 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/; 9 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/;
10 my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/; 10 my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/;
104 printf("\nCities\n"); 104 printf("\nCities\n");
105 foreach my $city ($u->cities) { 105 foreach my $city ($u->cities) {
106 my $island = Ikariam::Island->retrieve($city->island); 106 my $island = Ikariam::Island->retrieve($city->island);
107 my $capture = $city->citylevel * ($city->citylevel - 1) * $u->trader_score_secondary / 10000; 107 my $capture = $city->citylevel * ($city->citylevel - 1) * $u->trader_score_secondary / 10000;
108 108
109 printf("Name: %s\n", $city->cityname); 109 printf("Name: %s [%s:%s]\n", $city->cityname, $island->x, $island->y);
110 if(defined($city->status)) { 110 if(defined($city->status)) {
111 printf("Status: <<<%s>>>\n", $city->status); 111 printf("Status: <<<%s>>>\n", $city->status);
112 } 112 }
113 printf("Level: %s\n", $city->citylevel);
114 printf("Island: %s\n", $island->name);
115 printf("Location: [%s:%s] http://%s/index.php?view=island&id=%s&selectCity=%d\n", 113 printf("Location: [%s:%s] http://%s/index.php?view=island&id=%s&selectCity=%d\n",
116 $island->x, $island->y, $::server, $island->id, $city->cityId); 114 $island->x, $island->y, $::server, $island->id, $city->cityId);
117 printf("Tradegood: %s\n", $tradegoodText[$island->tradegood]); 115 if(-f sprintf("spy-%d-dump.yaml", $city->cityId)) {
118 printf("Wonder: %s\n", $wonderText[$island->wonder]); 116 my $spydata = LoadFile(sprintf("spy-%d-dump.yaml", $city->cityId));
117 if($spydata->{city}->{buildings}->{townHall} ne $city->citylevel) {
118 printf("*OUTDATED* ");
119 }
120 printf("Hall: %s, Wall: %s, Port: %s, Safehouse: %s, Risk: %s\n",
121 $spydata->{city}->{buildings}->{townHall},
122 $spydata->{city}->{buildings}->{wall},
123 $spydata->{city}->{buildings}->{port},
124 $spydata->{city}->{buildings}->{safehouse},
125 $spydata->{risks}[1]);
126 } else {
127 printf("Level: %s\n", $city->citylevel);
128 }
129
119 printf("Capture: %d\n", $capture); 130 printf("Capture: %d\n", $capture);
131 printf("Tradegood: %s, Wonder: %s\n",
132 $tradegoodText[$island->tradegood], $wonderText[$island->wonder]);
133 # printf("Island: %s\n", $island->name);
134
120 myTownToVicim($island->id); 135 myTownToVicim($island->id);
121 printf("\n"); 136 printf("\n");
122 } 137 }
123 print "-"x80 . "\n"; 138 print "-"x80 . "\n";
124 } 139 }