From a7bb7d8dbd43af3347c8c4c49ed3e72b7ea6dbd2 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Wed, 9 Sep 2026 14:34:40 +0300 Subject: [PATCH] =?UTF-8?q?Hero=20T4=20=E2=80=94=20First=20Adventure=20Hor?= =?UTF-8?q?se=20Reward=20by=20@Sk4r7z=20fix=20#391?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first adventure now guarantees one tier-1 Riding Horse (item ID 70), replacing the random item reward. Behavior: The horse is added to the player’s inventory and included in the adventure report. Experience, silver, and resource rewards remain unchanged. Subsequent adventures use the existing random item rewards. Eligibility is based on the player’s completed adventure history. Selling the horse or retraining the hero does not reset eligibility. If the hero dies on the first adventure, all loot is forfeited, including the horse. The next adventure does not receive the guaranteed reward. This change is not retroactive for players with completed adventures. --- GameEngine/HeroAdventure.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/GameEngine/HeroAdventure.php b/GameEngine/HeroAdventure.php index 3a5b5756..69dbce76 100644 --- a/GameEngine/HeroAdventure.php +++ b/GameEngine/HeroAdventure.php @@ -39,6 +39,9 @@ class HeroAdventure /** Hero base speed on foot, fields/hour (T4 convention). */ const BASE_HERO_SPEED = 7; + /** Guaranteed item on the player's first adventure: tier-1 Riding Horse. */ + const FIRST_ADVENTURE_ITEM = 70; + /** How far from the hero's village adventure sites are picked (tiles). */ const SITE_MIN_RADIUS = 3; const SITE_MAX_RADIUS = 25; @@ -454,6 +457,24 @@ class HeroAdventure } /* ---- Hero survives: apply rewards ---- */ + // Completed adventures are retained (including deaths). Use player + // history rather than inventory so selling a horse or retraining a + // hero cannot grant the introductory reward again. Available/expired + // offers do not count as adventures the player has undertaken. + $stmt = $this->db->prepare( + "SELECT id FROM " . TB_PREFIX . "hero_adventure + WHERE uid = ? AND status = 2 LIMIT 1" + ); + $stmt->bind_param('i', $uid); + $stmt->execute(); + $previousAdventure = $stmt->get_result()->fetch_assoc(); + $stmt->close(); + if (!$previousAdventure) { + // Replace the random item, keeping the one-item reward limit. + $itemId = self::FIRST_ADVENTURE_ITEM; + $itemQty = 1; + } + $heroItems = new HeroItems(); // XP with helmet bonus; level-up handled by Automation::updateHero().