diff options
-rw-r--r-- | sql/updates/world/2016_01_22_00_world.sql | 1 | ||||
-rw-r--r-- | sql/updates/world/2016_01_26_00_world.sql | 2 | ||||
-rw-r--r-- | sql/updates/world/2016_01_27_00_world.sql | 6 | ||||
-rw-r--r-- | src/server/game/Movement/MotionMaster.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Movement/MotionMaster.h | 8 | ||||
-rwxr-xr-x | src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Movement/MovementGenerators/PointMovementGenerator.h | 7 | ||||
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 7 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_warrior.cpp | 119 |
9 files changed, 149 insertions, 11 deletions
diff --git a/sql/updates/world/2016_01_22_00_world.sql b/sql/updates/world/2016_01_22_00_world.sql index 4809e3cef3c..196d006acad 100644 --- a/sql/updates/world/2016_01_22_00_world.sql +++ b/sql/updates/world/2016_01_22_00_world.sql @@ -997,6 +997,7 @@ INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseId`,`position_x`,` UPDATE `gameobject` SET `guid`=380 WHERE `guid`=20; +DELETE FROM `gameobject` WHERE `guid` IN (2568,2730); INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseId`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES (2568, 188514, 578, 4228, 4228, 3, 1, 1209.71, 1334.59, 192.375, 1.10828, 0, 0, 0.526214, 0.850352, 180, 0, 1, 0), (2730, 183043, 530, 3521, 3648, 1, 1, 907.398, 5773.45, 10.7675, -1.58825, 0, 0, 0.71325, -0.700909, 60, 100, 1, 0); diff --git a/sql/updates/world/2016_01_26_00_world.sql b/sql/updates/world/2016_01_26_00_world.sql new file mode 100644 index 00000000000..3a7a6cab8c4 --- /dev/null +++ b/sql/updates/world/2016_01_26_00_world.sql @@ -0,0 +1,2 @@ +-- +DELETE FROM `gameobject` WHERE `guid` BETWEEN 1822 AND 1851 and `id`=177807; diff --git a/sql/updates/world/2016_01_27_00_world.sql b/sql/updates/world/2016_01_27_00_world.sql new file mode 100644 index 00000000000..0690f8ceed7 --- /dev/null +++ b/sql/updates/world/2016_01_27_00_world.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_warr_heroic_leap', 'spell_warr_heroic_leap_jump'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(6544,'spell_warr_heroic_leap'), +(178368,'spell_warr_heroic_leap_jump'); + +UPDATE `creature_template` SET `flags_extra`=`flags_extra`|0x80 WHERE `entry`=47319; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 56cfd6f4a92..982db89978b 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -363,7 +363,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) MoveJump(x, y, z, speedXY, speedZ); } -void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id) +void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id /*= EVENT_JUMP*/, uint32 arrivalSpellId /*= 0*/, ObjectGuid const& arrivalSpellTargetGuid /*= ObjectGuid::Empty*/) { TC_LOG_DEBUG("misc", "Unit (%s) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUID().ToString().c_str(), x, y, z); if (speedXY <= 0.1f) @@ -377,7 +377,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee init.SetParabolic(max_height, 0); init.SetVelocity(speedXY); init.Launch(); - Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); + Mutate(new EffectMovementGenerator(id, arrivalSpellId, arrivalSpellTargetGuid), MOTION_SLOT_CONTROLLED); } void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount) diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index ce0f1f7836e..3cb56e7d9d9 100644 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -181,9 +181,11 @@ class MotionMaster //: private std::stack<MovementGenerator *> void MoveCharge(PathGenerator const& path, float speed = SPEED_CHARGE); void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ); void MoveJumpTo(float angle, float speedXY, float speedZ); - void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP) - { MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id); } - void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = EVENT_JUMP); + void MoveJump(Position const& pos, float speedXY, float speedZ, uint32 id = EVENT_JUMP, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty) + { + MoveJump(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speedXY, speedZ, id, arrivalSpellId, arrivalSpellTargetGuid); + } + void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = EVENT_JUMP, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty); void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount); void MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints, size_t pathSize, bool walk); void MoveFall(uint32 id = 0); diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp index 38295f83859..c2f65bfdb84 100755 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp @@ -25,6 +25,7 @@ #include "MoveSpline.h" #include "Player.h" #include "CreatureGroups.h" +#include "ObjectAccessor.h" //----- Point Movement Generator template<class T> @@ -134,6 +135,9 @@ bool EffectMovementGenerator::Update(Unit* unit, uint32) void EffectMovementGenerator::Finalize(Unit* unit) { + if (_arrivalSpellId) + unit->CastSpell(ObjectAccessor::GetUnit(*unit, _arrivalSpellTargetGuid), _arrivalSpellId, true); + if (unit->GetTypeId() != TYPEID_UNIT) return; @@ -147,5 +151,5 @@ void EffectMovementGenerator::Finalize(Unit* unit) } if (unit->ToCreature()->AI()) - unit->ToCreature()->AI()->MovementInform(EFFECT_MOTION_TYPE, m_Id); + unit->ToCreature()->AI()->MovementInform(EFFECT_MOTION_TYPE, _id); } diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h index f73d51db962..87241276262 100644 --- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h @@ -63,14 +63,17 @@ class AssistanceMovementGenerator : public PointMovementGenerator<Creature> class EffectMovementGenerator : public MovementGenerator { public: - explicit EffectMovementGenerator(uint32 Id) : m_Id(Id) { } + EffectMovementGenerator(uint32 id, uint32 arrivalSpellId = 0, ObjectGuid const& arrivalSpellTargetGuid = ObjectGuid::Empty) + : _id(id), _arrivalSpellId(arrivalSpellId), _arrivalSpellTargetGuid(arrivalSpellTargetGuid) { } void Initialize(Unit*) override { } void Finalize(Unit*) override; void Reset(Unit*) override { } bool Update(Unit*, uint32) override; MovementGeneratorType GetMovementGeneratorType() const override { return EFFECT_MOTION_TYPE; } private: - uint32 m_Id; + uint32 _id; + uint32 _arrivalSpellId; + ObjectGuid _arrivalSpellTargetGuid; }; #endif diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 66cf7173f27..d014119f00c 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -924,7 +924,7 @@ void Spell::EffectJump(SpellEffIndex /*effIndex*/) float speedXY, speedZ; CalculateJumpSpeeds(effectInfo, m_caster->GetExactDist2d(x, y), speedXY, speedZ); - m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); + m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, EVENT_JUMP, effectInfo->TriggerSpell, unitTarget->GetGUID()); } void Spell::EffectJumpDest(SpellEffIndex /*effIndex*/) @@ -944,7 +944,7 @@ void Spell::EffectJumpDest(SpellEffIndex /*effIndex*/) float speedXY, speedZ; CalculateJumpSpeeds(effectInfo, m_caster->GetExactDist2d(x, y), speedXY, speedZ); - m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ); + m_caster->GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ, EVENT_JUMP, effectInfo->TriggerSpell); } void Spell::CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ) @@ -4514,6 +4514,9 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/) // not all charge effects used in negative spells if (!m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->Attack(unitTarget, true); + + if (effectInfo->TriggerSpell) + m_caster->CastSpell(unitTarget, effectInfo->TriggerSpell, true, nullptr, nullptr, m_originalCasterGUID); } } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 2619a5af065..5d686f6aa38 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -62,7 +62,11 @@ enum WarriorSpells SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_1 = 64849, SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_2 = 64850, SPELL_WARRIOR_VIGILANCE_PROC = 50725, - SPELL_WARRIOR_VENGEANCE = 76691 + SPELL_WARRIOR_VENGEANCE = 76691, + SPELL_WARRIOR_HEROIC_LEAP_JUMP = 178368, + SPELL_WARRIOR_GLYPH_OF_HEROIC_LEAP = 159708, + SPELL_WARRIOR_GLYPH_OF_HEROIC_LEAP_BUFF = 133278, + SPELL_WARRIOR_IMPROVED_HEROIC_LEAP = 157449, }; enum WarriorSpellIcons @@ -948,6 +952,117 @@ class spell_warr_vigilance_trigger : public SpellScriptLoader } }; +// Heroic leap - 6544 +class spell_warr_heroic_leap : public SpellScriptLoader +{ +public: + spell_warr_heroic_leap() : SpellScriptLoader("spell_warr_heroic_leap") { } + + class spell_warr_heroic_leap_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_heroic_leap_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_HEROIC_LEAP_JUMP)) + return false; + return true; + } + + SpellCastResult CheckElevation() + { + if (WorldLocation const* dest = GetExplTargetDest()) + { + if (GetCaster()->HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) + return SPELL_FAILED_ROOTED; + + if (GetCaster()->GetMap()->Instanceable()) + { + float range = GetSpellInfo()->GetMaxRange(true, GetCaster()) * 1.5f; + + PathGenerator generatedPath(GetCaster()); + generatedPath.SetPathLengthLimit(range); + + bool result = generatedPath.CalculatePath(dest->GetPositionX(), dest->GetPositionY(), dest->GetPositionZ(), false, true); + if (generatedPath.GetPathType() & PATHFIND_SHORT) + return SPELL_FAILED_OUT_OF_RANGE; + else if (!result || generatedPath.GetPathType() & PATHFIND_NOPATH) + { + result = generatedPath.CalculatePath(dest->GetPositionX(), dest->GetPositionY(), dest->GetPositionZ(), false, false); + if (generatedPath.GetPathType() & PATHFIND_SHORT) + return SPELL_FAILED_OUT_OF_RANGE; + else if (!result || generatedPath.GetPathType() & PATHFIND_NOPATH) + return SPELL_FAILED_NOPATH; + } + } + else if (dest->GetPositionZ() > GetCaster()->GetPositionZ() + 4.0f) + return SPELL_FAILED_NOPATH; + + return SPELL_CAST_OK; + } + + return SPELL_FAILED_NO_VALID_TARGETS; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (WorldLocation* dest = GetHitDest()) + GetCaster()->CastSpell(dest->GetPositionX(), dest->GetPositionY(), dest->GetPositionZ(), SPELL_WARRIOR_HEROIC_LEAP_JUMP, true); + } + + void Register() override + { + OnCheckCast += SpellCheckCastFn(spell_warr_heroic_leap_SpellScript::CheckElevation); + OnEffectHit += SpellEffectFn(spell_warr_heroic_leap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_warr_heroic_leap_SpellScript(); + } +}; + +// Heroic Leap (triggered by Heroic Leap (6544)) - 178368 +class spell_warr_heroic_leap_jump : public SpellScriptLoader +{ +public: + spell_warr_heroic_leap_jump() : SpellScriptLoader("spell_warr_heroic_leap_jump") { } + + class spell_warr_heroic_leap_jump_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warr_heroic_leap_jump_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_HEROIC_LEAP) || + !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_GLYPH_OF_HEROIC_LEAP_BUFF) || + !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_IMPROVED_HEROIC_LEAP) || + !sSpellMgr->GetSpellInfo(SPELL_WARRIOR_TAUNT)) + return false; + return true; + } + + void AfterJump(SpellEffIndex /*effIndex*/) + { + if (GetCaster()->HasAura(SPELL_WARRIOR_GLYPH_OF_HEROIC_LEAP)) + GetCaster()->CastSpell(GetCaster(), SPELL_WARRIOR_GLYPH_OF_HEROIC_LEAP_BUFF, true); + if (GetCaster()->HasAura(SPELL_WARRIOR_IMPROVED_HEROIC_LEAP)) + GetCaster()->GetSpellHistory()->ResetCooldown(SPELL_WARRIOR_TAUNT, true); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_warr_heroic_leap_jump_SpellScript::AfterJump, EFFECT_1, SPELL_EFFECT_JUMP_DEST); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_warr_heroic_leap_jump_SpellScript(); + } +}; + void AddSC_warrior_spell_scripts() { new spell_warr_bloodthirst(); @@ -972,4 +1087,6 @@ void AddSC_warrior_spell_scripts() new spell_warr_victorious(); new spell_warr_vigilance(); new spell_warr_vigilance_trigger(); + new spell_warr_heroic_leap(); + new spell_warr_heroic_leap_jump(); } |