Mercurial > eagle-eye
view scan.pl @ 7:2040ccc95670
implemented scores collection.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 08 Oct 2008 02:50:19 +0800 |
parents | dbb97c4265ba |
children | e4b3168d0319 |
line wrap: on
line source
#!/usr/bin/perl use strict; use Ikariam; package main; my $i = new Ikariam("s2.ikariam.tw", "chihchun", "c795d57d"); $i->login; my @islands; if($#ARGV >= 1) { @islands = $i->viewWorldMap($ARGV[0], $ARGV[1]); } else { @islands = $i->viewHomeMap(); } foreach my $island (@islands) { printf("checking island %d\n", $island->{id}); if(my $c = Ikariam::Island->retrieve($island->{id})) { foreach my $i (keys(%$island)) { eval($c->$i($island->{$i})); } } else { Ikariam::Island->insert($island); } # scanning the island my @cities = $i->viewIsland($island->{id}); foreach my $city (@cities) { $city->{island} = $island->{id}; if(my $c = Ikariam::Cities->retrieve($city->{cityId})) { foreach my $i (keys(%$city)) { eval($c->$i($city->{$i})); # printf("%s %s ", $i, $city->{$i}); } #print ("\n"); $c->autoupdate(1); $c->update(); } else { Ikariam::Cities->insert($city); } printf("city %d %s saved\n", $city->{cityId}, $city->{cityname}); } } # $i->getCityInfo();