comparison freeland.pl @ 85:f25d13153501

fixed the server name
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 26 Oct 2008 12:26:43 +0800
parents b18369979b58
children 73f0a1cafc23
comparison
equal deleted inserted replaced
84:2c6c219dc3ff 85:f25d13153501
2 use strict; 2 use strict;
3 use Ikariam; 3 use Ikariam;
4 use Data::Dumper; 4 use Data::Dumper;
5 5
6 package main; 6 package main;
7 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/;
8 my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/;
7 9
8 if($#ARGV != 1) { 10 if($#ARGV != 1) {
9 die("Usage: $0 x y\n"); 11 die("Usage: $0 x y\n");
10 } 12 }
11 my ($x, $y) = @ARGV; 13 my ($x, $y) = @ARGV;
21 AND cities.status != 'v' 23 AND cities.status != 'v'
22 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? AND tradegood == 2) 24 AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? AND tradegood == 2)
23 } 25 }
24 ); 26 );
25 27
28 #
26 my @islands = Ikariam::Island->retrieve_from_sql(qq{ 29 my @islands = Ikariam::Island->retrieve_from_sql(qq{
27 tradegood == 2 30 tradegood == 2
28 AND people < 16 31 AND people < 16
29 AND x <= $location[0] 32 AND x <= $location[0]
30 AND x >= $location[1] 33 AND x >= $location[1]
35 if($#islands == -1) { 38 if($#islands == -1) {
36 my @cities = Ikariam::Cities->search_lamers(@location); 39 my @cities = Ikariam::Cities->search_lamers(@location);
37 foreach my $city (@cities) { 40 foreach my $city (@cities) {
38 my $island = Ikariam::Island->retrieve($city->island); 41 my $island = Ikariam::Island->retrieve($city->island);
39 my $user = Ikariam::User->retrieve($city->user); 42 my $user = Ikariam::User->retrieve($city->user);
40 printf("%s (%d) \"%s\" %d [%d,%d] http://s2.ikariam.tw/index.php?view=island&id=%d&selectCity=%d\n", 43 printf("%s (%d) \"%s\" %d [%d,%d] http://%s/index.php?view=island&id=%d&selectCity=%d\n",
41 $user->name, $user->score, 44 $user->name, $user->score,
42 $city->cityname, $city->citylevel, 45 $city->cityname, $city->citylevel,
43 $island->x, $island->y, 46 $island->x, $island->y,
47 $::server,
44 $island->id, 48 $island->id,
45 $city->cityId 49 $city->cityId
46 ); 50 );
47 } 51 }
48 } else { 52 } else {
53 # 依照距離列表
49 foreach my $island (@islands) 54 foreach my $island (@islands)
50 { 55 {
51 printf("[%d:%d] http://s2.ikariam.tw/index.php?view=island&id=%d%s\n", 56 printf("%d [%d:%d] %s %s http://%s/index.php?view=island&id=%d%s\n",
57 (abs($x-$island->x) + abs($y-$island->y)),
52 $island->x, $island->y, 58 $island->x, $island->y,
59 $tradegoodText[$island->tradegood],
60 $wonderText[$island->wonder],
61 $::server,
53 $island->id, 62 $island->id,
54 ); 63 );
55 } 64 }
56 } 65 }