Mercurial > eagle-eye
view scores.pl @ 5:dbb97c4265ba
implemented the scores search tool
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 08 Oct 2008 01:51:28 +0800 |
parents | |
children | 2040ccc95670 |
line wrap: on
line source
#!/usr/bin/perl use strict; use Ikariam; use Data::Dumper; package main; sub saveUser { my $users = shift; foreach my $user (values(%{$users})) { if(my $c = Ikariam::Users->retrieve($user->{id})) { foreach my $i (keys(%$user)) { eval($c->$i($user->{$i})); } $c->autoupdate(1); $c->update(); } else { Ikariam::Users->insert($user); } } } my $i = new Ikariam("s2.ikariam.tw", "chihchun", "c795d57d"); # $i->login; if($#ARGV == 0) { my $users; foreach my $x (qw/score army_score_main trader_score_secondary/) { $users = $i->viewScore($x, $ARGV[0], 0); saveUser($users); } } else { my $users = $i->viewScore('army_score_main'); saveUser($users); # die("Usage: $0 nickname\n"); } # highscoreType # <option value="score">總積分</option> # <option value="building_score_main">建築大師</option> # <option value="building_score_secondary">建築等級</option> # <option value="research_score_main">科學巨人</option> # <option value="research_score_secondary">研究等級</option> # <option value="army_score_main" selected="selected">戰爭將軍</option> # <option value="trader_score_secondary">黃金存量</option> # my $users = $i->viewScore('score', 'chihchun', '0');