Mercurial > eagle-eye
diff scan.pl @ 0:abaee7064429
new scanning prototype.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Tue, 07 Oct 2008 22:24:46 +0800 |
parents | |
children | f9eac5385dc0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scan.pl Tue Oct 07 22:24:46 2008 +0800 @@ -0,0 +1,69 @@ +#!/usr/bin/perl +use strict; +use Ikariam; + +package main; + +use Class::DBI::AutoLoader ( + dsn => 'dbi:SQLite:dbname=ikariam.sqlite', + options => { RaiseError => 1 }, + tables => ['cities', 'islands'], + use_base => 'Class::DBI::SQLite', + namespace => 'Ikariam', +); + +my $i = new Ikariam("s2.ikariam.tw", "chihchun", "c795d57d"); +$i->login; +my @islands = $i->viewWorldMap(89, 60); + +foreach my $island (@islands) +{ + printf("checking island %d\n", $island->{id}); + if(my $c = Ikariam::Islands->retrieve($island->{id})) { + foreach my $i (keys(%$island)) { + eval($c->$i($island->{$i})); + } + } else { + Ikariam::Islands->insert($island); + } + + # scanning the island + my @cities = $i->viewIsland($island->{id}); + foreach my $city (@cities) + { + $city->{island} = $island->{id}; + printf("checking city %d\n", $city->{cityId}); + 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->update(); + } else { + Ikariam::Cities->insert($city); + } + } +} + + +# TODO +# $i->worldmap($x, $y); +# http://s2.ikariam.tw/index.php?view=worldmap_iso +# xajax getMapData +# xajaxargs[] 54 +# xajaxargs[] 30 +# xajaxr 1223302744553 +# $i->getAcount() account database. + +# 經濟, 軍事 +# http://s2.ikariam.tw/index.php +# view highscore +# highscoreType score +# offset -1 +# searchUser chihchun + +# $i->getCityInfo();