mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-02 00:27:12 +00:00
Add T4 Hero System (configurable on install)
Add T4 Hero System (configurable on install with TRUE/FALS) part of #285 -Adventures -Merchants -Equipment
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
#################################################################################
|
||||
# T4 hero adventures tab (37_adventures.tpl) - Phase 6 #
|
||||
# POST: t4action=startadv, advid. Countdown spans reuse the existing #
|
||||
# $session->timer JS convention (same as 37.tpl's training timer). #
|
||||
#################################################################################
|
||||
|
||||
$t4Adventures = new HeroAdventure();
|
||||
$t4Msg = '';
|
||||
|
||||
if (isset($_POST['t4action'], $_POST['advid']) && $_POST['t4action'] === 'startadv') {
|
||||
$t4Result = $t4Adventures->startAdventure($session->uid, (int) $_POST['advid']);
|
||||
if ($t4Result === HeroAdventure::START_OK) {
|
||||
$t4Msg = HERO_ADV_START_OK;
|
||||
} elseif ($t4Result === HeroAdventure::START_NO_HERO) {
|
||||
$t4Msg = HERO_ADV_START_NOHERO;
|
||||
} elseif ($t4Result === HeroAdventure::START_HERO_AWAY) {
|
||||
$t4Msg = HERO_ADV_START_AWAY;
|
||||
} else {
|
||||
$t4Msg = HERO_ADV_START_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
// Top up the list opportunistically (respects max/refresh limits internally).
|
||||
$t4Adventures->generateOffers($session->uid);
|
||||
|
||||
$t4Offers = $t4Adventures->getOffers($session->uid);
|
||||
$t4Running = $t4Adventures->getRunning($session->uid);
|
||||
$t4Now = time();
|
||||
?>
|
||||
|
||||
<?php if ($t4Msg !== '') { ?>
|
||||
<p class="message" style="font-weight:bold;"><?php echo $t4Msg; ?></p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($t4Running) { ?>
|
||||
<table id="distribution" cellpadding="1" cellspacing="1">
|
||||
<thead>
|
||||
<tr><th><?php echo HERO_ADV_RUNNING; ?>
|
||||
<span id="timer<?php echo ++$session->timer; ?>"><?php echo $generator->getTimeFormat(max(0, $t4Running['endtime'] - $t4Now)); ?></span>
|
||||
</th></tr>
|
||||
</thead>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
<table id="distribution" cellpadding="1" cellspacing="1" style="margin-top:10px;">
|
||||
<thead>
|
||||
<tr><th colspan="4"><?php echo HERO_ADV_LIST; ?></th></tr>
|
||||
<tr>
|
||||
<td><b><?php echo HERO_ADV_DIFFICULTY; ?></b></td>
|
||||
<td><b><?php echo HERO_ADV_DURATION; ?></b></td>
|
||||
<td><b><?php echo HERO_ADV_EXPIRES; ?></b></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($t4Offers)) { ?>
|
||||
<?php foreach ($t4Offers as $t4Offer) { ?>
|
||||
<tr>
|
||||
<td><?php echo ((int) $t4Offer['difficulty'] === 1) ? HERO_ADV_DIFF_HARD : HERO_ADV_DIFF_NORMAL; ?></td>
|
||||
<td><?php echo $generator->getTimeFormat((int) $t4Offer['duration']); ?></td>
|
||||
<td><span id="timer<?php echo ++$session->timer; ?>"><?php echo $generator->getTimeFormat(max(0, $t4Offer['expire'] - $t4Now)); ?></span></td>
|
||||
<td style="width:140px;text-align:center;">
|
||||
<?php if (!$t4Running) { ?>
|
||||
<form action="" method="POST" style="margin:0;">
|
||||
<input type="hidden" name="t4action" value="startadv">
|
||||
<input type="hidden" name="advid" value="<?php echo (int) $t4Offer['id']; ?>">
|
||||
<input type="submit" value="<?php echo HERO_ADV_GO; ?>">
|
||||
</form>
|
||||
<?php } else { ?>-<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr><td colspan="4"><?php echo HERO_ADV_NONE; ?></td></tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user