TrinityCore
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
instance_scarlet_monastery.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "scarlet_monastery.h"
19#include "Creature.h"
20#include "CreatureAI.h"
21#include "EventMap.h"
22#include "GameObject.h"
23#include "InstanceScript.h"
24#include "Map.h"
25#include "ScriptMgr.h"
26#include "TemporarySummon.h"
27
28Position const BunnySpawnPosition = { 1776.27f, 1348.74f, 19.20f };
29Position const EarthBunnySpawnPosition = { 1765.28f, 1347.46f, 18.55f, 6.17f };
30Position const HeadlessHorsemanSpawnPosition = { 1765.00f, 1347.00f, 15.00f };
31Position const HeadlessHorsemanHeadSpawnPosition = { 1788.54f, 1348.05f, 18.88f }; // Guessed
32
34{
43 { 0, 0 } // END
44};
45
47{
51 { 0, 0 } // END
52};
53
55{
56 public:
58
60 {
62 {
67 }
68
70 {
73 if (GameObject* gob = GetGameObject(data))
74 gob->SetFlag(GO_FLAG_NOT_SELECTABLE);
75
82 if (Creature* thomas = GetCreature(DATA_THOMAS))
83 thomas->DespawnOrUnsummon();
84 }
85
86 void SetData(uint32 type, uint32 data) override
87 {
88 switch (type)
89 {
93 break;
95 _horsemanState = data;
96 break;
100 if (Creature* bunny = GetCreature(data))
101 bunny->DespawnOrUnsummon();
102 break;
103 default:
104 break;
105 }
106 }
107
108 uint32 GetData(uint32 type) const override
109 {
110 switch (type)
111 {
113 return _horsemanState;
114 default:
115 return 0;
116 }
117 }
118
119 void Update(uint32 diff) override
120 {
121 if (_events.Empty())
122 return;
123
124 _events.Update(diff);
125
126 while (uint32 eventId = _events.ExecuteEvent())
127 {
128 switch (eventId)
129 {
131 if (Creature* earthBunny = GetCreature(DATA_EARTH_BUNNY))
132 earthBunny->CastSpell(earthBunny, SPELL_EARTH_EXPLOSION);
133 break;
136 horseman->AI()->DoAction(ACTION_HORSEMAN_EVENT_START);
137 break;
140 if (GameObject* gob = GetGameObject(data))
141 gob->RemoveFromWorld();
142 break;
143 default:
144 break;
145 }
146 }
147 }
148
149 private:
152 };
153
155 {
157 }
158};
159
161{
163}
uint32_t uint32
Definition: Define.h:133
@ IN_PROGRESS
@ NOT_STARTED
@ GO_FLAG_NOT_SELECTABLE
#define DataHeader
uint32 const EncounterCount
void Update(uint32 time)
Definition: EventMap.h:67
bool Empty() const
Definition: EventMap.h:95
EventId ExecuteEvent()
Definition: EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition: EventMap.cpp:36
void SetBossNumber(uint32 number)
Creature * GetCreature(uint32 type)
InstanceMap * instance
GameObject * GetGameObject(uint32 type)
void SetHeaders(std::string const &dataHeaders)
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:1852
InstanceScript * GetInstanceScript(InstanceMap *map) const override
ObjectData const gameObjectData[]
Position const HeadlessHorsemanHeadSpawnPosition
ObjectData const creatureData[]
void AddSC_instance_scarlet_monastery()
Position const EarthBunnySpawnPosition
Position const BunnySpawnPosition
Position const HeadlessHorsemanSpawnPosition
@ SPELL_EARTH_EXPLOSION
@ EVENT_ACTIVE_EARTH_EXPLOSION
@ EVENT_SPAWN_HEADLESS_HORSEMAN
@ EVENT_DESPAWN_OBJECTS
@ ACTION_HORSEMAN_EVENT_START
@ GO_LOOSELY_TURNED_SOIL
@ GO_PUMPKIN_SHRINE
@ GO_HIGH_INQUISITORS_DOOR
@ DATA_MOGRAINE
@ DATA_PREPARE_RESET
@ DATA_WHITEMANE
@ DATA_HORSEMAN_HEAD
@ DATA_HEADLESS_HORSEMAN
@ DATA_VORREL
@ DATA_LOOSELY_TURNED_SOIL
@ DATA_HORSEMAN_EVENT_STATE
@ DATA_FLAME_BUNNY
@ DATA_EARTH_BUNNY
@ DATA_HIGH_INQUISITORS_DOOR
@ DATA_START_HORSEMAN_EVENT
@ DATA_THOMAS
@ DATA_PUMPKIN_SHRINE
@ NPC_VORREL
@ NPC_HEADLESS_HORSEMAN_HEAD
@ NPC_HEADLESS_HORSEMAN
@ NPC_FLAME_BUNNY
@ NPC_MOGRAINE
@ NPC_SIR_THOMAS
@ NPC_WHITEMANE
@ NPC_EARTH_BUNNY
#define SMScriptName