fix: hero dying and revival doesn't work correctly with multiple heroes

This commit is contained in:
Martin Ambrus
2017-11-02 23:59:03 +01:00
parent bf0409a18e
commit 90f8982245
14 changed files with 56 additions and 48 deletions
+2 -2
View File
@@ -193,7 +193,7 @@ if(isset($_GET['o'])) {
}
if ($prisoner['t11']>0){
$p_qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $p_owner."";
$p_qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".(int) $p_owner." AND dead = 0";
$p_resulth = mysqli_query($GLOBALS['link'],$p_qh);
$p_hero_f=mysqli_fetch_array($p_resulth);
$p_hero_unit=$p_hero_f['unit'];
@@ -222,7 +222,7 @@ if(isset($_GET['o'])) {
$troops = $prisoner['t1']+$prisoner['t2']+$prisoner['t3']+$prisoner['t4']+$prisoner['t5']+$prisoner['t6']+$prisoner['t7']+$prisoner['t8']+$prisoner['t9']+$prisoner['t10']+$prisoner['t11'];
if($prisoner['t11'] > 0){
$p_owner = $database->getVillageField($prisoner['from'],"owner");
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `dead` = '1', `health` = '0' WHERE `uid` = '".$p_owner."'");
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `dead` = '1', `health` = '0' WHERE `uid` = '".$p_owner."' AND dead = 0");
}
$database->modifyUnit($prisoner['wref'],array("99o"),array($troops),array(0));
$database->deletePrisoners($prisoner['id']);