17
17
/* ScriptData
18
18
SDName: instance_oculus
19
19
SD%Complete: 50
20
- SDComment: Spawn instance bosses and handle Varos pre event; Dialogue NYI
20
+ SDComment: Spawn instance bosses and handle Varos pre event; Dialogue handled by DBScripts
21
21
SDCategory: Oculus
22
22
EndScriptData */
23
23
24
24
#include " precompiled.h"
25
25
#include " oculus.h"
26
26
27
- instance_oculus::instance_oculus (Map* pMap) : ScriptedInstance(pMap),
28
- m_uiConstructsDead(0 )
27
+ instance_oculus::instance_oculus (Map* pMap) : ScriptedInstance(pMap)
29
28
{
30
29
Initialize ();
31
30
}
@@ -37,7 +36,16 @@ void instance_oculus::Initialize()
37
36
38
37
void instance_oculus::OnPlayerEnter (Player* pPlayer)
39
38
{
39
+ if (GetData (TYPE_EREGOS) == DONE)
40
+ return ;
41
+
40
42
DoSpawnNextBossIfCan ();
43
+
44
+ if (GetData (TYPE_DRAKOS) == DONE && GetData (TYPE_VAROS) == NOT_STARTED)
45
+ {
46
+ pPlayer->SendUpdateWorldState (WORLD_STATE_CONSTRUCTS, 1 );
47
+ pPlayer->SendUpdateWorldState (WORLD_STATE_CONSTRUCTS_COUNT, m_sConstructsAliveGUIDSet.size ());
48
+ }
41
49
}
42
50
43
51
void instance_oculus::OnCreatureCreate (Creature* pCreature)
@@ -80,12 +88,12 @@ void instance_oculus::SetData(uint32 uiType, uint32 uiData)
80
88
for (GuidList::const_iterator itr = m_lCageDoorGUIDs.begin (); itr != m_lCageDoorGUIDs.end (); ++itr)
81
89
DoUseDoorOrButton (*itr);
82
90
83
- // Notes: There should also be a small dialogue here involving Belgaristrasz and Varos
84
- // Also the Centrifuge Constructs and the related npcs should be summoned
91
+ // Notes: The dialogue is handled by DB script
92
+ // Also the Centrifuge Constructs and the related npcs should be summoned - requires additional research
85
93
86
- // Activate the world state
94
+ // Activate the world state - the Centrifuge contructs should be loaded by now
87
95
DoUpdateWorldState (WORLD_STATE_CONSTRUCTS, 1 );
88
- DoUpdateWorldState (WORLD_STATE_CONSTRUCTS_COUNT, MAX_CONSTRUCTS );
96
+ DoUpdateWorldState (WORLD_STATE_CONSTRUCTS_COUNT, m_sConstructsAliveGUIDSet. size () );
89
97
90
98
DoStartTimedAchievement (ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEV_START_EREGOS_ID);
91
99
}
@@ -94,22 +102,26 @@ void instance_oculus::SetData(uint32 uiType, uint32 uiData)
94
102
m_auiEncounter[TYPE_VAROS] = uiData;
95
103
if (uiData == DONE)
96
104
{
97
- // Note: Image of Belgaristrasz teleports here after the boss is dead and does some dialogue
105
+ // Note: Image of Belgaristrasz dialogue is handled by DB script
98
106
DoSpawnNextBossIfCan ();
99
107
DoUpdateWorldState (WORLD_STATE_CONSTRUCTS, 0 );
100
108
}
101
109
break ;
102
110
case TYPE_UROM:
103
111
m_auiEncounter[TYPE_UROM] = uiData;
104
- // Note: Image of Belgaristrasz teleports to this boss after it's killed and does some dialogue; Right after this, Eregos appears
112
+ // Note: Image of Belgaristrasz dialogue is handled by DB script
105
113
if (uiData == DONE)
106
114
DoSpawnNextBossIfCan ();
107
115
break ;
108
116
case TYPE_EREGOS:
109
117
m_auiEncounter[TYPE_EREGOS] = uiData;
110
- // Note: Image of Belgaristrasz teleports to the Cache location and does more dialogue
118
+ // Note: Image of Belgaristrasz teleports to the Cache location and does more dialogue - requires additional research
111
119
if (uiData == DONE)
120
+ {
121
+ // The data about the cache isn't consistent, so it's better to handle both cases
112
122
DoToggleGameObjectFlags (instance->IsRegularDifficulty () ? GO_CACHE_EREGOS : GO_CACHE_EREGOS_H, GO_FLAG_NO_INTERACT, false );
123
+ DoRespawnGameObject (instance->IsRegularDifficulty () ? GO_CACHE_EREGOS : GO_CACHE_EREGOS_H, 30 * MINUTE);
124
+ }
113
125
break ;
114
126
}
115
127
@@ -135,6 +147,24 @@ uint32 instance_oculus::GetData(uint32 uiType) const
135
147
return 0 ;
136
148
}
137
149
150
+ void instance_oculus::SetData64 (uint32 uiData, uint64 uiGuid)
151
+ {
152
+ // If Varos already completed, just ignore
153
+ if (GetData (TYPE_VAROS) == DONE)
154
+ return ;
155
+
156
+ // Note: this is handled in Acid. The purpose is check which Centrifuge Construct is alive, in case of server reset
157
+ // The function is triggered by eventAI on generic timer
158
+ if (uiData == DATA_CONSTRUCTS_EVENT)
159
+ {
160
+ m_sConstructsAliveGUIDSet.insert (ObjectGuid (uiGuid));
161
+
162
+ // Update world state in case of server reset
163
+ if (GetData (TYPE_DRAKOS) == DONE)
164
+ DoUpdateWorldState (WORLD_STATE_CONSTRUCTS_COUNT, m_sConstructsAliveGUIDSet.size ());
165
+ }
166
+ }
167
+
138
168
void instance_oculus::OnCreatureEnterCombat (Creature* pCreature)
139
169
{
140
170
switch (pCreature->GetEntry ())
@@ -160,10 +190,10 @@ void instance_oculus::OnCreatureDeath(Creature* pCreature)
160
190
case NPC_DRAKOS: SetData (TYPE_DRAKOS, DONE); break ;
161
191
case NPC_VAROS: SetData (TYPE_VAROS, DONE); break ;
162
192
case NPC_CENTRIFUGE_CONSTRUCT:
163
- ++m_uiConstructsDead ;
164
- DoUpdateWorldState (WORLD_STATE_CONSTRUCTS_COUNT, MAX_CONSTRUCTS - m_uiConstructsDead );
193
+ m_sConstructsAliveGUIDSet. erase (pCreature-> GetObjectGuid ()) ;
194
+ DoUpdateWorldState (WORLD_STATE_CONSTRUCTS_COUNT, m_sConstructsAliveGUIDSet. size () );
165
195
166
- if (m_uiConstructsDead == MAX_CONSTRUCTS )
196
+ if (m_sConstructsAliveGUIDSet. empty () )
167
197
{
168
198
if (Creature* pVaros = GetSingleCreatureFromStorage (NPC_VAROS))
169
199
pVaros->InterruptNonMeleeSpells (false );
0 commit comments