mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
fix: only 1 hero can exist and is deleted upon new hero training start
Closes #261
This commit is contained in:
@@ -10,11 +10,18 @@
|
||||
#################################################################################
|
||||
if(isset($_GET['uid'])){
|
||||
$id = (int) $_GET['uid'];
|
||||
$hid = (int) $_GET['hid'];
|
||||
include_once("../GameEngine/Data/hero_full.php");
|
||||
include_once("../GameEngine/Units.php");
|
||||
$result = mysqli_query($GLOBALS["link"], "SELECT * FROM " . TB_PREFIX . "hero WHERE `uid` = ".$id);
|
||||
$hero_info = mysqli_fetch_array($result);
|
||||
$hero = $units->Hero($id,1);
|
||||
$heroes = $units->Hero($id,1);
|
||||
|
||||
foreach ($heroes as $hdata) {
|
||||
if ($hdata['heroid'] == $hid) {
|
||||
$hero = $hdata;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$unarray = array(1=>U1,U2,U3,U4,U5,U6,U7,U8,U9,U10,U11,U12,U13,U14,U15,U16,U17,U18,U19,U20,U21,U22,U23,U24,U25,U26,U27,U28,U29,U30,U31,U32,U33,U34,U35,U36,U37,U38,U39,U40,U41,U42,U43,U44,U45,U46,U47,U48,U49,U50,U99,U0);
|
||||
$utribe=($user['tribe']-1)*10;
|
||||
?>
|
||||
@@ -88,6 +95,7 @@ function check_unit(el) {
|
||||
<form name="frmHero" action="../GameEngine/Admin/Mods/editHero.php" method="POST">
|
||||
<input type="hidden" name="admid" id="admid" value="<?php echo $_SESSION['id']; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>" />
|
||||
<input type="hidden" name="hid" value="<?php echo $hid; ?>" />
|
||||
<table style="border-collapse:collapse; margin-top:25px; line-height:16px; width:100%;">
|
||||
<tr>
|
||||
<td colspan="6" align="center"><b>Edit Player Hero</b></td>
|
||||
@@ -100,24 +108,24 @@ function check_unit(el) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hero Name</td>
|
||||
<td colspan="2"><?php echo $hero_info['name'];?></td>
|
||||
<td colspan="3"><input name="hname" class="fm" value="<?php echo $hero_info['name'];?>"></td>
|
||||
<td colspan="2"><?php echo $hero['name'];?></td>
|
||||
<td colspan="3"><input name="hname" class="fm" value="<?php echo $hero['name'];?>"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hero Level</td>
|
||||
<td colspan="2"><?php echo $hero_info['level']; ?></td>
|
||||
<td colspan="2"><?php echo $hero['level']; ?></td>
|
||||
<td colspan="3" style="font-weight:bold"><div id="hlvl">0</div><input name="hlvl" type="hidden" value="0"</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hero Unit</td>
|
||||
<td colspan="2"><?php echo "<img class=\"unit u".$hero_info['unit']."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($hero_info['unit'])."\" title=\"".$technology->getUnitName($hero_info['unit'])."\" /> (".$technology->getUnitName($hero_info['unit']); ?>)</td>
|
||||
<td width="10%" align="center" style="border-right:none"><div id="unt"><?php echo "<img class=\"unit u".$hero_info['unit']."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($hero_info['unit'])."\" title=\"".$technology->getUnitName($hero_info['unit'])."\" />";?></div></td>
|
||||
<td colspan="2"><?php echo "<img class=\"unit u".$hero['unit']."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($hero['unit'])."\" title=\"".$technology->getUnitName($hero['unit'])."\" /> (".$technology->getUnitName($hero['unit']); ?>)</td>
|
||||
<td width="10%" align="center" style="border-right:none"><div id="unt"><?php echo "<img class=\"unit u".$hero['unit']."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($hero['unit'])."\" title=\"".$technology->getUnitName($hero['unit'])."\" />";?></div></td>
|
||||
<td width="25%" colspan="2" style="border-left:none" align="left"><select name="hunit" class="dropdown" onchange="check_unit(this)">
|
||||
<?php
|
||||
for ($i=1;$i<7;$i++) {
|
||||
if (($i==3 && $user['tribe']==4) || ($i==4 && $user['tribe']!=3)) {
|
||||
}else{
|
||||
echo "<option value='".($utribe+$i)."'".($hero_info['unit'] == ($utribe+$i)? 'selected':'').">".$unarray[($utribe+$i)]."</option>\<br>";
|
||||
echo "<option value='".($utribe+$i)."'".($hero['unit'] == ($utribe+$i)? 'selected':'').">".$unarray[($utribe+$i)]."</option>\<br>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -133,7 +141,7 @@ function check_unit(el) {
|
||||
<tr>
|
||||
<td>Offence</td>
|
||||
<td align="center"><?php echo $hero['atk']; ?></td>
|
||||
<td align="center"><?php echo $hero_info['attack'];?></td>
|
||||
<td align="center"><?php echo $hero['attack'];?></td>
|
||||
<td width="10%" align="center" id="hatk0"><font color="grey">(-)</font></td>
|
||||
<td width="10%" align="center" id="hatk1"><a href="#" onclick="return changeValue(1,'hatk')">(+)</a></td>
|
||||
<td width="15%" align="center" style="font-weight:bold"><div id="hatk2">0</div><input id="hatk" name="hatk" type="hidden" value="0"></td>
|
||||
@@ -141,7 +149,7 @@ function check_unit(el) {
|
||||
<tr>
|
||||
<td>Defence</td>
|
||||
<td align="center"><?php echo $hero['di'] . "/" . $hero['dc']; ?></td>
|
||||
<td align="center"><?php echo $hero_info['defence'];?></td>
|
||||
<td align="center"><?php echo $hero['defence'];?></td>
|
||||
<td align="center" id="hdef0"><font color="grey">(-)</font></td>
|
||||
<td align="center" id="hdef1"><a href="#" onclick="return changeValue(1,'hdef')">(+)</a></td>
|
||||
<td align="center" style="font-weight:bold"><div id="hdef2">0</div><input id="hdef" name="hdef" type="hidden" value="0"></td>
|
||||
@@ -149,7 +157,7 @@ function check_unit(el) {
|
||||
<tr>
|
||||
<td>Off-Bonus</td>
|
||||
<td align="center"><?php echo ($hero['ob']-1)*100; ?>%</td>
|
||||
<td align="center"><?php echo $hero_info['attackbonus'];?></td>
|
||||
<td align="center"><?php echo $hero['attackbonus'];?></td>
|
||||
<td align="center" id="hob0"><font color="grey">(-)</font></td>
|
||||
<td align="center" id="hob1"><a href="#" onclick="return changeValue(1,'hob')">(+)</a></td>
|
||||
<td align="center" style="font-weight:bold"><div id="hob2">0</div><input id="hob" name="hob" type="hidden" value="0"></td>
|
||||
@@ -157,37 +165,37 @@ function check_unit(el) {
|
||||
<tr>
|
||||
<td>Def-Bonus</td>
|
||||
<td align="center"><?php echo ($hero['db']-1)*100; ?>%</td>
|
||||
<td align="center"><?php echo $hero_info['defencebonus'];?></td>
|
||||
<td align="center"><?php echo $hero['defencebonus'];?></td>
|
||||
<td align="center" id="hdb0"><font color="grey">(-)</font></td>
|
||||
<td align="center" id="hdb1"><a href="#" onclick="return changeValue(1,'hdb')">(+)</a></td>
|
||||
<td align="center" style="font-weight:bold"><div id="hdb2">0</div><input id="hdb" name="hdb" type="hidden" value="0"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Regeneration</td>
|
||||
<td align="center"><?php echo ($hero_info['regeneration']*5*SPEED); ?>/Day</font></td>
|
||||
<td align="center"><?php echo $hero_info['regeneration'];?></td>
|
||||
<td align="center"><?php echo ($hero['regeneration']*5*SPEED); ?>/Day</font></td>
|
||||
<td align="center"><?php echo $hero['regeneration'];?></td>
|
||||
<td align="center" id="hrege0"><font color="grey">(-)</font></td>
|
||||
<td align="center" id="hrege1"><a href="#" onclick="return changeValue(1,'hrege')">(+)</a></td>
|
||||
<td align="center" style="font-weight:bold"><div id="hrege2">0</div><input id="hrege" name="hrege" type="hidden" value="0"></td>
|
||||
<tr>
|
||||
<?php
|
||||
$count_level_exp=500-intval($hero_info['attack']+$hero_info['defence']+$hero_info['attackbonus']+$hero_info['defencebonus']+$hero_info['regeneration']);
|
||||
if ($hero_info['points']>$count_level_exp) $hero_info['points']=$count_level_exp;
|
||||
if($hero_info['experience'] < 495000){ ?>
|
||||
$count_level_exp=500-intval($hero['attack']+$hero['defence']+$hero['attackbonus']+$hero['defencebonus']+$hero['regeneration']);
|
||||
if ($hero['points']>$count_level_exp) $hero['points']=$count_level_exp;
|
||||
if($hero['experience'] < 495000){ ?>
|
||||
<td>Experience</td>
|
||||
<td colspan="2" align="center"><?php echo (int) (($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100) ?>% (
|
||||
<?php echo $hero_info['points']; ?>)</td>
|
||||
<td colspan="2" align="center"><?php echo (int) (($hero['experience'] - $hero_levels[$hero['level']]) / ($hero_levels[$hero['level']+1] - $hero_levels[$hero['level']])*100) ?>% (
|
||||
<?php echo $hero['points']; ?>)</td>
|
||||
<?php }else{ ?>
|
||||
<td>Experience</td>
|
||||
<td colspan="2" align="center">100% (<?php echo $hero_info['points']; ?>)</td>
|
||||
<td colspan="2" align="center">100% (<?php echo $hero['points']; ?>)</td>
|
||||
<?php } ?>
|
||||
<td align="center" style="font-weight:bold" colspan="3"><div id="exp1">5</div><input id="exp" name="exp" type="hidden" value="5"></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Health</td>
|
||||
<td colspan="2" align="center"><?php echo round($hero_info['health']);?>%</td>
|
||||
<td colspan="3" align="center"><input name="hhealth" class="fm fm40" maxlength="3" value="<?php echo round($hero_info['health']);?>">%</td>
|
||||
<td colspan="2" align="center"><?php echo round($hero['health']);?>%</td>
|
||||
<td colspan="3" align="center"><input name="hhealth" class="fm fm40" maxlength="3" value="<?php echo round($hero['health']);?>">%</td>
|
||||
</tr>
|
||||
<tr class="thead">
|
||||
<td style="border-right:none" align="left"><input name="back" type="image" id="btn_back" class="dynamic_img" src="img/x.gif" value="back" alt="back" onclick="return go_url('../Admin/admin.php?p=player&uid=<?php echo $_GET["uid"];?>')" /></td>
|
||||
|
||||
@@ -11,14 +11,19 @@
|
||||
|
||||
include_once("../GameEngine/Data/hero_full.php");
|
||||
include_once("../GameEngine/Units.php");
|
||||
$id=(int) $user['id'];
|
||||
$hero = mysqli_query($GLOBALS["link"], "SELECT * FROM " . TB_PREFIX . "hero WHERE `uid` = ".$id);
|
||||
$hero_info = mysqli_fetch_array($hero);
|
||||
if (!empty($hero_info)) {
|
||||
$hero = $units->Hero($id,1);
|
||||
}else {
|
||||
$hero="none";
|
||||
}
|
||||
$id = (int) $_GET['uid'];
|
||||
$hero = $units->Hero($id,1);
|
||||
|
||||
// find a hero who's alive
|
||||
$heroAliveIndex = -1;
|
||||
if ($hero !== false) {
|
||||
foreach ($hero as $hid => $h) {
|
||||
if (!$h['dead']) {
|
||||
$heroAliveIndex = $hid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
td {
|
||||
@@ -35,17 +40,10 @@ thead {
|
||||
<table style="border-collapse:collapse; margin-top:25px; line-height:16px; width:100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Player Hero Info
|
||||
<?php if (!$hero_info['dead'] && $hero!="none") {?>
|
||||
<a href='admin.php?p=editHero&uid=<?php echo $id; ?>'>
|
||||
<img src="../img/admin/edit.gif" title="Edit Player Hero Info"></a>
|
||||
<a href='?action=killHero&uid=<?php echo $id; ?>'>
|
||||
<img src="../img/admin/del.gif" title="Kill Player Hero"></a>
|
||||
<?php }?>
|
||||
</td>
|
||||
<td colspan="3">Player Heroes</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php if ($hero=="none") {?>
|
||||
<?php if ($hero === false) {?>
|
||||
<tr>
|
||||
<td colspan="3" align="center">None <font color="blue">Add Hero</font>
|
||||
<?php
|
||||
@@ -62,20 +60,59 @@ thead {
|
||||
?>
|
||||
|
||||
</tr>
|
||||
<?php }else {?>
|
||||
<?php
|
||||
} else {
|
||||
$x = 1;
|
||||
foreach ($hero as $h) {
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center; color: blue; font-weight: bold">
|
||||
Hero #<?php echo $x++; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="35%">Hero Name</td>
|
||||
<td colspan="2" width="65%"><?php echo $hero_info['name']; ?></td>
|
||||
<td colspan="2" width="65%"><?php echo $h['name']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hero Level</td>
|
||||
<td colspan="2"><?php echo $hero_info['level']; ?></td>
|
||||
<td colspan="2"><?php echo $h['level']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hero Unit</td>
|
||||
<td colspan="2"><?php echo "<img class=\"unit u".$hero_info['unit']."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($hero_info['unit'])."\" title=\"".$technology->getUnitName($hero_info['unit'])."\" /> (".$technology->getUnitName($hero_info['unit']); ?>)</td>
|
||||
<td colspan="2"><?php echo "<img class=\"unit u".$h['unit']."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($h['unit'])."\" title=\"".$technology->getUnitName($h['unit'])."\" /> (".$technology->getUnitName($h['unit']); ?>)</td>
|
||||
</tr>
|
||||
<?php if (!$hero_info['dead']) {?>
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td colspan="2"<?php
|
||||
if ($h['dead']) {
|
||||
echo ' class="c5"';
|
||||
}
|
||||
?>>
|
||||
<?php
|
||||
if (!$h['dead']) {
|
||||
?>
|
||||
<span style="color: green; font-weight: bold">Alive</span>
|
||||
<a href='admin.php?p=editHero&uid=<?php echo $id; ?>&hid=<?php echo $h['heroid'] ?>'>
|
||||
<img src="../img/admin/edit.gif" title="Edit Player Hero Info"></a>
|
||||
<a href='?action=killHero&uid=<?php echo $id; ?>'>
|
||||
<img src="../img/admin/del.gif" title="Kill Player Hero"></a></td>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
Dead
|
||||
<?php
|
||||
if ($heroAliveIndex === -1) {
|
||||
?><a href="?action=reviveHero&uid=<?php echo $id;?>&hid=<?php echo $h['heroid'] ?>" title="Revive hero"><?php echo $refreshicon; ?></a>
|
||||
<?php
|
||||
} else {
|
||||
echo '<span style="color: black; font-size: smaller">(cannot revive, kill living hero first)</span>';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php if (!$h['dead']) { ?>
|
||||
<thead>
|
||||
<tr>
|
||||
<td width="35%">Details</td>
|
||||
@@ -85,66 +122,73 @@ thead {
|
||||
</thead>
|
||||
<tr>
|
||||
<td>Offence</td>
|
||||
<td><?php echo $hero['atk']; ?></td>
|
||||
<td><?php echo $hero_info['attack']; ?></td>
|
||||
<td><?php echo $h['atk']; ?></td>
|
||||
<td><?php echo $h['attack']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Defence</td>
|
||||
<td><?php echo $hero['di'] . "/" . $hero['dc']; ?></td>
|
||||
<td><?php echo $hero_info['defence']; ?></td>
|
||||
<td><?php echo $h['di'] . "/" . $h['dc']; ?></td>
|
||||
<td><?php echo $h['defence']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Off-Bonus</td>
|
||||
<td><?php echo ($hero['ob']-1)*100; ?>%</td>
|
||||
<td><?php echo $hero_info['attackbonus']; ?></td>
|
||||
<td><?php echo ($h['ob']-1)*100; ?>%</td>
|
||||
<td><?php echo $h['attackbonus']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Def-Bonus</td>
|
||||
<td><?php echo ($hero['db']-1)*100; ?>%</td>
|
||||
<td><?php echo $hero_info['defencebonus']; ?></td>
|
||||
<td><?php echo ($h['db']-1)*100; ?>%</td>
|
||||
<td><?php echo $h['defencebonus']; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Regeneration</td>
|
||||
<td><?php echo ($hero_info['regeneration']*5*SPEED); ?>/Day</td>
|
||||
<td><?php echo $hero_info['regeneration']; ?></td>
|
||||
<td><?php echo ($h['regeneration']*5*SPEED); ?>/Day</td>
|
||||
<td><?php echo $h['regeneration']; ?></td>
|
||||
<tr>
|
||||
<?php
|
||||
$count_level_exp=500-intval($hero_info['attack']+$hero_info['defence']+$hero_info['attackbonus']+$hero_info['defencebonus']+$hero_info['regeneration']);
|
||||
if ($hero_info['points']>$count_level_exp) $hero_info['points']=$count_level_exp;
|
||||
if($hero_info['experience'] < 495000){ ?>
|
||||
<td>Experience: <?php echo (int) (($hero_info['experience'] - $hero_levels[$hero_info['level']]) / ($hero_levels[$hero_info['level']+1] - $hero_levels[$hero_info['level']])*100) ?>%</td>
|
||||
<td colspan="2"><?php echo $hero_info['points']; ?></td>
|
||||
$count_level_exp=500-intval($h['attack']+$h['defence']+$h['attackbonus']+$h['defencebonus']+$h['regeneration']);
|
||||
if ($h['points']>$count_level_exp) $h['points']=$count_level_exp;
|
||||
if($h['experience'] < 495000){ ?>
|
||||
<td>Experience: <?php echo (int) (($h['experience'] - $hero_levels[$h['level']]) / ($hero_levels[$h['level']+1] - $hero_levels[$h['level']])*100) ?>%</td>
|
||||
<td colspan="2"><?php echo $h['points']; ?></td>
|
||||
<?php }else{ ?>
|
||||
<td>Experience: 100%</td>
|
||||
<td colspan="2"><?php echo $hero_info['points']; ?></td>
|
||||
<td colspan="2"><?php echo $h['points']; ?></td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Health</td>
|
||||
<td colspan="2"><?php echo round($hero_info['health']); ?>%</td>
|
||||
<td colspan="2"><?php echo round($h['health']); ?>%</td>
|
||||
<tr>
|
||||
<?php }else{?>
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td colspan="2" class="c5">Dead <a href="?action=reviveHero&uid=<?php echo $id;?>" title="Revive hero"><?php echo $refreshicon; ?></a></td>
|
||||
<tr>
|
||||
|
||||
<?php }
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
if(isset($_GET['e'])){
|
||||
echo '<div align="center"><font color="Red"><b>Problem to kill hero</font></b></div>';
|
||||
echo '<div align="center"><font color="Red"><b>Here could not be killed due to an unexpected error.</font></b></div>';
|
||||
}elseif(isset($_GET['kc'])){
|
||||
echo '<div align="center"><font color="blue"><b>Kill hero has done</font></b></div>';
|
||||
echo '<div align="center"><font color="blue"><b>Hero has been killed.</b></font></div>';
|
||||
}elseif(isset($_GET['rc'])){
|
||||
echo '<div align="center"><font color="blue"><b>Revive hero has done</font></b></div>';
|
||||
echo '<div align="center"><font color="blue"><b>Hero has been revived.</b></font></div>';
|
||||
}elseif(isset($_GET['re'])){
|
||||
echo '<div align="center"><font color="red"><b>Hero cannot be revived because another hero still lives or is in revival.</b></font></div>';
|
||||
}elseif(isset($_GET['ac'])){
|
||||
echo '<div align="center"><font color="blue"><b>Add hero has done</font></b></div>';
|
||||
echo '<div align="center"><font color="blue"><b>A new hero was added.</b></font></div>';
|
||||
}elseif(isset($_GET['cs'])){
|
||||
echo '<div align="center"><font color="blue"><b>Change hero info has done</font></b></div>';
|
||||
echo '<div align="center"><font color="blue"><b>Hero information has been saved.</b></font></div>';
|
||||
}elseif(isset($_GET['ce'])){
|
||||
echo '<div align="center"><font color="Red"><b>Problem to change hero info</font></b></div>';
|
||||
echo '<div align="center"><font color="Red"><b>Hero data could not be edited due to an unexpected error.</b></font></div>';
|
||||
}
|
||||
?>
|
||||
@@ -19,7 +19,7 @@ foreach ($_POST as $key => $value) {
|
||||
$_POST[$key] = $database->escape($value);
|
||||
}
|
||||
|
||||
if(isset($_POST['id'])) {
|
||||
if(isset($_POST['id']) && isset($_POST['hid'])) {
|
||||
$_POST['hname'] = trim(stripslashes($_POST['hname']));
|
||||
if ($_POST['hname']=="") {
|
||||
header("Location: ../../../Admin/admin.php?p=editHero&uid=".$_POST['id']."&e=1");
|
||||
@@ -29,9 +29,10 @@ if(isset($_POST['id'])) {
|
||||
include_once("../../Data/hero_full.php");
|
||||
|
||||
$id = (int) $_POST['id'];
|
||||
$hid = (int) $_POST['hid'];
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."hero SET unit=".(int) $_POST['hunit'].", name='".$_POST['hname']."', level=".(int) $_POST['hlvl'].", points=".(int) $_POST['exp'].", experience=".(int) $hero_levels[$_POST['hlvl']].", health='".$_POST['hhealth']."',
|
||||
attack=".(int) $_POST['hatk'].", defence=".(int) $_POST['hdef'].", attackbonus=".(int) $_POST['hob'].", defencebonus=".(int) $_POST['hdb'].", regeneration=".(int) $_POST['hrege']." WHERE uid = ".$id;
|
||||
attack=".(int) $_POST['hatk'].", defence=".(int) $_POST['hdef'].", attackbonus=".(int) $_POST['hob'].", defencebonus=".(int) $_POST['hdb'].", regeneration=".(int) $_POST['hrege']." WHERE heroid = ".$hid." AND uid = ".$id;
|
||||
$return=$database->query($q);
|
||||
if($return) {
|
||||
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".(int) $_SESSION['id'].",'Changed hero info',".time().")");
|
||||
|
||||
@@ -92,10 +92,17 @@ class funct {
|
||||
header("Location: admin.php?p=player&uid=".$get['uid'].$error);
|
||||
exit;
|
||||
case "reviveHero":
|
||||
$result=$database->query("SELECT * FROM ".TB_PREFIX."hero WHERE uid=".(int) $get['uid']);
|
||||
$livingHeroesCount = mysqli_fetch_array($database->query("SELECT Count(*) as Total FROM ".TB_PREFIX."hero WHERE uid=".(int) $get['uid']." AND (dead = 0 OR inrevive = 1)"), MYSQLI_ASSOC);
|
||||
|
||||
if ($livingHeroesCount['Total'] > 0) {
|
||||
header("Location: admin.php?p=player&uid=".$get['uid']."&re=1");
|
||||
exit;
|
||||
}
|
||||
|
||||
$result=$database->query("SELECT * FROM ".TB_PREFIX."hero WHERE heroid = ".(int) $get['hid']." AND uid=".(int) $get['uid']);
|
||||
$hdata=mysqli_fetch_array($result);
|
||||
$database->query("UPDATE ".TB_PREFIX."units SET hero = 1 WHERE vref = ".(int) $hdata['wref']);
|
||||
$database->query("UPDATE ".TB_PREFIX."hero SET `dead` = '0', `inrevive` = '0', `health` = '100', `lastupdate` = ".time()." WHERE `uid` = ".(int) $get['uid']);
|
||||
$database->query("UPDATE ".TB_PREFIX."hero SET `dead` = '0', `inrevive` = '0', `health` = '100', `lastupdate` = ".time()." WHERE `heroid` = ".(int) $get['hid']." AND `uid` = ".(int) $get['uid']);
|
||||
header("Location: admin.php?p=player&uid=".$get['uid']."&rc=1");
|
||||
exit;
|
||||
case "addHero":
|
||||
|
||||
@@ -4280,11 +4280,11 @@ class Automation {
|
||||
$villunits = $database->getUnit($hdata['wref']);
|
||||
if($villunits['hero'] == 0 && $hdata['trainingtime'] < time() && $hdata['inrevive'] == 1){
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".(int) $hdata['wref']."");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `dead` = '0', `inrevive` = '0', `health` = '100', `lastupdate` = ".(int) $hdata['trainingtime']." WHERE `uid` = ".(int) $hdata['uid']);
|
||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `dead` = '0', `inrevive` = '0', `health` = '100', `lastupdate` = ".(int) $hdata['trainingtime']." WHERE `heroid` = ".(int) $hdata['heroid']);
|
||||
}
|
||||
if($villunits['hero'] == 0 && $hdata['trainingtime'] < time() && $hdata['intraining'] == 1){
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".(int) $hdata['wref']);
|
||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `intraining` = '0', `lastupdate` = ".(int) $hdata['trainingtime']." WHERE `uid` = ".(int) $hdata['uid']);
|
||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `intraining` = '0', `lastupdate` = ".(int) $hdata['trainingtime']." WHERE `heroid` = ".(int) $hdata['heroid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3709,15 +3709,15 @@ class MYSQLi_DB implements IDbConnection {
|
||||
return $totalunits;
|
||||
}
|
||||
|
||||
function getHero($uid=0,$all=0) {
|
||||
function getHero($uid=0, $all=0, $include_dead = false) {
|
||||
list($uid,$all) = $this->escape_input((int) $uid,$all);
|
||||
|
||||
if ($all) {
|
||||
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid=$uid";
|
||||
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid=$uid ORDER BY lastupdate DESC";
|
||||
} elseif (!$uid) {
|
||||
$q = "SELECT * FROM ".TB_PREFIX."hero";
|
||||
} else {
|
||||
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE dead=0 AND uid=$uid LIMIT 1";
|
||||
$q = "SELECT * FROM ".TB_PREFIX."hero WHERE ".($include_dead ? '' : "dead=0 AND ")."uid=$uid LIMIT 1";
|
||||
}
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
if (!empty($result)) {
|
||||
|
||||
+97
-9
@@ -711,18 +711,106 @@ exit;
|
||||
}
|
||||
}
|
||||
|
||||
public function Hero($uid,$all=0) {
|
||||
public function Hero($uid, $all = 0, $include_dead = false) {
|
||||
global $database;
|
||||
$heroarray = $database->getHero($uid,$all);
|
||||
$herodata = $GLOBALS["h".$heroarray[0]['unit']];
|
||||
$heroarray = $database->getHero($uid, $all, $include_dead);
|
||||
$herodata = false;
|
||||
$singleHeroArrayID = 0;
|
||||
|
||||
$h_atk = $herodata['atk'] + 5 * floor($heroarray[0]['attack'] * $herodata['atkp'] / 5);
|
||||
$h_di = $herodata['di'] + 5 * floor($heroarray[0]['defence'] * $herodata['dip'] / 5);
|
||||
$h_dc = $herodata['dc'] + 5 * floor($heroarray[0]['defence'] * $herodata['dcp'] / 5);
|
||||
$h_ob = 1 + 0.002 * $heroarray[0]['attackbonus'];
|
||||
$h_db = 1 + 0.002 * $heroarray[0]['defencebonus'];
|
||||
// no hero data found
|
||||
if (!count($heroarray)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return array('heroid'=>$heroarray[0]['heroid'],'unit'=>$heroarray[0]['unit'],'atk'=>$h_atk,'di'=>$h_di,'dc'=>$h_dc,'ob'=>$h_ob,'db'=>$h_db,'health'=>$heroarray[0]['health']);
|
||||
// check all heroes and load hero data for the one,
|
||||
// whose data were updated more recently - if we're not getting all of them
|
||||
if (!$all) {
|
||||
foreach ($heroarray as $id => $hero) {
|
||||
// try to load a hero who's alive first
|
||||
if (!$herodata && $hero['dead'] != 1) {
|
||||
// this global value comes from GameEngine/Data/unitdata.php
|
||||
$herodata = $GLOBALS["h".$hero['unit']];
|
||||
$singleHeroArrayID = $id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we couldn't get a living hero,
|
||||
// resort to loading the first one from the list,
|
||||
// as that would be the one most recently updated/used
|
||||
if (!$herodata) {
|
||||
// this global value comes from GameEngine/Data/unitdata.php
|
||||
$herodata = $GLOBALS["h".$heroarray[0]['unit']];
|
||||
}
|
||||
|
||||
$h_atk = $herodata['atk'] + 5 * floor($heroarray[$singleHeroArrayID]['attack'] * $herodata['atkp'] / 5);
|
||||
$h_di = $herodata['di'] + 5 * floor($heroarray[$singleHeroArrayID]['defence'] * $herodata['dip'] / 5);
|
||||
$h_dc = $herodata['dc'] + 5 * floor($heroarray[$singleHeroArrayID]['defence'] * $herodata['dcp'] / 5);
|
||||
$h_ob = 1 + 0.002 * $heroarray[$singleHeroArrayID]['attackbonus'];
|
||||
$h_db = 1 + 0.002 * $heroarray[$singleHeroArrayID]['defencebonus'];
|
||||
|
||||
return [
|
||||
'heroid' => $heroarray[$singleHeroArrayID]['heroid'],
|
||||
'unit' => $heroarray[$singleHeroArrayID]['unit'],
|
||||
'name' => $heroarray[$singleHeroArrayID]['name'],
|
||||
'inrevive' => $heroarray[$singleHeroArrayID]['inrevive'],
|
||||
'intraining' => $heroarray[$singleHeroArrayID]['intraining'],
|
||||
'trainingtime' => $heroarray[$singleHeroArrayID]['trainingtime'],
|
||||
'level' => $heroarray[$singleHeroArrayID]['level'],
|
||||
'attack' => $heroarray[$singleHeroArrayID]['attack'],
|
||||
'atk' => $h_atk,
|
||||
'defence' => $heroarray[$singleHeroArrayID]['defence'],
|
||||
'di' => $h_di,
|
||||
'dc' => $h_dc,
|
||||
'attackbonus' => $heroarray[$singleHeroArrayID]['attackbonus'],
|
||||
'ob' => $h_ob,
|
||||
'defencebonus' => $heroarray[$singleHeroArrayID]['defencebonus'],
|
||||
'db' => $h_db,
|
||||
'regeneration' => $heroarray[$singleHeroArrayID]['regeneration'],
|
||||
'health' => $heroarray[$singleHeroArrayID]['health'],
|
||||
'dead' => $heroarray[$singleHeroArrayID]['dead'],
|
||||
'points' => $heroarray[$singleHeroArrayID]['points'],
|
||||
'experience' => $heroarray[$singleHeroArrayID]['experience']
|
||||
];
|
||||
} else {
|
||||
// build up a full array of heroes and their stats
|
||||
$heroes = [];
|
||||
foreach ($heroarray as $id => $hero) {
|
||||
$herodata = $GLOBALS["h".$heroarray[$id]['unit']];
|
||||
|
||||
$h_atk = $herodata['atk'] + 5 * floor($heroarray[$id]['attack'] * $herodata['atkp'] / 5);
|
||||
$h_di = $herodata['di'] + 5 * floor($heroarray[$id]['defence'] * $herodata['dip'] / 5);
|
||||
$h_dc = $herodata['dc'] + 5 * floor($heroarray[$id]['defence'] * $herodata['dcp'] / 5);
|
||||
$h_ob = 1 + 0.002 * $heroarray[$id]['attackbonus'];
|
||||
$h_db = 1 + 0.002 * $heroarray[$id]['defencebonus'];
|
||||
|
||||
$heroes[] = [
|
||||
'heroid' => $heroarray[$id]['heroid'],
|
||||
'unit' => $heroarray[$id]['unit'],
|
||||
'name' => $heroarray[$id]['name'],
|
||||
'inrevive' => $heroarray[$id]['inrevive'],
|
||||
'intraining' => $heroarray[$id]['intraining'],
|
||||
'trainingtime' => $heroarray[$id]['trainingtime'],
|
||||
'level' => $heroarray[$id]['level'],
|
||||
'attack' => $heroarray[$id]['attack'],
|
||||
'atk' => $h_atk,
|
||||
'defence' => $heroarray[$id]['defence'],
|
||||
'di' => $h_di,
|
||||
'dc' => $h_dc,
|
||||
'attackbonus' => $heroarray[$id]['attackbonus'],
|
||||
'ob' => $h_ob,
|
||||
'defencebonus' => $heroarray[$id]['defencebonus'],
|
||||
'db' => $h_db,
|
||||
'regeneration' => $heroarray[$id]['regeneration'],
|
||||
'health' => $heroarray[$id]['health'],
|
||||
'dead' => $heroarray[$id]['dead'],
|
||||
'points' => $heroarray[$id]['points'],
|
||||
'experience' => $heroarray[$id]['experience']
|
||||
];
|
||||
}
|
||||
|
||||
return $heroes;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ martinambrus changes:
|
||||
57. new feature: access log (only in config.php file to be used by advanced users to log game traffic and reveal URL hacks)
|
||||
58. fixed ability to go back in quests and gain gold and resources all over again when using default quests set
|
||||
59. fix for "finish immediatelly" PLUS button to decrease gold amount even when demolition alone has been insta-completed
|
||||
60. fix: building a Palace in another village makes that village capital
|
||||
60. fixed maximum of 3 heroes in the Hero's Mansion (+ update of the Admin interface to account for it)
|
||||
61. new feature: Embassy mechanics overhaul - check out our [Wiki Page](https://github.com/Shadowss/TravianZ/wiki/New-Alliance-&-Embassy-Mechanics) or this [Google Presentation](https://docs.google.com/presentation/d/1KN1qVAlxVj7aAN6F9QkRai1oliajfxKPIaJ4MSodUac/edit?usp=sharing) to learn more about it
|
||||
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
| Copyright: TravianX Project All rights reserved |
|
||||
\*-------------------------------------------------------*/
|
||||
|
||||
$hero = mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PREFIX . "hero WHERE `uid` = " . (int) $session->uid . "");
|
||||
$hero_info = mysqli_fetch_array($hero);
|
||||
|
||||
$hero_info = $units->Hero($session->uid, 0, true);
|
||||
$define['reset_level'] = 3; // Until which level you are able to reset your points
|
||||
|
||||
?>
|
||||
@@ -61,7 +59,7 @@
|
||||
if(isset($_GET['land'])) {
|
||||
include("37_land.tpl");
|
||||
} else {
|
||||
if(mysqli_num_rows($hero) == 0){
|
||||
if($hero_info === false){
|
||||
include("37_train.tpl");
|
||||
}elseif($hero_info['intraining'] == 1){
|
||||
$timeleft = $generator->getTimeFormat($hero_info['trainingtime'] - time());
|
||||
@@ -87,10 +85,10 @@
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
if(mysqli_num_rows($hero) != 0 AND $hero_info['dead'] == 1 AND $hero_info['intraining'] == 0){
|
||||
if($hero_info !== false AND $hero_info['dead'] == 1 AND $hero_info['intraining'] == 0){
|
||||
include("37_revive.tpl");
|
||||
}
|
||||
if(mysqli_num_rows($hero) != 0 AND $hero_info['dead'] == 0 AND $hero_info['trainingtime'] <= time() AND $hero_info['inrevive'] == 0 AND $hero_info['intraining'] == 0){
|
||||
if($hero_info !== false AND $hero_info['dead'] == 0 AND $hero_info['trainingtime'] <= time() AND $hero_info['inrevive'] == 0 AND $hero_info['intraining'] == 0){
|
||||
include("37_hero.tpl");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Copyright: Travianx Project */
|
||||
|
||||
$oasisarray = $database->getOasis($village->wid);
|
||||
if($_GET['gid']==37 && isset($_GET['del'])){
|
||||
if(isset($_GET['gid']) && $_GET['gid']==37 && isset($_GET['del'])){
|
||||
if($session->access != BANNED){
|
||||
$database->removeOases($_GET['del']);
|
||||
header("Location: build.php?id=".$id."&land");
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
<table cellpadding="1" cellspacing="1" class="build_details">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo REVIVE; ?> <?php echo U0; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<?php
|
||||
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,5,3,0));
|
||||
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,5,1,1));
|
||||
@@ -22,66 +29,75 @@
|
||||
| Dzoki < dzoki.travian@gmail.com > |
|
||||
| Copyright: TravianX Project All rights reserved |
|
||||
\*-------------------------------------------------------*/
|
||||
|
||||
if($hero_info['unit'] == 1) {
|
||||
$heroes = $units->Hero($session->uid, 1);
|
||||
|
||||
// check if there is a hero in revive already
|
||||
$reviving = false;
|
||||
$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_info['unit'] == 2) {
|
||||
} else if($hero_datarow['unit'] == 2) {
|
||||
$name = U2;
|
||||
} else if($hero_info['unit'] == 3) {
|
||||
} else if($hero_datarow['unit'] == 3) {
|
||||
$name = U3;
|
||||
} else if($hero_info['unit'] == 5) {
|
||||
} else if($hero_datarow['unit'] == 5) {
|
||||
$name = U5;
|
||||
} else if($hero_info['unit'] == 6) {
|
||||
} else if($hero_datarow['unit'] == 6) {
|
||||
$name = U6;
|
||||
} else if($hero_info['unit'] == 11) {
|
||||
} else if($hero_datarow['unit'] == 11) {
|
||||
$name = U11;
|
||||
} else if($hero_info['unit'] == 12) {
|
||||
} else if($hero_datarow['unit'] == 12) {
|
||||
$name = U12;
|
||||
} else if($hero_info['unit'] == 13) {
|
||||
} else if($hero_datarow['unit'] == 13) {
|
||||
$name = U13;
|
||||
} else if($hero_info['unit'] == 15) {
|
||||
} else if($hero_datarow['unit'] == 15) {
|
||||
$name = U15;
|
||||
} else if($hero_info['unit'] == 16) {
|
||||
} else if($hero_datarow['unit'] == 16) {
|
||||
$name = U16;
|
||||
} else if($hero_info['unit'] == 21) {
|
||||
} else if($hero_datarow['unit'] == 21) {
|
||||
$name = U21;
|
||||
} else if($hero_info['unit'] == 22) {
|
||||
} else if($hero_datarow['unit'] == 22) {
|
||||
$name = U22;
|
||||
} else if($hero_info['unit'] == 24) {
|
||||
} else if($hero_datarow['unit'] == 24) {
|
||||
$name = U24;
|
||||
} else if($hero_info['unit'] == 25) {
|
||||
} else if($hero_datarow['unit'] == 25) {
|
||||
$name = U25;
|
||||
} else if($hero_info['unit'] == 26) {
|
||||
} else if($hero_datarow['unit'] == 26) {
|
||||
$name = U26;
|
||||
}
|
||||
if($hero_info['level'] <= 60){
|
||||
$wood = (${'h'.$hero_info['unit'].'_full'}[$hero_info['level']]['wood']);
|
||||
$clay = (${'h'.$hero_info['unit'].'_full'}[$hero_info['level']]['clay']);
|
||||
$iron = (${'h'.$hero_info['unit'].'_full'}[$hero_info['level']]['iron']);
|
||||
$crop = (${'h'.$hero_info['unit'].'_full'}[$hero_info['level']]['crop']);
|
||||
$training_time = $generator->getTimeFormat(round((${'h'.$hero_info['unit'].'_full'}[$hero_info['level']]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus));
|
||||
$training_time2 = time() + round((${'h'.$hero_info['unit'].'_full'}[$hero_info['level']]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus);
|
||||
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 = round((${'h'.$hero_datarow['unit'].'_full'}[$hero_datarow['level']]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus);
|
||||
$training_time = $generator->getTimeFormat($timeToTrain);
|
||||
$training_time2 = time() + $timeToTrain;
|
||||
}else{
|
||||
$wood = (${'h'.$hero_info['unit'].'_full'}[60]['wood']);
|
||||
$clay = (${'h'.$hero_info['unit'].'_full'}[60]['clay']);
|
||||
$iron = (${'h'.$hero_info['unit'].'_full'}[60]['iron']);
|
||||
$crop = (${'h'.$hero_info['unit'].'_full'}[60]['crop']);
|
||||
$training_time = $generator->getTimeFormat(round((${'h'.$hero_info['unit'].'_full'}[60]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus));
|
||||
$training_time2 = time() + round((${'h'.$hero_info['unit'].'_full'}[60]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus);
|
||||
$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 = round((${'h'.$hero_datarow['unit'].'_full'}[60]['time']) / SPEED * $artefact_bonus2 / $artefact_bonus);
|
||||
$training_time = $generator->getTimeFormat($timeToTrain);
|
||||
$training_time2 = time() + $timeToTrain;
|
||||
}
|
||||
?>
|
||||
|
||||
<table cellpadding="1" cellspacing="1" class="build_details">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"><?php echo REVIVE; ?> <?php echo U0; ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<?php
|
||||
if($hero_info['inrevive'] == 1) {
|
||||
$timeleft = $generator->getTimeFormat($hero_info['trainingtime'] - time());
|
||||
|
||||
if($hero_datarow['inrevive'] == 1) {
|
||||
$timeleft = $generator->getTimeFormat($hero_datarow['trainingtime'] - time());
|
||||
?>
|
||||
<table id="distribution" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
@@ -95,19 +111,19 @@
|
||||
echo "<tr>
|
||||
<td class=\"desc\">
|
||||
<div class=\"tit\">
|
||||
<img class=\"unit u".$hero_info['unit']."\" src=\"img/x.gif\" alt=\"".$name."\" title=\"".$name."\" />
|
||||
<img class=\"unit u".$hero_datarow['unit']."\" src=\"img/x.gif\" alt=\"".$name."\" title=\"".$name."\" />
|
||||
$name ($name1)
|
||||
</div>"
|
||||
?>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
<?php }else{ if($hero_info['unit'] == 1 OR 11 OR 21){ ?>
|
||||
<?php }else if (!$reviving) { if($hero_datarow['unit'] == 1 OR 11 OR 21){ ?>
|
||||
<tr>
|
||||
<td class="desc">
|
||||
<div class="tit">
|
||||
<img class="unit u<?php echo $hero_info['unit']; ?>" src="img/x.gif" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
||||
<?php echo $name . " (Level " . $hero_info['level'] . ")"; ?>
|
||||
<img class="unit u<?php echo $hero_datarow['unit']; ?>" src="img/x.gif" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
||||
<?php echo $name . " (Level " . $hero_datarow['level'] . ")"; ?>
|
||||
</div>
|
||||
<div class="details">
|
||||
<img class="r1" src="img/x.gif" alt="Wood" title="<?php echo LUMBER; ?>" /><?php echo $wood; ?>|
|
||||
@@ -130,7 +146,7 @@
|
||||
if($village->awood < $wood OR $village->aclay < $clay OR $village->airon < $iron OR $village->acrop < $crop) {
|
||||
echo "<span class=\"none\">".NOT."".ENOUGH_RESOURCES."</span>";
|
||||
}else {
|
||||
echo "<a href=\"build.php?id=".$id."&revive=1\">".REVIVE."</a>";
|
||||
echo "<a href=\"build.php?id=".$id."&revive=1&hid=".$hero_datarow['heroid']."\">".REVIVE."</a>";
|
||||
}
|
||||
|
||||
?></center></td>
|
||||
@@ -138,12 +154,12 @@
|
||||
<?php }else { ?>
|
||||
|
||||
|
||||
<?php if($database->checkIfResearched($village->wid, 't'.$hero_info['unit']) != 0){ ?>
|
||||
<?php if($database->checkIfResearched($village->wid, 't'.$hero_datarow['unit']) != 0){ ?>
|
||||
<tr>
|
||||
<td class="desc">
|
||||
<div class="tit">
|
||||
<img class="unit u<?php echo $hero_info['unit']; ?>" src="img/x.gif" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
||||
<?php echo $name . " (Level " . $hero_info['level'] . ")"; ?>
|
||||
<img class="unit u<?php echo $hero_datarow['unit']; ?>" src="img/x.gif" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
||||
<?php echo $name . " (Level " . $hero_datarow['level'] . ")"; ?>
|
||||
</div>
|
||||
<div class="details">
|
||||
<img class="r1" src="img/x.gif" alt="Wood" title="<?php echo LUMBER; ?>" /><?php echo $wood; ?>|
|
||||
@@ -166,34 +182,39 @@
|
||||
if($village->awood < $wood OR $village->aclay < $clay OR $village->airon < $iron OR $village->acrop < $crop) {
|
||||
echo "<span class=\"none\">".NOT."".ENOUGH_RESOURCES."</span>";
|
||||
}else {
|
||||
echo "<a href=\"build.php?id=".$id."&revive=1\">".REVIVE."</a>";
|
||||
echo "<a href=\"build.php?id=".$id."&revive=1&hid=".$hero_datarow['heroid']."\">".REVIVE."</a>";
|
||||
}
|
||||
|
||||
?>
|
||||
</center></td>
|
||||
</tr>
|
||||
<?php } }} ?>
|
||||
|
||||
</table>
|
||||
<?php }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
if(isset($_GET['revive']) && $_GET['revive'] == 1 && $hero_info['inrevive'] == 0 && $hero_info['intraining'] == 0 && $hero_info['dead'] == 1){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `inrevive` = '1', `trainingtime` = '".(int) $training_time2."', `wref` = '".(int) $village->wid."' WHERE `uid` = '".(int) $session->uid."'");
|
||||
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($GLOBALS['link'],"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."'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $wood." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `clay` = `clay` - ".(int) $clay." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `iron` = `iron` - ".(int) $iron ." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `crop` = `crop` - ".(int) $crop." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
header("Location: build.php?id=".$id."");
|
||||
exit;
|
||||
}else{
|
||||
} else {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($hero_info['inrevive'] == 0 && $hero_info['intraining'] == 0) {
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<?php
|
||||
if(!$reviving && !$training) {
|
||||
include ("37_train.tpl");
|
||||
}
|
||||
?>
|
||||
@@ -37,6 +37,11 @@
|
||||
$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."units WHERE `vref` = ".(int) $village->wid."");
|
||||
$units = mysqli_fetch_array($result);
|
||||
|
||||
$count_hero = mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM " . TB_PREFIX . "hero WHERE `uid` = " . $database->escape($session->uid) . ""), MYSQLI_ASSOC);
|
||||
$count_hero = $count_hero['Total'];
|
||||
|
||||
if ($count_hero < 3) {
|
||||
|
||||
$output="<table cellpadding=1 cellspacing=1 class=\"build_details\">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -613,12 +618,10 @@ $output.="<tr>
|
||||
|
||||
|
||||
//HERO TRAINING
|
||||
$count_hero = mysqli_num_rows(mysqli_query($GLOBALS['link'],"SELECT * FROM " . TB_PREFIX . "hero WHERE `uid` = " . $database->escape($session->uid) . ""));
|
||||
if($session->tribe == 1){
|
||||
if($_GET['train'] == 1){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 1){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '1', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u1['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u1` = `u1` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u1['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -633,10 +636,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 2){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 2){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '2', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u1['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u2` = `u2` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u2['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -651,9 +653,8 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 3){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 3){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '3', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u3['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u3` = `u3` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u3['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -667,10 +668,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 5){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 5){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '5', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u5['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u5` = `u5` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u5['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -685,10 +685,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 6){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 6){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '6', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u6['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u6` = `u6` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u6['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -705,10 +704,9 @@ $output.="<tr>
|
||||
}
|
||||
}
|
||||
if($session->tribe == 2){
|
||||
if($_GET['train'] == 11){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 11){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '11', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u11['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u11` = `u11` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u11['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -723,10 +721,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 12){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 12){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '12', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u12['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u12` = `u12` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u12['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -741,10 +738,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 13){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 13){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '13', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u13['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u13` = `u13` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u13['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -759,10 +755,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 15){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 15){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '15', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u15['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u15` = `u15` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u15['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -777,10 +772,9 @@ $output.="<tr>
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if($_GET['train'] == 16){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 16){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '16', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u16['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u16` = `u16` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u16['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -799,8 +793,7 @@ $output.="<tr>
|
||||
if($session->tribe == 3){
|
||||
if(isset($_GET['train']) && $_GET['train'] == 21){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '21', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u21['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u21` = `u21` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u21['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -817,8 +810,7 @@ $output.="<tr>
|
||||
}
|
||||
if(isset($_GET['train']) && $_GET['train'] == 22){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '22', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u22['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u22` = `u22` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u22['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -835,8 +827,7 @@ $output.="<tr>
|
||||
}
|
||||
if(isset($_GET['train']) && $_GET['train'] == 24){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '24', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u24['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u24` = `u24` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u24['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -853,8 +844,7 @@ $output.="<tr>
|
||||
}
|
||||
if(isset($_GET['train']) && $_GET['train'] == 25){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '25', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u25['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u25` = `u25` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u25['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -871,8 +861,7 @@ $output.="<tr>
|
||||
}
|
||||
if(isset($_GET['train']) && $_GET['train'] == 26){
|
||||
if($session->access != BANNED){
|
||||
mysqli_query($GLOBALS['link'],"DELETE from " . TB_PREFIX . "hero WHERE `dead` = 1 AND `uid` = '" . $database->escape($session->uid) . "'");
|
||||
if($count_hero == 0){
|
||||
if($count_hero < 3){
|
||||
mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '26', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u26['time'] / SPEED)*3))."', '50', '1')");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u26` = `u26` - 1 WHERE `vref` = '" . (int) $village->wid . "'");
|
||||
mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "vdata SET `wood` = `wood` - ".(int) $u26['wood']." WHERE `wref` = '" . (int) $village->wid . "'");
|
||||
@@ -892,7 +881,7 @@ $output.="<tr>
|
||||
|
||||
|
||||
|
||||
echo $output;
|
||||
|
||||
echo $output;
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
-- 2.11.2017 -> Hero fixes
|
||||
ALTER TABLE `s1_hero` ADD INDEX(`lastupdate`);
|
||||
ALTER TABLE `s1_hero` DROP INDEX `uid`, ADD INDEX `uid` (`uid`, `dead`) USING BTREE;
|
||||
ALTER TABLE `s1_hero` ADD INDEX(`inrevive`);
|
||||
|
||||
-- 31.10.2017 -> Embassy and alliance updates
|
||||
ALTER TABLE `s1_ali_permission` ADD INDEX(`alliance`);
|
||||
ALTER TABLE `s1_allimedal` ADD INDEX(`allyid`);
|
||||
|
||||
+3
-1
@@ -914,7 +914,9 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%hero` (
|
||||
`inrevive` tinyint(1) NULL,
|
||||
`intraining` tinyint(1) NULL,
|
||||
PRIMARY KEY (`heroid`),
|
||||
KEY `uid` (`uid`)
|
||||
KEY `uid` (`uid`, `dead`) USING BTREE,
|
||||
KEY `lastupdate` (`lastupdate`),
|
||||
KEY `inrevive` (`inrevive`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
|
||||
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user