Mercurial > eagle-eye
view freeland.pl @ 119:755e5f5434e4
merged for fixed inactive-map.pl and hacks for highscore search.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Thu, 30 Oct 2008 15:08:56 +0800 |
parents | 73f0a1cafc23 |
children | dba0543daf36 |
line wrap: on
line source
#!/usr/bin/perl use strict; use Ikariam; use Data::Dumper; package main; my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/; my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/; if($#ARGV != 1) { die("Usage: $0 x y\n"); } my ($x, $y) = @ARGV; my @location = (($x + 6), ($x - 6), ($y + 6), ($y - 6)); # 找空位 Ikariam::Cities->set_sql(lamers => qq { SELECT cities.cityId FROM user, cities WHERE user.id == cities.user AND user.score <= 1000 AND cities.status != 'v' AND cities.island IN (SELECT island.id FROM island WHERE island.x <= ? AND island.x >= ? AND island.y <= ? AND island.y >= ? AND tradegood == 2) } ); # my @islands = Ikariam::Island->retrieve_from_sql(qq{ tradegood == 2 AND people < 16 AND x <= $location[0] AND x >= $location[1] AND y <= $location[2] AND y >= $location[3] }); if($#islands == -1) { my @cities = Ikariam::Cities->search_lamers(@location); foreach my $city (@cities) { my $island = Ikariam::Island->retrieve($city->island); my $user = Ikariam::User->retrieve($city->user); printf("%s (%d) \"%s\" %d [%d,%d] http://%s/index.php?view=island&id=%d&selectCity=%d\n", $user->name, $user->score, $city->cityname, $city->citylevel, $island->x, $island->y, $::server, $island->id, $city->cityId ); } } else { # 依照距離列表 foreach my $island (@islands) { printf("%d [%d:%d] %s %s http://%s/index.php?view=island&id=%d%s\n", (abs($x-$island->x) + abs($y-$island->y)), # minutes ? $island->x, $island->y, $tradegoodText[$island->tradegood], $wonderText[$island->wonder], $::server, $island->id, ); } }