Item use check

This commit is contained in:
Yunfan Li
2024-02-14 01:01:28 +08:00
parent 21e9e2e2aa
commit a1903ad888
6 changed files with 26 additions and 7 deletions

View File

@@ -86,7 +86,9 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
if (item->GetTemplate()->Spells[i].SpellId > 0)
{
spellId = item->GetTemplate()->Spells[i].SpellId;
break;
if (!botAI->CanCastSpell(spellId, bot, false, item)) {
return false;
}
}
}
@@ -195,7 +197,7 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
{
spellId = item->GetTemplate()->Spells[i].SpellId;
uint32 spellId = item->GetTemplate()->Spells[i].SpellId;
if (!spellId)
continue;