mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-24 05:26:19 +00:00
1e19f117ca
/* |-------------------------------------------------------------------------- | FIX List |-------------------------------------------------------------------------- | | 1. Hero Attribute Points | - When adding attribute points to the hero, the page currently refreshes | after every click on the "+" button. | - Implement a faster allocation method (AJAX or similar) so multiple | points can be assigned without a full page refresh. | - The implementation must remain secure and not be exploitable | (validate requests server-side, prevent double submissions, | verify available points, etc.). | | 2. Hero Equipment Restrictions (Original Travian Behavior) | - Prevent equipping or unequipping hero items while the hero is: | • On an adventure. | • Attacking (alone or with troops). | • Away as reinforcements. | | 3. Oasis Navigation | - When opening an oasis (37_land.tpl), the 37_t4nav.tpl navigation | disappears. | - Include the navigation menu on the oasis page as well. | | 4. Auction House Redesign | - Redesign 37_auction.tpl to match the Merchant.png mockup. | - Keep the existing auction functionality exactly as it is. | - Only improve the UI/UX. | - You may crop and reuse graphics from Merchant.png. | - Add Gold ⇄ Silver exchange functionality. | | 5. Hero Item Bonuses (Highest Priority) | - Verify that hero equipment bonuses are applied correctly. | - Example: | • Helmet of the Ruler should reduce Barracks training time by 20%. | • Currently, training time remains unchanged whether the helmet | is equipped or not. | - Also verify: | • Stable training speed bonuses. | • Boots bonuses. | • Any other related hero equipment effects. | | 6. Adventures Page Redesign | - Redesign 37_adventures.tpl to match the Adventure.png mockup. | - Keep the "Expires in" column intact. | */
158 lines
7.6 KiB
Smarty
158 lines
7.6 KiB
Smarty
<?php
|
|
|
|
#################################################################################
|
|
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
|
## --------------------------------------------------------------------------- ##
|
|
## Filename : HERO T4 ITEMS PAGE ##
|
|
## Type : BUILDING TEMPLATE ##
|
|
## --------------------------------------------------------------------------- ##
|
|
## Created by : Shadow ##
|
|
## Designed by : Shadow ##
|
|
## --------------------------------------------------------------------------- ##
|
|
## Contact : cata7007@gmail.com ##
|
|
## Project : TravianZ ##
|
|
## Test Server : https://travianz.org ##
|
|
## GitHub : https://github.com/Shadowss/TravianZ ##
|
|
## --------------------------------------------------------------------------- ##
|
|
## License : TravianZ Project ##
|
|
## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
|
|
## --------------------------------------------------------------------------- ##
|
|
#################################################################################
|
|
|
|
$t4Msg = '';
|
|
|
|
// Eroul poate schimba echipamentul doar cat timp e in sat (ca in Travian
|
|
// original). Motivul e calculat o singura data si folosit atat pentru mesaj,
|
|
// cat si pentru ascunderea butoanelor. Regula e impusa si in HeroItems, deci
|
|
// un POST trimis manual nu o poate ocoli.
|
|
$t4AwayReason = $t4HeroItems->heroAwayReason($session->uid);
|
|
|
|
$t4AwayText = '';
|
|
if ($t4AwayReason === 'nohero') {
|
|
$t4AwayText = defined('HERO_LOCKED_NOHERO') ? HERO_LOCKED_NOHERO
|
|
: 'You have no hero yet. Train one in the Hero\'s Mansion before equipping items.';
|
|
} elseif ($t4AwayReason === 'adventure') {
|
|
$t4AwayText = defined('HERO_LOCKED_ADVENTURE') ? HERO_LOCKED_ADVENTURE
|
|
: 'Your hero is on an adventure. Equipment can only be changed while the hero is in a village.';
|
|
} elseif ($t4AwayReason === 'attack') {
|
|
$t4AwayText = defined('HERO_LOCKED_ATTACK') ? HERO_LOCKED_ATTACK
|
|
: 'Your hero is on the move with the army. Equipment can only be changed while the hero is in a village.';
|
|
} elseif ($t4AwayReason === 'reinforcement') {
|
|
$t4AwayText = defined('HERO_LOCKED_REINFORCEMENT') ? HERO_LOCKED_REINFORCEMENT
|
|
: 'Your hero is reinforcing another village. Equipment can only be changed while the hero is in a village.';
|
|
}
|
|
|
|
if (isset($_POST['t4action'], $_POST['rowid'])) {
|
|
$t4RowId = (int) $_POST['rowid'];
|
|
|
|
switch ($_POST['t4action']) {
|
|
case 'equip':
|
|
$t4Msg = $t4HeroItems->equipItem($session->uid, $t4RowId)
|
|
? HERO_EQUIP_OK : HERO_EQUIP_FAIL;
|
|
break;
|
|
|
|
case 'unequip':
|
|
$t4Msg = $t4HeroItems->unequipItem($session->uid, $t4RowId)
|
|
? HERO_UNEQUIP_OK : HERO_ITEM_USE_FAIL;
|
|
break;
|
|
|
|
case 'useitem':
|
|
$t4Qty = max(1, (int) ($_POST['qty'] ?? 1));
|
|
$t4Result = $t4HeroItems->useItem($session->uid, $t4RowId, $t4Qty, $village->wid);
|
|
if ($t4Result === HeroItems::USE_OK) {
|
|
$t4Msg = HERO_ITEM_USED_OK;
|
|
} elseif ($t4Result === HeroItems::USE_DEFERRED) {
|
|
$t4Msg = HERO_ITEM_USE_BATTLE;
|
|
} else {
|
|
$t4Msg = HERO_ITEM_USE_FAIL;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
$t4Inventory = $t4HeroItems->getInventory($session->uid);
|
|
$t4Equipped = $t4HeroItems->getEquipped($session->uid);
|
|
?>
|
|
|
|
<?php if ($t4AwayText !== '') { ?>
|
|
<p class="message" style="font-weight:bold;color:#8a6d3b;background:#fcf8e3;border:1px solid #faebcc;padding:6px 9px;border-radius:4px;">
|
|
<?php echo $t4AwayText; ?>
|
|
</p>
|
|
<?php } ?>
|
|
<?php if ($t4Msg !== '') { ?>
|
|
<p class="message" style="font-weight:bold;"><?php echo $t4Msg; ?></p>
|
|
<?php } ?>
|
|
|
|
<table id="distribution" cellpadding="1" cellspacing="1">
|
|
<thead>
|
|
<tr><th colspan="4"><?php echo HERO_ITEMS_EQUIPPED; ?></th></tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php for ($t4Slot = 1; $t4Slot <= 6; $t4Slot++) { ?>
|
|
<tr>
|
|
<td style="width:110px;"><b><?php echo constant('HERO_SLOT_' . $t4Slot); ?></b></td>
|
|
<?php if (isset($t4Equipped[$t4Slot])) { $t4Row = $t4Equipped[$t4Slot]; ?>
|
|
<td title="<?php echo htmlspecialchars(heroItemBonusText((int) $t4Row['itemid'])); ?>"><span class="heroT4Item item<?php echo (int) $t4Row['itemid']; ?>"></span> <?php echo $t4Row['name']; ?></td>
|
|
<td style="width:60px;text-align:center;"><?php echo 'T' . (int) $t4Row['def']['tier']; ?></td>
|
|
<td style="width:110px;text-align:center;">
|
|
<?php if ($t4AwayReason === '') { ?>
|
|
<form action="" method="POST" style="margin:0;">
|
|
<input type="hidden" name="t4action" value="unequip">
|
|
<input type="hidden" name="rowid" value="<?php echo (int) $t4Row['id']; ?>">
|
|
<input type="submit" value="<?php echo HERO_UNEQUIP; ?>">
|
|
</form>
|
|
<?php } else { ?>
|
|
<span style="color:#999;">—</span>
|
|
<?php } ?>
|
|
</td>
|
|
<?php } else { ?>
|
|
<td colspan="3" style="color:#888;">-</td>
|
|
<?php } ?>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<table id="distribution" cellpadding="1" cellspacing="1" style="margin-top:10px;">
|
|
<thead>
|
|
<tr><th colspan="4"><?php echo HERO_ITEMS_BAG; ?></th></tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$t4HasUnequipped = false;
|
|
foreach ($t4Inventory as $t4Row) {
|
|
if ($t4Row['equipped'] == 1 || $t4Row['orphan']) {
|
|
continue;
|
|
}
|
|
$t4HasUnequipped = true;
|
|
$t4IsBag = ((int) $t4Row['def']['slot'] === HSLOT_BAG);
|
|
?>
|
|
<tr>
|
|
<td title="<?php echo htmlspecialchars(heroItemBonusText((int) $t4Row['itemid'])); ?>"><span class="heroT4Item item<?php echo (int) $t4Row['itemid']; ?>"></span> <?php echo $t4Row['name']; ?></td>
|
|
<td style="width:80px;text-align:center;">
|
|
<?php echo $t4IsBag ? (int) $t4Row['quantity'] . 'x' : 'T' . (int) $t4Row['def']['tier']; ?>
|
|
</td>
|
|
<td style="width:110px;text-align:center;"><?php echo constant('HERO_SLOT_' . (int) $t4Row['def']['slot']); ?></td>
|
|
<td style="width:170px;text-align:center;">
|
|
<form action="" method="POST" style="margin:0;">
|
|
<input type="hidden" name="rowid" value="<?php echo (int) $t4Row['id']; ?>">
|
|
<?php if ($t4IsBag) { ?>
|
|
<input type="hidden" name="t4action" value="useitem">
|
|
<input type="text" name="qty" value="1" size="3" style="text-align:center;">
|
|
<input type="submit" value="<?php echo HERO_USE_ITEM; ?>">
|
|
<?php } elseif ($t4AwayReason === '') { ?>
|
|
<input type="hidden" name="t4action" value="equip">
|
|
<input type="submit" value="<?php echo HERO_EQUIP; ?>">
|
|
<?php } else { ?>
|
|
<span style="color:#999;">—</span>
|
|
<?php } ?>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (!$t4HasUnequipped) { ?>
|
|
<tr><td colspan="4"><?php echo HERO_ITEMS_EMPTY; ?></td></tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|