fix(Core/PlayerStorage): Equip OH, 2H, Titan's Grip weapon swapping (#19884)
titan's grip, unequip with full bags
This commit is contained in:
@@ -12426,6 +12426,14 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
|
|||||||
if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
|
if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
|
||||||
force = true;
|
force = true;
|
||||||
|
|
||||||
|
// unequip offhand weapon if player main hand weapon is a polearm or staff or fishing pole
|
||||||
|
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||||
|
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
|
||||||
|
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM ||
|
||||||
|
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF ||
|
||||||
|
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
||||||
|
force = true;
|
||||||
|
|
||||||
// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
|
// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
|
||||||
if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
|
if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -201,28 +201,11 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c
|
|||||||
break;
|
break;
|
||||||
case INVTYPE_2HWEAPON:
|
case INVTYPE_2HWEAPON:
|
||||||
slots[0] = EQUIPMENT_SLOT_MAINHAND;
|
slots[0] = EQUIPMENT_SLOT_MAINHAND;
|
||||||
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
|
||||||
{
|
|
||||||
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
|
|
||||||
{
|
|
||||||
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
|
|
||||||
{
|
|
||||||
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
|
||||||
{
|
|
||||||
if (proto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || proto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
|
|
||||||
{
|
|
||||||
const_cast<Player*>(this)->AutoUnequipOffhandIfNeed(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
if (CanDualWield() && CanTitanGrip() && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
||||||
slots[1] = EQUIPMENT_SLOT_OFFHAND;
|
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||||
|
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
|
||||||
|
if (mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && mhWeaponProto->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
||||||
|
slots[1] = EQUIPMENT_SLOT_OFFHAND;
|
||||||
break;
|
break;
|
||||||
case INVTYPE_TABARD:
|
case INVTYPE_TABARD:
|
||||||
slots[0] = EQUIPMENT_SLOT_TABARD;
|
slots[0] = EQUIPMENT_SLOT_TABARD;
|
||||||
@@ -1962,6 +1945,14 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
|
|||||||
return EQUIP_ERR_CANT_DUAL_WIELD;
|
return EQUIP_ERR_CANT_DUAL_WIELD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not allow offhand with main hand polearm, staff or fishing pole
|
||||||
|
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||||
|
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
|
||||||
|
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM ||
|
||||||
|
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF ||
|
||||||
|
mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE)
|
||||||
|
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;
|
||||||
|
|
||||||
if (IsTwoHandUsed())
|
if (IsTwoHandUsed())
|
||||||
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;
|
return EQUIP_ERR_CANT_EQUIP_WITH_TWOHANDED;
|
||||||
}
|
}
|
||||||
@@ -1977,7 +1968,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool
|
|||||||
else if (eslot != EQUIPMENT_SLOT_MAINHAND)
|
else if (eslot != EQUIPMENT_SLOT_MAINHAND)
|
||||||
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED;
|
||||||
|
|
||||||
if (!CanTitanGrip())
|
if (!CanTitanGrip() || (pProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || pProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF || pProto->SubClass == ITEM_SUBCLASS_WEAPON_FISHING_POLE))
|
||||||
{
|
{
|
||||||
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
|
// offhand item must can be stored in inventory for offhand item and it also must be unequipped
|
||||||
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
|
||||||
|
|||||||
Reference in New Issue
Block a user