diff --git a/sql/updates/world/custom/custom_2018_08_06_00_world.sql b/sql/updates/world/custom/custom_2018_08_06_00_world.sql
new file mode 100644
index 0000000000..e147fb63c8
--- /dev/null
+++ b/sql/updates/world/custom/custom_2018_08_06_00_world.sql
@@ -0,0 +1,56 @@
+UPDATE `creature_template` SET `ScriptName`= 'npc_tott_ozumat_vehicle_big' WHERE `entry`= 45030;
+UPDATE `creature_template` SET `VehicleId`= 1074 WHERE `entry`= 49101;
+
+DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (45030, 49101);
+INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES
+(45030, 46598, 1, 1),
+(49101, 46598, 1, 1);
+
+-- Naz'jar Sentinel
+SET @ENTRY := 40577;
+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, 0, 0, 100, 0, 4000, 6000, 4000, 6000, 11, 77218, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 4000 and 6000 ms (and later repeats every 4000 and 6000 ms) - Self: Cast spell 77218 on Random hostile // "),
+(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 13000, 14000, 13000, 14000, 11, 76721, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 13000 and 14000 ms (and later repeats every 13000 and 14000 ms) - Self: Cast spell 76721 on Victim // ");
+UPDATE `creature_template` SET `DamageModifier`= 30, `BaseVariance`= 0.5 WHERE `entry`= 40577;
+UPDATE `creature_template` SET `DamageModifier`= 60, `BaseVariance`= 0.5 WHERE `entry`= 49087;
+UPDATE `creature_template` SET `mechanic_immune_mask`= 1 | 2 | 4 | 16 | 32 | 512 | 65536 | 131072, `flags_extra`= 0x40000000 WHERE `entry` IN (40577, 49087);
+
+-- Noxius Mire
+UPDATE `creature_template` SET `unit_flags`= 33554432, `flags_extra`= 128 WHERE `entry`= 41201;
+DELETE FROM `creature_template_addon` WHERE `entry`= 41201;
+INSERT INTO `creature_template_addon` (`entry`, `auras`) VALUES
+(41201, '77217');
+
+-- Naz'jar Invader and Naz'jar Spiritmender
+UPDATE `creature_template` SET `unit_flags`= `unit_flags` & ~256, `InhabitType`= 1, `flags_extra`= 0x00000200 WHERE `entry` IN (41096, 49090, 39616, 49085);
+UPDATE `creature_template` SET `BaseVariance`= 0.5, `DamageModifier`= 15 WHERE `entry` IN (41096, 39616);
+UPDATE `creature_template` SET `BaseVariance`= 0.5, `DamageModifier`= 30 WHERE `entry` IN (49090, 49085);
+
+-- Conditions
+DELETE FROM `conditions` WHERE `SourceEntry`= 74465 AND `SourceTypeOrReferenceId`= 13;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES
+(13, 1, 74465, 0, 0, 31, 0, 3, 22515, 0, 0, 0, '', 'Summon Falling Rocks - Target World Trigger');
+
+-- Areatriggers
+DELETE FROM `areatrigger_scripts` WHERE `entry`= 5806;
+INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES
+(5806, 'at_tott_first_invader_event');
+
+-- Creature Naz'jar Spiritmender 41096 SAI
+SET @ENTRY := 41096;
+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, 0, 0, 100, 0, 1500, 1500, 2400, 2400, 11, 76815, 64, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 1500 and 1500 ms (and later repeats every 2400 and 2400 ms) - Self: Cast spell 76815 on Victim // "),
+(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 22000, 23000, 14000, 15000, 11, 76820, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "When in combat and timer at the begining between 22000 and 23000 ms (and later repeats every 14000 and 15000 ms) - Self: Cast spell 76820 on Random hostile // "),
+(@ENTRY, 0, 2, 0, 2, 0, 100, 0, 0, 50, 5000, 5000, 11, 76813, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When health between 0% and 50% (check every 5000 - 5000 ms) - Self: Cast spell 76813 on Self // ");
+
+-- Creature Naz'jar Invader 39616 SAI
+SET @ENTRY := 39616;
+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, 60, 0, 100, 0, 5000, 7000, 5000, 7000, 11, 76807, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Every 5000 and 7000 ms (for the first time, timer between 5000 and 7000 ms) - Self: Cast spell 76807 on Victim // "),
+(@ENTRY, 0, 1, 0, 2, 0, 100, 0, 0, 50, 5000, 5000, 86, 76813, 0, 11, 41096, 20, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When health between 0% and 50% (check every 5000 - 5000 ms) - SMART_TARGET_CREATURE_DISTANCE: Cast spell 76813 at Self // ");
diff --git a/src/server/scripts/EasternKingdoms/ThroneOfTheTides/instance_throne_of_the_todes.cpp b/src/server/scripts/EasternKingdoms/ThroneOfTheTides/instance_throne_of_the_todes.cpp
index a9561cbe3a..fbfaa6a316 100644
--- a/src/server/scripts/EasternKingdoms/ThroneOfTheTides/instance_throne_of_the_todes.cpp
+++ b/src/server/scripts/EasternKingdoms/ThroneOfTheTides/instance_throne_of_the_todes.cpp
@@ -19,6 +19,7 @@
#include "throne_of_the_tides.h"
#include "InstanceScript.h"
#include "Vehicle.h"
+#include "MoveSpline.h"
ObjectData const creatureData[] =
{
@@ -29,6 +30,57 @@ ObjectData const creatureData[] =
{ 0, 0 } // END
};
+enum Events
+{
+ EVENT_FALLING_ROCKS = 1
+};
+
+Position const fallingRocksDummyPos = { -144.283f, 983.316f, 230.4773f };
+
+class FaceDirectionEvent : public BasicEvent
+{
+ public:
+ FaceDirectionEvent(Creature* owner, float facingAngle) : _owner(owner), _facingAngle(facingAngle) { }
+
+ bool Execute(uint64 /*time*/, uint32 /*diff*/) override
+ {
+ _owner->RemoveAurasDueToSpell(SPELL_WATER_JUMP_THROUGH_WINDOW_VISUAL);
+ _owner->SetDisableGravity(false);
+ _owner->SendSetPlayHoverAnim(false);
+ _owner->SetMovementAnimKitId(0);
+ _owner->SetFacingTo(_facingAngle);
+ _owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ _owner->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2HL);
+ _owner->SetReactState(REACT_AGGRESSIVE);
+ return true;
+ }
+
+ private:
+ Creature* _owner;
+ float _facingAngle;
+};
+
+
+class JumpThroughWindowEvent : public BasicEvent
+{
+ public:
+ JumpThroughWindowEvent(Creature* owner, Position const jumpPos) : _owner(owner), _jumpPos(jumpPos) { }
+
+ bool Execute(uint64 /*time*/, uint32 /*diff*/) override
+ {
+ _owner->CastSpell(_owner, SPELL_WATER_JUMP_THROUGH_WINDOW_VISUAL, true);
+ _owner->GetMotionMaster()->MoveJump(_jumpPos, 16.0f, 10.0f);
+ _owner->SetHomePosition(_jumpPos);
+ if (int32 travelTime = _owner->movespline->Duration())
+ _owner->m_Events.AddEvent(new FaceDirectionEvent(_owner, _jumpPos.GetOrientation()), _owner->m_Events.CalculateTime(travelTime));
+ return true;
+ }
+
+ private:
+ Creature* _owner;
+ Position const _jumpPos;
+};
+
class instance_throne_of_the_tides : public InstanceMapScript
{
public:
@@ -46,6 +98,8 @@ class instance_throne_of_the_tides : public InstanceMapScript
void Initialize()
{
+ _eventIndex = EVENT_INDEX_NONE;
+ _fallingRocksDummyGUID = ObjectGuid::Empty;
}
bool SetBossState(uint32 type, EncounterState state) override
@@ -68,6 +122,17 @@ class instance_throne_of_the_tides : public InstanceMapScript
creature->setActive(true);
creature->SetFarVisible(true);
break;
+ case NPC_WORLD_TRIGGER_INFINITE_AOI:
+ creature->setActive(true);
+ creature->SetFarVisible(true);
+
+ if (creature->GetExactDist2d(fallingRocksDummyPos) < 1.0f)
+ {
+ _fallingRocksDummyGUID = creature->GetGUID();
+ if (_eventIndex < EVENT_INDEX_DEFENSE_SYSTEM_ACTIVATED)
+ events.ScheduleEvent(EVENT_FALLING_ROCKS, 1min + 15s);
+ }
+ break;
default:
break;
}
@@ -75,22 +140,81 @@ class instance_throne_of_the_tides : public InstanceMapScript
uint32 GetData(uint32 type) const override
{
+ switch (type)
+ {
+ case DATA_CURRENT_EVENT_PROGRESS:
+ return _eventIndex;
+ }
return 0;
}
void SetData(uint32 type, uint32 data) override
{
+ switch (type)
+ {
+ case DATA_CURRENT_EVENT_PROGRESS:
+ _eventIndex = data;
+
+ if (data == EVENT_INDEX_FIRST_INVADERS)
+ {
+ for (uint8 i = 0; i < 4; i++)
+ {
+ if (Creature* invader = instance->SummonCreature(i < 2 ? NPC_NAZJAR_SPIRITMENDER : NPC_NAZJAR_INVADER, TotTFirstInvaderPositions[i]))
+ {
+ invader->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
+ invader->SetDisableGravity(true);
+ invader->SendSetPlayHoverAnim(true);
+ invader->SetMovementAnimKitId(3);
+ invader->SetReactState(REACT_PASSIVE);
+ invader->GetMotionMaster()->MovePoint(0, TotTFirstInvaderInitialMovePositions[i], false);
+ if (int32 travelTime = invader->movespline->Duration() + 200)
+ invader->m_Events.AddEvent(new JumpThroughWindowEvent(invader, TotTFirstInvaderJumpPositions[i]), invader->m_Events.CalculateTime(travelTime));
+ }
+ }
+ }
+
+ if (data == EVENT_INDEX_DEFENSE_SYSTEM_ACTIVATED)
+ events.CancelEvent(EVENT_FALLING_ROCKS);
+ SaveToDB();
+ break;
+ default:
+ break;
+ }
+ }
+
+ void Update(uint32 diff) override
+ {
+ events.Update(diff);
+
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case EVENT_FALLING_ROCKS:
+ if (Creature* fallingRocksDummy = instance->GetCreature(_fallingRocksDummyGUID))
+ fallingRocksDummy->CastSpell(fallingRocksDummy, SPELL_SUMMON_FALLING_ROCKS, true);
+ events.Repeat(1min + 25s, 2min);
+ break;
+ default:
+ break;
+ }
+ }
}
void WriteSaveDataMore(std::ostringstream& data) override
{
+ data << _eventIndex;
}
void ReadSaveDataMore(std::istringstream& data) override
{
+ data >> _eventIndex;
}
private:
+ EventMap events;
+ uint8 _eventIndex;
+ ObjectGuid _fallingRocksDummyGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
diff --git a/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.cpp b/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.cpp
index 2989354918..fee371e771 100644
--- a/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.cpp
+++ b/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.cpp
@@ -15,6 +15,52 @@
* with this program. If not, see .
*/
+#include "throne_of_the_tides.h"
+#include "ScriptedCreature.h"
+#include "Vehicle.h"
+
+
+struct npc_tott_ozumat_vehicle_big : public ScriptedAI
+{
+ npc_tott_ozumat_vehicle_big(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript()) { }
+
+ void JustAppeared() override
+ {
+ if (_instance->GetData(DATA_CURRENT_EVENT_PROGRESS) < EVENT_INDEX_DEFENSE_SYSTEM_ACTIVATED)
+ if (Creature* ozumat = DoSummon(BOSS_OZUMAT, me->GetPosition()))
+ me->HandleSpellClick(ozumat, -1);
+ }
+
+ void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) override
+ {
+ if (!who)
+ return;
+
+ if (apply)
+ who->SetFacingTo(3.141593f, true);
+ }
+
+private:
+ InstanceScript* _instance;
+};
+
+class at_tott_first_invader_event : public AreaTriggerScript
+{
+ public:
+ at_tott_first_invader_event() : AreaTriggerScript("at_tott_first_invader_event") { }
+
+ bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/)
+ {
+ if (InstanceScript* instance = player->GetInstanceScript())
+ if (instance->GetData(DATA_CURRENT_EVENT_PROGRESS) < EVENT_INDEX_FIRST_INVADERS)
+ instance->SetData(DATA_CURRENT_EVENT_PROGRESS, EVENT_INDEX_FIRST_INVADERS);
+
+ return true;
+ }
+};
+
void AddSC_throne_of_the_tides()
{
+ RegisterThroneOfTheTidesCreatureAI(npc_tott_ozumat_vehicle_big);
+ new at_tott_first_invader_event();
}
diff --git a/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.h b/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.h
index e4762234b5..d1228eaf89 100644
--- a/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.h
+++ b/src/server/scripts/EasternKingdoms/ThroneOfTheTides/throne_of_the_tides.h
@@ -28,23 +28,69 @@ uint32 const EncounterCount = 4;
enum TotTDataTypes
{
// Encounters
- DATA_LADY_NAZJAR = 0,
- DATA_COMMANDER_ULTHOK = 1,
- DATA_MINDBENDER_GURSHA = 2,
- DATA_OZUMAT = 3
+ DATA_LADY_NAZJAR = 0,
+ DATA_COMMANDER_ULTHOK = 1,
+ DATA_MINDBENDER_GURSHA = 2,
+ DATA_OZUMAT = 3,
+
+ // Additional Data Types
+ DATA_CURRENT_EVENT_PROGRESS = 4
};
enum TotTCreatureIds
{
// Bosses
- BOSS_LADY_NAZJAR = 40586,
- BOSS_COMMANDER_ULTHOK = 40765,
- BOSS_MINDBENDER_GURSHA = 40788,
- BOSS_OZUMAT = 40655,
+ BOSS_LADY_NAZJAR = 40586,
+ BOSS_COMMANDER_ULTHOK = 40765,
+ BOSS_MINDBENDER_GURSHA = 40788,
+ BOSS_OZUMAT = 40655,
// Event Creatures
- NPC_OZUMAT_VEHICLE_BIG = 45030,
- NPC_OZUMAT_VEHICLE = 44581
+ NPC_OZUMAT_VEHICLE_BIG = 45030,
+ NPC_OZUMAT_VEHICLE = 44581,
+ NPC_WORLD_TRIGGER_INFINITE_AOI = 36171,
+ NPC_NAZJAR_SPIRITMENDER = 41096,
+ NPC_NAZJAR_INVADER = 39616,
+
+};
+
+enum TotTSpells
+{
+ SPELL_SUMMON_FALLING_ROCKS = 74465,
+ SPELL_WATER_JUMP_THROUGH_WINDOW_VISUAL = 74048
+};
+
+enum TotTEventIndex
+{
+ EVENT_INDEX_NONE = 0,
+ EVENT_INDEX_FIRST_INVADERS,
+ EVENT_INDEX_LADY_NAZJAR_GAUNTLET,
+ EVENT_INDEX_DEFENSE_SYSTEM_ACTIVATED,
+ EVENT_INDEX_ULTHOK_ARRIVED
+};
+
+Position const TotTFirstInvaderPositions[] =
+{
+ { -409.0035f, 839.2552f, 262.0498f, 5.119945f }, // Naz'jar Spiritmender
+ { -396.9653f, 779.9288f, 265.7069f, 1.55391f }, // Naz'jar Spiritmender
+ { -421.6042f, 839.7882f, 263.3889f, 4.842506f }, // Naz'jar Invader
+ { -411.3646f, 778.8055f, 262.9503f, 1.528872f } // Naz'Jar Invader
+};
+
+Position const TotTFirstInvaderInitialMovePositions[] =
+{
+ { -400.842f, 820.351f, 263.69f },
+ { -396.74f, 793.269f, 260.422f },
+ { -418.925f, 819.314f, 261.505f },
+ { -410.885f, 790.238f, 261.178f }
+};
+
+Position const TotTFirstInvaderJumpPositions[] =
+{
+ { -410.087f, 807.931f, 248.335f, 3.106686f },
+ { -409.13f, 802.774f, 248.357f, 3.106686f },
+ { -414.969f, 810.604f, 248.433f, 3.106686f },
+ { -413.5f, 798.38f, 248.561f, 3.106686f }
};
template