mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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:
parent
e3fd03c7b9
commit
31957a22d6
5 changed files with 13 additions and 8 deletions
|
|
@ -1688,12 +1688,18 @@ void ObjectMgr::LoadItemPrototypes()
|
||||||
{
|
{
|
||||||
for (int j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j)
|
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);
|
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].SpellId = 0;
|
||||||
const_cast<ItemPrototype*>(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
|
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)
|
if(proto->Spells[j].SpellId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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())
|
if(!item || item->IsBroken())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1775,7 +1775,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false);
|
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false);
|
||||||
void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
|
void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
|
||||||
void UpdateEquipSpellsAtFormChange();
|
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 CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex);
|
||||||
|
|
||||||
void SendEquipmentSetList();
|
void SendEquipmentSetList();
|
||||||
|
|
|
||||||
|
|
@ -1505,11 +1505,9 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
||||||
// If not miss
|
// If not miss
|
||||||
if (!(damageInfo->HitInfo & HITINFO_MISS))
|
if (!(damageInfo->HitInfo & HITINFO_MISS))
|
||||||
{
|
{
|
||||||
|
// on weapon hit casts
|
||||||
if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive())
|
if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive())
|
||||||
{
|
((Player*)this)->CastItemCombatSpell(pVictim, damageInfo->attackType);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// victim's damage shield
|
// victim's damage shield
|
||||||
std::set<Aura*> alreadyDone;
|
std::set<Aura*> alreadyDone;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7989"
|
#define REVISION_NR "7990"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue