Allow SD3 scripted dummy and script spelleffects upon players

This commit is contained in:
Olion 2016-02-17 23:11:41 +02:00
parent 78c5faed9d
commit 89a3ec852e
3 changed files with 14 additions and 13 deletions

View File

@ -2420,16 +2420,17 @@ bool ScriptMgr::OnProcessEvent(uint32 eventId, Object* pSource, Object* pTarget,
#endif
}
bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget, ObjectGuid originalCasterGuid)
bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Unit* pTarget, ObjectGuid originalCasterGuid)
{
// Used by Eluna
#ifdef ENABLE_ELUNA
if (sEluna->OnDummyEffect(pCaster, spellId, effIndex, pTarget))
return true;
if (pTarget->ToCreature())
if (sEluna->OnDummyEffect(pCaster, spellId, effIndex, pTarget->ToCreature()))
return true;
#endif /* ENABLE_ELUNA */
#ifdef ENABLE_SD3
return SD3::EffectDummyCreature(pCaster, spellId, effIndex, pTarget, originalCasterGuid);
return SD3::EffectDummyUnit(pCaster, spellId, effIndex, pTarget, originalCasterGuid);
#else
return false;
#endif
@ -2465,10 +2466,10 @@ bool ScriptMgr::OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex ef
#endif
}
bool ScriptMgr::OnEffectScriptEffect(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget, ObjectGuid originalCasterGuid)
bool ScriptMgr::OnEffectScriptEffect(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Unit* pTarget, ObjectGuid originalCasterGuid)
{
#ifdef ENABLE_SD3
return SD3::EffectScriptEffectCreature(pCaster, spellId, effIndex, pTarget, originalCasterGuid);
return SD3::EffectScriptEffectUnit(pCaster, spellId, effIndex, pTarget, originalCasterGuid);
#else
return false;
#endif
@ -2553,7 +2554,7 @@ void ScriptMgr::CollectPossibleEventIds(std::set<uint32>& eventIds)
}
}
}
#if defined(TBC)
#if defined(TBC) || defined (WOTLK)
// Load all possible event entries from taxi path nodes
for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx)
{

View File

@ -635,10 +635,10 @@ class ScriptMgr
bool OnItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets);
bool OnAreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry);
bool OnProcessEvent(uint32 eventId, Object* pSource, Object* pTarget, bool isStart);
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget, ObjectGuid originalCasterGuid);
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Unit* pTarget, ObjectGuid originalCasterGuid);
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, GameObject* pTarget, ObjectGuid originalCasterGuid);
bool OnEffectDummy(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Item* pTarget, ObjectGuid originalCasterGuid);
bool OnEffectScriptEffect(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Creature* pTarget, ObjectGuid originalCasterGuid);
bool OnEffectScriptEffect(Unit* pCaster, uint32 spellId, SpellEffectIndex effIndex, Unit* pTarget, ObjectGuid originalCasterGuid);
bool OnAuraDummy(Aura const* pAura, bool apply);
private:

View File

@ -1318,8 +1318,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
bool libraryResult = false;
if (gameObjTarget)
{ libraryResult = sScriptMgr.OnEffectDummy(m_caster, m_spellInfo->Id, eff_idx, gameObjTarget, m_originalCasterGUID); }
else if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT)
{ libraryResult = sScriptMgr.OnEffectDummy(m_caster, m_spellInfo->Id, eff_idx, (Creature*)unitTarget, m_originalCasterGUID); }
else if (unitTarget && (unitTarget->GetTypeId() == TYPEID_UNIT || unitTarget->GetTypeId() == TYPEID_PLAYER))
{ libraryResult = sScriptMgr.OnEffectDummy(m_caster, m_spellInfo->Id, eff_idx, unitTarget, m_originalCasterGUID); }
else if (itemTarget)
{ libraryResult = sScriptMgr.OnEffectDummy(m_caster, m_spellInfo->Id, eff_idx, itemTarget, m_originalCasterGUID); }
@ -3811,9 +3811,9 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
// Script based implementation. Must be used only for not good for implementation in core spell effects
// So called only for not processed cases
if (unitTarget->GetTypeId() == TYPEID_UNIT)
if (unitTarget->GetTypeId() == TYPEID_UNIT || unitTarget->GetTypeId() == TYPEID_PLAYER)
{
if (sScriptMgr.OnEffectScriptEffect(m_caster, m_spellInfo->Id, eff_idx, (Creature*)unitTarget, m_originalCasterGUID))
if (sScriptMgr.OnEffectScriptEffect(m_caster, m_spellInfo->Id, eff_idx, unitTarget, m_originalCasterGUID))
{ return; }
}