Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
instance_stormstout_brewery.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"
9
11{
12 public:
14
16 {
18 {
20 //LoadDoorData(doorData);
21
22 OokOokGUID = 0;
23 HoptalusGUID = 0;
24 YanZhuGUID = 0;
25 BananaCount = 0;
26 }
27
29 {
30 switch (creature->GetEntry())
31 {
32 case NPC_OOK_OOK:
33 OokOokGUID = creature->GetGUID();
34 break;
35 case NPC_HOPTALLUS:
36 HoptalusGUID = creature->GetGUID();
37 break;
38 case NPC_YAN_ZHU:
39 YanZhuGUID = creature->GetGUID();
40 break;
41 default:
42 break;
43 }
44 }
45
46 //void OnGameObjectCreate(GameObject* go) OVERRIDE
47 //{}
48
49 //void OnGameObjectRemove(GameObject* go) OVERRIDE
50 //{}
51
53 {
54 switch (type)
55 {
56 case DATA_OOK_OOK:
57 return OokOokGUID;
58 case DATA_HOPTALLUS:
59 return HoptalusGUID;
60 case DATA_YAN_ZHU:
61 return YanZhuGUID;
63 return BananaCount;
64 default:
65 break;
66 }
67 return 0;
68 }
69
70 void SetData(uint32 type, uint32 data) OVERRIDE
71 {
72 switch (type)
73 {
75 if (data == SPECIAL)
77 else if (data == IN_PROGRESS)
78 BananaCount = 0;
79 break;
80 }
81 }
82
83 std::string GetSaveData() OVERRIDE
84 {
86
87 std::ostringstream saveStream;
88 saveStream << "S S B " << GetBossSaveData();
89
91 return saveStream.str();
92 }
93
94 void Load(char const* str) OVERRIDE
95 {
96 if (!str)
97 {
99 return;
100 }
101
103
104 char dataHead1, dataHead2, dataHead3;
105
106 std::istringstream loadStream(str);
107 loadStream >> dataHead1 >> dataHead2 >> dataHead3;
108
109 if (dataHead1 == 'S' && dataHead2 == 'S' && dataHead3 == 'B')
110 {
111 for (uint32 i = 0; i < EncounterCount; ++i)
112 {
113 uint32 tmpState;
114 loadStream >> tmpState;
115 if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
116 tmpState = NOT_STARTED;
117 SetBossState(i, EncounterState(tmpState));
118 }
119 }
120 else
122
124 }
125
126 protected:
131 };
132
137};
138
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
EncounterState
@ IN_PROGRESS
@ 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)
uint32 const EncounterCount
InstanceMapScript(const char *name, uint32 mapId)
InstanceScript(Map *map)
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
std::string GetBossSaveData()
Definition Map.h:238
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
void AddSC_instance_stormstout_brewery()
@ NPC_OOK_OOK
@ NPC_HOPTALLUS
@ NPC_YAN_ZHU
#define StormstoutBreweryScriptName
@ DATA_YAN_ZHU
@ DATA_OOK_OOK
@ DATA_BANANA_EVENT
@ DATA_HOPTALLUS