mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-18 01:01:01 +00:00
Refactor + BugFix
1. Fix a bug in Admin Panel that you can edit by yourself your rank, now you cannot edit your rank anymore. 2. Now Alliance Leader can edit his own Position 3. Fix negative value on Demolition Building, now in database at lvl is appear new level not -1 4. Refactor Ajax map, now all is alligned (Ajax folder and Map folder) 5. Fix bug from Palace (when change capital now Automation recount population automaticaly on old capital and new capital)
This commit is contained in:
@@ -1,68 +1,97 @@
|
||||
<form method="POST" name="snd" action="build.php">
|
||||
<input type="hidden" name="id" value="<?php echo $id; ?>" />
|
||||
<input type="hidden" name="ft" value="t1" />
|
||||
|
||||
<table cellpadding="1" cellspacing="1" class="build_details">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Naam</td>
|
||||
<td>Aantal</td>
|
||||
<td>max</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$i = 20;
|
||||
echo "<tr><td class=\"desc\">
|
||||
<div class=\"tit\">
|
||||
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
|
||||
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(Available: ".$village->unitarray['u'.$i].")</span>
|
||||
</div>
|
||||
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".${'u'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"duration\" />";
|
||||
echo $generator->getTimeFormat(round(${'u'.$i}['time']/SPEED));
|
||||
//-- If available resources combined are not enough, remove NPC button
|
||||
//$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
|
||||
// 26_create.tpl - PALACE / TRAIN SETTLERS
|
||||
global $village, $technology, $generator, $id;
|
||||
|
||||
//if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
|
||||
//echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
|
||||
//}
|
||||
echo "
|
||||
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"4\"></td>
|
||||
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a></td></tr></tbody>
|
||||
";
|
||||
?>
|
||||
$unitId = 20; // colonist
|
||||
$unitName = $technology->getUnitName($unitId);
|
||||
$costs = $GLOBALS['u'.$unitId]; // $u20 din config
|
||||
$maxTrain = $technology->maxUnit($unitId);
|
||||
$available = (int)($village->unitarray['u'.$unitId]?? 0);
|
||||
$trainTime = $generator->getTimeFormat(round($costs['time'] / SPEED));
|
||||
$trainList = $technology->getTrainingList($unitId);
|
||||
?>
|
||||
<form method="POST" name="snd" action="build.php">
|
||||
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
|
||||
<input type="hidden" name="ft" value="t1" />
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" />
|
||||
</p>
|
||||
<table cellpadding="1" cellspacing="1" class="build_details">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Naam</td>
|
||||
<td>Aantal</td>
|
||||
<td>max</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="desc">
|
||||
<div class="tit">
|
||||
<img class="unit u<?php echo $unitId;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($unitName);?>" title="<?php echo htmlspecialchars($unitName);?>" />
|
||||
<a href="#" onclick="return Popup(<?php echo $unitId;?>,1);"><?php echo htmlspecialchars($unitName);?></a>
|
||||
<span class="info">(Available: <?php echo $available;?>)</span>
|
||||
</div>
|
||||
<div class="details">
|
||||
<img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><?php echo $costs['wood'];?>|
|
||||
<img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><?php echo $costs['clay'];?>|
|
||||
<img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><?php echo $costs['iron'];?>|
|
||||
<img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><?php echo $costs['crop'];?>|
|
||||
<img class="clock" src="img/x.gif" alt="duration" title="duration" /><?php echo $trainTime;?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="val">
|
||||
<input type="text" class="text" name="t<?php echo $unitId;?>" value="0" maxlength="4">
|
||||
</td>
|
||||
<td class="max">
|
||||
<a href="#" onclick="document.snd.t<?php echo $unitId;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
$trainlist = $technology->getTrainingList(20);
|
||||
if(count($trainlist) > 0) {
|
||||
$timer = 2*count($trainlist);
|
||||
echo "
|
||||
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
|
||||
<thead><tr>
|
||||
<td>Training</td>
|
||||
<td>Duration</td>
|
||||
<td>Finished</td>
|
||||
</tr></thead>
|
||||
<tbody>";
|
||||
foreach($trainlist as $train) {
|
||||
echo "<tr><td class=\"desc\">";
|
||||
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />".$train['amt']." ".$train['name']."</td><td class=\"dur\"><span id=timer".$timer.">".$generator->getTimeFormat(($train['commence']+($train['eachtime']*$train['amt']))-time())."</span></td><td class=\"fin\">";
|
||||
$timer -= 1;
|
||||
$time = $generator->procMTime($train['commence']+(1*$train['amt']));
|
||||
if($time[0] != "today") {
|
||||
echo "on ".$time[0]." at";
|
||||
}
|
||||
echo $time[1]."</span><span> o'clock</td>
|
||||
</tr><tr class=\"next\"><td colspan=\"3\">The next unit will be finished in <span id=timer".$timer.">".$generator->getTimeFormat(($train['commence']+$train['eachtime'])-time())."</span></td></tr>";
|
||||
}
|
||||
echo "</tbody></table>";
|
||||
}
|
||||
?>
|
||||
<p>
|
||||
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" />
|
||||
</p>
|
||||
|
||||
</form>
|
||||
<?php if (!empty($trainList)):
|
||||
$timer = count($trainList) * 2;
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" class="under_progress">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Training</td>
|
||||
<td>Duration</td>
|
||||
<td>Finished</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($trainList as $train):
|
||||
$totalFinish = $train['commence'] + ($train['eachtime'] * $train['amt']);
|
||||
$nextFinish = $train['commence'] + $train['eachtime'];
|
||||
$remainingTotal = max(0, $totalFinish - time());
|
||||
$remainingNext = max(0, $nextFinish - time());
|
||||
$time = $generator->procMTime($totalFinish);
|
||||
?>
|
||||
<tr>
|
||||
<td class="desc">
|
||||
<img class="unit u<?php echo (int)$train['unit'];?>" src="img/x.gif" alt="<?php echo htmlspecialchars($train['name']);?>" title="<?php echo htmlspecialchars($train['name']);?>" />
|
||||
<?php echo (int)$train['amt'];?> <?php echo htmlspecialchars($train['name']);?>
|
||||
</td>
|
||||
<td class="dur">
|
||||
<span id="timer<?php echo $timer;?>"><?php echo $generator->getTimeFormat($remainingTotal);?></span>
|
||||
</td>
|
||||
<td class="fin">
|
||||
<?php if ($time[0]!= "today") echo "on ".$time[0]." at "; echo $time[1];?> o'clock
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="next">
|
||||
<td colspan="3">
|
||||
The next unit will be finished in <span id="timer<?php echo $timer-1;?>"><?php echo $generator->getTimeFormat($remainingNext);?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$timer -= 2;
|
||||
endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
Reference in New Issue
Block a user