Last fix for Hero T4 & V11

/*
|--------------------------------------------------------------------------
| 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.
|
*/
This commit is contained in:
novgorodschi catalin
2026-07-23 15:16:51 +03:00
parent 34e3d88e39
commit 1e19f117ca
19 changed files with 620 additions and 29 deletions
+55 -14
View File
@@ -17,6 +17,9 @@
## License : TravianZ Project ##
## Copyright : TravianZ (c) 2010-2026. All rights reserved. ##
## --------------------------------------------------------------------------- ##
## NOTA: doar prezentarea a fost refacuta (aspect ca in Travian original). ##
## Logica - generarea ofertelor, pornirea aventurii, mesajele - e neschimbata.##
## Coloana "Expires in" a fost pastrata (nu exista in originalul T4). ##
#################################################################################
$t4Adventures = new HeroAdventure();
@@ -41,6 +44,32 @@ $t4Adventures->generateOffers($session->uid);
$t4Offers = $t4Adventures->getOffers($session->uid);
$t4Running = $t4Adventures->getRunning($session->uid);
$t4Now = time();
/**
* Numele locului tintit de aventura, ca in Travian: "Abandoned valley" pentru
* un teren liber, "Unoccupied oasis" pentru o oaza libera. Tintele sunt mereu
* tile-uri neocupate (vezi HeroAdventure::generateOffers).
* getCoor() e cache-uit per request, deci nu adauga query-uri pe rand.
*/
$t4PlaceInfo = function ($wref) use ($database, $generator) {
$tile = $database->getCoor((int) $wref);
if (!is_array($tile) || !isset($tile['x'])) {
return null;
}
$isOasis = isset($tile['oasistype']) && (int) $tile['oasistype'] > 0;
return array(
'name' => $isOasis
? (defined('UNOCCUPIED') && defined('OASIS') ? UNOCCUPIED . ' ' . strtolower(OASIS) : 'Unoccupied oasis')
: (defined('ABANDVALLEY') ? ABANDVALLEY : 'Abandoned valley'),
'x' => (int) $tile['x'],
'y' => (int) $tile['y'],
'wref' => (int) $wref,
'check' => $generator->getMapCheck((int) $wref),
);
};
?>
<?php if ($t4Msg !== '') { ?>
@@ -59,10 +88,11 @@ $t4Now = time();
<table id="distribution" cellpadding="1" cellspacing="1" style="margin-top:10px;">
<thead>
<tr><th colspan="4"><?php echo HERO_ADV_LIST; ?></th></tr>
<tr><th colspan="5"><?php echo HERO_ADV_LIST; ?></th></tr>
<tr>
<td><b><?php echo HERO_ADV_DIFFICULTY; ?></b></td>
<td><b><?php echo defined('HERO_ADV_PLACE') ? HERO_ADV_PLACE : 'Place'; ?></b></td>
<td><b><?php echo HERO_ADV_DURATION; ?></b></td>
<td><b><?php echo defined('HERO_ADV_DANGER') ? HERO_ADV_DANGER : 'Danger'; ?></b></td>
<td><b><?php echo HERO_ADV_EXPIRES; ?></b></td>
<td></td>
</tr>
@@ -70,31 +100,42 @@ $t4Now = time();
<tbody>
<?php if (count($t4Offers)) { ?>
<?php foreach ($t4Offers as $t4Offer) { ?>
<?php
$t4Place = $t4PlaceInfo($t4Offer['wref']);
$t4Hard = ((int) $t4Offer['difficulty'] === 1);
?>
<tr>
<td>
<?php if ((int)$t4Offer['difficulty'] === 1): ?>
<img src="img/hero/dangerGreat.gif" alt="hard" title="<?php echo HERO_ADV_DIFF_HARD; ?>" style="vertical-align:middle; margin-right:4px; width:16px; height:16px;">
<?php echo HERO_ADV_DIFF_HARD; ?>
<?php else: ?>
<img src="img/hero/danger.gif" alt="normal" title="<?php echo HERO_ADV_DIFF_NORMAL; ?>" style="vertical-align:middle; margin-right:4px; width:16px; height:16px;">
<?php echo HERO_ADV_DIFF_NORMAL; ?>
<?php endif; ?>
</td>
<?php echo $t4Place ? $t4Place['name'] : '&mdash;'; ?>
<?php if ($t4Place) { ?>
<a href="karte.php?d=<?php echo $t4Place['wref']; ?>&amp;c=<?php echo $t4Place['check']; ?>"><b>(<?php echo $t4Place['x']; ?>|<?php echo $t4Place['y']; ?>)</b></a>
<?php } ?>
</td>
<td><?php echo $generator->getTimeFormat((int) $t4Offer['duration']); ?></td>
<td style="text-align:center;">
<img src="img/hero/<?php echo $t4Hard ? 'dangerGreat.gif' : 'danger.gif'; ?>"
alt="<?php echo $t4Hard ? HERO_ADV_DIFF_HARD : HERO_ADV_DIFF_NORMAL; ?>"
title="<?php echo $t4Hard ? HERO_ADV_DIFF_HARD : HERO_ADV_DIFF_NORMAL; ?>"
style="width:16px;height:16px;vertical-align:middle;">
</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;">
<td style="width:150px;">
<?php if (!$t4Running) { ?>
<form action="" method="POST" style="margin:0;">
<form action="" method="POST" style="margin:0;display:inline;">
<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; ?>">
<button type="submit" style="background:none;border:0;padding:0;cursor:pointer;font-size:inherit;font-family:inherit;color:#3a6f1e;font-weight:bold;">&#9658; <?php echo HERO_ADV_GO; ?></button>
</form>
<?php } else { ?>-<?php } ?>
</td>
</tr>
<?php } ?>
<?php } else { ?>
<tr><td colspan="4"><?php echo HERO_ADV_NONE; ?></td></tr>
<tr><td colspan="5"><?php echo HERO_ADV_NONE; ?></td></tr>
<?php } ?>
</tbody>
</table>