From 1981dacbbacfd35061c35983179315a5208ca6d0 Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Wed, 6 Dec 2023 03:16:26 -0800 Subject: [PATCH 1/2] fix: sell items while wearing an imbued version (#1965) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The client filters equipped items locally, so we don't have control over what it's doing, and on retail tibia you can sell imbued items to NPCs, so everything should count as far as the client is concerned. Here's what this PR does, to fix selling items while having one equipped, but also preventing accidental sale of imbued equipment: • We'll send the count of all items to the client, imbued or not. • Client will attempt to sell all the non-equipped ones (assuming "sell equipped" is unchecked). • Server will then sell only the non-imbued ones. This might cause a weird behavior, where you think you can sell 2 crown helmets, but you can only sell 1 (because one of them is imbued), but it's better than the alternative where the user will just simply think they can't sell the thing at all. --- src/creatures/players/player.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 0c68ec3a659..1fe7a0b1ca2 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -3942,9 +3942,7 @@ std::map &Player::getAllItemTypeCount(std::map &Player::getAllSaleItemIdAndCount(std::map &countMap) const { for (const auto item : getAllInventoryItems(false, true)) { - if (!item->hasImbuements()) { - countMap[item->getID()] += item->getItemCount(); - } + countMap[item->getID()] += item->getItemCount(); } return countMap; From 779b479706863a7a786bc49c50503c1d69e58fa4 Mon Sep 17 00:00:00 2001 From: Pedro Cruz Date: Wed, 6 Dec 2023 08:22:27 -0300 Subject: [PATCH 2/2] feat: add sound for open and close doors (#1978) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added open sound to custom/normal doors • Added open sound to key doors • Added open sound to level doors • Added open sound to quest doors --- data-otservbr-global/scripts/actions/door/custom_door.lua | 2 ++ data-otservbr-global/scripts/actions/door/key_door.lua | 6 ++++++ data-otservbr-global/scripts/actions/door/level_door.lua | 1 + data-otservbr-global/scripts/actions/door/quest_door.lua | 1 + .../scripts/movements/others/closing_door.lua | 2 ++ 5 files changed, 12 insertions(+) diff --git a/data-otservbr-global/scripts/actions/door/custom_door.lua b/data-otservbr-global/scripts/actions/door/custom_door.lua index 50e27feaf46..2dadeb68488 100644 --- a/data-otservbr-global/scripts/actions/door/custom_door.lua +++ b/data-otservbr-global/scripts/actions/door/custom_door.lua @@ -18,12 +18,14 @@ function customDoor.onUse(player, item, fromPosition, target, toPosition, isHotk for index, value in ipairs(CustomDoorTable) do if value.closedDoor == item.itemid then item:transform(value.openDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_OPEN_DOOR) return true end end for index, value in ipairs(CustomDoorTable) do if value.openDoor == item.itemid then item:transform(value.closedDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_CLOSE_DOOR) return true end end diff --git a/data-otservbr-global/scripts/actions/door/key_door.lua b/data-otservbr-global/scripts/actions/door/key_door.lua index 15a38a884d1..4f748b6b635 100644 --- a/data-otservbr-global/scripts/actions/door/key_door.lua +++ b/data-otservbr-global/scripts/actions/door/key_door.lua @@ -37,6 +37,7 @@ function keyDoor.onUse(player, item, fromPosition, target, toPosition, isHotkey) for index, value in ipairs(KeyDoorTable) do if value.closedDoor == item.itemid then item:transform(value.openDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_OPEN_DOOR) return true end end @@ -46,6 +47,7 @@ function keyDoor.onUse(player, item, fromPosition, target, toPosition, isHotkey) return false end item:transform(value.closedDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_CLOSE_DOOR) return true end end @@ -60,8 +62,12 @@ function keyDoor.onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.actionid == target.actionid then if value.lockedDoor == target.itemid then target:transform(value.openDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_OPEN_DOOR) return true elseif table.contains({ value.openDoor, value.closedDoor }, target.itemid) then + if value.openDoor == item.itemid then + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_CLOSE_DOOR) + end target:transform(value.lockedDoor) return true end diff --git a/data-otservbr-global/scripts/actions/door/level_door.lua b/data-otservbr-global/scripts/actions/door/level_door.lua index 177c0894c4b..6c90fca6df9 100644 --- a/data-otservbr-global/scripts/actions/door/level_door.lua +++ b/data-otservbr-global/scripts/actions/door/level_door.lua @@ -15,6 +15,7 @@ function levelDoor.onUse(player, item, fromPosition, target, toPosition, isHotke if value.closedDoor == item.itemid then if item.actionid > 0 and player:getLevel() >= item.actionid - 1000 then item:transform(value.openDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_OPEN_DOOR) player:teleportTo(toPosition, true) return true else diff --git a/data-otservbr-global/scripts/actions/door/quest_door.lua b/data-otservbr-global/scripts/actions/door/quest_door.lua index 438a23a5591..16dffc37919 100644 --- a/data-otservbr-global/scripts/actions/door/quest_door.lua +++ b/data-otservbr-global/scripts/actions/door/quest_door.lua @@ -15,6 +15,7 @@ function questDoor.onUse(player, item, fromPosition, target, toPosition, isHotke if value.closedDoor == item.itemid then if item.actionid > 0 and player:getStorageValue(item.actionid) ~= -1 then item:transform(value.openDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_OPEN_DOOR) player:teleportTo(toPosition, true) return true else diff --git a/data-otservbr-global/scripts/movements/others/closing_door.lua b/data-otservbr-global/scripts/movements/others/closing_door.lua index 750d6defc9b..a4e286d0a71 100644 --- a/data-otservbr-global/scripts/movements/others/closing_door.lua +++ b/data-otservbr-global/scripts/movements/others/closing_door.lua @@ -103,11 +103,13 @@ function closingDoor.onStepOut(creature, item, position, fromPosition) for index, value in ipairs(LevelDoorTable) do if value.openDoor == item.itemid then item:transform(value.closedDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_CLOSE_DOOR) end end for index, value in ipairs(QuestDoorTable) do if value.openDoor == item.itemid then item:transform(value.closedDoor) + item:getPosition():sendSingleSoundEffect(SOUND_EFFECT_TYPE_ACTION_CLOSE_DOOR) end end return true