From a844afb9d3935fcaf7e6118d70343b8dbc7ff37d Mon Sep 17 00:00:00 2001 From: yi12345 Date: Fri, 27 Sep 2013 14:03:30 +0300 Subject: [PATCH] pull request by Shadowss --- GameEngine/Automation.php | 77 ++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 37 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 4efb2357..989fc41b 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1,9 +1,16 @@ bountyresarray['f'.$i.'t'] == 4) { - array_push($cropholder,'f'.$i); - } - if($this->bountyresarray['f'.$i.'t'] == 8) { - $grainmill = $this->bountyresarray['f'.$i]; - } - if($this->bountyresarray['f'.$i.'t'] == 9) { - $bakery = $this->bountyresarray['f'.$i]; - } - } - for($i=0;$i<=count($cropholder)-1;$i++) { $crop+= $bid4[$this->bountyresarray[$cropholder[$i]]]['prod']; } - if($grainmill >= 1) { - $crop += $crop /100 * $bid8[$grainmill]['attri']; - } - if($bakery >= 1) { - $crop += $crop /100 * $bid9[$bakery]['attri']; - } - if($this->bountyocounter[3] != 0) { - $crop += $crop*0.25*$this->bountyocounter[3]; - } - $who=$database->getVillageField($bountyresarray['vref'],"owner"); - $croptrue=$database->getUserField($who,"b4",0); - if($croptrue > time()) { - $crop*=1.25; - if(!empty($bountyresarray['vref']) && is_numeric($bountyresarray['vref'])){ + global $bid4,$bid8,$bid9,$session; + $crop = $grainmill = $bakery = 0; + $cropholder = array(); + for($i=1;$i<=38;$i++) { + if($this->bountyresarray['f'.$i.'t'] == 4) { + array_push($cropholder,'f'.$i); + } + if($this->bountyresarray['f'.$i.'t'] == 8) { + $grainmill = $this->bountyresarray['f'.$i]; + } + if($this->bountyresarray['f'.$i.'t'] == 9) { + $bakery = $this->bountyresarray['f'.$i]; + } + } + for($i=0;$i<=count($cropholder)-1;$i++) { $crop+= $bid4[$this->bountyresarray[$cropholder[$i]]]['prod']; } + if($grainmill >= 1) { + $crop += $crop /100 * $bid8[$grainmill]['attri']; + } + if($bakery >= 1) { + $crop += $crop /100 * $bid9[$bakery]['attri']; + } + if($this->bountyocounter[3] != 0) { + $crop += $crop*0.25*$this->bountyocounter[3]; + } + if(!empty($bountyresarray['vref']) && is_numeric($bountyresarray['vref'])){ $who=$database->getVillageField($bountyresarray['vref'],"owner"); $croptrue=$database->getUserField($who,"b4",0); if($croptrue > time()) { $crop*=1.25; } - } - $crop *= SPEED; + } + $crop *= SPEED; return round($crop); - } + } private function trainingComplete() { if(file_exists("GameEngine/Prevention/training.txt")) {