Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
instance_the_eye.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Instance_The_Eye
8SD%Complete: 100
9SDComment:
10SDCategory: Tempest Keep, The Eye
11EndScriptData */
12
13#include "ScriptMgr.h"
14#include "InstanceScript.h"
15#include "the_eye.h"
16
17#define MAX_ENCOUNTER 5
18
19/* The Eye encounters:
200 - Kael'thas event
211 - Al' ar event
222 - Solarian Event
233 - Void Reaver event
24*/
25
27{
28 public:
30 : InstanceMapScript("instance_the_eye", 550)
31 {
32 }
33
35 {
37
47
49
51 {
52 memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
53
55 LordSanguinar = 0;
58 Kaelthas = 0;
59 Astromancer = 0;
60 Alar = 0;
61
64 }
65
67 {
68 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
70 return true;
71
72 return false;
73 }
74
76 {
77 switch (creature->GetEntry())
78 {
79 case 20064:
80 ThaladredTheDarkener = creature->GetGUID();
81 break;
82 case 20063:
83 MasterEngineerTelonicus = creature->GetGUID();
84 break;
85 case 20062:
86 GrandAstromancerCapernian = creature->GetGUID();
87 break;
88 case 20060:
89 LordSanguinar = creature->GetGUID();
90 break;
91 case 19622:
92 Kaelthas = creature->GetGUID();
93 break;
94 case 18805:
95 Astromancer = creature->GetGUID();
96 break;
97 case 19514:
98 Alar = creature->GetGUID();
99 break;
100 }
101 }
102
103 uint64 GetData64(uint32 identifier) const OVERRIDE
104 {
105 switch (identifier)
106 {
111 case DATA_KAELTHAS: return Kaelthas;
112 case DATA_ASTROMANCER: return Astromancer;
113 case DATA_ALAR: return Alar;
114 }
115 return 0;
116 }
117
118 void SetData(uint32 type, uint32 data) OVERRIDE
119 {
120 switch (type)
121 {
122 case DATA_ALAREVENT:
123 AlarEventPhase = data;
124 m_auiEncounter[0] = data;
125 break;
127 m_auiEncounter[1] = data;
128 break;
130 m_auiEncounter[2] = data;
131 break;
133 KaelthasEventPhase = data;
134 m_auiEncounter[3] = data;
135 break;
136 }
137 if (data == DONE)
138 SaveToDB();
139 }
140
142 {
143 switch (type)
144 {
145 case DATA_ALAREVENT: return AlarEventPhase;
147 case DATA_VOIDREAVEREVENT: return m_auiEncounter[2];
149 }
150 return 0;
151 }
152
153 std::string GetSaveData() OVERRIDE
154 {
156
157 std::ostringstream stream;
158 stream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' << m_auiEncounter[3];
159
161 return stream.str();
162 }
163
164 void Load(const char* in) OVERRIDE
165 {
166 if (!in)
167 {
169 return;
170 }
172
173 std::istringstream stream(in);
174 stream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3];
175 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
176 if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead.
179 }
180 };
181
186};
188{
190}
191
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
#define OUT_LOAD_INST_DATA_FAIL
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
#define OUT_SAVE_INST_DATA_COMPLETE
#define OUT_LOAD_INST_DATA_COMPLETE
#define OUT_SAVE_INST_DATA
#define OUT_LOAD_INST_DATA(a)
InstanceMapScript(const char *name, uint32 mapId)
InstanceScript(Map *map)
Definition Map.h:238
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
void AddSC_instance_the_eye()
#define MAX_ENCOUNTER
uint64 GetData64(uint32 identifier) const OVERRIDE
void SetData(uint32 type, uint32 data) OVERRIDE
@ DATA_MASTERENGINEERTELONICUS
Definition the_eye.h:18
@ DATA_HIGHASTROMANCERSOLARIANEVENT
Definition the_eye.h:14
@ DATA_ALAR
Definition the_eye.h:21
@ DATA_GRANDASTROMANCERCAPERNIAN
Definition the_eye.h:13
@ DATA_KAELTHAS
Definition the_eye.h:15
@ DATA_VOIDREAVEREVENT
Definition the_eye.h:20
@ DATA_LORDSANGUINAR
Definition the_eye.h:17
@ DATA_KAELTHASEVENT
Definition the_eye.h:16
@ DATA_THALADREDTHEDARKENER
Definition the_eye.h:19
@ DATA_ASTROMANCER
Definition the_eye.h:12
@ DATA_ALAREVENT
Definition the_eye.h:11