Mercurial > eagle-eye
diff planner.pl @ 358:58351fccf619
default unit number is now 0, for avoid stupid thing
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Mon, 23 Feb 2009 16:24:22 +0800 |
parents | 72df6f5bd05d |
children | 2444685c68c9 |
line wrap: on
line diff
--- a/planner.pl Sun Feb 15 15:00:09 2009 +0800 +++ b/planner.pl Mon Feb 23 16:24:22 2009 +0800 @@ -55,19 +55,19 @@ my $navyCity = shift(@ARGV); my $armyCity = shift(@ARGV); my @wingman = @ARGV; +my $vanguard = 21; my $targetCity = Ikariam::Cities->retrieve($targetCityId); - # NAVY my $city = LoadFile(sprintf("city-%s-dump.yaml", $navyCity)); -$city->{distance} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 33) + 45; +$city->{distance} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 33) + $vanguard + 8; $city->{type} = "navy"; push (@cities, $city); # ARMY my $city = LoadFile(sprintf("city-%s-dump.yaml", $armyCity)); -$city->{distance} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 60) + 5; +$city->{distance} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 60) + $vanguard + 5; $city->{type} = "army"; push (@cities, $city); @@ -84,9 +84,6 @@ push (@cities, $city); } -@cities = sort { $a->{distance} <=> $b->{distance}; } (@cities); - - # print the code. print <<EOF; #!/usr/bin/perl @@ -97,6 +94,11 @@ my \$ikariam = new Ikariam(\$::server, \$::user, \$::pass); EOF +foreach(@cities) { + printf("# %s %s (%s)\n", $_->{type}, $_->{id}, $_->{distance}); +} +@cities = sort { $a->{distance} <=> $b->{distance}; } (@cities); + printf ("# %s %s [%s:%s]\n", $targetCity->owner, $targetCity->cityname, $targetCity->island->x, $targetCity->island->y); printf ("# http://%s/index.php?view=island&id=%d&selectCity=%d\n", $::server, $targetCity->island->id, $targetCity->id); @@ -115,10 +117,10 @@ if($cities[$i]->{type} eq "navy") { printf('$ikariam->changeCity(%d);' . "\n", $cities[$i]->{id}); printf('$ikariam->blockadeCity(%d, {' . "\n", $targetCity->id); - printf("\tblockadeDuration => 2*60*60," . "\n"); + printf("\tblockadeDuration => 8*60*60," . "\n"); while (my ($k, $v) = each(%{$cities[$i]->{fleet}})) { if($v > 0) { - printf("\tcargo_fleet_%s => %s, # %s \n", $fleet->{$k}, $v, $k); + printf("\tcargo_fleet_%s => %s, # %s (%d)\n", $fleet->{$k}, 0, $k, $v); } } printf('});' . "\n", $cities[$i]->{id}); @@ -127,10 +129,10 @@ printf('$ikariam->plunderCity(%d, {' . "\n", $targetCity->id); while (my ($k, $v) = each(%{$cities[$i]->{army}})) { if($v > 0) { - printf("\tcargo_army_%s => %s, # %s \n", $army->{$k}, $v, $k); + printf("\tcargo_army_%s => %s, # %s (%d)\n", $army->{$k}, 0, $k, $v); } } - printf("\ttransporter => %s, # transporter\n", $cities[$i]->{transporters}->{avail}); + printf("\ttransporter => %s, # transporter\n", $cities[$i]->{transporters}->{avail}); printf('});' . "\n", $cities[$i]->{id}); } printf('$ikariam->logout;' . "\n");