Skip to content

Commit fe5f506

Browse files
committed
[2909] Update Ambassador Hellmaw banish behavior
Thanks AlexHjelm for pointing the issue Please make sure you update to the latest ACID version
1 parent f995b94 commit fe5f506

4 files changed

Lines changed: 78 additions & 62 deletions

File tree

scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,29 +43,23 @@ struct MANGOS_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
4343
{
4444
boss_ambassador_hellmawAI(Creature* pCreature) : ScriptedAI(pCreature)
4545
{
46-
m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
46+
m_pInstance = (instance_shadow_labyrinth*)pCreature->GetInstanceData();
4747
m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
4848
Reset();
49-
50-
if (m_pInstance && m_creature->isAlive())
51-
{
52-
if (m_pInstance->GetData(TYPE_OVERSEER) != DONE)
53-
DoCastSpellIfCan(m_creature, SPELL_BANISH, CAST_TRIGGERED);
54-
else
55-
m_creature->GetMotionMaster()->MoveWaypoint();
56-
}
5749
}
5850

59-
ScriptedInstance* m_pInstance;
51+
instance_shadow_labyrinth* m_pInstance;
6052
bool m_bIsRegularMode;
6153

54+
uint32 m_uiBanishTimer;
6255
uint32 m_uiCorrosiveAcidTimer;
6356
uint32 m_uiFearTimer;
6457
uint32 m_uiEnrageTimer;
6558
bool m_bIsEnraged;
6659

6760
void Reset() override
6861
{
62+
m_uiBanishTimer = 2000;
6963
m_uiCorrosiveAcidTimer = urand(20000, 23000);
7064
m_uiFearTimer = urand(20000, 26000);
7165
m_uiEnrageTimer = 3 * MINUTE * IN_MILLISECONDS;
@@ -106,6 +100,25 @@ struct MANGOS_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
106100

107101
void UpdateAI(const uint32 uiDiff) override
108102
{
103+
if (m_uiBanishTimer)
104+
{
105+
if (m_uiBanishTimer <= uiDiff)
106+
{
107+
if (!m_pInstance)
108+
return;
109+
110+
// Check for banish
111+
if (m_pInstance->IsHellmawUnbanished())
112+
{
113+
m_creature->RemoveAurasDueToSpell(SPELL_BANISH);
114+
m_creature->GetMotionMaster()->MoveWaypoint();
115+
m_uiBanishTimer = 0;
116+
}
117+
}
118+
else
119+
m_uiBanishTimer -= uiDiff;
120+
}
121+
109122
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
110123
return;
111124

scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp

Lines changed: 41 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ EndScriptData */
3131
4 - Murmur event
3232
*/
3333

34-
instance_shadow_labyrinth::instance_shadow_labyrinth(Map* pMap) : ScriptedInstance(pMap),
35-
m_uiFelOverseerCount(0)
34+
instance_shadow_labyrinth::instance_shadow_labyrinth(Map* pMap) : ScriptedInstance(pMap)
3635
{
3736
Initialize();
3837
}
@@ -70,10 +69,6 @@ void instance_shadow_labyrinth::OnCreatureCreate(Creature* pCreature)
7069
case NPC_HELLMAW:
7170
m_mNpcEntryGuidStore[pCreature->GetEntry()] = pCreature->GetObjectGuid();
7271
break;
73-
case NPC_FEL_OVERSEER:
74-
++m_uiFelOverseerCount; // TODO should actually only count alive ones
75-
debug_log("SD2: Shadow Labyrinth: counting %u Fel Overseers.", m_uiFelOverseerCount);
76-
break;
7772
}
7873
}
7974

@@ -85,54 +80,20 @@ void instance_shadow_labyrinth::SetData(uint32 uiType, uint32 uiData)
8580
m_auiEncounter[0] = uiData;
8681
break;
8782

88-
case TYPE_OVERSEER:
89-
if (uiData != DONE)
90-
{
91-
script_error_log("Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE");
92-
return;
93-
}
94-
if (m_uiFelOverseerCount)
95-
{
96-
--m_uiFelOverseerCount;
97-
98-
if (m_uiFelOverseerCount)
99-
{
100-
debug_log("SD2: Shadow Labyrinth: %u Fel Overseers left to kill.", m_uiFelOverseerCount);
101-
102-
// Skip save call
103-
return;
104-
}
105-
else
106-
{
107-
if (Creature* pHellmaw = GetSingleCreatureFromStorage(NPC_HELLMAW))
108-
{
109-
// yell intro and remove banish aura
110-
DoScriptText(SAY_HELLMAW_INTRO, pHellmaw);
111-
pHellmaw->GetMotionMaster()->MoveWaypoint();
112-
if (pHellmaw->HasAura(SPELL_BANISH))
113-
pHellmaw->RemoveAurasDueToSpell(SPELL_BANISH);
114-
}
115-
116-
m_auiEncounter[1] = DONE;
117-
debug_log("SD2: Shadow Labyrinth: TYPE_OVERSEER == DONE");
118-
}
119-
}
120-
break;
121-
12283
case TYPE_INCITER:
12384
if (uiData == DONE)
12485
DoUseDoorOrButton(GO_REFECTORY_DOOR);
125-
m_auiEncounter[2] = uiData;
86+
m_auiEncounter[1] = uiData;
12687
break;
12788

12889
case TYPE_VORPIL:
12990
if (uiData == DONE)
13091
DoUseDoorOrButton(GO_SCREAMING_HALL_DOOR);
131-
m_auiEncounter[3] = uiData;
92+
m_auiEncounter[2] = uiData;
13293
break;
13394

13495
case TYPE_MURMUR:
135-
m_auiEncounter[4] = uiData;
96+
m_auiEncounter[3] = uiData;
13697
break;
13798
}
13899

