mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Scripts/KingsRest: Implement Intro event (#30026)
This commit is contained in:
43
sql/updates/world/master/2024_06_07_00_world.sql
Normal file
43
sql/updates/world/master/2024_06_07_00_world.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
SET @ATID := 67;
|
||||
SEt @ATCP := 55;
|
||||
SET @ATIDSPAWN := 69;
|
||||
|
||||
-- Instance Template
|
||||
DELETE FROM `instance_template` WHERE `map` = 1762;
|
||||
INSERT INTO `instance_template` (`map`, `parent`, `script`) VALUES
|
||||
(1762, 0, 'instance_kings_rest');
|
||||
|
||||
-- Creature Template Addon
|
||||
DELETE FROM `creature_template_addon` WHERE `entry` IN (137020 /*137020 (Shadow of Zul) - Zul Shadowform*/);
|
||||
INSERT INTO `creature_template_addon` (`entry`, `PathId`, `mount`, `StandState`, `AnimTier`, `VisFlags`, `SheathState`, `PvpFlags`, `emote`, `aiAnimKit`, `movementAnimKit`, `meleeAnimKit`, `visibilityDistanceType`, `auras`) VALUES
|
||||
(137020, 0, 0, 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, '269058'); -- 137020 (Shadow of Zul) - Zul Shadowform
|
||||
|
||||
-- Areatrigger
|
||||
DELETE FROM `areatrigger_template` WHERE (`Id` = @ATID+0 AND `IsCustom` = 1);
|
||||
INSERT INTO `areatrigger_template` (`Id`, `IsCustom`, `Flags`, `VerifiedBuild`) VALUES
|
||||
(@ATID+0, 1, 1, 0);
|
||||
|
||||
DELETE FROM `areatrigger_create_properties` WHERE (`Id`= @ATCP+0 AND `IsCustom`=1);
|
||||
INSERT INTO `areatrigger_create_properties` (`Id`, `IsCustom`, `AreaTriggerId`, `IsAreatriggerCustom`, `Flags`, `MoveCurveId`, `ScaleCurveId`, `MorphCurveId`, `FacingCurveId`, `AnimId`, `AnimKitId`, `DecalPropertiesId`, `TimeToTarget`, `TimeToTargetScale`, `Shape`, `ShapeData0`, `ShapeData1`, `ShapeData2`, `ShapeData3`, `ShapeData4`, `ShapeData5`, `ShapeData6`, `ShapeData7`, `ScriptName`, `VerifiedBuild`) VALUES
|
||||
(@ATCP+0, 1, @ATID+0, 1, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 16, 18, 10, 16, 18, 10, 0, 0, '', 0);
|
||||
|
||||
DELETE FROM `areatrigger` WHERE `SpawnId` = @ATIDSPAWN+0;
|
||||
INSERT INTO `areatrigger` (`SpawnId`, `AreaTriggerCreatePropertiesId`, `IsCustom`, `MapId`, `SpawnDifficulties`, `PosX`, `PosY`, `PosZ`, `Orientation`, `PhaseUseFlags`, `PhaseId`, `PhaseGroup`, `ScriptName`, `Comment`, `VerifiedBuild`) VALUES
|
||||
(@ATIDSPAWN+0, @ATCP+0, 1, 1762, '23,8,2', -945.071, 2602.210, 833.052, 1.556985, 0, 0, 0, 'at_kings_rest_trigger_intro_event_with_zul', 'KingsRest - Trigger intro Conversation for Zul', 0);
|
||||
|
||||
-- Conversation
|
||||
DELETE FROM `conversation_template` WHERE `Id`=7690;
|
||||
INSERT INTO `conversation_template` (`Id`, `FirstLineID`, `TextureKitId`, `VerifiedBuild`) VALUES
|
||||
(7690, 17525, 0, 54904);
|
||||
|
||||
UPDATE `conversation_template` SET `ScriptName` = 'conversation_kings_rest_intro' WHERE `Id` = 7690;
|
||||
|
||||
DELETE FROM `conversation_actors` WHERE (`ConversationId`=7690 AND `Idx`=0);
|
||||
INSERT INTO `conversation_actors` (`ConversationId`, `ConversationActorId`, `Idx`, `CreatureId`, `CreatureDisplayInfoId`, `NoActorObject`, `ActivePlayerObject`, `VerifiedBuild`) VALUES
|
||||
(7690, 64206, 0, 0, 0, 0, 0, 54904); -- Full: 0x0
|
||||
|
||||
DELETE FROM `conversation_line_template` WHERE `Id` IN (17527, 17526, 17525);
|
||||
INSERT INTO `conversation_line_template` (`Id`, `UiCameraID`, `ActorIdx`, `Flags`, `ChatType`, `VerifiedBuild`) VALUES
|
||||
(17527, 0, 0, 0, 1, 54904),
|
||||
(17526, 0, 0, 0, 1, 54904),
|
||||
(17525, 0, 0, 0, 1, 54904);
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "InstanceScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "kings_rest.h"
|
||||
|
||||
ObjectData const creatureData[] =
|
||||
{
|
||||
{ BOSS_GOLDEN_SERPENT, DATA_GOLDEN_SERPENT },
|
||||
{ BOSS_MCHIMBA_THE_EMBALMER, DATA_MCHIMBA_THE_EMBALMER },
|
||||
{ BOSS_AKAALI_THE_CONQUEROR, DATA_AKAALI_THE_CONQUEROR },
|
||||
{ BOSS_ZANAZAL_THE_WISE, DATA_ZANAZAL_THE_WISE },
|
||||
{ BOSS_KULA_THE_BUTCHER, DATA_KULA_THE_BUTCHER },
|
||||
{ BOSS_KING_DAZAR, DATA_KING_DAZAR },
|
||||
{ 0, 0 } // END
|
||||
};
|
||||
|
||||
DoorData const doorData[] =
|
||||
{
|
||||
{ GO_KINGS_REST_SERPENT_POST_DOOR, DATA_GOLDEN_SERPENT, EncounterDoorBehavior::OpenWhenDone },
|
||||
{ 0, 0, EncounterDoorBehavior::OpenWhenNotInProgress } // END
|
||||
};
|
||||
|
||||
ObjectData const objectData[] =
|
||||
{
|
||||
{ GO_KINGS_REST_ENTRYWAY_DOOR, DATA_KINGS_REST_INTRO_DOOR },
|
||||
{ 0, 0 } // END
|
||||
};
|
||||
|
||||
DungeonEncounterData const encounters[] =
|
||||
{
|
||||
{ DATA_GOLDEN_SERPENT, {{ 2139 }} },
|
||||
{ DATA_COUNCIL_OF_TRIBES, {{ 2140 }} },
|
||||
{ DATA_MCHIMBA_THE_EMBALMER, {{ 2142 }} },
|
||||
{ DATA_KING_DAZAR, {{ 2143 }} },
|
||||
};
|
||||
|
||||
class instance_kings_rest : public InstanceMapScript
|
||||
{
|
||||
public:
|
||||
instance_kings_rest() : InstanceMapScript(KingsRestScriptName, 1762) { }
|
||||
|
||||
struct instance_kings_rest_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_kings_rest_InstanceMapScript(InstanceMap* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadObjectData(creatureData, objectData);
|
||||
LoadDoorData(doorData);
|
||||
LoadDungeonEncounterData(encounters);
|
||||
}
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
{
|
||||
return new instance_kings_rest_InstanceMapScript(map);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_kings_rest()
|
||||
{
|
||||
new instance_kings_rest();
|
||||
}
|
||||
149
src/server/scripts/Zandalar/KingsRest/kings_rest.cpp
Normal file
149
src/server/scripts/Zandalar/KingsRest/kings_rest.cpp
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "AreaTrigger.h"
|
||||
#include "AreaTriggerAI.h"
|
||||
#include "Conversation.h"
|
||||
#include "GameObject.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "TemporarySummon.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Unit.h"
|
||||
#include "kings_rest.h"
|
||||
|
||||
enum KingsRestData
|
||||
{
|
||||
// Creature
|
||||
NPC_SHADOW_OF_ZUL = 137020,
|
||||
|
||||
// DisplayIDs
|
||||
DISPLAY_INVISIBLE_ZUL = 11686,
|
||||
|
||||
// Spell Visuals
|
||||
SPELL_VISUAL_ZUL_OPEN_GOB = 77330,
|
||||
|
||||
// Conversation
|
||||
CONV_ZUL_KINGS_REST_INTRO = 7690,
|
||||
|
||||
// Spells
|
||||
SPELL_ZUL_SHADOWFORM = 269058
|
||||
};
|
||||
|
||||
constexpr Position ShadowOfZulIntroSpawnPosition = { -944.9617f, 2646.5268f, 832.8684f, 4.716575f };
|
||||
|
||||
// XX - KingsRest - Trigger Intro Event with Shadow of Zul
|
||||
struct at_kings_rest_trigger_intro_event_with_zul : AreaTriggerAI
|
||||
{
|
||||
at_kings_rest_trigger_intro_event_with_zul(AreaTrigger* areatrigger) : AreaTriggerAI(areatrigger) { }
|
||||
|
||||
void OnUnitEnter(Unit* unit) override
|
||||
{
|
||||
if (!unit->IsPlayer())
|
||||
return;
|
||||
|
||||
Conversation::CreateConversation(CONV_ZUL_KINGS_REST_INTRO, unit, unit->GetPosition(), unit->GetGUID());
|
||||
at->Remove();
|
||||
}
|
||||
};
|
||||
|
||||
// 7690 - Shadow of Zul - KingsRest Intro
|
||||
class conversation_kings_rest_intro : public ConversationScript
|
||||
{
|
||||
public:
|
||||
conversation_kings_rest_intro() : ConversationScript("conversation_kings_rest_intro") { }
|
||||
|
||||
enum KingsRestIntroConversationData
|
||||
{
|
||||
CONVO_ACTOR_INTRO_ZUL = 64206,
|
||||
|
||||
CONVO_LINE_INTRO_DOOR = 17526
|
||||
};
|
||||
|
||||
enum KingsRestIntroEventData
|
||||
{
|
||||
EVENT_ZUL_OPEN_INTRO_DOOR = 1,
|
||||
EVENT_ZUL_INTRO_DESPAWN,
|
||||
};
|
||||
|
||||
void OnConversationCreate(Conversation* conversation, Unit* /*creator*/) override
|
||||
{
|
||||
TempSummon* shadowOfZul = conversation->SummonCreature(NPC_SHADOW_OF_ZUL, ShadowOfZulIntroSpawnPosition, TEMPSUMMON_MANUAL_DESPAWN);
|
||||
if (!shadowOfZul)
|
||||
return;
|
||||
|
||||
conversation->AddActor(CONVO_ACTOR_INTRO_ZUL, 0, shadowOfZul->GetGUID());
|
||||
conversation->Start();
|
||||
}
|
||||
|
||||
void OnConversationStart(Conversation* conversation) override
|
||||
{
|
||||
_events.ScheduleEvent(EVENT_ZUL_OPEN_INTRO_DOOR, conversation->GetLineEndTime(DEFAULT_LOCALE, CONVO_LINE_INTRO_DOOR));
|
||||
}
|
||||
|
||||
void OnConversationUpdate(Conversation* conversation, uint32 diff) override
|
||||
{
|
||||
_events.Update(diff);
|
||||
|
||||
switch (_events.ExecuteEvent())
|
||||
{
|
||||
case EVENT_ZUL_OPEN_INTRO_DOOR:
|
||||
{
|
||||
Creature* shadowOfZul = conversation->GetActorCreature(0);
|
||||
if (!shadowOfZul)
|
||||
break;
|
||||
|
||||
shadowOfZul->RemoveAurasDueToSpell(SPELL_ZUL_SHADOWFORM);
|
||||
_events.ScheduleEvent(EVENT_ZUL_INTRO_DESPAWN, 1s);
|
||||
|
||||
if (InstanceScript* instance = conversation->GetInstanceScript())
|
||||
{
|
||||
if (GameObject* gate = instance->GetGameObject(DATA_KINGS_REST_INTRO_DOOR))
|
||||
{
|
||||
gate->SetGoState(GO_STATE_ACTIVE);
|
||||
gate->SetSpellVisualId(SPELL_VISUAL_ZUL_OPEN_GOB);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_ZUL_INTRO_DESPAWN:
|
||||
{
|
||||
Creature* shadowOfZul = conversation->GetActorCreature(0);
|
||||
if (!shadowOfZul)
|
||||
break;
|
||||
|
||||
shadowOfZul->SetDisplayId(DISPLAY_INVISIBLE_ZUL);
|
||||
shadowOfZul->DespawnOrUnsummon(1s);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
EventMap _events;
|
||||
};
|
||||
|
||||
void AddSC_kings_rest()
|
||||
{
|
||||
// Areatrigger
|
||||
RegisterAreaTriggerAI(at_kings_rest_trigger_intro_event_with_zul);
|
||||
|
||||
// Conversation
|
||||
new conversation_kings_rest_intro();
|
||||
}
|
||||
70
src/server/scripts/Zandalar/KingsRest/kings_rest.h
Normal file
70
src/server/scripts/Zandalar/KingsRest/kings_rest.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DEF_KINGS_REST_H_
|
||||
#define DEF_KINGS_REST_H_
|
||||
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#define DataHeader "KingsRest"
|
||||
#define KingsRestScriptName "instance_kings_rest"
|
||||
|
||||
uint32 const EncounterCount = 4;
|
||||
|
||||
enum KingsRestDataTypes
|
||||
{
|
||||
// Encounters
|
||||
DATA_GOLDEN_SERPENT = 0,
|
||||
DATA_MCHIMBA_THE_EMBALMER,
|
||||
DATA_COUNCIL_OF_TRIBES,
|
||||
DATA_KING_DAZAR,
|
||||
|
||||
// Council of Tribes
|
||||
DATA_AKAALI_THE_CONQUEROR,
|
||||
DATA_ZANAZAL_THE_WISE,
|
||||
DATA_KULA_THE_BUTCHER,
|
||||
|
||||
// GameObjects
|
||||
DATA_KINGS_REST_INTRO_DOOR,
|
||||
};
|
||||
|
||||
enum KingsRestCreatureIds
|
||||
{
|
||||
// Bosses
|
||||
BOSS_GOLDEN_SERPENT = 135322,
|
||||
BOSS_AKAALI_THE_CONQUEROR = 135470,
|
||||
BOSS_ZANAZAL_THE_WISE = 135472,
|
||||
BOSS_KULA_THE_BUTCHER = 135475,
|
||||
BOSS_MCHIMBA_THE_EMBALMER = 134993,
|
||||
BOSS_KING_DAZAR = 136160
|
||||
};
|
||||
|
||||
enum KingsRestGameObjectIds
|
||||
{
|
||||
GO_KINGS_REST_ENTRYWAY_DOOR = 282652,
|
||||
GO_KINGS_REST_SERPENT_POST_DOOR = 287392
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetKingsRestAI(T* obj)
|
||||
{
|
||||
return GetInstanceAI<AI>(obj, KingsRestScriptName);
|
||||
}
|
||||
|
||||
#define RegisterKingsRestCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetKingsRestAI)
|
||||
|
||||
#endif
|
||||
@@ -22,6 +22,10 @@ void AddSC_instance_underrot();
|
||||
void AddSC_boss_elder_leaxa();
|
||||
void AddSC_boss_cragmaw_the_infested();
|
||||
|
||||
// KingsRest
|
||||
void AddSC_instance_kings_rest();
|
||||
void AddSC_kings_rest();
|
||||
|
||||
// The name of this function should match:
|
||||
// void Add${NameOfDirectory}Scripts()
|
||||
void AddZandalarScripts()
|
||||
@@ -30,4 +34,8 @@ void AddZandalarScripts()
|
||||
AddSC_instance_underrot();
|
||||
AddSC_boss_elder_leaxa();
|
||||
AddSC_boss_cragmaw_the_infested();
|
||||
|
||||
//KingsRest
|
||||
AddSC_instance_kings_rest();
|
||||
AddSC_kings_rest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user