- Added method BotCanUseItem

This commit is contained in:
kadeshar
2025-10-01 20:39:57 +02:00
parent 0145bebb10
commit 19a834fa55
2 changed files with 26 additions and 20 deletions

View File

@@ -1290,6 +1290,7 @@ public:
InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
[[nodiscard]] bool HasItemTotemCategory(uint32 TotemCategory) const;
bool IsTotemCategoryCompatiableWith(ItemTemplate const* pProto, uint32 requiredTotemCategoryId) const;
InventoryResult BotCanUseItem(ItemTemplate const* pItem) const;
InventoryResult CanUseItem(ItemTemplate const* pItem) const;
[[nodiscard]] InventoryResult CanUseAmmo(uint32 item) const;
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;

View File

@@ -906,6 +906,31 @@ bool Player::IsTotemCategoryCompatiableWith(ItemTemplate const* pProto, uint32 r
return true;
}
InventoryResult Player::BotCanUseItem(ItemTemplate const* proto) const
{
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_IDOL && !IsClass(CLASS_DRUID, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_TOTEM && !IsClass(CLASS_SHAMAN, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_LIBRAM && !IsClass(CLASS_PALADIN, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_SIGIL && !IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
return CanUseItem(proto);
}
InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const
{
Item* pItem2 = GetItemByPos(bag, slot);
@@ -2296,26 +2321,6 @@ InventoryResult Player::CanUseItem(ItemTemplate const* proto) const
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_IDOL && !IsClass(CLASS_DRUID, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_TOTEM && !IsClass(CLASS_SHAMAN, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_LIBRAM && !IsClass(CLASS_PALADIN, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->Class == ITEM_CLASS_ARMOR && proto->SubClass == ITEM_SUBCLASS_ARMOR_SIGIL && !IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_EQUIP_RELIC))
{
return EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
if (proto->RequiredSkill != 0)
{
if (GetSkillValue(proto->RequiredSkill) == 0)