FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[s2840] Replace Princess Moria with Priestess of Thaurissan if requir… · scriptdev2/scriptdev2-tbc@aa67170 · GitHub

Commit aa67170

Browse files
committed
[s2840] Replace Princess Moria with Priestess of Thaurissan if required - BRD
Also cleanup script for Emperor Dagran Thaurissan (based on commit SD2-TBC[3127] - c3af183) Signed-off-by: xfurry <xfurry@scriptdev2.com>
1 parent 7ff510a commit aa67170

4 files changed

Lines changed: 77 additions & 53 deletions

File tree

‎scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ enum
2323

2424
NPC_EMPEROR = 9019,
2525
NPC_PRINCESS = 8929,
26+
NPC_PRIESTESS = 10076,
2627
NPC_PHALANX = 9502,
2728
NPC_HATEREL = 9034,
2829
NPC_ANGERREL = 9035,
@@ -80,6 +81,9 @@ enum
8081
GO_DWARFRUNE_F01 = 170583,
8182
GO_DWARFRUNE_G01 = 170584,
8283

84+
QUEST_ROYAL_RESCUE = 4003, // horde quest
85+
QUEST_FATE_KINGDOM = 4362, // alliance quest
86+
8387
SPELL_STONED = 10255, // Aura of Warbringer Constructs in Relict Vault
8488

8589
FACTION_DWARF_HOSTILE = 754, // Hostile faction for the Tomb of the Seven dwarfs
@@ -157,6 +161,7 @@ class instance_blackrock_depths : public ScriptedInstance
157161

158162
private:
159163
void DoCallNextDwarf();
164+
bool CanReplacePrincess();
160165

161166
uint32 m_auiEncounter[MAX_ENCOUNTER];
162167
std::string m_strInstData;

‎scripts/eastern_kingdoms/blackrock_depths/boss_emperor_dagran_thaurissan.cpp‎

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,13 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI
4444

4545
ScriptedInstance* m_pInstance;
4646

47-
uint32 m_uiHandOfThaurissan_Timer;
48-
uint32 m_uiAvatarOfFlame_Timer;
49-
// uint32 m_uiCounter;
47+
uint32 m_uiHandOfThaurissanTimer;
48+
uint32 m_uiAvatarOfFlameTimer;
5049

5150
void Reset() override
5251
{
53-
m_uiHandOfThaurissan_Timer = 4000;
54-
m_uiAvatarOfFlame_Timer = 25000;
55-
// m_uiCounter = 0;
52+
m_uiHandOfThaurissanTimer = 4000;
53+
m_uiAvatarOfFlameTimer = 25000;
5654
}
5755

5856
void Aggro(Unit* /*pWho*/) override
@@ -68,6 +66,10 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI
6866

6967
if (Creature* pPrincess = m_pInstance->GetSingleCreatureFromStorage(NPC_PRINCESS))
7068
{
69+
// check if we didn't update the entry
70+
if (pPrincess->GetEntry() != NPC_PRINCESS)
71+
return;
72+
7173
if (pPrincess->isAlive())
7274
{
7375
pPrincess->SetFactionTemporary(FACTION_NEUTRAL, TEMPFACTION_NONE);
@@ -86,34 +88,25 @@ struct boss_emperor_dagran_thaurissanAI : public ScriptedAI
8688
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
8789
return;
8890

89-
if (m_uiHandOfThaurissan_Timer < uiDiff)
91+
if (m_uiHandOfThaurissanTimer < uiDiff)
9092
{
9193
if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
92-
DoCastSpellIfCan(pTarget, SPELL_HANDOFTHAURISSAN);
93-
94-
// 3 Hands of Thaurissan will be casted
95-
// if (m_uiCounter < 3)
96-
//{
97-
// m_uiHandOfThaurissan_Timer = 1000;
98-
// ++m_uiCounter;
99-
//}
100-
// else
101-
//{
102-
m_uiHandOfThaurissan_Timer = 5000;
103-
// m_uiCounter = 0;
104-
//}
94+
{
95+
if (DoCastSpellIfCan(pTarget, SPELL_HANDOFTHAURISSAN) == CAST_OK)
96+
m_uiHandOfThaurissanTimer = 5000;
97+
}
10598
}
10699
else
107-
m_uiHandOfThaurissan_Timer -= uiDiff;
100+
m_uiHandOfThaurissanTimer -= uiDiff;
108101

109102
// AvatarOfFlame_Timer
110-
if (m_uiAvatarOfFlame_Timer < uiDiff)
103+
if (m_uiAvatarOfFlameTimer < uiDiff)
111104
{
112-
DoCastSpellIfCan(m_creature->getVictim(), SPELL_AVATAROFFLAME);
113-
m_uiAvatarOfFlame_Timer = 18000;
105+
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_AVATAROFFLAME) == CAST_OK)
106+
m_uiAvatarOfFlameTimer = 18000;
114107
}
115108
else
116-
m_uiAvatarOfFlame_Timer -= uiDiff;
109+
m_uiAvatarOfFlameTimer -= uiDiff;
117110

118111
DoMeleeAttackIfReady();
119112
}
@@ -150,17 +143,17 @@ struct boss_moira_bronzebeardAI : public ScriptedAI
150143

151144
ScriptedInstance* m_pInstance;
152145

153-
uint32 m_uiHeal_Timer;
154-
uint32 m_uiMindBlast_Timer;
155-
uint32 m_uiShadowWordPain_Timer;
156-
uint32 m_uiSmite_Timer;
146+
uint32 m_uiHealTimer;
147+
uint32 m_uiMindBlastTimer;
148+
uint32 m_uiShadowWordPainTimer;
149+
uint32 m_uiSmiteTimer;
157150

