From 3283a23ee819f00762f6f5c4a418902ae5872ee3 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Wed, 22 Nov 2023 03:15:05 -0300 Subject: [PATCH 1/2] fix: prey reroll time on old protocol (#1876) Resolves #1837 --- src/server/network/protocol/protocolgame.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index dc6cea87b90..d60c653aced 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -6899,7 +6899,10 @@ void ProtocolGame::sendPreyData(const std::unique_ptr &slot) { } if (oldProtocol) { - msg.add(static_cast(std::max(std::max(static_cast(((slot->freeRerollTimeStamp - OTSYS_TIME()) / 1000)), 0), 0))); + auto currentTime = OTSYS_TIME(); + auto timeDiffMs = (slot->freeRerollTimeStamp > currentTime) ? (slot->freeRerollTimeStamp - currentTime) : 0; + auto timeDiffMinutes = timeDiffMs / 60000; + msg.add(timeDiffMinutes ? timeDiffMinutes : 0); } else { msg.add(std::max(static_cast(((slot->freeRerollTimeStamp - OTSYS_TIME()) / 1000)), 0)); msg.addByte(static_cast(slot->option)); From 8e2f21371bcc7af4a992cfdff7afc06802e40da9 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Wed, 22 Nov 2023 03:29:48 -0300 Subject: [PATCH 2/2] fix: hireling stash and bank (#1875) Resolves #1869 --- data-otservbr-global/npc/hireling.lua | 14 +++++++++++--- src/game/game.cpp | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data-otservbr-global/npc/hireling.lua b/data-otservbr-global/npc/hireling.lua index 7caf05d9bcd..519ff32773a 100644 --- a/data-otservbr-global/npc/hireling.lua +++ b/data-otservbr-global/npc/hireling.lua @@ -7,6 +7,7 @@ function createHirelingType(HirelingName) end local npcConfig = {} + local enableBankSystem = {} npcConfig.name = HirelingName npcConfig.description = HirelingName @@ -355,6 +356,7 @@ function createHirelingType(HirelingName) end npcType.onDisappear = function(npc, creature) + enableBankSystem[creature:getId()] = nil npcHandler:onDisappear(npc, creature) end @@ -363,6 +365,7 @@ function createHirelingType(HirelingName) end npcType.onCloseChannel = function(npc, creature) + enableBankSystem[creature:getId()] = nil npcHandler:onCloseChannel(npc, creature) end @@ -586,7 +589,9 @@ function createHirelingType(HirelingName) elseif MsgContains(message, "stash") then if hireling:hasSkill(HIRELING_SKILLS.STEWARD) then npcHandler:say(GREETINGS.STASH, npc, creature) + player:setSpecialContainersAvailable(true) player:openStash(true) + player:sendTextMessage(MESSAGE_FAILURE, "Your supply stash contains " .. player:getStashCount() .. " item" .. (player:getStashCount() > 1 and "s." or ".")) else sendSkillNotLearned(npc, creature, HIRELING_SKILLS.STEWARD) end @@ -614,15 +619,18 @@ function createHirelingType(HirelingName) npcHandler:setTopic(playerId, TOPIC.SERVICES) npcHandler:say("Alright then, I will be here.", npc, creature) end - elseif npcHandler:getTopic(playerId) >= TOPIC.BANK and npcHandler:getTopic(playerId) < TOPIC.FOOD then + elseif npcHandler:getTopic(playerId) == TOPIC.BANK then + enableBankSystem[playerId] = true + elseif npcHandler:getTopic(playerId) >= TOPIC.FOOD and npcHandler:getTopic(playerId) < TOPIC.GOODS then + handleFoodActions(npc, creature, message) + end + if enableBankSystem[playerId] then -- Parse bank npc:parseBank(message, npc, creature, npcHandler) -- Parse guild bank npc:parseGuildBank(message, npc, creature, playerId, npcHandler) -- Normal messages npc:parseBankMessages(message, npc, creature, npcHandler) - elseif npcHandler:getTopic(playerId) >= TOPIC.FOOD and npcHandler:getTopic(playerId) < TOPIC.GOODS then - handleFoodActions(npc, creature, message) end return true end diff --git a/src/game/game.cpp b/src/game/game.cpp index 0ff4a08e6e3..5aa0e6eecca 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -4214,6 +4214,8 @@ void Game::playerStashWithdraw(uint32_t playerId, uint16_t itemId, uint32_t coun if (player->isDepotSearchOpenOnItem(itemId)) { player->requestDepotSearchItem(itemId, 0); } + + player->sendOpenStash(true); } void Game::playerSeekInContainer(uint32_t playerId, uint8_t containerId, uint16_t index, uint8_t containerCategory) {