annotate enemy.pl @ 367:d9d3cdff27c6

handling field not found error
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 01 Mar 2009 22:14:05 +0800
parents 2cfa03edc22e
children 6ca0677a361e
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;
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
5 use YAML qw/Dump LoadFile/;
274
2590bcd517a5 added time information in output
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 273
diff changeset
6 use POSIX qw(strftime);
8
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
7
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
8 package main;
18
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
9 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/;
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
10 my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/;
8
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
11
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
12 Ikariam::User->has_many(cities => 'Ikariam::Cities');
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
13
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
14 sub travelTime {
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
15 my ($x1, $y1, $x2, $y2, $speed) = @_;
353
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
16 $speed = 60 unless(defined($speed));
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
17 if($x1 == $x2 && $y1 == $y2) {
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
18 return 600/$speed;
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
19 } else {
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
20 return int( (sqrt((abs($x1 - $x2) * abs($x1 - $x2)) + (abs($y1 - $y2) * abs($y1 - $y2)))) * (1200/$speed));
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
21 }
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
22 }
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
23
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
24 sub travelMatrix {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
25 my $userName = shift;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
26 my @cities = ();
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
27 if(my $user = Ikariam::User->retrieve(name => $userName)) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
28
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
29 foreach my $target ($user->cities) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
30 my $island = Ikariam::Island->retrieve($target->island);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
31 my $city;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
32 $city->{id} = $target->id;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
33 $city->{name} = $target->cityname;
366
2cfa03edc22e ignore island we don't know yet
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 357
diff changeset
34 if(defined($island)) {
2cfa03edc22e ignore island we don't know yet
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 357
diff changeset
35 $city->{island}->{id} = $island->id;
2cfa03edc22e ignore island we don't know yet
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 357
diff changeset
36 $city->{island}->{x} = $island->x;
2cfa03edc22e ignore island we don't know yet
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 357
diff changeset
37 $city->{island}->{y} = $island->y;
2cfa03edc22e ignore island we don't know yet
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 357
diff changeset
38 }
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
39 push (@cities, $city);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
40 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
41 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
42
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
43 my $n = $#cities;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
44
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
45 # Print them out.
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
46 # header
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
47 printf("Defence\n");
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
48 printf(" %5s ", undef);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
49 for my $y (0..$n) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
50 printf ("%5s ", $cities[$y]->{id});
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
51 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
52 print "\n";
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
53
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
54 # body
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
55 for my $x (0..$n) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
56 printf(" %5s ", $cities[$x]->{id});
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
57 my $total = 0;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
58 for my $y (0..$n) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
59 my $t = travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $cities[$y]->{island}->{x}, $cities[$y]->{island}->{y});
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
60 printf("%5s ", $t);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
61 $total += $t;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
62 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
63 printf(" %s", $cities[$x]->{name});
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
64 printf("\n");
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
65 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
66 printf("\n");
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
67 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
68
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
69 sub myTownToVicim {
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
70 my $islandId = shift;
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
71
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
72 if(my $island = Ikariam::Island->retrieve($islandId)) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
73 my @cities = ();
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
74 foreach (glob("city-*-dump.yaml")) {
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
75 my $city = LoadFile($_);
353
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
76 $city->{distance} = travelTime($island->x, $island->y, $city->{island}->{x}, $city->{island}->{y}, 60);
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
77 push (@cities, $city);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
78 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
79 @cities = sort { $a->{distance} <=> $b->{distance}; } (@cities);
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
80
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
81 my $n = $#cities;
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
82 for my $x (0..$n) {
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
83 printf("%s (%d)\t- ", $cities[$x]->{name}, $cities[$x]->{id});
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
84 printf("Land %3d Ship %3d Catapult %3d Ram %3d\n",
353
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
85 travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 60),
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
86 travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 33),
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
87 travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 26),
6c03c2c80429 fixed counting travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 336
diff changeset
88 travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 40),
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
89 );
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
90 }
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
91 }
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
92 }
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
93
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
94 package main;
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
95
8
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
96 if($#ARGV != 0) {
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
97 die("Usage: $0 nickname\n");
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
98 }
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
99
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
100 my ($u) = Ikariam::User->search('name' => $ARGV[0]);
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
101 if(defined($u)) {
18
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
102 foreach my $i (qw/name score trader_score_secondary army_score_main ally/) {
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
103 printf("%s: %s\n", $i, $u->get($i));
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
104 }
274
2590bcd517a5 added time information in output
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 273
diff changeset
105 printf("time: %s\n", strftime ("%Y-%m-%d %H:%M", localtime($u->get('time'))));
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
106
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
107 travelMatrix($ARGV[0]);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
108
18
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
109 printf("\nCities\n");
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
110 foreach my $city ($u->cities) {
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
111 my $island = Ikariam::Island->retrieve($city->island);
366
2cfa03edc22e ignore island we don't know yet
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 357
diff changeset
112 next if(!defined($island));
38
0863b32e1a05 counting for the capture we can get from the enemy
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 27
diff changeset
113
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
114 printf("Name: %s [%s:%s]\n", $city->cityname, $island->x, $island->y);
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
115 if(defined($city->status)) {
20
5635e75c92d0 the user profile is also cached for 1 hour.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 18
diff changeset
116 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
117 }
78
4120f560f214 fixed the server name.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 44
diff changeset
118 printf("Location: [%s:%s] http://%s/index.php?view=island&id=%s&selectCity=%d\n",
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
119 $island->x, $island->y, $::server, $island->id, $city->cityId);
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
120 if(-f sprintf("spy-%d-dump.yaml", $city->cityId)) {
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
121 my $spydata = LoadFile(sprintf("spy-%d-dump.yaml", $city->cityId));
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
122 if($spydata->{city}->{buildings}->{townHall} ne $city->citylevel) {
302
efffa408eec5 refined the output of spy information
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 299
diff changeset
123 printf("Hall: %s", $city->citylevel);
efffa408eec5 refined the output of spy information
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 299
diff changeset
124 printf("\n*OUTDATED* ");
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
125 }
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
126 printf("Hall: %s, Wall: %s, Port: %s, Safehouse: %s, Risk: %s\n",
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
127 $spydata->{city}->{buildings}->{townHall},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
128 $spydata->{city}->{buildings}->{wall},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
129 $spydata->{city}->{buildings}->{port},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
130 $spydata->{city}->{buildings}->{safehouse},
357
f9a6b226fb79 capture scores names nothing, fixed the risk of spy
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 353
diff changeset
131 $spydata->{risks}[4]);
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
132 } else {
299
986a75252cb3 added risk column
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 286
diff changeset
133 printf("Level: %s, Rsik %d\n", $city->citylevel, $city->risk);
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
134 }
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
135
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
136 printf("Tradegood: %s, Wonder: %s\n",
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
137 $tradegoodText[$island->tradegood], $wonderText[$island->wonder]);
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
138 # printf("Island: %s\n", $island->name);
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
139
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
140 myTownToVicim($island->id);
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
141 printf("\n");
8
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
142 }
97
5f9bb3042d0c refined the output.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 78
diff changeset
143 print "-"x80 . "\n";
8
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
144 }