@@ -142,7 +103,7 @@ void instance_shadow_labyrinth::SetData(uint32 uiType, uint32 uiData)
142103

143104
std::ostringstream saveStream;
144105
saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
145-
<< m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4];
106+
<< m_auiEncounter[2] << " " << m_auiEncounter[3];
146107

147108
m_strInstData = saveStream.str();
148109

@@ -156,13 +117,47 @@ uint32 instance_shadow_labyrinth::GetData(uint32 uiType) const
156117
switch (uiType)
157118
{
158119
case TYPE_HELLMAW: return m_auiEncounter[0];
159-
case TYPE_OVERSEER: return m_auiEncounter[1];
120+
case TYPE_INCITER: return m_auiEncounter[1];
121+
case TYPE_VORPIL: return m_auiEncounter[2];
122+
case TYPE_MURMUR: return m_auiEncounter[3];
160123

161124
default:
162125
return 0;
163126
}
164127
}
165128

129+
void instance_shadow_labyrinth::SetData64(uint32 uiData, uint64 uiGuid)
130+
{
131+
// If Hellmaw already completed, just ignore
132+
if (GetData(TYPE_HELLMAW) == DONE)
133+
return;
134+
135+
// Note: this is handled in Acid. The purpose is check which Cabal Ritualists is alive, in case of server reset
136+
// The function is triggered by eventAI on generic timer
137+
if (uiData == DATA_CABAL_RITUALIST)
138+
m_sRitualistsAliveGUIDSet.insert(ObjectGuid(uiGuid));
139+
}
140+
141+
void instance_shadow_labyrinth::OnCreatureDeath(Creature* pCreature)
142+
{
143+
// unbanish Hellmaw when all Cabal Ritualists are dead
144+
if (pCreature->GetEntry() == NPC_CABAL_RITUALIST)
145+
{
146+
m_sRitualistsAliveGUIDSet.erase(pCreature->GetObjectGuid());
147+
148+
if (m_sRitualistsAliveGUIDSet.empty())
149+
{
150+
if (Creature* pHellmaw = GetSingleCreatureFromStorage(NPC_HELLMAW))
151+
{
152+
// yell intro and remove banish aura
153+
DoScriptText(SAY_HELLMAW_INTRO, pHellmaw);
154+
pHellmaw->GetMotionMaster()->MoveWaypoint();
155+
pHellmaw->RemoveAurasDueToSpell(SPELL_BANISH);
156+
}
157+
}
158+
}
159+
}
160+
166161
void instance_shadow_labyrinth::Load(const char* chrIn)
167162
{
168163
if (!chrIn)
@@ -174,7 +169,7 @@ void instance_shadow_labyrinth::Load(const char* chrIn)
174169
OUT_LOAD_INST_DATA(chrIn);
175170

176171
std::istringstream loadStream(chrIn);
177-
loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4];
172+
loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3];
178173

179174
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
180175
{

scripts/outland/auchindoun/shadow_labyrinth/shadow_labyrinth.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77

88
enum
99
{
10-
MAX_ENCOUNTER = 5,
10+
MAX_ENCOUNTER = 4,
1111

1212
TYPE_HELLMAW = 1,
13-
TYPE_OVERSEER = 2,
13+
// TYPE_OVERSEER = 2, // obsolete id used by acid
1414
TYPE_INCITER = 3,
1515
TYPE_VORPIL = 4,
1616
TYPE_MURMUR = 5,
1717

18+
DATA_CABAL_RITUALIST = 1, // DO NOT CHANGE! Used by Acid. - used to check the Cabal Ritualists alive
19+
1820
NPC_HELLMAW = 18731,
1921
NPC_VORPIL = 18732,
20-
NPC_FEL_OVERSEER = 18796,
22+
NPC_CABAL_RITUALIST = 18794,
2123

2224
GO_REFECTORY_DOOR = 183296, // door opened when blackheart the inciter dies
2325
GO_SCREAMING_HALL_DOOR = 183295, // door opened when grandmaster vorpil dies
2426

2527
SAY_HELLMAW_INTRO = -1555000,
2628

27-
SPELL_BANISH = 30231,
29+
SPELL_BANISH = 30231, // spell is handled in creature_template_addon;
2830
};
2931

3032
class MANGOS_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance
@@ -37,17 +39,23 @@ class MANGOS_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance
3739
void OnObjectCreate(GameObject* pGo) override;
3840
void OnCreatureCreate(Creature* pCreature) override;
3941

42+
void OnCreatureDeath(Creature* pCreature) override;
43+
4044
void SetData(uint32 uiType, uint32 uiData) override;
4145
uint32 GetData(uint32 uiType) const override;
4246

47+
void SetData64(uint32 uiType, uint64 uiGuid) override;
48+
4349
const char* Save() const override { return m_strInstData.c_str(); }
4450
void Load(const char* chrIn) override;
4551

52+
bool IsHellmawUnbanished() { return m_sRitualistsAliveGUIDSet.empty(); }
53+
4654
private:
4755
uint32 m_auiEncounter[MAX_ENCOUNTER];
4856
std::string m_strInstData;
4957

50-
uint32 m_uiFelOverseerCount;
58+
GuidSet m_sRitualistsAliveGUIDSet;
5159
};
5260

5361
#endif

sd2_revision_nr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifndef __SD2_REVISION_NR_H__
22
#define __SD2_REVISION_NR_H__
3-
#define SD2_REVISION_NR "2908"
3+
#define SD2_REVISION_NR "2909"
44
#endif // __SD2_REVISION_NR_H__

0 commit comments

Comments
 (0)