Scripts/Uldaman: Added dungeon encounter ids

This commit is contained in:
Shauren
2023-09-17 22:01:07 +02:00
parent 83c0b901e5
commit 03d6dd8539
4 changed files with 75 additions and 32 deletions

View File

@@ -67,12 +67,11 @@ class boss_archaedas : public CreatureScript
{
}
struct boss_archaedasAI : public ScriptedAI
struct boss_archaedasAI : public BossAI
{
boss_archaedasAI(Creature* creature) : ScriptedAI(creature)
boss_archaedasAI(Creature* creature) : BossAI(creature, BOSS_ARCHAEDAS)
{
Initialize();
instance = me->GetInstanceScript();
}
void Initialize()
@@ -93,10 +92,10 @@ class boss_archaedas : public CreatureScript
bool bGuardiansAwake;
bool bVaultWalkersAwake;
InstanceScript* instance;
void Reset() override
{
_Reset();
Initialize();
instance->SetData(0, 5); // respawn any dead minions
@@ -121,8 +120,9 @@ class boss_archaedas : public CreatureScript
}
}
void JustEngagedWith(Unit* /*who*/) override
void JustEngagedWith(Unit* who) override
{
_JustEngagedWith(who);
me->SetFaction(FACTION_MONSTER);
me->SetUninteractible(false);
me->SetControlled(false, UNIT_STATE_ROOT);
@@ -208,7 +208,7 @@ class boss_archaedas : public CreatureScript
void JustDied (Unit* /*killer*/) override
{
instance->SetData(DATA_ANCIENT_DOOR, DONE); // open the vault door
_JustDied();
instance->SetData(DATA_MINIONS, SPECIAL); // deactivate his minions
}
};

View File

