From 176c313845e71ab6f4a1d9378797d42f3429ffe2 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 26 Oct 2012 14:17:53 +0200 Subject: [PATCH] fix problem with hero levels --- GameEngine/Automation.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 5184314b..2ae5f073 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3849,10 +3849,15 @@ $crannyimg = "modifyHero("lastupdate",time(),$hdata['heroid']); } } - while($hdata['experience'] > $hero_levels[$hdata['level']+1] && $hdata['level'] < 100){ - mysql_query("UPDATE " . TB_PREFIX ."hero SET level = level + 1 WHERE heroid = '".$hdata['heroid']."'"); + $herolevel = $hdata['level']; + for($i = $herolevel+1; $i < 100; $i++){ + if($hdata['experience'] > $hero_levels[$i]){ + mysql_query("UPDATE " . TB_PREFIX ."hero SET level = $i WHERE heroid = '".$hdata['heroid']."'"); + if($i < 99){ mysql_query("UPDATE " . TB_PREFIX ."hero SET points = points + 5 WHERE heroid = '".$hdata['heroid']."'"); } + } + } $villunits = $database->getUnit($hdata['wref']); if($villunits['hero'] == 0 && $hdata['trainingtime'] < time() && $hdata['inrevive'] == 1){ mysql_query("UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".$hdata['wref']."");