mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #699 from Bobblybook/master
Dual-wield item comparison fixes
This commit is contained in:
@@ -89,9 +89,21 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
if (!equippedBag)
|
if (!equippedBag)
|
||||||
{
|
{
|
||||||
uint8 dstSlot = botAI->FindEquipSlot(itemProto, NULL_SLOT, true);
|
uint8 dstSlot = botAI->FindEquipSlot(itemProto, NULL_SLOT, true);
|
||||||
|
bool have2HWeapon = false;
|
||||||
|
bool isValidTGWeapon = false;
|
||||||
|
if (dstSlot == EQUIPMENT_SLOT_MAINHAND)
|
||||||
|
{
|
||||||
|
Item* currentWeapon = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||||
|
have2HWeapon = currentWeapon && currentWeapon->GetTemplate()->InventoryType == INVTYPE_2HWEAPON;
|
||||||
|
isValidTGWeapon = itemProto->SubClass == ITEM_SUBCLASS_WEAPON_AXE2 ||
|
||||||
|
itemProto->SubClass == ITEM_SUBCLASS_WEAPON_MACE2 ||
|
||||||
|
itemProto->SubClass == ITEM_SUBCLASS_WEAPON_SWORD2;
|
||||||
|
}
|
||||||
|
|
||||||
if (dstSlot == EQUIPMENT_SLOT_FINGER1 ||
|
if (dstSlot == EQUIPMENT_SLOT_FINGER1 ||
|
||||||
dstSlot == EQUIPMENT_SLOT_TRINKET1 ||
|
dstSlot == EQUIPMENT_SLOT_TRINKET1 ||
|
||||||
dstSlot == EQUIPMENT_SLOT_MAINHAND)
|
(dstSlot == EQUIPMENT_SLOT_MAINHAND && bot->CanDualWield() &&
|
||||||
|
((itemProto->InventoryType != INVTYPE_2HWEAPON && !have2HWeapon) || (bot->CanTitanGrip() && isValidTGWeapon))))
|
||||||
{
|
{
|
||||||
Item* const equippedItems[2] = {
|
Item* const equippedItems[2] = {
|
||||||
bot->GetItemByPos(INVENTORY_SLOT_BAG_0, dstSlot),
|
bot->GetItemByPos(INVENTORY_SLOT_BAG_0, dstSlot),
|
||||||
|
|||||||
@@ -207,13 +207,29 @@ ItemUsage ItemUsageValue::QueryItemUsageForEquip(ItemTemplate const* itemProto)
|
|||||||
|
|
||||||
uint8 possibleSlots = 1;
|
uint8 possibleSlots = 1;
|
||||||
uint8 dstSlot = botAI->FindEquipSlot(itemProto, NULL_SLOT, true);
|
uint8 dstSlot = botAI->FindEquipSlot(itemProto, NULL_SLOT, true);
|
||||||
if (dstSlot == EQUIPMENT_SLOT_FINGER1 ||
|
|
||||||
dstSlot == EQUIPMENT_SLOT_TRINKET1 ||
|
if (dstSlot == EQUIPMENT_SLOT_FINGER1 || dstSlot == EQUIPMENT_SLOT_TRINKET1)
|
||||||
dstSlot == EQUIPMENT_SLOT_MAINHAND)
|
|
||||||
{
|
{
|
||||||
possibleSlots = 2;
|
possibleSlots = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check weapon case separately to keep things a bit cleaner
|
||||||
|
bool have2HWeapon = false;
|
||||||
|
bool isValidTGWeapon = false;
|
||||||
|
if (dstSlot == EQUIPMENT_SLOT_MAINHAND)
|
||||||
|
{
|
||||||
|
Item* currentWeapon = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
|
||||||
|
have2HWeapon = currentWeapon && currentWeapon->GetTemplate()->InventoryType == INVTYPE_2HWEAPON;
|
||||||
|
isValidTGWeapon = itemProto->SubClass == ITEM_SUBCLASS_WEAPON_AXE2 ||
|
||||||
|
itemProto->SubClass == ITEM_SUBCLASS_WEAPON_MACE2 ||
|
||||||
|
itemProto->SubClass == ITEM_SUBCLASS_WEAPON_SWORD2;
|
||||||
|
|
||||||
|
if (bot->CanDualWield() && ((itemProto->InventoryType != INVTYPE_2HWEAPON && !have2HWeapon) || (bot->CanTitanGrip() && isValidTGWeapon)))
|
||||||
|
{
|
||||||
|
possibleSlots = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (uint8 i = 0; i < possibleSlots; i++)
|
for (uint8 i = 0; i < possibleSlots; i++)
|
||||||
{
|
{
|
||||||
bool shouldEquipInSlot = shouldEquip;
|
bool shouldEquipInSlot = shouldEquip;
|
||||||
|
|||||||
Reference in New Issue
Block a user