From 1a5af00760e8ba96a01c0e9049cca9de30ded567 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 24 May 2025 22:12:32 +0200 Subject: Core/Players: Unbreak dual wield --- src/server/game/Entities/Player/Player.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 739d19806bd..4919eb8c781 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23528,15 +23528,21 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) if (!offItem) return; + ItemTemplate const* offhandTemplate = offItem->GetTemplate(); + // unequip offhand weapon if player doesn't have dual wield anymore - if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON)) + if (!CanDualWield() && (offhandTemplate->InventoryType == INVTYPE_WEAPONOFFHAND || offhandTemplate->InventoryType == INVTYPE_WEAPON)) force = true; // need unequip offhand for 2h-weapon without TitanGrip (in any from hands) - if (!force && CanTitanGrip(offItem)) + if (!force) { Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - if (!mainItem || CanTitanGrip(mainItem)) + if ((!mainItem || mainItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON) + && offhandTemplate->InventoryType != INVTYPE_2HWEAPON) + return; + + if ((!mainItem || CanTitanGrip(mainItem)) && CanTitanGrip(offItem)) return; } -- cgit v1.2.3