mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Added logic for early ranged/thrown weapon equipping (#839)
Ranged weapons get caught up in the ITEM_CLASS_WEAPON logic but aren't handled. Added an early check and equip for ranged INVTYPE_
This commit is contained in:
@@ -96,6 +96,21 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
// If we didn't equip as a bag, try to equip as gear
|
// If we didn't equip as a bag, try to equip as gear
|
||||||
if (!equippedBag)
|
if (!equippedBag)
|
||||||
{
|
{
|
||||||
|
// Ranged weapons aren't handled by the rest of the weapon equip logic
|
||||||
|
// Handle them early here to avoid issues.
|
||||||
|
if (invType == INVTYPE_RANGED || invType == INVTYPE_THROWN || invType == INVTYPE_RANGEDRIGHT)
|
||||||
|
{
|
||||||
|
WorldPacket packet(CMSG_AUTOEQUIP_ITEM_SLOT, 2);
|
||||||
|
ObjectGuid itemguid = item->GetGUID();
|
||||||
|
packet << itemguid << uint8(EQUIPMENT_SLOT_RANGED);
|
||||||
|
bot->GetSession()->HandleAutoEquipItemSlotOpcode(packet);
|
||||||
|
|
||||||
|
std::ostringstream out;
|
||||||
|
out << "Equipping " << chat->FormatItem(itemProto) << " in ranged slot";
|
||||||
|
botAI->TellMaster(out);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 dstSlot = botAI->FindEquipSlot(itemProto, NULL_SLOT, true);
|
uint8 dstSlot = botAI->FindEquipSlot(itemProto, NULL_SLOT, true);
|
||||||
|
|
||||||
// Check if the item is a weapon and whether the bot can dual wield or use Titan Grip
|
// Check if the item is a weapon and whether the bot can dual wield or use Titan Grip
|
||||||
|
|||||||
Reference in New Issue
Block a user