From 406de9279ce6efd3e98917bc62e9a88368c2ed92 Mon Sep 17 00:00:00 2001 From: Ovah Date: Thu, 23 Nov 2017 22:52:49 +0000 Subject: [PATCH] Scripts/LCT: implement General Husam encounter --- .../world/4.3.4/2017_11_23_01_world.sql | 85 +++ src/server/game/Spells/SpellMgr.cpp | 9 + .../boss_general_husam.cpp | 589 ++++++++++++++++++ .../instance_lost_city_of_the_tolvir.cpp | 70 +++ .../lost_city_of_the_tolvir.h | 66 ++ .../Kalimdor/kalimdor_script_loader.cpp | 4 + 6 files changed, 823 insertions(+) create mode 100644 sql/updates/world/4.3.4/2017_11_23_01_world.sql create mode 100644 src/server/scripts/Kalimdor/LostCityOfTheTolvir/boss_general_husam.cpp create mode 100644 src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp create mode 100644 src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h diff --git a/sql/updates/world/4.3.4/2017_11_23_01_world.sql b/sql/updates/world/4.3.4/2017_11_23_01_world.sql new file mode 100644 index 0000000000..8052baacb0 --- /dev/null +++ b/sql/updates/world/4.3.4/2017_11_23_01_world.sql @@ -0,0 +1,85 @@ +-- Set scriptname for instance +UPDATE `instance_template` SET `script`= 'instance_lost_city_of_the_tolvir' WHERE `map`= 755; + +-- Correct wrong base level of non-heroic bosses +UPDATE `creature_template` SET `minlevel`= 86, `maxlevel`= 86 WHERE `entry` IN (44577, 43612, 43614, 44819); + +-- General Husam +UPDATE `creature_template` SET `difficulty_entry_1`= 48932, `mechanic_immune_mask`= 667893759, `scriptname`= 'boss_general_husam' WHERE `entry`= 44577; +UPDATE `creature_template` SET `minlevel`= 87, `maxlevel`= 87, `faction`= 16, `exp`= 3, `speed_walk`= 2.8, `speed_run`= 1.42857, `unit_flags`= 32832, `unit_flags2`= 67584, `VehicleId`= 1036, `movementId`= 154, `mechanic_immune_mask`= 667893759 WHERE `entry`= 48932; +-- Shockwave Stalker +UPDATE `creature_template` SET `minlevel`= 82, `maxlevel`= 82, `faction`= 35, `unit_flags`= 33554432, `unit_flags2`= 2048, `InhabitType`= 4, `flags_extra`= 131, `speed_run`= 1.14286 WHERE `entry`= 44711; +-- Shockwave Visual +UPDATE `creature_template` SET `minlevel`= 82, `maxlevel`= 82, `faction`= 14, `unit_flags`= 33554432, `unit_flags2`= 2048, `InhabitType`= 4, `flags_extra`= 131 WHERE `entry`= 44712; +-- Tol'Vir Land Mine +UPDATE `creature_template` SET `minlevel`= 82, `maxlevel`= 82, `faction`= 14, `unit_flags`= 33554432, `unit_flags2`= 2048, `InhabitType`= 1, `flags_extra`= 131, `scriptname`= 'npc_husam_tolvir_land_mine_trigger' WHERE `entry`= 44840; +-- Tol'Vir Land Mine Vehicle +UPDATE `creature_template` SET `minlevel`= 82, `maxlevel`= 82, `faction`= 14, `unit_flags`= 33554432, `unit_flags2`= 2048, `InhabitType`= 1, `flags_extra`= 131, `VehicleId`= 1050, `scriptname`= 'npc_husam_tolvir_land_mine_vehicle' WHERE `entry`= 44798; +-- Tol'Vir Land Mine 2 +UPDATE `creature_template` SET `minlevel`= 82, `maxlevel`= 82, `faction`= 14, `unit_flags`= 33554432, `unit_flags2`= 2048, `InhabitType`= 1, `flags_extra`= 131, `scriptname`= 'npc_husam_tolvir_land_mine' WHERE `entry`= 44796; +-- Bad Intentions Target +UPDATE `creature_template` SET `InhabitType`= 4, `flags_extra`= 128 WHERE `entry`= 44586; + +DELETE FROM `creature_text` WHERE `CreatureID`= 44577; +INSERT INTO `creature_text` (`CreatureID`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `BroadcastTextId`, `comment`) VALUES +(44577, 0, 0, 'Invaders, you shall go no further!', 14, 0, 100, 0, 0, 0, 49310, 'General Husam to Player'), +(44577, 1, 0, 'Insolent rat!', 14, 0, 100, 0, 0, 0, 49311, 'General Husam to Player'), +(44577, 2, 0, 'Murkash!', 14, 0, 100, 0, 0, 0, 49313, 'General Husam'), +(44577, 3, 0, '|TInterface\\Icons\\spell_nature_earthquake.blp:20|t%s begins to cast |cFFFF0000|Hspell:83445|h[Shockwave]!|h|r', 41, 0, 100, 0, 0, 0, 44921, 'General Husam'), +(44577, 4, 0, 'Tread Lightly.', 14, 0, 100, 0, 0, 0, 49314, 'General Husam'), +(44577, 5, 0, 'Siamat must not be freed! Turn back before it is too late!', 14, 0, 100, 0, 0, 0, 49312, 'General Husam to Player'); + +DELETE FROM `spell_script_names` WHERE `ScriptName` IN +('spell_husam_hammer_fist', +'spell_husam_hammer_fist', +'spell_husam_shockwave_summon_search', +'spell_husam_shockwave', +'spell_husam_shockwave', +'spell_husam_mystic_trap', +'spell_husam_mystic_trap', +'spell_husam_detonate_traps', +'spell_husam_bad_intentions', +'spell_husam_hurl', +'spell_husam_hurl_vehicle'); +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(83654, 'spell_husam_hammer_fist'), +(91256, 'spell_husam_hammer_fist'), +(83466, 'spell_husam_shockwave_summon_search'), +(83445, 'spell_husam_shockwave'), +(91257, 'spell_husam_shockwave'), +(83644, 'spell_husam_mystic_trap'), +(91252, 'spell_husam_mystic_trap'), +(91263, 'spell_husam_detonate_traps'), +(83113, 'spell_husam_bad_intentions'), +(83236, 'spell_husam_hurl'), +(83235, 'spell_husam_hurl_vehicle'); + +DELETE FROM `creature_template_addon` WHERE `entry` IN (44711, 44712); +INSERT INTO `creature_template_addon` (`entry`, `Auras`) VALUES +(44711, '83129'); + +DELETE FROM conditions WHERE SourceEntry IN (83445, 91257, 83466, 81350, 91263, 91263, 83235); +INSERT INTO conditions (SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ScriptName, Comment) VALUES +(13, 7, 83466, 0, 0, 31, 0, 3, 44712, 0, 0, 0, '', 'Shockwave Searcher - Target Shockwave Visual'), +(13, 7, 83445, 0, 0, 31, 0, 3, 44711, 0, 0, 0, '', 'Shockwave - Target Shockwave Stalker'), +(13, 7, 91257, 0, 0, 31, 0, 3, 44711, 0, 0, 0, '', 'Shockwave - Target Shockwave Stalker'), +(13, 7, 91263, 0, 0, 31, 0, 3, 44796, 0, 0, 0, '', 'Detonate Traps - Target Tolvir Land Mine'); + +-- Creature Shockwave Visual 44712 SAI +SET @ENTRY := 44712; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 1, 63, 0, 100, 0, 0, 0, 0, 0, 11, 83127, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When just created - Self: Cast spell 83127 on Self // "), +(@ENTRY, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 67, 0, 5000, 5000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, " Linked - Trigger timed event #0 in 5000 - 5000 ms // "), +(@ENTRY, 0, 2, 3, 59, 0, 100, 1, 0, 0, 0, 0, 28, 83127, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "On timed event 0 triggered - Self: Remove aura due to spell 83127 // "), +(@ENTRY, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 11, 83454, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 83454 on Self // "); + +-- Creature Bad Intentions Target 44586 SAI +SET @ENTRY := 44586; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 0, 27, 0, 100, 0, 0, 0, 0, 0, 67, 0, 1000, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "On passenger boarded (vehicle) - Trigger timed event #0 in 1000 - 1000 ms // "), +(@ENTRY, 0, 1, 2, 59, 0, 100, 0, 0, 0, 0, 0, 11, 83339, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "On timed event 0 triggered - Self: Cast spell 83339 on Action invoker // "), +(@ENTRY, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 11, 50630, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 50630 on Self // "); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 5cc8e72688..ad2ae35560 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3615,6 +3615,15 @@ void SpellMgr::LoadSpellInfoCorrections() case 87723: // Beam C spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY); break; + // The Lost City of the Tol'Vir Spells + // General Husam + case 83131: // Summon Shockwave Target N + spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_4_YARDS); + break; + case 83235: // Hurl + spellInfo->Effects[EFFECT_0].Effect = SPELL_EFFECT_APPLY_AURA; + spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY); + break; // Halls Of Origination spells // Temple Guardian Anhuur case 76606: // Disable Beacon Beams L diff --git a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/boss_general_husam.cpp b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/boss_general_husam.cpp new file mode 100644 index 0000000000..efdf4fe795 --- /dev/null +++ b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/boss_general_husam.cpp @@ -0,0 +1,589 @@ +/* +* Copyright (C) 2008-2017 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include "ObjectMgr.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" +#include "Player.h" +#include "Vehicle.h" +#include "lost_city_of_the_tolvir.h" + +enum Spells +{ + // General Husam + SPELL_HAMMER_FIST = 83654, + SPELL_SHOCKWAVE = 83445, + SPELL_SHOCKWAVE_VISUAL = 83130, + SPELL_SUMMON_SHOCKWAVE_TARGET_N = 83131, + SPELL_SUMMON_SHOCKWAVE_TARGET_S = 83132, + SPELL_SUMMON_SHOCKWAVE_TARGET_E = 83133, + SPELL_SUMMON_SHOCKWAVE_TARGET_W = 83134, + SPELL_MYSTIC_TRAP = 83644, + SPELL_THROW_LAND_MINES = 83122, + SPELL_DETONE_TRAPS = 91263, + SPELL_BAD_INTENTIONS = 83113, + SPELL_HURL = 83236, + SPELL_THROW_VISUAL = 83371, + + // Shockwave Stalker + SPELL_SHOCKWAVE_SUMMON_EFFECT = 83128, + + // Tol'Vir Land Mine + SPELL_TOLVIR_LAND_MINE_VISUAL = 83110, + SPELL_LAND_MINE_PLAYER_SEARCH_TRIGGER = 83111, + SPELL_LAND_MINE_PLAYER_SEARCH_EFFECT = 83112, + SPELL_LAND_MINE_PERIODIC = 85523, + SPELL_MYSTIC_TRAP_DAMAGE = 83171 +}; + +enum Events +{ + // General Husam + EVENT_HAMMER_FIST = 1, + EVENT_SHOCKWAVE, + EVENT_MYSTIC_TRAP, + EVENT_DETONATE_TRAPS, + EVENT_BAD_INTENTIONS, + EVENT_THROW_PLAYER, + + // Tol'Vir Land Mine + EVENT_READY_MINE, + EVENT_START_COUNTDOWN, + EVENT_CLEAR_AURAS +}; + +enum Actions +{ + ACTION_DETONATE_MINE = 1 +}; + +enum Texts +{ + SAY_AGGRO = 0, + SAY_SLAY = 1, + SAY_SHOCKWAVE = 2, + SAY_ANNOUNCE_SHOCKWAVE = 3, + SAY_DETONATE_MINES = 4, + SAY_DEATH = 5 +}; + +enum Seats +{ + SEAT_PLAYER = 0 +}; + +class boss_general_husam : public CreatureScript +{ +public: + boss_general_husam() : CreatureScript("boss_general_husam") { } + + struct boss_general_husamAI : public BossAI + { + boss_general_husamAI(Creature* creature) : BossAI(creature, DATA_GENERAL_HUSAM) { } + + void Reset() override + { + _Reset(); + _shockwaveStalkerCount = 0; + } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + Talk(SAY_AGGRO); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + events.ScheduleEvent(EVENT_HAMMER_FIST, Seconds(10)); + events.ScheduleEvent(EVENT_SHOCKWAVE, Seconds(18)); + events.ScheduleEvent(EVENT_MYSTIC_TRAP, Seconds(7) + Milliseconds(500)); + events.ScheduleEvent(EVENT_BAD_INTENTIONS, Seconds(13)); + } + + void KilledUnit(Unit* victim) override + { + if (victim->GetTypeId() == TYPEID_PLAYER) + Talk(SAY_SLAY); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + summons.DespawnAll(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + Talk(SAY_DEATH); + } + + void EnterEvadeMode(EvadeReason /*why*/) override + { + _EnterEvadeMode(); + summons.DespawnAll(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + _DespawnAtEvade(); + } + + void JustSummoned(Creature* summon) override + { + summons.Summon(summon); + + if (summon->GetEntry() == NPC_SHOCKWAVE_STALKER) + { + _shockwaveStalkerCount++; + float x = summon->GetPositionX(); + float y = summon->GetPositionY(); + float z = summon->GetPositionZ(); + float orientation = summon->GetAngle(me->GetPosition()) + float(M_PI); + summon->GetMotionMaster()->MovePoint(0, x + cos(orientation) * 200, y + sin(orientation) * 200, z, false); + + if (_shockwaveStalkerCount == 4) + { + DoCastSelf(SPELL_SHOCKWAVE); + _shockwaveStalkerCount = 0; + } + } + } + + void PassengerBoarded(Unit* /*who*/, int8 seatId, bool apply) override + { + if (!me->GetVehicleKit()) + return; + + if (apply && seatId == SEAT_PLAYER) + { + me->AttackStop(); + me->SetReactState(REACT_PASSIVE); + events.ScheduleEvent(EVENT_THROW_PLAYER, Seconds(1)); + } + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_HAMMER_FIST: + DoCastSelf(SPELL_HAMMER_FIST, true); + events.Repeat(Seconds(20)); + break; + case EVENT_SHOCKWAVE: + Talk(SAY_ANNOUNCE_SHOCKWAVE); + Talk(SAY_SHOCKWAVE); + DoCastSelf(SPELL_SUMMON_SHOCKWAVE_TARGET_N, true); + DoCastSelf(SPELL_SUMMON_SHOCKWAVE_TARGET_S, true); + DoCastSelf(SPELL_SUMMON_SHOCKWAVE_TARGET_E, true); + DoCastSelf(SPELL_SUMMON_SHOCKWAVE_TARGET_W, true); + events.Repeat(Seconds(39)); + if (IsHeroic()) + events.ScheduleEvent(EVENT_DETONATE_TRAPS, Seconds(6)); + break; + case EVENT_MYSTIC_TRAP: + DoCastSelf(SPELL_MYSTIC_TRAP, true); + events.Repeat(Seconds(16) + Milliseconds(500)); + break; + case EVENT_DETONATE_TRAPS: + Talk(SAY_DETONATE_MINES); + DoCastSelf(SPELL_DETONE_TRAPS); + break; + case EVENT_BAD_INTENTIONS: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_BAD_INTENTIONS); + events.Repeat(Seconds(25)); + break; + case EVENT_THROW_PLAYER: + DoCastSelf(SPELL_HURL, true); + DoCastSelf(SPELL_THROW_VISUAL, true); + me->SetReactState(REACT_AGGRESSIVE); + break; + default: + break; + } + } + DoMeleeAttackIfReady(); + } + + private: + uint8 _shockwaveStalkerCount; + }; + + CreatureAI* GetAI(Creature *creature) const override + { + return GetLostCityOfTheTolvirAI(creature); + } +}; + +class npc_husam_tolvir_land_mine : public CreatureScript +{ +public: + npc_husam_tolvir_land_mine() : CreatureScript("npc_husam_tolvir_land_mine") { } + + struct npc_husam_tolvir_land_mineAI : public ScriptedAI + { + npc_husam_tolvir_land_mineAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + void IsSummonedBy(Unit* /*summoner*/) override + { + if (Creature* husam = _instance->GetCreature(DATA_GENERAL_HUSAM)) + husam->AI()->JustSummoned(me); + + _events.ScheduleEvent(EVENT_READY_MINE, Seconds(2)); + } + + void SpellHitTarget(Unit* target, SpellInfo const* spell) override + { + if (spell->Id == SPELL_LAND_MINE_PLAYER_SEARCH_EFFECT && target->GetTypeId() == TYPEID_PLAYER) + { + DoCastSelf(SPELL_MYSTIC_TRAP_DAMAGE, true); + me->RemoveAurasDueToSpell(SPELL_LAND_MINE_PLAYER_SEARCH_TRIGGER); + me->RemoveAurasDueToSpell(SPELL_TOLVIR_LAND_MINE_VISUAL); + me->RemoveAurasDueToSpell(SPELL_LAND_MINE_PERIODIC); + me->DespawnOrUnsummon(3000); + } + } + + void DoAction(int32 action) override + { + if (action == ACTION_DETONATE_MINE) + { + _events.CancelEvent(EVENT_START_COUNTDOWN); + _events.ScheduleEvent(EVENT_START_COUNTDOWN, 1); + } + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_READY_MINE: + DoCastSelf(SPELL_TOLVIR_LAND_MINE_VISUAL, true); + DoCastSelf(SPELL_LAND_MINE_PLAYER_SEARCH_TRIGGER, true); + _events.ScheduleEvent(EVENT_START_COUNTDOWN, Seconds(20)); + break; + case EVENT_START_COUNTDOWN: + DoCastSelf(SPELL_LAND_MINE_PERIODIC, true); + _events.ScheduleEvent(EVENT_CLEAR_AURAS, Seconds(5)); + break; + case EVENT_CLEAR_AURAS: + me->RemoveAurasDueToSpell(SPELL_TOLVIR_LAND_MINE_VISUAL); + me->RemoveAurasDueToSpell(SPELL_LAND_MINE_PLAYER_SEARCH_TRIGGER); + me->DespawnOrUnsummon(3000); + break; + default: + break; + } + } + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetLostCityOfTheTolvirAI(creature); + } +}; + +class npc_husam_tolvir_land_mine_trigger : public CreatureScript +{ +public: + npc_husam_tolvir_land_mine_trigger() : CreatureScript("npc_husam_tolvir_land_mine_trigger") { } + + struct npc_husam_tolvir_land_mine_triggerAI : public ScriptedAI + { + npc_husam_tolvir_land_mine_triggerAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { } + + void IsSummonedBy(Unit* /*summoner*/) override + { + if (Creature* husam = _instance->GetCreature(DATA_GENERAL_HUSAM)) + husam->CastSpell(me, SPELL_THROW_LAND_MINES, true); + } + + private: + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetLostCityOfTheTolvirAI(creature); + } +}; + +class npc_husam_tolvir_land_mine_vehicle : public CreatureScript +{ +public: + npc_husam_tolvir_land_mine_vehicle() : CreatureScript("npc_husam_tolvir_land_mine_vehicle") { } + + struct npc_husam_tolvir_land_mine_vehicleAI : public ScriptedAI + { + npc_husam_tolvir_land_mine_vehicleAI(Creature* creature) : ScriptedAI(creature) { } + + void IsSummonedBy(Unit* /*summoner*/) override + { + if (Creature* mine = me->SummonCreature(NPC_TOLVIR_LAND_MINE, me->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 30000)) + mine->CastSpell(me, VEHICLE_SPELL_RIDE_HARDCODED, true); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetLostCityOfTheTolvirAI(creature); + } +}; + +class spell_husam_hammer_fist : public SpellScriptLoader +{ +public: + spell_husam_hammer_fist() : SpellScriptLoader("spell_husam_hammer_fist") { } + + class spell_husam_hammer_fist_AuraScript : public AuraScript + { + PrepareAuraScript(spell_husam_hammer_fist_AuraScript); + + void HandleTick(AuraEffect const* /*aurEff*/) + { + PreventDefaultAction(); + if (Unit* caster = GetCaster()) + if (caster->GetVictim()) + caster->CastSpell(GetCaster()->GetVictim(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_husam_hammer_fist_AuraScript::HandleTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_husam_hammer_fist_AuraScript(); + } +}; + +class spell_husam_shockwave : public SpellScriptLoader +{ +public: + spell_husam_shockwave() : SpellScriptLoader("spell_husam_shockwave") { } + + class spell_husam_shockwave_SpellScript : public SpellScript + { + PrepareSpellScript(spell_husam_shockwave_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHOCKWAVE_VISUAL)) + return false; + + return true; + } + + void EffectScriptEffect(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), SPELL_SHOCKWAVE_VISUAL, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_husam_shockwave_SpellScript::EffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_husam_shockwave_SpellScript(); + } +}; + +class spell_husam_shockwave_summon_search : public SpellScriptLoader +{ +public: + spell_husam_shockwave_summon_search() : SpellScriptLoader("spell_husam_shockwave_summon_search") { } + + class spell_husam_shockwave_summon_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_husam_shockwave_summon_search_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_SHOCKWAVE_SUMMON_EFFECT)) + return false; + + return true; + } + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + GetCaster()->CastSpell(GetCaster(), SPELL_SHOCKWAVE_SUMMON_EFFECT, true); + } + + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_husam_shockwave_summon_search_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_husam_shockwave_summon_search_SpellScript(); + } +}; + +class spell_husam_mystic_trap : public SpellScriptLoader +{ +public: + spell_husam_mystic_trap() : SpellScriptLoader("spell_husam_mystic_trap") { } + + class spell_husam_mystic_trap_SpellScript : public SpellScript + { + PrepareSpellScript(spell_husam_mystic_trap_SpellScript); + + void FilterTargets(std::list& targets) + { + if (targets.empty()) + return; + + Trinity::Containers::RandomResize(targets, 3); + } + + void Register() + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_husam_mystic_trap_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_husam_mystic_trap_SpellScript(); + } +}; + +class spell_husam_detonate_traps : public SpellScriptLoader +{ +public: + spell_husam_detonate_traps() : SpellScriptLoader("spell_husam_detonate_traps") { } + + class spell_husam_detonate_traps_SpellScript : public SpellScript + { + PrepareSpellScript(spell_husam_detonate_traps_SpellScript); + + void EffectScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Creature* target = GetHitCreature()) + target->AI()->DoAction(ACTION_DETONATE_MINE); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_husam_detonate_traps_SpellScript::EffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_husam_detonate_traps_SpellScript(); + } +}; + +class spell_husam_bad_intentions : public SpellScriptLoader +{ +public: + spell_husam_bad_intentions() : SpellScriptLoader("spell_husam_bad_intentions") { } + + class spell_husam_bad_intentions_SpellScript : public SpellScript + { + PrepareSpellScript(spell_husam_bad_intentions_SpellScript); + + void HandleScriptEffect(SpellEffIndex /*effIndex*/) + { + GetHitUnit()->CastStop(); + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[EFFECT_1].BasePoints, true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_husam_bad_intentions_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_husam_bad_intentions_SpellScript(); + } +}; + +class spell_husam_hurl : public SpellScriptLoader +{ +public: + spell_husam_hurl() : SpellScriptLoader("spell_husam_hurl") { } + + class spell_husam_hurl_SpellScript : public SpellScript + { + PrepareSpellScript(spell_husam_hurl_SpellScript); + + void EffectScriptEffect(SpellEffIndex /*effIndex*/) + { + if (Vehicle* vehicle = GetCaster()->GetVehicleKit()) + { + if (Unit* passenger = vehicle->GetPassenger(SEAT_PLAYER)) + { + passenger->ExitVehicle(); + if (Creature* intentionsTarget = GetCaster()->FindNearestCreature(NPC_BAD_INTENTIONS_TARGET, 100.0f, true)) + passenger->CastSpell(intentionsTarget, GetSpellInfo()->Effects[EFFECT_0].BasePoints, true); + } + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_husam_hurl_SpellScript::EffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_husam_hurl_SpellScript(); + } +}; + +void AddSC_boss_general_husam() +{ + new boss_general_husam(); + new npc_husam_tolvir_land_mine(); + new npc_husam_tolvir_land_mine_trigger(); + new npc_husam_tolvir_land_mine_vehicle(); + new spell_husam_hammer_fist(); + new spell_husam_shockwave(); + new spell_husam_shockwave_summon_search(); + new spell_husam_mystic_trap(); + new spell_husam_detonate_traps(); + new spell_husam_bad_intentions(); + new spell_husam_hurl(); +} diff --git a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp new file mode 100644 index 0000000000..d7c2a9cfdb --- /dev/null +++ b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp @@ -0,0 +1,70 @@ +/* +* Copyright (C) 2008-2017 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "lost_city_of_the_tolvir.h" + +ObjectData const creatureData[] = +{ + { BOSS_GENERAL_HUSAM, DATA_GENERAL_HUSAM }, + { BOSS_LOCKMAW, DATA_LOCKMAW }, + { BOSS_AUGH, DATA_AUGH }, + { BOSS_HIGH_PROPHET_BARIM, DATA_HIGH_PROPHET_BARIM }, + { BOSS_SIAMAT, DATA_SIAMAT }, + { 0, 0 } // End +}; + +ObjectData const gameObjectData[] = +{ + { GO_SIAMAT_PLATFORM, DATA_SIAMAT_PLATFORM }, + { 0, 0 } // End +}; + +class instance_lost_city_of_the_tolvir : public InstanceMapScript +{ +public: + instance_lost_city_of_the_tolvir() : InstanceMapScript(LCTScriptName, 755) { } + + struct instance_lost_city_of_the_tolvir_InstanceMapScript : public InstanceScript + { + instance_lost_city_of_the_tolvir_InstanceMapScript(Map* map) : InstanceScript(map) + { + SetHeaders(DataHeader); + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, gameObjectData); + } + + bool SetBossState(uint32 type, EncounterState state) override + { + if (!InstanceScript::SetBossState(type, state)) + return false; + + return true; + } + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const override + { + return new instance_lost_city_of_the_tolvir_InstanceMapScript(map); + } +}; + +void AddSC_instance_lost_city_of_the_tolvir() +{ + new instance_lost_city_of_the_tolvir(); +} diff --git a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h new file mode 100644 index 0000000000..f23f2780ef --- /dev/null +++ b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2008-2017 TrinityCore +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along +* with this program. If not, see . +*/ + +#ifndef LOST_CITY_OF_THE_TOLVIR_H_ +#define LOST_CITY_OF_THE_TOLVIR_H_ + +#define LCTScriptName "instance_lost_city_of_the_tolvir" +#define DataHeader "LCT" + +uint32 const EncounterCount = 4; + +enum LCTDataTypes +{ + // Encounter States + DATA_GENERAL_HUSAM = 1, + DATA_LOCKMAW = 2, + DATA_AUGH = 3, + DATA_HIGH_PROPHET_BARIM = 4, + DATA_SIAMAT = 5, + + // Additional Data + DATA_SIAMAT_PLATFORM = 6 +}; + +enum LCTCreatureIds +{ + // Bosses + BOSS_GENERAL_HUSAM = 44577, + BOSS_LOCKMAW = 43614, + BOSS_AUGH = 49045, + BOSS_HIGH_PROPHET_BARIM = 43612, + BOSS_SIAMAT = 44819, + + // Misc + NPC_BAD_INTENTIONS_TARGET = 44586, + NPC_SHOCKWAVE_STALKER = 44711, + NPC_SHOCKWAVE_VISUAL = 44712, + NPC_TOLVIR_LAND_MINE = 44796 +}; + +enum LCTGameObjectIds +{ + GO_SIAMAT_PLATFORM = 205365 +}; + +template +AI* GetLostCityOfTheTolvirAI(Creature* creature) +{ + return GetInstanceAI(creature, LCTScriptName); +} + +#endif // LOST_CITY_OF_THE_TOLVIR_H_ diff --git a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp index 44ee0f251e..7e3382a269 100644 --- a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp +++ b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp @@ -93,6 +93,8 @@ void AddSC_boss_skum(); void AddSC_boss_zum_rah(); //Zul'Farrak void AddSC_zulfarrak(); void AddSC_instance_zulfarrak(); +void AddSC_instance_lost_city_of_the_tolvir(); // Lost City of the Tol'Vir +void AddSC_boss_general_husam(); void AddSC_instance_halls_of_origination(); //Halls of Origination void AddSC_boss_temple_guardian_anhuur(); void AddSC_boss_earthrager_ptah(); @@ -203,6 +205,8 @@ void AddKalimdorScripts() AddSC_boss_zum_rah(); //Zul'Farrak AddSC_zulfarrak(); AddSC_instance_zulfarrak(); + AddSC_instance_lost_city_of_the_tolvir(); // Lost City of the Tol'Vir + AddSC_boss_general_husam(); AddSC_instance_halls_of_origination(); //Halls of Origination AddSC_boss_temple_guardian_anhuur(); AddSC_boss_earthrager_ptah();