From d03ea954af93882402198792a08f9e8e7e720ac8 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 12 Mar 2009 13:50:52 +0300 Subject: [PATCH] [7445] Implement SPELL_EFFECT_JUMP2 used in some jump to target (unit/go/coordinates) spells. --- src/game/Spell.h | 1 + src/game/SpellEffects.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++- src/shared/revision_nr.h | 2 +- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/game/Spell.h b/src/game/Spell.h index 2b70422a..6b33e636 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -249,6 +249,7 @@ class Spell void EffectSummonWild(uint32 i); void EffectSummonGuardian(uint32 i); void EffectHealMechanical(uint32 i); + void EffectJump(uint32 i); void EffectTeleUnitsFaceCaster(uint32 i); void EffectLearnSkill(uint32 i); void EffectAddHonor(uint32 i); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 7c78f05b..5d3c5447 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -99,7 +99,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectUnused, // 39 SPELL_EFFECT_LANGUAGE &Spell::EffectDualWield, // 40 SPELL_EFFECT_DUAL_WIELD &Spell::EffectUnused, // 41 SPELL_EFFECT_JUMP - &Spell::EffectUnused, // 42 SPELL_EFFECT_JUMP2 + &Spell::EffectJump, // 42 SPELL_EFFECT_JUMP2 &Spell::EffectTeleUnitsFaceCaster, // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER &Spell::EffectLearnSkill, // 44 SPELL_EFFECT_SKILL_STEP &Spell::EffectAddHonor, // 45 SPELL_EFFECT_ADD_HONOR honor/pvp related @@ -1997,6 +1997,53 @@ void Spell::EffectTriggerMissileSpell(uint32 effect_idx) m_caster->CastSpell(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, spellInfo, true, m_CastItem, 0, m_originalCasterGUID); } +void Spell::EffectJump(uint32 i) +{ + if(m_caster->isInFlight()) + return; + + // Init dest coordinates + float x,y,z,o; + if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + { + x = m_targets.m_destX; + y = m_targets.m_destY; + z = m_targets.m_destZ; + o = m_caster->GetOrientation(); + } + else if(unitTarget) + { + x = unitTarget->GetPositionX(); + y = unitTarget->GetPositionY(); + z = unitTarget->GetPositionZ(); + o = m_spellInfo->EffectImplicitTargetA[i] == TARGET_BEHIND_VICTIM + ? unitTarget->GetOrientation() + : m_caster->GetOrientation(); + } + else if(gameObjTarget) + { + x = gameObjTarget->GetPositionX(); + y = gameObjTarget->GetPositionY(); + z = gameObjTarget->GetPositionZ(); + o = m_caster->GetOrientation(); + } + else + return; + + + // Teleport + if(m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->TeleportTo(m_caster->GetMapId(), x, y, z, o, + TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); + else + { + m_caster->GetMap()->CreatureRelocation((Creature*)m_caster, x, y, z, o); + WorldPacket data; + m_caster->BuildTeleportAckMsg(&data, x, y, z, o); + m_caster->SendMessageToSet(&data, false); + } +} + void Spell::EffectTeleportUnits(uint32 i) { if(!unitTarget || unitTarget->isInFlight()) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 2e7ea2df..cdb1df0c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7444" + #define REVISION_NR "7445" #endif // __REVISION_NR_H__ -- 2.11.4.GIT