annotate enemy_scores.pl @ 313:a5d85719155d

fixed the if/else logic
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 06 Jan 2009 23:51:53 +0800
parents cea21f99e56f
children e551351b18de
rev   line source
277
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
1 #!/usr/bin/perl
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
2 use strict;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
3 use Ikariam;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
4 use Data::Dumper;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
5 use YAML qw/LoadFile/;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
6 use POSIX qw(strftime);
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
7
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
8 package main;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
9 my @tradegoodText = qw/NULL 葡萄酒 大理石 水晶 硫磺/;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
10 my @wonderText = qw/NULL 赫菲斯拓斯的熔爐 蓋亞的神殿 狄奧尼索斯的花園 雅典娜的神殿 赫秘士的神殿 阿瑞斯的要塞 波賽頓的神殿 克羅瑟斯的神殿/;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
11
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
12 package main;
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
13
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
14 if($#ARGV != 0) {
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
15 die("Usage: $0 nickname\n");
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
16 }
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
17
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
18 my ($u) = Ikariam::User->search('name' => $ARGV[0]);
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
19 if(defined($u)) {
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
20 foreach my $i (qw/name time score trader_score_secondary army_score_main ally/) {
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
21 if($i eq "time") {
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
22 printf("time: %s, ", strftime ("%Y-%m-%d %H:%M", localtime($u->get('time'))));
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
23 } else {
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
24 printf("%s: %s, ", $i, $u->get($i));
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
25 }
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
26 }
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
27 print("\n");
cea21f99e56f script for morning scores
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
28 }