diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index b5f1c7d7c..8f3e5e186 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -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(proto)->Spells[j].SpellId = 0; const_cast(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) { diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 90f5de665..d8773cd74 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6828,8 +6828,9 @@ void Player::UpdateEquipSpellsAtFormChange() } } -void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType) +void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType) { + Item *item = GetWeaponForAttack(attType, true); if(!item || item->IsBroken()) return; diff --git a/src/game/Player.h b/src/game/Player.h index da67355f0..a4dcb371a 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1775,7 +1775,7 @@ class MANGOS_DLL_SPEC Player : public Unit void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false); void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false); void UpdateEquipSpellsAtFormChange(); - void CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType); + void CastItemCombatSpell(Unit* Target, WeaponAttackType attType); void CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex); void SendEquipmentSetList(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 552df688f..2db68f718 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1505,11 +1505,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) // If not miss if (!(damageInfo->HitInfo & HITINFO_MISS)) { + // on weapon hit casts if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) - { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) - ((Player*)this)->CastItemCombatSpell(((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i), pVictim, damageInfo->attackType); - } + ((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType); // victim's damage shield std::set alreadyDone; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f403c7667..8749a49cc 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7989" + #define REVISION_NR "7990" #endif // __REVISION_NR_H__