mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Fixes #1276 This change adds logic to detect if an item is a relic and ensures it can only be equipped by bots of the corresponding class: - Idols are restricted to druids - Librams are restricted to paladins - Sigils are restricted to death knights - Totems are restricted to shamans Fixes a bug where bots would attempt to equip relics regardless of class restrictions. Additionally, this commit resolves two unrelated build warnings found in the same file.
This commit is contained in:
@@ -67,6 +67,19 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
uint32 itemId = itemProto->ItemId;
|
uint32 itemId = itemProto->ItemId;
|
||||||
uint8 invType = itemProto->InventoryType;
|
uint8 invType = itemProto->InventoryType;
|
||||||
|
|
||||||
|
// Ensure only the correct classes attempt to equip relics
|
||||||
|
if (itemProto->SubClass == ITEM_SUBCLASS_ARMOR_IDOL && bot->getClass() != CLASS_DRUID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (itemProto->SubClass == ITEM_SUBCLASS_ARMOR_SIGIL && bot->getClass() != CLASS_DEATH_KNIGHT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (itemProto->SubClass == ITEM_SUBCLASS_ARMOR_LIBRAM && bot->getClass() != CLASS_PALADIN)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (itemProto->SubClass == ITEM_SUBCLASS_ARMOR_TOTEM && bot->getClass() != CLASS_SHAMAN)
|
||||||
|
return;
|
||||||
|
|
||||||
// Handle ammunition separately
|
// Handle ammunition separately
|
||||||
if (invType == INVTYPE_AMMO)
|
if (invType == INVTYPE_AMMO)
|
||||||
{
|
{
|
||||||
@@ -82,7 +95,6 @@ void EquipAction::EquipItem(Item* item)
|
|||||||
if (itemProto->Class == ITEM_CLASS_CONTAINER)
|
if (itemProto->Class == ITEM_CLASS_CONTAINER)
|
||||||
{
|
{
|
||||||
// Attempt to equip as a bag
|
// Attempt to equip as a bag
|
||||||
Bag* pBag = reinterpret_cast<Bag*>(item);
|
|
||||||
uint8 newBagSlot = GetSmallestBagSlot();
|
uint8 newBagSlot = GetSmallestBagSlot();
|
||||||
if (newBagSlot > 0)
|
if (newBagSlot > 0)
|
||||||
{
|
{
|
||||||
@@ -331,7 +343,7 @@ bool EquipUpgradesAction::Execute(Event event)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EquipUpgradeAction::Execute(Event event)
|
bool EquipUpgradeAction::Execute(Event /*event*/)
|
||||||
{
|
{
|
||||||
ListItemsVisitor visitor;
|
ListItemsVisitor visitor;
|
||||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||||
|
|||||||
Reference in New Issue
Block a user