comparison planner.pl @ 276:8355ec8514f9

refined output data
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 02 Dec 2008 03:38:28 +0800
parents 0ed1b3e72e65
children c864134ebe3e
comparison
equal deleted inserted replaced
275:c1333052a4ed 276:8355ec8514f9
82 use Data::Dumper; 82 use Data::Dumper;
83 package main; 83 package main;
84 my \$ikariam = new Ikariam(\$::server, \$::user, \$::pass); 84 my \$ikariam = new Ikariam(\$::server, \$::user, \$::pass);
85 EOF 85 EOF
86 86
87 printf ("# %s %s %s %s\n", $targetCity->cityname, $targetCity->owner, $targetCity->island->x, $targetCity->island->y); 87 printf ("# %s %s [%s:%s]\n", $targetCity->owner, $targetCity->cityname, $targetCity->island->x, $targetCity->island->y);
88 printf ("# http://%s/index.php?view=island&id=%d&selectCity=%d\n", $::server, $targetCity->island->id, $targetCity->id);
88 89
89 for(my $i = ($#cities + 1) ; $i-- ; $i < 0 ) { 90 for(my $i = ($#cities + 1) ; $i-- ; $i < 0 ) {
90 91
91 if($i ne $#cities){ 92 if($i ne $#cities) {
93 # TODO, 計算港口速度
94 # 減掉 cities[$i+1]->buliding->port 的速度
92 printf("sleep(%d*60);\n", 95 printf("sleep(%d*60);\n",
93 ($cities[$i+1]->{distance} - $cities[$i]->{distance})); 96 ($cities[$i+1]->{distance} - $cities[$i]->{distance}));
94 } 97 }
95 printf("\n\n\n# %s %s %dm\n", $cities[$i]->{name}, $cities[$i]->{type}, $cities[$i]->{distance}); 98 printf("\n# %s %s %dm\n", $cities[$i]->{name}, $cities[$i]->{type}, $cities[$i]->{distance});
96 99
97 printf('$ikariam->login;' . "\n"); 100 printf('$ikariam->login;' . "\n");
98 if($cities[$i]->{type} eq "navy") { 101 if($cities[$i]->{type} eq "navy") {
99 printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id}); 102 printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id});
100 printf('$ikariam->blockadeCity(%d, {' . "\n", $targetCity->id); 103 printf('$ikariam->blockadeCity(%d, {' . "\n", $targetCity->id);