Hunter equip bug (#1050)

This commit is contained in:
avirar
2025-03-04 01:09:47 +11:00
committed by GitHub
parent d8cb75d376
commit 9edddc5b26
4 changed files with 46 additions and 8 deletions

View File

@@ -132,7 +132,8 @@ void EquipAction::EquipItem(Item* item)
Item* currentMHItem = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
bool have2HWeaponEquipped = (currentMHItem && currentMHItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON);
bool canDualWieldOrTG = (canDualWield || (canTitanGrip && isTwoHander));
// bool canDualWieldOrTG = (canDualWield || (canTitanGrip && isTwoHander));
bool canDualWieldOrTG = (canDualWield || isTwoHander);
// If this is a weapon and we can dual wield or Titan Grip, check if we can improve main/off-hand setup
if (isWeapon && canDualWieldOrTG)
@@ -154,7 +155,7 @@ void EquipAction::EquipItem(Item* item)
// Determine where this weapon can go
bool canGoMain = (invType == INVTYPE_WEAPON ||
invType == INVTYPE_WEAPONMAINHAND ||
(canTitanGrip && isTwoHander));
isTwoHander);
bool canTGOff = false;
if (canTitanGrip && isTwoHander && isValidTGWeapon)
@@ -186,7 +187,8 @@ void EquipAction::EquipItem(Item* item)
// and if conditions allow (e.g. no conflicting 2H logic)
bool betterThanMH = (newItemScore > mainHandScore);
bool mhConditionOK = ((invType != INVTYPE_2HWEAPON && !have2HWeaponEquipped) ||
(canTitanGrip && isValidTGWeapon));
(isTwoHander && !canTitanGrip) ||
(canTitanGrip && isValidTGWeapon));
if (canGoMain && betterThanMH && mhConditionOK)
{
@@ -288,7 +290,7 @@ void EquipAction::EquipItem(Item* item)
}
std::ostringstream out;
out << "equipping " << chat->FormatItem(itemProto);
out << "Equipping " << chat->FormatItem(itemProto);
botAI->TellMaster(out);
}
@@ -318,9 +320,9 @@ bool EquipUpgradesAction::Execute(Event event)
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", i->first);
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
{
// LOG_INFO("playerbots", "Bot {} <{}> auto equips item {} ({})", bot->GetGUID().ToString().c_str(),
// bot->GetName().c_str(), i->first, usage == 1 ? "no item in slot" : usage == 2 ? "replace" : usage == 3 ?
// "wrong item but empty slot" : "");
// LOG_INFO("playerbots", "Bot {} <{}> EquipUpgradesAction {} ({})", bot->GetGUID().ToString().c_str(),
// bot->GetName().c_str(), i->first, usage == 1 ? "no item in slot" : usage == 2 ? "replace" : usage == 3 ?
// "wrong item but empty slot" : "");
items.insert(i->first);
}
}
@@ -340,6 +342,9 @@ bool EquipUpgradeAction::Execute(Event event)
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", i->first);
if (usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_BAD_EQUIP)
{
// LOG_INFO("playerbots", "Bot {} <{}> EquipUpgradeAction item {} ({})", bot->GetGUID().ToString().c_str(),
// bot->GetName().c_str(), i->first, usage == 1 ? "no item in slot" : usage == 2 ? "replace" : usage == 3 ?
// "wrong item but empty slot" : "");
items.insert(i->first);
}
}