Mercurial > eagle-eye
comparison Ikariam.pm @ 173:e8a244ce5a1d
update the tavern setting
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sun, 02 Nov 2008 04:12:00 +0800 |
parents | ba03aa8abdb2 |
children | 0cfc7a19a4d2 |
comparison
equal
deleted
inserted
replaced
172:ba03aa8abdb2 | 173:e8a244ce5a1d |
---|---|
1 #!/usr/bin/env perl | |
2 BEGIN { | 1 BEGIN { |
3 foreach (((getpwuid($<))[7], $ENV{HOME}, $ENV{LOGDIR}, ".")) { | 2 foreach (((getpwuid($<))[7], $ENV{HOME}, $ENV{LOGDIR}, ".")) { |
4 require "$_/.eagleeye.pm" if (-f "$_/.eagleeye.pm"); | 3 require "$_/.eagleeye.pm" if (-f "$_/.eagleeye.pm"); |
5 } | 4 } |
6 } | 5 } |
371 $self->{server}, $cityId, $_)); | 370 $self->{server}, $cityId, $_)); |
372 } | 371 } |
373 } | 372 } |
374 } | 373 } |
375 | 374 |
375 # for tavern only | |
376 sub set { | |
377 my $self = shift; | |
378 my $type = shift; | |
379 my $cityId = shift; | |
380 | |
381 die ("we don't know about this city") unless(defined($self->{'cities'}->{$cityId})); | |
382 | |
383 my $position = -1; | |
384 my @locations = @{$self->{'cities'}->{$cityId}->{locations}}; | |
385 foreach (0..$#locations) { | |
386 $position = $_ if($locations[$_] eq $type); | |
387 } | |
388 | |
389 if($position != -1) { | |
390 $self->{mech}->get (sprintf("http://%s/index.php?view=%s&id=%s&position=%d", $self->{server}, $type, $cityId, $position)); | |
391 $self->{mech}->submit_form( | |
392 form_number => 1, | |
393 fields => { | |
394 amount => $self->{'cities'}->{$cityId}->{$type}->{maxValue}, | |
395 } | |
396 ); | |
397 | |
398 } | |
399 } | |
400 | |
376 sub build { | 401 sub build { |
377 my $self = shift; | 402 my $self = shift; |
378 my $type = shift; | 403 my $type = shift; |
379 my $cityId = shift; | 404 my $cityId = shift; |
380 | 405 |