*Merge tc1 1591 - 1599, skip 1596

--HG--
branch : trunk
This commit is contained in:
QAston
2009-06-27 15:51:36 +02:00
10 changed files with 122 additions and 127 deletions
-3
View File
@@ -1,3 +0,0 @@
# 1589
-- Spiritual Attunement
UPDATE `spell_proc_event` SET `procFlags` = `procFlags`|0x80000 WHERE `entry` IN ('31785','33776');
+9
View File
@@ -0,0 +1,9 @@
# 1588
DELETE FROM `trinity_string` WHERE `entry` IN(301, 300);
INSERT INTO `trinity_string` (`entry`, `content_default`)VALUES
('300', 'Your chat has been disabled for %u minutes. Reason: %s.'),
('301', 'You have disabled %s\'s chat for %u minutes. Reason: %s.');
DELETE FROM `command` WHERE `name` = 'mute';
INSERT INTO `command` (`name`, `security`, `help`) VALUES
('mute', 1 ,'Syntax: .mute [$playerName] $timeInMinutes [$reason]\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.');
@@ -107,11 +107,11 @@ const uint32 spawnEntries[4]= { 23523, 23318, 23524 };
struct TRINITY_DLL_DECL mob_ashtongue_channelerAI : public ScriptedAI 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; uint64 ShadeGUID;
void Reset() { ShadeGUID = 0; } void Reset() {}
void JustDied(Unit* killer); void JustDied(Unit* killer);
void EnterCombat(Unit* who) {} void EnterCombat(Unit* who) {}
void AttackStart(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 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; uint64 ShadeGUID;
uint32 CheckTimer; uint32 CheckTimer;
@@ -131,7 +131,6 @@ struct TRINITY_DLL_DECL mob_ashtongue_sorcererAI : public ScriptedAI
{ {
StartBanishing = false; StartBanishing = false;
CheckTimer = 5000; CheckTimer = 5000;
ShadeGUID = 0;
} }
void JustDied(Unit* killer); void JustDied(Unit* killer);
@@ -237,8 +236,20 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
reseting = false; reseting = false;
} }
void JustSummoned(Creature *summon) {summons.Summon(summon);} void JustDied(Unit* killer)
void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} {
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) void MoveInLineOfSight(Unit *who)
{ {
@@ -498,7 +509,7 @@ void mob_ashtongue_sorcererAI::JustDied(Unit* killer)
struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI 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; ShadeHasDied = false;
StartCombat = false; StartCombat = false;
@@ -536,6 +547,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
bool ShadeHasDied; bool ShadeHasDied;
bool StartCombat; bool StartCombat;
bool HasYelledOnce; bool HasYelledOnce;
SummonList summons;
void Reset() 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->SetUInt32Value(UNIT_NPC_FLAGS, 0); // Database sometimes has very very strange values
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); 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) {} void EnterCombat(Unit* who) {}
@@ -617,6 +641,7 @@ struct TRINITY_DLL_DECL npc_akamaAI : public ScriptedAI
Creature* Shade = Unit::GetCreature((*m_creature), ShadeGUID); Creature* Shade = Unit::GetCreature((*m_creature), ShadeGUID);
if(Shade && Shade->isAlive()) if(Shade && Shade->isAlive())
CAST_AI(boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true; CAST_AI(boss_shade_of_akamaAI, Shade->AI())->HasKilledAkama = true;
summons.DespawnAll();
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
+5 -1
View File
@@ -159,7 +159,11 @@ void Bag::RemoveItem( uint8 slot, bool /*update*/ )
void Bag::StoreItem( uint8 slot, Item *pItem, 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 ) if( pItem )
{ {
-1
View File
@@ -272,7 +272,6 @@ MapManager::Update(uint32 diff)
update_queue[i]->Update(i_timer.GetCurrent()); update_queue[i]->Update(i_timer.GetCurrent());
sWorld.RecordTimeDiff("UpdateMap %u", update_queue[i]->GetId()); 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()); // 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 #else
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter) for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
+43 -12
View File
@@ -6983,17 +6983,48 @@ void Player::UpdateEquipSpellsAtFormChange()
} }
} }
} }
void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPrototype const * proto)
{ {
Unit * Target = damageInfo->target; if(!target || !target->isAlive() || target == this)
WeaponAttackType attType = damageInfo->attackType;
if (!Target || Target == this )
return; 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 // 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) //if (damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE)
{ {
for (int i = 0; i < 5; i++) 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 // 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; return;
float chance = spellInfo->procChance; float chance = spellInfo->procChance;
@@ -7032,7 +7063,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro
} }
if (roll_chance_f(chance)) 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) if (entry && entry->procEx)
{ {
// Check hit/crit/dodge/parry requirement // Check hit/crit/dodge/parry requirement
if((entry->procEx & damageInfo->procEx) == 0) if((entry->procEx & procEx) == 0)
continue; continue;
} }
else else
{ {
// Can do effect if any damage done to target // 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)) //if (!(damageInfo->procVictim & PROC_FLAG_TAKEN_ANY_DAMAGE))
continue; continue;
} }
@@ -7088,7 +7119,7 @@ void Player::CastItemCombatSpell(Item *item, CalcDamageInfo *damageInfo, ItemPro
if(IsPositiveSpell(pEnchant->spellid[s])) if(IsPositiveSpell(pEnchant->spellid[s]))
CastSpell(this, pEnchant->spellid[s], true, item); CastSpell(this, pEnchant->spellid[s], true, item);
else else
CastSpell(Target, pEnchant->spellid[s], true, item); CastSpell(target, pEnchant->spellid[s], true, item);
} }
} }
} }
+2 -1
View File
@@ -1768,8 +1768,9 @@ class TRINITY_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, 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 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 SendEquipmentSetList();
void SetEquipmentSet(uint32 index, EquipmentSet eqset); void SetEquipmentSet(uint32 index, EquipmentSet eqset);
+12 -7
View File
@@ -1108,14 +1108,19 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
procEx |= createProcExtendMask(&damageInfo, missInfo); procEx |= createProcExtendMask(&damageInfo, missInfo);
procVictim |= PROC_FLAG_TAKEN_ANY_DAMAGE; procVictim |= PROC_FLAG_TAKEN_ANY_DAMAGE;
// 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);
if (m_spellAura)
m_spellAura->SetProcDamage(damageInfo.damage);
caster->DealSpellDamage(&damageInfo, true); 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_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);
// Judgement of Blood // Judgement of Blood
if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && m_spellInfo->SpellFamilyFlags[1] & 0x00000008 && m_spellInfo->SpellIconID==153) 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) SpellCastResult Spell::CheckCast(bool strict)
{ {
// check cooldowns to prevent cheating // 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 //can cast triggered (by aura only?) spells while have this flag
if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY)) if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
+2 -2
View File
@@ -5930,8 +5930,8 @@ void Spell::EffectAddExtraAttacks(uint32 /*i*/)
if(!unitTarget || !unitTarget->isAlive()) if(!unitTarget || !unitTarget->isAlive())
return; return;
if( unitTarget->m_extraAttacks ) //if( unitTarget->m_extraAttacks )
return; // return;
Unit *victim = unitTarget->getVictim(); Unit *victim = unitTarget->getVictim();
+10 -86
View File
@@ -1709,34 +1709,8 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
CastSpell(pVictim, 1604, true); CastSpell(pVictim, 1604, true);
} }
if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) if(GetTypeId() == TYPEID_PLAYER)
{ ((Player *)this)->CastItemCombatSpell(pVictim, damageInfo->attackType, damageInfo->procVictim, damageInfo->procEx);
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);
}
}
}
// Do effect if any damage done to target // Do effect if any damage done to target
if (damageInfo->damage) if (damageInfo->damage)
@@ -2334,7 +2308,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool extra ) 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; return;
if (!pVictim->isAlive()) if (!pVictim->isAlive())
@@ -2366,8 +2340,8 @@ void Unit::AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType, bool ex
// Send log damage message to client // Send log damage message to client
DealDamageMods(pVictim,damageInfo.damage,&damageInfo.absorb); DealDamageMods(pVictim,damageInfo.damage,&damageInfo.absorb);
SendAttackStateUpdate(&damageInfo); SendAttackStateUpdate(&damageInfo);
ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType);
DealMeleeDamage(&damageInfo,true); DealMeleeDamage(&damageInfo,true);
ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType);
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
DEBUG_LOG("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", 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 // check if shown in spell book
if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED) if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED)
continue; continue;
SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first); SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first);
if (!spellProto) if (!spellProto)
continue; continue;
@@ -6981,16 +6954,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return true; return true;
} }
bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{ {
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
uint32 effIndex = triggeredByAura->GetEffIndex(); uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount(); int32 triggerAmount = triggeredByAura->GetAmount();
Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL; ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0; uint32 triggered_spell_id = 0;
Unit* target = pVictim; Unit* target = pVictim;
int32 basepoints0 = 0; int32 basepoints0 = 0;
@@ -7004,7 +6974,6 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
{ {
uint32 maxmana = GetMaxPower(POWER_MANA); uint32 maxmana = GetMaxPower(POWER_MANA);
basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f; basepoints0 = maxmana* GetAttackTime(RANGED_ATTACK)/1000.0f/100.0f;
target = this; target = this;
triggered_spell_id = 34075; triggered_spell_id = 34075;
break; break;
@@ -7015,39 +6984,30 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect*
// processed charge only counting case // processed charge only counting case
if(!triggered_spell_id) if(!triggered_spell_id)
return true; return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
if(!triggerEntry) if(!triggerEntry)
{ {
sLog.outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); sLog.outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
return false; return false;
} }
// default case // default case
if(!target || target!=this && !target->isAlive()) if(!target || target!=this && !target->isAlive())
return false; return false;
if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id)) if( cooldown && GetTypeId()==TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false; return false;
if(basepoints0) if(basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura);
if( cooldown && GetTypeId()==TYPEID_PLAYER ) if( cooldown && GetTypeId()==TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); ((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true; return true;
} }
bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown) bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{ {
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto (); SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
uint32 effIndex = triggeredByAura->GetEffIndex(); uint32 effIndex = triggeredByAura->GetEffIndex();
int32 triggerAmount = triggeredByAura->GetAmount(); int32 triggerAmount = triggeredByAura->GetAmount();
Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL; ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
@@ -7065,42 +7025,11 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff
switch (getPowerType()) switch (getPowerType())
{ {
case POWER_MANA: triggered_spell_id = 57319; break; case POWER_MANA: triggered_spell_id = 57319; break;
default:
return false;
}
}
break;
}
}
// processed charge only counting case // processed charge only counting case
if(!triggered_spell_id)
return true; 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); sLog.outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
return false;
}
// default case // default case
if(!target || target!=this && !target->isAlive()) 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 // Used in case when access to whole aura is needed
// All procs should be handled like this... // 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 requirements (not listed in procEx) Warning! damage dealing after this
// Custom triggered spells // Custom triggered spells
switch (auraSpellInfo->Id) switch (auraSpellInfo->Id)
@@ -7929,16 +7854,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig
if(!target || target!=this && !target->isAlive()) if(!target || target!=this && !target->isAlive())
return false; return false;
if(basepoints0) // apply spell cooldown before casting to prevent triggering spells with SPELL_EFFECT_ADD_EXTRA_ATTACKS if spell has hidden cooldown
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 ) if( cooldown && GetTypeId()==TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); ((Player*)this)->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown);
if(basepoints0)
CastCustomSpell(target,trigger_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
else
CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura);
return true; return true;
} }