diff agent.pl @ 84:2c6c219dc3ff

fixed the checkCity function, implemneted a human resources palnning function.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 26 Oct 2008 01:43:40 +0800
parents 82acbba33b97
children a8acf50bf7bb
line wrap: on
line diff
--- a/agent.pl	Sat Oct 25 01:18:00 2008 +0800
+++ b/agent.pl	Sun Oct 26 01:43:40 2008 +0800
@@ -4,7 +4,7 @@
 use Ikariam;
 use Data::Dumper;
 use Decision::ParseTree q{ParseTree};
-use YAML qw/LoadFile Dump/;
+use YAML qw/LoadFile Dump DumpFile/;
 
 package Ikariam::Cities::Rules;
 use strict;
@@ -172,7 +172,7 @@
 
 
 package main;
-my $verbose = undef;
+my $verbose = 1;
 
 our $i = new Ikariam($::server, $::user, $::pass);
 $i->login;
@@ -187,7 +187,7 @@
 $decision->{parse_answer} = undef;
 my $action = ParseTree($tree, $rules, $decision);
 triggerAction($action, (keys(%$cities))[0]) if(defined($action));
-print STDERR Dumper($decision) if(defined($verbose));
+print STDERR Dump($decision) if(defined($verbose));
 
 
 # show cities.
@@ -205,6 +205,7 @@
         print("\n");
     }
     print("\n");
+    $i->blanceHurmanResource($cityId);
 
     # build and upgrade for cities
     $tree  = LoadFile('city.yaml');
@@ -220,9 +221,10 @@
         }
     }
     # Debug
-    print(Dumper($cities->{$cityId}->{parse_path})) if(defined($verbose));
-    print(Dumper($cities)) if(defined($verbose));
+    # print(Dump($cities->{$cityId}->{parse_path})) if(defined($verbose));
 }
+# print(Dump($cities)) if(defined($verbose));
+DumpFile("dump.yaml", $cities);
 
 $i->logout;