Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
instance_forge_of_souls.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 "forge_of_souls.h"
9#include "Player.h"
10
11#define MAX_ENCOUNTER 2
12
13/* Forge of Souls encounters:
140- Bronjahm, The Godfather of Souls
151- The Devourer of Souls
16*/
17
19{
20 public:
22
24 {
33
35 {
36 Map::PlayerList const &players = instance->GetPlayers();
37 if (!players.isEmpty())
38 if (Player* player = players.begin()->GetSource())
39 teamInInstance = player->GetTeam();
40
41 switch (creature->GetEntry())
42 {
44 bronjahm = creature->GetGUID();
45 break;
47 devourerOfSouls = creature->GetGUID();
48 break;
51 creature->UpdateEntry(NPC_JAINA_PART1, ALLIANCE);
52 break;
53 case NPC_LORALEN:
55 creature->UpdateEntry(NPC_ELANDRA, ALLIANCE);
56 break;
57 case NPC_KALIRA:
59 creature->UpdateEntry(NPC_KORELN, ALLIANCE);
60 break;
61 }
62 }
63
65 {
66 switch (type)
67 {
69 return teamInInstance;
70 default:
71 break;
72 }
73
74 return 0;
75 }
76
78 {
79 switch (type)
80 {
81 case DATA_BRONJAHM:
82 return bronjahm;
83 case DATA_DEVOURER:
84 return devourerOfSouls;
85 default:
86 break;
87 }
88
89 return 0;
90 }
91
92 std::string GetSaveData() OVERRIDE
93 {
95
96 std::ostringstream saveStream;
97 saveStream << "F S " << GetBossSaveData();
98
100 return saveStream.str();
101 }
102
103 void Load(const char* in) OVERRIDE
104 {
105 if (!in)
106 {
108 return;
109 }
110
112
113 char dataHead1, dataHead2;
114
115 std::istringstream loadStream(in);
116 loadStream >> dataHead1 >> dataHead2;
117
118 if (dataHead1 == 'F' && dataHead2 == 'S')
119 {
120 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
121 {
122 uint32 tmpState;
123 loadStream >> tmpState;
124 if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
125 tmpState = NOT_STARTED;
126 SetBossState(i, EncounterState(tmpState));
127 }
129
131 }
132
133 private:
136
138 };
139
144};
145
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
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)
@ ALLIANCE
InstanceMapScript(const char *name, uint32 mapId)
InstanceScript(Map *map)
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
std::string GetBossSaveData()
bool isEmpty() const
Definition LinkedList.h:86
Definition Map.h:238
MapRefManager PlayerList
Definition Map.h:406
iterator begin()
FROM * GetSource() const
Definition Reference.h:83
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
@ NPC_JAINA_PART1
@ CREATURE_BRONJAHM
@ CREATURE_DEVOURER
@ NPC_KALIRA
@ NPC_KORELN
@ NPC_LORALEN
@ NPC_ELANDRA
@ NPC_SYLVANAS_PART1
#define FoSScriptName
@ DATA_TEAM_IN_INSTANCE
@ DATA_BRONJAHM
@ DATA_DEVOURER
void AddSC_instance_forge_of_souls()
#define MAX_ENCOUNTER