Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
instance_steam_vault.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#include "ScriptMgr.h"
7#include "InstanceScript.h"
8#include "steam_vault.h"
9
11{
12 public:
13 go_main_chambers_access_panel() : GameObjectScript("go_main_chambers_access_panel") { }
14
15 bool OnGossipHello(Player* /*player*/, GameObject* go) OVERRIDE
16 {
17 InstanceScript* instance = go->GetInstanceScript();
18 if (!instance)
19 return false;
20
22 {
24 go->SetGoState(GOState::GO_STATE_ACTIVE);
25 }
26
28 {
30 go->SetGoState(GOState::GO_STATE_ACTIVE);
31 }
32
33 return true;
34 }
35};
36
38{
39 public:
41
43 {
55
57 {
58 switch (creature->GetEntry())
59 {
61 ThespiaGUID = creature->GetGUID();
62 break;
64 MekgineerGUID = creature->GetGUID();
65 break;
67 KalithreshGUID = creature->GetGUID();
68 break;
69 default:
70 break;
71 }
72 }
73
75 {
76 switch (go->GetEntry())
77 {
79 MainChambersDoorGUID = go->GetGUID();
80 break;
81 default:
82 break;
83 }
84 }
85
87 {
88 switch (type)
89 {
91 return ThespiaGUID;
93 return MekgineerGUID;
95 return KalithreshGUID;
96 default:
97 break;
98 }
99 return 0;
100 }
101
102 void SetData(uint32 type, uint32 data) OVERRIDE
103 {
104 if (type == DATA_DISTILLER)
105 DistillerState = data;
106 }
107
109 {
110 if (type == DATA_DISTILLER)
111 return DistillerState;
112 return 0;
113 }
114
116 {
117 if (!InstanceScript::SetBossState(type, state))
118 return false;
119
120 switch (type)
121 {
123 if (state == SPECIAL)
124 {
127
128 SF_LOG_DEBUG("scripts", "Instance Steamvault: Access panel used.");
129 }
130 break;
132 if (state == SPECIAL)
133 {
136
137 SF_LOG_DEBUG("scripts", "Instance Steamvault: Access panel used.");
138 }
139 break;
140 default:
141 break;
142 }
143
144 return true;
145 }
146
147 std::string GetSaveData() OVERRIDE
148 {
150
151 std::ostringstream saveStream;
152 saveStream << "S V " << GetBossSaveData();
153
155 return saveStream.str();
156 }
157
158 void Load(char const* str) OVERRIDE
159 {
160 if (!str)
161 {
163 return;
164 }
165
167
168 char dataHead1, dataHead2;
169
170 std::istringstream loadStream(str);
171 loadStream >> dataHead1 >> dataHead2;
172
173 if (dataHead1 == 'S' && dataHead2 == 'V')
174 {
175 for (uint32 i = 0; i < EncounterCount; ++i)
176 {
177 uint32 tmpState;
178 loadStream >> tmpState;
179 if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
180 tmpState = NOT_STARTED;
181 SetBossState(i, EncounterState(tmpState));
182 }
183 }
184 else
186
188 }
189
190 protected:
194
197 };
198
203};
204
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
@ GO_STATE_ACTIVE
Definition GameObject.h:576
#define OUT_LOAD_INST_DATA_FAIL
EncounterState
@ IN_PROGRESS
@ DONE
@ SPECIAL
@ 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)
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
uint32 const EncounterCount
GameObjectScript(const char *name)
InstanceMapScript(const char *name, uint32 mapId)
InstanceScript(Map *map)
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
std::string GetBossSaveData()
EncounterState GetBossState(uint32 id) const
void HandleGameObject(uint64 guid, bool open, GameObject *go=NULL)
Definition Map.h:238
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
void AddSC_instance_steam_vault()
#define SteamVaultScriptName
Definition steam_vault.h:9
@ GO_ACCESS_PANEL_HYDRO
Definition steam_vault.h:31
@ GO_MAIN_CHAMBERS_DOOR
Definition steam_vault.h:30
@ GO_ACCESS_PANEL_MEK
Definition steam_vault.h:32
@ NPC_HYDROMANCER_THESPIA
Definition steam_vault.h:23
@ NPC_WARLORD_KALITHRESH
Definition steam_vault.h:25
@ NPC_MEKGINEER_STEAMRIGGER
Definition steam_vault.h:24
@ DATA_HYDROMANCER_THESPIA
Definition steam_vault.h:15
@ DATA_MEKGINEER_STEAMRIGGER
Definition steam_vault.h:16
@ DATA_DISTILLER
Definition steam_vault.h:18
@ DATA_WARLORD_KALITHRESH
Definition steam_vault.h:17
bool SetBossState(uint32 type, EncounterState state) OVERRIDE