158151
void Reset() override
159152
{
160-
m_uiHeal_Timer = 12000; // These times are probably wrong
161-
m_uiMindBlast_Timer = 16000;
162-
m_uiShadowWordPain_Timer = 2000;
163-
m_uiSmite_Timer = 8000;
153+
m_uiHealTimer = 12000; // These times are probably wrong
154+
m_uiMindBlastTimer = 16000;
155+
m_uiShadowWordPainTimer = 2000;
156+
m_uiSmiteTimer = 8000;
164157
}
165158

166159
void AttackStart(Unit* pWho) override
@@ -183,7 +176,7 @@ struct boss_moira_bronzebeardAI : public ScriptedAI
183176
{
184177
// if evade, then check if he is alive. If not, start make portal
185178
if (!pEmperor->isAlive())
186-
m_creature->CastSpell(m_creature, SPELL_OPEN_PORTAL, false);
179+
DoCastSpellIfCan(m_creature, SPELL_OPEN_PORTAL);
187180
}
188181
}
189182
}
@@ -195,45 +188,46 @@ struct boss_moira_bronzebeardAI : public ScriptedAI
195188
return;
196189

197190
// MindBlast_Timer
198-
if (m_uiMindBlast_Timer < uiDiff)
191+
if (m_uiMindBlastTimer < uiDiff)
199192
{
200-
DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST);
201-
m_uiMindBlast_Timer = 14000;
193+
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_MINDBLAST) == CAST_OK)
194+
m_uiMindBlastTimer = 14000;
202195
}
203196
else
204-
m_uiMindBlast_Timer -= uiDiff;
197+
m_uiMindBlastTimer -= uiDiff;
205198

206199
// ShadowWordPain_Timer
207-
if (m_uiShadowWordPain_Timer < uiDiff)
200+
if (m_uiShadowWordPainTimer < uiDiff)
208201
{
209-
DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN);
210-
m_uiShadowWordPain_Timer = 18000;
202+
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SHADOWWORDPAIN) == CAST_OK)
203+
m_uiShadowWordPainTimer = 18000;
211204
}
212205
else
213-
m_uiShadowWordPain_Timer -= uiDiff;
206+
m_uiShadowWordPainTimer -= uiDiff;
214207

215208
// Smite_Timer
216-
if (m_uiSmite_Timer < uiDiff)
209+
if (m_uiSmiteTimer < uiDiff)
217210
{
218-
DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE);
219-
m_uiSmite_Timer = 10000;
211+
if (DoCastSpellIfCan(m_creature->getVictim(), SPELL_SMITE) == CAST_OK)
212+
m_uiSmiteTimer = 10000;
220213
}
221214
else
222-
m_uiSmite_Timer -= uiDiff;
215+
m_uiSmiteTimer -= uiDiff;
223216

224217
// Heal_Timer
225-
if (m_uiHeal_Timer < uiDiff)
218+
if (m_uiHealTimer < uiDiff)
226219
{
227220
if (Creature* pEmperor = m_pInstance->GetSingleCreatureFromStorage(NPC_EMPEROR))
228221
{
229222
if (pEmperor->isAlive() && pEmperor->GetHealthPercent() != 100.0f)
230-
DoCastSpellIfCan(pEmperor, SPELL_HEAL);
223+
{
224+
if (DoCastSpellIfCan(pEmperor, SPELL_HEAL) == CAST_OK)
225+
m_uiHealTimer = 10000;
226+
}
231227
}
232-
233-
m_uiHeal_Timer = 10000;
234228
}
235229
else
236-
m_uiHeal_Timer -= uiDiff;
230+
m_uiHealTimer -= uiDiff;
237231

238232
// No meele?
239233
}

‎scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ void instance_blackrock_depths::OnCreatureCreate(Creature* pCreature)
4646
{
4747
switch (pCreature->GetEntry())
4848
{
49-
case NPC_EMPEROR:
5049
case NPC_PRINCESS:
50+
// replace the princess if required
51+
if (CanReplacePrincess())
52+
pCreature->UpdateEntry(NPC_PRIESTESS);
53+
// no break;
54+
case NPC_EMPEROR:
5155
case NPC_PHALANX:
5256
case NPC_HATEREL:
5357
case NPC_ANGERREL:
@@ -400,6 +404,27 @@ void instance_blackrock_depths::DoCallNextDwarf()
400404
++m_uiDwarfRound;
401405
}
402406

407+
// function that replaces the princess if requirements are met
408+
bool instance_blackrock_depths::CanReplacePrincess()
409+
{
410+
Map::PlayerList const& players = instance->GetPlayers();
411+
if (players.isEmpty())
412+
return false;
413+
414+
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
415+
{
416+
if (Player* pPlayer = itr->getSource())
417+
{
418+
// if at least one player didn't complete the quest, return false
419+
if ((pPlayer->GetTeam() == ALLIANCE && !pPlayer->GetQuestRewardStatus(QUEST_FATE_KINGDOM))
420+
|| (pPlayer->GetTeam() == HORDE && !pPlayer->GetQuestRewardStatus(QUEST_ROYAL_RESCUE)))
421+
return false;
422+
}
423+
}
424+
425+
return true;
426+
}
427+
403428
void instance_blackrock_depths::Update(uint32 uiDiff)
404429
{
405430
if (m_uiDwarfFightTimer)

‎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 "s2839"
3+
#define SD2_REVISION_NR "s2840"
44
#endif // __SD2_REVISION_NR_H__

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL