Mercurial > eagle-eye
comparison agent.pl @ 54:2d3c394b7940
rules for build new building and buy transporters
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Mon, 20 Oct 2008 23:24:15 +0800 |
parents | d2ac1e198ce4 |
children | ff00d108e955 |
comparison
equal
deleted
inserted
replaced
53:336164c9a983 | 54:2d3c394b7940 |
---|---|
68 sub is_shipyard | 68 sub is_shipyard |
69 { | 69 { |
70 return 1; | 70 return 1; |
71 } | 71 } |
72 | 72 |
73 sub is_gold_enoughforcargo { | |
74 my ($self, $city) = @_; | |
75 my @cargoCost = qw/160 244 396 812 1240 1272 1832 1888 3848 3972 5204 5384 6868 7120 8864 9200 11268 11712 14108 14680 23320 24288 28664 29880 34956 36468 42348 44212 51024 53308 61236 64024 73096 76468 87020 91088 103224 116524 122072 137432 180060 202132 211964 237444 249108 278276 292076 306623 321963 338138 355198 373191 392171 412195 433320 455612 479135 503962 530166 557828 587031 617863 650420 684802 721113 759466 799981 842783 888005 935790 986286 1039654 1096062 1155689 1218724 1285369 1355837 1430353 1509159 1592508 1680670 1773932 1872597 1976989 2087448 2204338 2328045 2458976 2597567 2744276 2899594 3064040 3238163 3422550 3617820 3824635 4043693 4275738 4521561 4782000 5057946 5350345 5660202 5988585 6336630 6705540 7096598 7511164 7950683 8416694 8910828 9434823 9990523 10579889 11205006 11868090 12571498 13317734 14109462 14949514/; | |
76 | |
77 if($city->{resources}->{gold} >= ($cargoCost[$city->{transporters}->{sum}]*5)) { | |
78 return 1; | |
79 } else { | |
80 return 0; | |
81 } | |
82 } | |
83 | |
73 sub is_drydock_researched { | 84 sub is_drydock_researched { |
74 my ($self, $city) = @_; | 85 my ($self, $city) = @_; |
75 return (defined($city->{research}->{4010}) ? 1 : 0); | 86 return (defined($city->{research}->{4010}) ? 1 : 0); |
76 } | 87 } |
77 | 88 |
133 print(Dumper($cities->{$cityId}->{parse_path})); | 144 print(Dumper($cities->{$cityId}->{parse_path})); |
134 } | 145 } |
135 | 146 |
136 $i->logout; | 147 $i->logout; |
137 | 148 |
149 | |
138 sub triggerAction { | 150 sub triggerAction { |
139 my ($action, $cityId) = @_; | 151 my ($action, $cityId) = @_; |
140 | 152 |
141 my ($func, $param) = split(/_/,$action); | 153 my ($func, $param) = split(/_/,$action); |
142 # printf('$i->%s("%s", %s);\n\n', $func, $param, $cityId); | 154 printf('$i->%s("%s", %s);'. "\n\n", $func, $param, $cityId); |
143 eval(sprintf('$i->%s("%s", %s);', $func, $param, $cityId)); | 155 eval(sprintf('$i->%s("%s", %s);', $func, $param, $cityId)); |
144 warn $@ if $@; | 156 warn $@ if $@; |
145 } | 157 } |