General fixes

+Fixed a bug that didn't permit to see a defender hero in a spy report
+Fixed a bug that only permitted to revive the last hero on the hero
list
This commit is contained in:
iopietro
2018-05-31 15:23:48 +02:00
parent e0166b1242
commit b12f4d4497
2 changed files with 43 additions and 76 deletions
+40 -72
View File
@@ -16,67 +16,35 @@
// check if there is a hero in revive already
$reviving = $training = false;
foreach ($heroes as $hero_datarow) {
if ($hero_datarow['inrevive']) $reviving = true;
if ($hero_datarow['intraining']) $training = true;
}
foreach ($heroes as $hero_datarow) {
if($hero_datarow['unit'] == 1){
$name = U1;
}else if($hero_datarow['unit'] == 2){
$name = U2;
}else if($hero_datarow['unit'] == 3){
$name = U3;
}else if($hero_datarow['unit'] == 5){
$name = U5;
}else if($hero_datarow['unit'] == 6){
$name = U6;
}else if($hero_datarow['unit'] == 11){
$name = U11;
}else if($hero_datarow['unit'] == 12){
$name = U12;
}else if($hero_datarow['unit'] == 13){
$name = U13;
}else if($hero_datarow['unit'] == 15){
$name = U15;
}else if($hero_datarow['unit'] == 16){
$name = U16;
}else if($hero_datarow['unit'] == 21){
$name = U21;
}else if($hero_datarow['unit'] == 22){
$name = U22;
}else if($hero_datarow['unit'] == 24){
$name = U24;
}else if($hero_datarow['unit'] == 25){
$name = U25;
}else if($hero_datarow['unit'] == 26){
$name = U26;
}
if($hero_datarow['level'] <= 60){
$wood = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['crop']);
$timeToTrain = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['time']) / SPEED);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}else{
$wood = (${'h'.$hero_datarow['unit'].'_full'}[60]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[60]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[60]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[60]['crop']);
$timeToTrain = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, (${'h'.$hero_datarow['unit'].'_full'}[60]['time']) / SPEED);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}
if($hero_datarow['inrevive'] == 1) {
$timeleft = $generator->getTimeFormat($hero_datarow['trainingtime'] - time());
?>
<table id="distribution" cellpadding="1" cellspacing="1">
foreach ($heroes as $hero_datarow) {
if ($hero_datarow['inrevive']) $reviving = true;
if ($hero_datarow['intraining']) $training = true;
$name = $technology->getUnitName($hero_datarow['unit']);
if($hero_datarow['level'] <= 60){
$wood = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['crop']);
$timeToTrain = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, (${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['time']) / SPEED);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}else{
$wood = (${'h'.$hero_datarow['unit'].'_full'}[60]['wood']);
$clay = (${'h'.$hero_datarow['unit'].'_full'}[60]['clay']);
$iron = (${'h'.$hero_datarow['unit'].'_full'}[60]['iron']);
$crop = (${'h'.$hero_datarow['unit'].'_full'}[60]['crop']);
$timeToTrain = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, (${'h'.$hero_datarow['unit'].'_full'}[60]['time']) / SPEED);
$training_time = $generator->getTimeFormat($timeToTrain);
$training_time2 = time() + $timeToTrain;
}
if($hero_datarow['inrevive'] == 1) {
$timeleft = $generator->getTimeFormat($hero_datarow['trainingtime'] - time());
?>
<table id="distribution" cellpadding="1" cellspacing="1">
<thead>
<tr>
<?php echo "<tr class='next'><th>".HERO_READY." <span id=timer".++$session->timer.">".$timeleft."</span></th></tr>"; ?>
@@ -171,18 +139,18 @@
</tr>
<?php }
}
}
if(isset($_GET['revive']) && $_GET['revive'] == 1 && isset($_GET['hid']) && $_GET['hid'] == $hero_datarow['heroid'] && $hero_datarow['inrevive'] == 0 && $hero_datarow['intraining'] == 0 && $hero_datarow['dead'] == 1){
if($session->access != BANNED){
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."hero SET `inrevive` = '1', `trainingtime` = '".(int) $training_time2."', `wref` = '".(int) $village->wid."' WHERE `heroid` = ".(int) $_GET['hid']." AND `uid` = '".(int) $session->uid."'");
$database->modifyResource($village->wid, $wood, $clay, $iron, $crop, 0);
header("Location: build.php?id=".$id."");
exit;
} else {
header("Location: banned.php");
exit;
}
if(isset($_GET['revive']) && $_GET['revive'] == 1 && isset($_GET['hid']) && $_GET['hid'] == $hero_datarow['heroid'] && $hero_datarow['inrevive'] == 0 && $hero_datarow['intraining'] == 0 && $hero_datarow['dead'] == 1){
if($session->access != BANNED){
mysqli_query($database->dblink,"UPDATE ".TB_PREFIX."hero SET `inrevive` = '1', `trainingtime` = '".(int) $training_time2."', `wref` = '".(int) $village->wid."' WHERE `heroid` = ".(int) $_GET['hid']." AND `uid` = '".(int) $session->uid."'");
$database->modifyResource($village->wid, $wood, $clay, $iron, $crop, 0);
header("Location: build.php?id=".$id."");
exit;
} else {
header("Location: banned.php");
exit;
}
}
}
?>