From b9c7af4d7fa11ab8032c6b95b21fc6cbad572fdb Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Mon, 2 Dec 2024 01:08:27 -0300 Subject: [PATCH] fix: exhaustion to playerEquipItem --- src/game/game.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/game/game.cpp b/src/game/game.cpp index 068ecad4a50..387e78544cf 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -3380,6 +3380,21 @@ void Game::playerEquipItem(uint32_t playerId, uint16_t itemId, bool hasTier /* = return; } + if (!player->canDoAction()) { + uint32_t delay = player->getNextActionTime() - OTSYS_TIME(); + if (delay > 0) { + const auto &task = createPlayerTask( + delay, + [this, playerId, itemId, hasTier, tier] { + playerEquipItem(playerId, itemId, hasTier, tier); + }, + __FUNCTION__ + ); + player->setNextActionTask(task); + } + return; + } + if (player->hasCondition(CONDITION_FEARED)) { /* * When player is feared the player canĀ“t equip any items. @@ -3477,6 +3492,8 @@ void Game::playerEquipItem(uint32_t playerId, uint16_t itemId, bool hasTier /* = if (ret != RETURNVALUE_NOERROR) { player->sendCancelMessage(ret); } + + player->setNextAction(OTSYS_TIME() + g_configManager().getNumber(ACTIONS_DELAY_INTERVAL)); } void Game::playerMove(uint32_t playerId, Direction direction) {