mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Auras: Fixed crash in AuraEffect::TriggerSpell (dummy effect) and removed some useless code
Scripts/AI: Changed sOnDummyEffect to return bool value Closes issue #5190. --HG-- branch : trunk
This commit is contained in:
@@ -219,7 +219,7 @@ class UnitAI
|
||||
virtual void sQuestSelect(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestComplete(Player* /*player*/, Quest const* /*quest*/) {}
|
||||
virtual void sQuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {}
|
||||
virtual void sOnDummyEffect(Unit* /*caster*/, uint32 /*spellId*/, SpellEffIndex /*effIndex*/) {}
|
||||
virtual bool sOnDummyEffect(Unit* /*caster*/, uint32 /*spellId*/, SpellEffIndex /*effIndex*/) { return false; }
|
||||
};
|
||||
|
||||
class PlayerAI : public UnitAI
|
||||
|
||||
@@ -746,9 +746,10 @@ void SmartAI::sQuestReward(Player* player, Quest const* quest, uint32 opt)
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_REWARD_QUEST, player, quest->GetQuestId(), opt);
|
||||
}
|
||||
|
||||
void SmartAI::sOnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex)
|
||||
bool SmartAI::sOnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DUMMY_EFFECT,caster,spellId,(uint32)effIndex);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SmartAI::SetCombatMove(bool on)
|
||||
|
||||
@@ -182,7 +182,7 @@ class SmartAI : public CreatureAI
|
||||
//void sQuestSelect(Player* player, Quest const* quest);
|
||||
//void sQuestComplete(Player* player, Quest const* quest);
|
||||
void sQuestReward(Player* player, Quest const* quest, uint32 opt);
|
||||
void sOnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex);
|
||||
bool sOnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex);
|
||||
|
||||
uint32 mEscortQuestID;
|
||||
|
||||
|
||||
@@ -2150,11 +2150,11 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
||||
// specific code for cases with no trigger spell provided in field
|
||||
if (triggeredSpellInfo == NULL)
|
||||
{
|
||||
switch(auraSpellInfo->SpellFamilyName)
|
||||
switch (auraSpellInfo->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_GENERIC:
|
||||
{
|
||||
switch(auraId)
|
||||
switch (auraId)
|
||||
{
|
||||
// Thaumaturgy Channel
|
||||
case 9712:
|
||||
@@ -2356,17 +2356,8 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
||||
else
|
||||
{
|
||||
// Spell exist but require custom code
|
||||
switch(auraId)
|
||||
switch (auraId)
|
||||
{
|
||||
case 66869:
|
||||
switch(caster->GetMap()->GetDifficulty())
|
||||
{
|
||||
case RAID_DIFFICULTY_10MAN_NORMAL: triggerSpellId = 66870; break;
|
||||
case RAID_DIFFICULTY_10MAN_HEROIC: triggerSpellId = 67621; break;
|
||||
case RAID_DIFFICULTY_25MAN_NORMAL: triggerSpellId = 67622; break;
|
||||
case RAID_DIFFICULTY_25MAN_HEROIC: triggerSpellId = 67623; break;
|
||||
}
|
||||
break;
|
||||
// Pursuing Spikes (Anub'arak)
|
||||
case 65920:
|
||||
case 65922:
|
||||
@@ -2422,15 +2413,14 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
|
||||
{
|
||||
Unit * triggerCaster = GetTriggeredSpellCaster(triggeredSpellInfo, caster, triggerTarget);
|
||||
triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this);
|
||||
sLog.outDebug("AuraEffect::TriggerSpell: Spell %u Trigger %u",GetId(), triggeredSpellInfo->Id);
|
||||
sLog.outDebug("AuraEffect::TriggerSpell: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id);
|
||||
}
|
||||
else if (target->GetTypeId() != TYPEID_UNIT || !sScriptMgr.OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), triggerTarget->ToCreature()))
|
||||
else
|
||||
{
|
||||
if (Creature* c = triggerTarget->ToCreature())
|
||||
{
|
||||
c->AI()->sOnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()));
|
||||
}
|
||||
sLog.outError("AuraEffect::TriggerSpell: Spell %u has value 0 in EffectTriggered[%d] and is therefor not handled. Define as custom case?",GetId(),GetEffIndex());
|
||||
Creature* c = triggerTarget->ToCreature();
|
||||
if (!c || (c && !sScriptMgr.OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), triggerTarget->ToCreature())) ||
|
||||
(c && !c->AI()->sOnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()))))
|
||||
sLog.outError("AuraEffect::TriggerSpell: Spell %u has value 0 in EffectTriggered[%d] and is therefor not handled. Define as custom case?",GetId(),GetEffIndex());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user