annotate enemy.pl @ 333:2ca2c4c49901

fixed travel time
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Thu, 12 Feb 2009 02:47:58 +0800
parents efffa408eec5
children ff816ffffbd8
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) = @_;
333
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
16 $speed = 60 unless(defined($speed));
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
17 if($x1 == $x2 && $y1 == $y2) {
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
18 return 600/$speed;
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
19 } else {
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
20 return int( (sqrt((abs($x1 - $x2) * abs($x1 - $x2)) + (abs($y1 - $y2) * abs($y1 - $y2)))) * (1200/$speed));
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
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;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
34 $city->{island}->{id} = $island->id;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
35 $city->{island}->{x} = $island->x;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
36 $city->{island}->{y} = $island->y;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
37
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
38 push (@cities, $city);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
39 }
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 my $n = $#cities;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
43
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
44 # Print them out.
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
45 # header
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
46 printf("Defence\n");
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
47 printf(" %5s ", undef);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
48 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
49 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
50 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
51 print "\n";
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
52
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
53 # body
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
54 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
55 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
56 my $total = 0;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
57 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
58 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
59 printf("%5s ", $t);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
60 $total += $t;
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
61 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
62 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
63 printf("\n");
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
64 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
65 printf("\n");
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
66 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
67
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
68 sub myTownToVicim {
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
69 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
70
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
71 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
72 my @cities = ();
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
73 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
74 my $city = LoadFile($_);
333
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
75 $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
76 push (@cities, $city);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
77 }
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
78 @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
79
273
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
80 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
81 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
82 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
83 printf("Land %3d Ship %3d Catapult %3d Ram %3d\n",
333
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
84 travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 60),
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
85 travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 33),
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
86 # travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 6),
2ca2c4c49901 fixed travel time
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 302
diff changeset
87 # travelTime($cities[$x]->{island}->{x}, $cities[$x]->{island}->{y}, $island->x, $island->y, 10),
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
88 );
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 package main;
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
94
8
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
95 if($#ARGV != 0) {
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
96 die("Usage: $0 nickname\n");
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
97 }
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 my ($u) = Ikariam::User->search('name' => $ARGV[0]);
e4b3168d0319 implemented sheep and enemy scripts.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
100 if(defined($u)) {
18
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
101 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
102 printf("%s: %s\n", $i, $u->get($i));
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
103 }
274
2590bcd517a5 added time information in output
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 273
diff changeset
104 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
105
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
106 travelMatrix($ARGV[0]);
f81c4f9d267f make the travel time is sort by distance
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 272
diff changeset
107
18
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
108 printf("\nCities\n");
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
109 foreach my $city ($u->cities) {
fd44e3a1f800 fixed the cache.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 8
diff changeset
110 my $island = Ikariam::Island->retrieve($city->island);
44
4f7bca0d6190 fixed typo.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 38
diff changeset
111 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
112
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
113 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
114 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
115 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
116 }
78
4120f560f214 fixed the server name.
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 44
diff changeset
117 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
118 $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
119 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
120 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
121 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
122 printf("Hall: %s", $city->citylevel);
efffa408eec5 refined the output of spy information
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 299
diff changeset
123 printf("\n*OUTDATED* ");
286
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
124 }
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
125 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
126 $spydata->{city}->{buildings}->{townHall},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
127 $spydata->{city}->{buildings}->{wall},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
128 $spydata->{city}->{buildings}->{port},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
129 $spydata->{city}->{buildings}->{safehouse},
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
130 $spydata->{risks}[1]);
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
131 } else {
299
986a75252cb3 added risk column
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 286
diff changeset
132 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
133 }
2ddd2bd21ef2 list spydata when check enemies
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 274
diff changeset
134
272
3730817e3079 show travel time from my cities to enemy's cities
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 97
diff changeset
135 printf("Capture: %d\n", $capture);
286
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 }