[7990] Trigering "on hit" combat spell only at related to current hit weapon.

Also check at loading that only weapon item templates have "on hit" spell triggers.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
nos4r2zod 2009-06-11 01:24:25 +04:00 committed by VladimirMangos
parent e3fd03c7b9
commit 31957a22d6
5 changed files with 13 additions and 8 deletions

View file

@ -1688,12 +1688,18 @@ void ObjectMgr::LoadItemPrototypes()
{
for (int j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j)
{
if(proto->Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
if (proto->Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
{
sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)",i,j+1,proto->Spells[j].SpellTrigger);
const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
const_cast<ItemPrototype*>(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
}
// on hit can be sued only at weapon
else if (proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
{
if(proto->Class != ITEM_CLASS_WEAPON)
sLog.outErrorDb("Item (Entry: %u) isn't weapon (Class: %u) but has on hit spelltrigger_%d (%u), it will not triggered.",i,proto->Class,j+1,proto->Spells[j].SpellTrigger);
}
if(proto->Spells[j].SpellId)
{