view enemy.pl @ 113:82eff1aaf0ec

billy3321 <billy3321 AT msn.com> 4HG: branch default Add chihchunloop to usebot.sh
author billy3321@f3svr.f3.csu.edu.tw.f3.csu.edu.tw
date Thu, 30 Oct 2008 12:07:13 +0800
parents 5f9bb3042d0c
children 3730817e3079
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 != 0) {
    die("Usage: $0 nickname\n");
}

# system('perl scores.pl ' . $ARGV[0]);

Ikariam::User->has_many(cities => 'Ikariam::Cities');
my ($u) = Ikariam::User->search('name' => $ARGV[0]);
if(defined($u)) {
    foreach my $i (qw/name score trader_score_secondary army_score_main ally/) {
        printf("%s: %s\n", $i, $u->get($i));
    }
    printf("\nCities\n");
    # print Dumper($u->_data_hash);
    foreach my $city ($u->cities) {
        my $island = Ikariam::Island->retrieve($city->island);
        my $capture = $city->citylevel * ($city->citylevel - 1) * $u->trader_score_secondary / 10000;

        printf("Name: %s\n", $city->cityname);
        if(defined($city->status))
        {
            printf("Status: <<<%s>>>\n", $city->status);
        }
        printf("Level: %s\n", $city->citylevel);
        printf("Island: %s\n", $island->name);
        printf("Location: [%s:%s] http://%s/index.php?view=island&id=%s&selectCity=%d\n", 
            $island->x, $island->y, $::server, $island->id, $city->cityId);
        printf("Tradegood: %s\n", $tradegoodText[$island->tradegood]);
        printf("Wonder: %s\n", $wonderText[$island->wonder]);
        printf("capture score: %d\n\n", $capture);
        # print Dumper($island->_data_hash);
        # print Dumper($city->_data_hash);
    }
    print "-"x80 . "\n";
}