@@ -33,9 +33,9 @@ enum Ironaya
SPELL_WSTOMP = 11876
};
struct boss_ironaya : public ScriptedAI
struct boss_ironaya : public BossAI
{
boss_ironaya(Creature* creature) : ScriptedAI(creature)
boss_ironaya(Creature* creature) : BossAI(creature, BOSS_IRONAYA)
{
Initialize();
}
@@ -48,7 +48,7 @@ struct boss_ironaya : public ScriptedAI
void Reset() override
{
_scheduler.CancelAll();
_Reset();
Initialize();
}
@@ -68,9 +68,10 @@ struct boss_ironaya : public ScriptedAI
}
}
void JustEngagedWith(Unit* /*who*/) override
void JustEngagedWith(Unit* who) override
{
_scheduler.Schedule(3s, [this](TaskContext task)
_JustEngagedWith(who);
scheduler.Schedule(3s, [this](TaskContext task)
{
DoCastSelf(SPELL_ARCINGSMASH);
task.Repeat(13s);
@@ -82,14 +83,13 @@ struct boss_ironaya : public ScriptedAI
if (!UpdateVictim())
return;
_scheduler.Update(diff, [this]
scheduler.Update(diff, [this]
{
DoMeleeAttackIfReady();
});
}
private:
TaskScheduler _scheduler;
bool _hasCastKnockaway;
bool _hasCastWstomp;
};

View File

@@ -27,7 +27,6 @@ EndScriptData */
#include "CreatureAI.h"
#include "GameObject.h"
#include "InstanceScript.h"
#include "Log.h"
#include "Map.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
@@ -51,6 +50,18 @@ enum IronayaTalk
SAY_AGGRO = 0
};
static constexpr DungeonEncounterData Encounters[] =
{
{ BOSS_REVELOSH, { { 547 } } },
{ BOSS_THE_LOST_DWARVES, { { 548 } } },
{ BOSS_IRONAYA, { { 549 } } },
{ BOSS_ANCIENT_STONE_KEEPER, { { 551 } } },
{ BOSS_GALGANN_FIREHAMMER, { { 552 } } },
{ BOSS_GRIMLOK, { { 553 } } },
{ BOSS_ARCHAEDAS, { { 554 } } },
{ BOSS_OBSIDIAN_SENTINEL, { { 1887 } } },
};
const Position IronayaPoint = { -231.228f, 246.6135f, -49.01617f, 0.0f };
class instance_uldaman : public InstanceMapScript
@@ -64,16 +75,23 @@ class instance_uldaman : public InstanceMapScript
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
LoadDungeonEncounterData(Encounters);
ironayaActive = false;
altarDoorsDone = false;
ironayaSealDoorTimer = 27000; //animation time
keystoneCheck = false;
}
ObjectGuid archaedasGUID;
ObjectGuid ironayaGUID;
bool ironayaActive;
ObjectGuid whoWokeuiArchaedasGUID;
ObjectGuid altarOfTheKeeperTempleDoor;
bool altarDoorsDone;
ObjectGuid archaedasTempleDoor;
ObjectGuid ancientVaultDoor;
ObjectGuid ironayaSealDoor;
@@ -96,14 +114,14 @@ class instance_uldaman : public InstanceMapScript
case GO_ALTAR_OF_THE_KEEPER_TEMPLE_DOOR: // lock the door
altarOfTheKeeperTempleDoor = go->GetGUID();
if (GetBossState(0) == DONE)
if (altarDoorsDone)
HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_ARCHAEDAS_TEMPLE_DOOR:
archaedasTempleDoor = go->GetGUID();
if (GetBossState(0) == DONE)
if (altarDoorsDone)
HandleGameObject(ObjectGuid::Empty, true, go);
break;
@@ -112,21 +130,21 @@ class instance_uldaman : public InstanceMapScript
go->ReplaceAllFlags(GO_FLAG_IN_USE | GO_FLAG_NODESPAWN);
ancientVaultDoor = go->GetGUID();
if (GetBossState(1) == DONE)
if (GetBossState(BOSS_ARCHAEDAS) == DONE)
HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_IRONAYA_SEAL_DOOR:
ironayaSealDoor = go->GetGUID();
if (GetBossState(2) == DONE)
if (ironayaActive)
HandleGameObject(ObjectGuid::Empty, true, go);
break;
case GO_KEYSTONE:
keystoneGUID = go->GetGUID();
if (GetBossState(2) == DONE)
if (ironayaActive)
{
HandleGameObject(ObjectGuid::Empty, true, go);
go->SetFlag(GO_FLAG_INTERACT_COND);
@@ -268,6 +286,7 @@ class instance_uldaman : public InstanceMapScript
ironaya->SetHomePosition(IronayaPoint);
ironaya->AI()->Talk(SAY_AGGRO);
ironayaActive = true;
}
void RespawnMinions()
@@ -320,32 +339,41 @@ class instance_uldaman : public InstanceMapScript
SetDoor(ironayaSealDoor, true);
BlockGO(keystoneGUID);
SetData(DATA_IRONAYA_DOOR, DONE); //save state
keystoneCheck = false;
}
else
ironayaSealDoorTimer -= diff;
}
bool SetBossState(uint32 id, EncounterState state) override
{
if (!InstanceScript::SetBossState(id, state))
return false;
switch (id)
{
case BOSS_ARCHAEDAS:
if (state == DONE) //archeadas defeat
{
SetDoor(archaedasTempleDoor, true); //re open enter door
SetDoor(ancientVaultDoor, true);
}
break;
}
return true;
}
void SetData(uint32 type, uint32 data) override
{
switch (type)
{
case DATA_ALTAR_DOORS:
SetBossState(0, EncounterState(data));
altarDoorsDone = data == DONE;
if (data == DONE)
SetDoor(altarOfTheKeeperTempleDoor, true);
break;
case DATA_ANCIENT_DOOR:
SetBossState(1, EncounterState(data));
if (data == DONE) //archeadas defeat
{
SetDoor(archaedasTempleDoor, true); //re open enter door
SetDoor(ancientVaultDoor, true);
}
break;
case DATA_IRONAYA_DOOR:
SetBossState(2, EncounterState(data));
break;
@@ -358,7 +386,7 @@ class instance_uldaman : public InstanceMapScript
switch (data)
{
case NOT_STARTED:
if (GetBossState(0) == DONE) //if players opened the doors
if (altarDoorsDone) //if players opened the doors
SetDoor(archaedasTempleDoor, true);
RespawnMinions();
@@ -414,7 +442,7 @@ class instance_uldaman : public InstanceMapScript
case 7228: // Ironaya
ironayaGUID = creature->GetGUID();
if (GetBossState(2) != DONE)
if (!ironayaActive)
SetFrozenState (creature);
break;
@@ -429,6 +457,20 @@ class instance_uldaman : public InstanceMapScript
}
}
void OnUnitDeath(Unit* unit) override
{
switch (unit->GetEntry())
{
case NPC_REVELOSH: SetBossState(BOSS_REVELOSH, DONE); break;
//case ?: SetBossState(BOSS_THE_LOST_DWARVES, DONE); break;
case NPC_ANCIENT_STONE_KEEPER: SetBossState(BOSS_ANCIENT_STONE_KEEPER, DONE); break;
case NPC_GALGANN_FIREHAMMER: SetBossState(BOSS_GALGANN_FIREHAMMER, DONE); break;
case NPC_GRIMLOK: SetBossState(BOSS_GRIMLOK, DONE); break;
case NPC_OBSIDIAN_SENTINEL: SetBossState(BOSS_OBSIDIAN_SENTINEL, DONE); break;
default: break;
}
}
ObjectGuid GetGuidData(uint32 identifier) const override
{
switch (identifier)

View File

@@ -26,6 +26,7 @@ EndScriptData */
#include "GameObject.h"
#include "InstanceScript.h"
#include "Map.h"
#include "Unit.h"
#include "razorfen_kraul.h"
#define WARD_KEEPERS_NR 2