Permalink
Browse files

Support auto-building halls, level range computations for make_halls,…

… and bugfix in count_where
  • Loading branch information...
1 parent 2481315 commit b9a8e2cff2dec2f9f4af5ead441632e1941121c7 T. Alexander Popiel committed May 4, 2012
Showing with 16 additions and 1 deletion.
  1. +6 −0 build_queue.pl
  2. +1 −1 count_where.sh
  3. +9 −0 make_halls.pl
View
@@ -282,6 +282,12 @@
my $target = (grep { $_->{name} eq $name && (!$level || $_->{level} == $level) } @buildings)[0];
if ($target) {
if (@halls <= $target->{level}) {
+ if ($queue[$j-1] !~ /-?build Halls of Vrbansk/) {
+ splice(@queue, $j, 0, "build Halls of Vrbansk\n") for (@halls..$target->{level});
+ write_queue();
+ $j--;
+ next;
+ }
emit("Insufficient halls to upgrade $name: have ".scalar(@halls).", need ".($target->{level}+1)) unless $quiet && $sleepy;
if ($queue[$j] !~ /^\-/) {
splice(@queue, $j, 1, "-$queue[$j]");
View
@@ -6,6 +6,6 @@ what=$2
# ls log/$when/*$what | xargs -n 1 get_json |
(for f in `ls log/$when/*$what`; do
- get_json stack $f || echo $f >&2;
+ get_json.pl stack $f || echo $f >&2;
done) \
| sed 's/.*at Client.pm line [0123456789]*...t//' | perl -pe '1 while s/\([^()]*\)//;' | sort | uniq -c | sort -n
View
@@ -21,6 +21,8 @@
my $quiet = 0;
my $hall_count = 0;
my $hall_max = 0;
+my $low = 0;
+my $high = 0;
my $reserve;
my %made;
@@ -31,10 +33,17 @@
"max=i" => \$hall_max,
"reserve=i" => \$reserve,
"for=s" => \$for_name,
+ "a=i" => \$low,
+ "z=i" => \$high,
"debug" => \$debug,
"quiet" => \$quiet,
) or die "$0 --config=foo.json --body=Bar\n";
+if ($high && $low) {
+ $hall_count = ($hall_count || 1) * (($high * ($high + 1) / 2) - ($low * ($low + 1) / 2));
+ print "Making $hall_count halls.\n";
+}
+
die "Must specify body\n" if ( $hall_count || $hall_max ) && !@body_name;
if ($hall_max) { $reserve //= 1 }

0 comments on commit b9a8e2c

Please sign in to comment.