view freeland.pl @ 51:bc31729f29f4

removed unused file
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sat, 18 Oct 2008 22:24:03 +0800
parents b18369979b58
children f25d13153501
line wrap: on
line source

#!/usr/bin/perl
use strict;
use Ikariam;
use Data::Dumper;

package main;

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://s2.ikariam.tw/index.php?view=island&id=%d&selectCity=%d\n",
                $user->name, $user->score,
                $city->cityname, $city->citylevel, 
                $island->x, $island->y,
                $island->id,
                $city->cityId
            );
        }
} else {
    foreach my $island (@islands)
    {
        printf("[%d:%d] http://s2.ikariam.tw/index.php?view=island&id=%d%s\n",
            $island->x, $island->y,
            $island->id,
        );
    }
}