diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp | 41 | ||||
-rw-r--r-- | src/game/Bag.cpp | 6 | ||||
-rw-r--r-- | src/game/MapManager.cpp | 15 | ||||
-rw-r--r-- | src/game/Player.cpp | 57 | ||||
-rw-r--r-- | src/game/Player.h | 3 | ||||
-rw-r--r-- | src/game/Spell.cpp | 15 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 4 | ||||
-rw-r--r-- | src/game/Unit.cpp | 92 |
8 files changed, 111 insertions, 122 deletions
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp index 502101f260e..5255a443b39 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp @@ -107,11 +107,11 @@ const uint32 spawnEntries[4]= { 23523, 23318, 23524 }; struct TRINITY_DLL_DECL mob_ashtongue_channelerAI : public ScriptedAI { - mob_ashtongue_channelerAI(Creature* c) : ScriptedAI(c) {} + mob_ashtongue_channelerAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} uint64 ShadeGUID; - void Reset() { ShadeGUID = 0; } + void Reset() {} void JustDied(Unit* killer); void EnterCombat(Unit* who) {} void AttackStart(Unit* who) {} @@ -121,7 +121,7 @@ struct TRINITY_DLL_DECL mob_ashtongue_channelerAI : public ScriptedAI struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI { - mob_ashtongue_sorcererAI(Creature* c) : ScriptedAI(c) {} + mob_ashtongue_sorcererAI(Creature* c) : ScriptedAI(c) {ShadeGUID = 0;} uint64 ShadeGUID; uint32 CheckTimer; @@ -130,8 +130,7 @@ struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI void Reset() { StartBanishing = false; - CheckTimer = 5000; - ShadeGUID = 0; + CheckTimer = 5000; } void JustDied(Unit* killer); @@ -237,8 +236,20 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI reseting = false; } - void JustSummoned(Creature *summon) {summons.Summon(summon);} - void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} + void JustDied(Unit* killer) + { + summons.DespawnAll(); + } + void JustSummoned(Creature *summon) + { + if(summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature *summon) + { + if(summon->GetEntry() == CREATURE_DEFENDER || summon->GetEntry() == 23523 || summon->GetEntry() == 23318 || summon->GetEntry() == 23524) + summons.Despawn(summon); + } void MoveInLineOfSight(Unit *who) { @@ -498,7 +509,7 @@ void mob_ashtongue_sorcererAI::JustDied(Unit* killer) struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI { - npc_akamaAI(Creature* c) : ScriptedAI(c) + npc_akamaAI(Creature* c) : ScriptedAI(c), summons(m_creature) { ShadeHasDied = false; StartCombat = false; @@ -536,6 +547,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI bool ShadeHasDied; bool StartCombat; bool HasYelledOnce; + SummonList summons; void Reset() { @@ -548,6 +560,18 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has very very strange values m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } + summons.DespawnAll(); + } + + void JustSummoned(Creature *summon) + { + if(summon->GetEntry() == CREATURE_BROKEN) + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature *summon) + { + if(summon->GetEntry() == CREATURE_BROKEN) + summons.Despawn(summon); } void EnterCombat(Unit* who) {} @@ -617,6 +641,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI Creature* Shade = Unit::GetCreature((*m_creature), ShadeGUID); if(Shade && Shade->isAlive()) CAST_AI(boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; + summons.DespawnAll(); } void UpdateAI(const uint32 diff) diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index 2d58b63c0a9..fc885b253b3 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -159,7 +159,11 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ ) void Bag::StoreItem( uint8 slot, Item *pItem, bool /*update*/ ) { - assert(slot < MAX_BAG_SIZE); + if(slot > MAX_BAG_SIZE) + { + sLog.outError("Player GUID " I64FMTD " tried to manipulate packets and crash the server.", GetOwnerGUID()); + return; + } if( pItem ) { diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 5fde20c55eb..fb93ba2e2f3 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -259,20 +259,19 @@ MapManager::Update(uint32 diff) MapMapType::iterator iter; std::vector<Map*> update_queue(i_maps.size()); int omp_set_num_threads(sWorld.getConfig(CONFIG_NUMTHREADS)); - for(iter = i_maps.begin(), i=0;iter != i_maps.end(); ++iter, i++) - update_queue[i]=iter->second; + for(iter = i_maps.begin(), i=0;iter != i_maps.end(); ++iter, i++) + update_queue[i]=iter->second; /* - gomp in gcc <4.4 version cannot parallelise loops using random access iterators - so until gcc 4.4 isnt standard, we need the update_queue workaround + gomp in gcc <4.4 version cannot parallelise loops using random access iterators + so until gcc 4.4 isnt standard, we need the update_queue workaround */ #pragma omp parallel for schedule(dynamic) private(i) shared(update_queue) for(int32 i = 0; i < i_maps.size(); ++i) { checkAndCorrectGridStatesArray(); // debugging code, should be deleted some day - update_queue[i]->Update(i_timer.GetCurrent()); - sWorld.RecordTimeDiff("UpdateMap %u", update_queue[i]->GetId()); - // sLog.outError("This is thread %d out of %d threads,updating map %u",omp_get_thread_num(),omp_get_num_threads(),iter->second->GetId()); - + update_queue[i]->Update(i_timer.GetCurrent()); + sWorld.RecordTimeDiff("UpdateMap %u", update_queue[i]->GetId()); + // sLog.outError("This is thread %d out of %d threads,updating map %u",omp_get_thread_num(),omp_get_num_threads(),iter->second->GetId()); } #else for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5ebf498b072..4c605c6ef79 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6983,17 +6983,48 @@ void Player::UpdateEquipSpellsAtFormChange() } } } - -void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto) +void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx) { - Unit * Target = damageInfo->target; - WeaponAttackType attType = damageInfo->attackType; - - if (!Target || Target == this ) + if(!target || !target->isAlive() || target == this) return; + for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) + { + // If usable, try to cast item spell + if (Item * item = ((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i)) + if(!item->IsBroken()) + if (ItemPrototype const *proto = item->GetProto()) + { + // Additional check for weapons + if (proto->Class==ITEM_CLASS_WEAPON) + { + // offhand item cannot proc from main hand hit etc + EquipmentSlots slot; + switch (attType) + { + case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break; + case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break; + case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break; + default: slot = EQUIPMENT_SLOT_END; break; + } + if (slot != i) + continue; + // Check if item is useable (forms or disarm) + if (attType == BASE_ATTACK) + { + if (!((Player*)this)->IsUseEquipedWeapon(true)) + continue; + } + } + ((Player*)this)->CastItemCombatSpell(target, attType, procVictim, procEx, item, proto); + } + } +} + +void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto) +{ // Can do effect if any damage done to target - if (damageInfo->damage) + if (procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE) //if (damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE) { for (int i = 0; i < 5; i++) @@ -7016,7 +7047,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro } // not allow proc extra attack spell at extra attack - if( m_extraAttacks && IsSpellHaveEffect(spellInfo,SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) + if( m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) return; float chance = spellInfo->procChance; @@ -7032,7 +7063,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro } if (roll_chance_f(chance)) - CastSpell(Target, spellInfo->Id, true, item); + CastSpell(target, spellInfo->Id, true, item); } } @@ -7052,13 +7083,13 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro if (entry && entry->procEx) { // Check hit/crit/dodge/parry requirement - if((entry->procEx & damageInfo->procEx) == 0) + if((entry->procEx & procEx) == 0) continue; } else { // Can do effect if any damage done to target - if (!(damageInfo->damage)) + if (!(procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)) //if (!(damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)) continue; } @@ -7088,7 +7119,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro if(IsPositiveSpell(pEnchant->spellid[s])) CastSpell(this, pEnchant->spellid[s], true, item); else - CastSpell(Target, pEnchant->spellid[s], true, item); + CastSpell(target, pEnchant->spellid[s], true, item); } } } @@ -17639,7 +17670,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint { // cheating attempt if(count < 1) count = 1; - + // cheating attempt if(slot > MAX_BAG_SIZE && slot !=NULL_SLOT) return false; diff --git a/src/game/Player.h b/src/game/Player.h index 9db0f28a9d0..6ed6a296094 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1768,8 +1768,9 @@ class TRINITY_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, CalcDamageInfo *damageInfo, ItemPrototype const * proto); + void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx); void CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex); + void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto); void SendEquipmentSetList(); void SetEquipmentSet(uint32 index, EquipmentSet eqset); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 3564f966566..e8b7ae1b796 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1108,15 +1108,20 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) procEx |= createProcExtendMask(&damageInfo, missInfo); procVictim |= PROC_FLAG_TAKEN_ANY_DAMAGE; + + caster->DealSpellDamage(&damageInfo, true); // Do triggers for unit (reflect triggers passed on hit phase for correct drop charge) if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT) - caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_triggeredByAuraSpell); - + { + caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, damageInfo.damage, m_attackType, m_spellInfo, m_canTrigger, m_triggeredByAuraSpell); + if(caster->GetTypeId() == TYPEID_PLAYER && (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET) == 0 && + (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) + ((Player *)caster)->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx); + } + caster->DealSpellDamage(&damageInfo, true); if (m_spellAura) m_spellAura->SetProcDamage(damageInfo.damage); - caster->DealSpellDamage(&damageInfo, true); - // Judgement of Blood if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags[1] & 0x00000008 && m_spellInfo->SpellIconID==153) { @@ -4090,7 +4095,7 @@ void Spell::TriggerSpell() SpellCastResult Spell::CheckCast(bool strict) { // check cooldowns to prevent cheating - if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id)) + if(!m_IsTriggeredSpell && m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id)) { //can cast triggered (by aura only?) spells while have this flag if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY)) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index d5ee8a0b731..a5210a3c208 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5930,8 +5930,8 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/) if(!unitTarget || !unitTarget->isAlive()) return; - if( unitTarget->m_extraAttacks ) - return; + //if( unitTarget->m_extraAttacks ) + // return; Unit *victim = unitTarget->getVictim(); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7ff15e5a6a3..aebf7b54002 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -1709,34 +1709,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) CastSpell(pVictim, 1604, true); } - if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) - { - for(uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) - { - // If usable, try to cast item spell - if (Item * item = ((Player*)this)->GetUseableItemByPos(INVENTORY_SLOT_BAG_0,i)) - if(!item->IsBroken()) - if (ItemPrototype const *proto = item->GetProto()) - { - // Additional check for weapons - if (proto->Class==ITEM_CLASS_WEAPON) - { - // offhand item cannot proc from main hand hit etc - EquipmentSlots slot; - switch (damageInfo->attackType) - { - case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break; - case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break; - case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break; - default: slot = EQUIPMENT_SLOT_END; break; - } - if (slot != i) - continue; - } - ((Player*)this)->CastItemCombatSpell(item, damageInfo, proto); - } - } - } + if(GetTypeId() == TYPEID_PLAYER) + ((Player *)this)->CastItemCombatSpell(pVictim, damageInfo->attackType, damageInfo->procVictim, damageInfo->procEx); // Do effect if any damage done to target if (damageInfo->damage) @@ -2334,7 +2308,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool extra ) { - if(hasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) ) + if(!extra && hasUnitState(UNIT_STAT_CANNOT_AUTOATTACK) || HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) ) return; if (!pVictim->isAlive()) @@ -2366,8 +2340,8 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex // Send log damage message to client DealDamageMods(pVictim,damageInfo.damage,&damageInfo.absorb); SendAttackStateUpdate(&damageInfo); - ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType); DealMeleeDamage(&damageInfo,true); + ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType); if (GetTypeId() == TYPEID_PLAYER) DEBUG_LOG("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", @@ -6874,7 +6848,6 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // check if shown in spell book if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED) continue; - SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first); if (!spellProto) continue; @@ -6981,16 +6954,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return true; } - bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) { SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); uint32 effIndex = triggeredByAura->GetEffIndex(); int32 triggerAmount = triggeredByAura->GetAmount(); - Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL; - uint32 triggered_spell_id = 0; Unit* target = pVictim; int32 basepoints0 = 0; @@ -7004,7 +6974,6 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* { uint32 maxmana = GetMaxPower(POWER_MANA); basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f; - target = this; triggered_spell_id = 34075; break; @@ -7015,39 +6984,30 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* // processed charge only counting case if(!triggered_spell_id) return true; - SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - if(!triggerEntry) { sLog.outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); return false; } - // default case if(!target || target!=this && !target->isAlive()) return false; - if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) return false; - if(basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId()==TYPEID_PLAYER ) ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); - return true; } - bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) { SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); uint32 effIndex = triggeredByAura->GetEffIndex(); int32 triggerAmount = triggeredByAura->GetAmount(); - Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL; @@ -7065,42 +7025,11 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff switch (getPowerType()) { case POWER_MANA: triggered_spell_id = 57319; break; - default: - return false; - } - } - break; - } - } // processed charge only counting case - if(!triggered_spell_id) return true; - - SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - - if(!triggerEntry) - { sLog.outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); - return false; - } - // default case if(!target || target!=this && !target->isAlive()) - return false; - - if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) - return false; - - if(basepoints0) - CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); - else - CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - - if( cooldown && GetTypeId()==TYPEID_PLAYER ) - ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); - - return true; -} // Used in case when access to whole aura is needed // All procs should be handled like this... @@ -7668,10 +7597,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } */ - // not allow proc extra attack spell at extra attack - if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) - return false; - // Custom requirements (not listed in procEx) Warning! damage dealing after this // Custom triggered spells switch (auraSpellInfo->Id) @@ -7929,16 +7854,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig if(!target || target!=this && !target->isAlive()) return false; + // apply spell cooldown before casting to prevent triggering spells with SPELL_EFFECT_ADD_EXTRA_ATTACKS if spell has hidden cooldown + if( cooldown && GetTypeId()==TYPEID_PLAYER ) + ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); + if(basepoints0) CastCustomSpell(target,trigger_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); - //else if(spellmgr.GetSpellCustomAttr(trigger_spell_id) & SPELL_ATTR_CU_AURA_SPELL) - // AddAura(trigger_spell_id, target); else CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId()==TYPEID_PLAYER ) - ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); - return true; } |