mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Scripts/MagistersTerrace: reworked InstanceScript and fixed some issues on boss Vexallus
* removed old hacks and added missing auras * Vexallus converted to EventMap
This commit is contained in:
7
sql/updates/world/2014_06_26_02_world_misc.sql
Normal file
7
sql/updates/world/2014_06_26_02_world_misc.sql
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Pure Energy
|
||||
SET @ENTRY := 24745;
|
||||
UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`=@ENTRY;
|
||||
|
||||
DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY;
|
||||
INSERT INTO `creature_template_addon` (`entry`, `mount`, `bytes1`, `bytes2`, `auras`) VALUES
|
||||
(@ENTRY, 0, 0x0, 0x0, '44326 46156');
|
||||
@@ -150,14 +150,14 @@ public:
|
||||
|
||||
Phase = 0;
|
||||
|
||||
instance->SetData(DATA_KAELTHAS_EVENT, NOT_STARTED);
|
||||
instance->SetBossState(DATA_KAELTHAS, NOT_STARTED);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
Talk(SAY_DEATH);
|
||||
|
||||
instance->SetData(DATA_KAELTHAS_EVENT, DONE);
|
||||
instance->SetBossState(DATA_KAELTHAS, DONE);
|
||||
|
||||
// Enable the Translocation Orb Exit
|
||||
if (GameObject* escapeOrb = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_ESCAPE_ORB)))
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
{
|
||||
instance->SetData(DATA_KAELTHAS_EVENT, IN_PROGRESS);
|
||||
instance->SetBossState(DATA_KAELTHAS, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
@@ -515,7 +515,7 @@ public:
|
||||
return;
|
||||
}
|
||||
//Don't really die in all phases of Kael'Thas
|
||||
if (instance->GetData(DATA_KAELTHAS_EVENT) == 0)
|
||||
if (instance->GetBossState(DATA_KAELTHAS) == 0)
|
||||
{
|
||||
//prevent death
|
||||
damage = 0;
|
||||
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
//this mean she at some point evaded
|
||||
void JustReachedHome() override
|
||||
{
|
||||
instance->SetData(DATA_DELRISSA_EVENT, FAIL);
|
||||
instance->SetBossState(DATA_DELRISSA, FAIL);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who) override
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
instance->SetData(DATA_DELRISSA_EVENT, IN_PROGRESS);
|
||||
instance->SetBossState(DATA_DELRISSA, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void InitializeLackeys()
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
Talk(SAY_DEATH);
|
||||
|
||||
if (instance->GetData(DATA_DELRISSA_DEATH_COUNT) == MAX_ACTIVE_LACKEY)
|
||||
instance->SetData(DATA_DELRISSA_EVENT, DONE);
|
||||
instance->SetBossState(DATA_DELRISSA, DONE);
|
||||
else
|
||||
{
|
||||
if (me->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
|
||||
@@ -434,7 +434,7 @@ struct boss_priestess_lackey_commonAI : public ScriptedAI
|
||||
if (!pDelrissa->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
|
||||
pDelrissa->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
|
||||
|
||||
instance->SetData(DATA_DELRISSA_EVENT, DONE);
|
||||
instance->SetBossState(DATA_DELRISSA, DONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
}
|
||||
|
||||
// Set Inst data for encounter
|
||||
instance->SetData(DATA_SELIN_EVENT, NOT_STARTED);
|
||||
instance->SetBossState(DATA_SELIN, NOT_STARTED);
|
||||
|
||||
DrainLifeTimer = urand(3000, 7000);
|
||||
DrainManaTimer = DrainLifeTimer + 5000;
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
instance->SetData(DATA_SELIN_EVENT, IN_PROGRESS);
|
||||
instance->SetBossState(DATA_SELIN, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/) override
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
{
|
||||
Talk(SAY_DEATH);
|
||||
|
||||
instance->SetData(DATA_SELIN_EVENT, DONE); // Encounter complete!
|
||||
instance->SetBossState(DATA_SELIN, DONE); // Encounter complete!
|
||||
ShatterRemainingCrystals();
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
} else TC_LOG_ERROR("scripts", ERROR_INST_DATA);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -16,13 +15,6 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
SDName: Boss_Vexallus
|
||||
SD%Complete: 90
|
||||
SDComment: Heroic and Normal support. Needs further testing.
|
||||
SDCategory: Magister's Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "magisters_terrace.h"
|
||||
@@ -41,26 +33,22 @@ enum Yells
|
||||
|
||||
enum Spells
|
||||
{
|
||||
// Pure energy spell info
|
||||
SPELL_ENERGY_BOLT = 46156,
|
||||
SPELL_ENERGY_FEEDBACK = 44335,
|
||||
|
||||
// Vexallus spell info
|
||||
SPELL_CHAIN_LIGHTNING = 44318,
|
||||
SPELL_H_CHAIN_LIGHTNING = 46380, // heroic spell
|
||||
SPELL_OVERLOAD = 44353,
|
||||
SPELL_ARCANE_SHOCK = 44319,
|
||||
SPELL_H_ARCANE_SHOCK = 46381, // heroic spell
|
||||
|
||||
SPELL_SUMMON_PURE_ENERGY = 44322, // mod scale -10
|
||||
H_SPELL_SUMMON_PURE_ENERGY1 = 46154, // mod scale -5
|
||||
H_SPELL_SUMMON_PURE_ENERGY2 = 46159 // mod scale -5
|
||||
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
enum Events
|
||||
{
|
||||
NPC_PURE_ENERGY = 24745,
|
||||
EVENT_ENERGY_BOLT = 1,
|
||||
EVENT_ENERGY_FEEDBACK,
|
||||
EVENT_CHAIN_LIGHTNING,
|
||||
EVENT_OVERLOAD,
|
||||
EVENT_ARCANE_SHOCK
|
||||
};
|
||||
|
||||
enum Misc
|
||||
@@ -71,170 +59,160 @@ enum Misc
|
||||
|
||||
class boss_vexallus : public CreatureScript
|
||||
{
|
||||
public:
|
||||
boss_vexallus() : CreatureScript("boss_vexallus") { }
|
||||
public:
|
||||
boss_vexallus() : CreatureScript("boss_vexallus") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetInstanceAI<boss_vexallusAI>(creature);
|
||||
};
|
||||
|
||||
struct boss_vexallusAI : public BossAI
|
||||
{
|
||||
boss_vexallusAI(Creature* creature) : BossAI(creature, DATA_VEXALLUS_EVENT)
|
||||
struct boss_vexallusAI : public BossAI
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
uint32 ChainLightningTimer;
|
||||
uint32 ArcaneShockTimer;
|
||||
uint32 OverloadTimer;
|
||||
uint32 IntervalHealthAmount;
|
||||
bool Enraged;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
summons.DespawnAll();
|
||||
ChainLightningTimer = 8000;
|
||||
ArcaneShockTimer = 5000;
|
||||
OverloadTimer = 1200;
|
||||
IntervalHealthAmount = 1;
|
||||
Enraged = false;
|
||||
|
||||
instance->SetData(DATA_VEXALLUS_EVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/) override
|
||||
{
|
||||
Talk(SAY_KILL);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
summons.DespawnAll();
|
||||
instance->SetData(DATA_VEXALLUS_EVENT, DONE);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
|
||||
instance->SetData(DATA_VEXALLUS_EVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned) override
|
||||
{
|
||||
if (Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
summoned->GetMotionMaster()->MoveFollow(temp, 0, 0);
|
||||
|
||||
//spells are SUMMON_TYPE_GUARDIAN, so using setOwner should be ok
|
||||
summoned->CastSpell(summoned, SPELL_ENERGY_BOLT, false, 0, 0, me->GetGUID());
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (!Enraged)
|
||||
boss_vexallusAI(Creature* creature) : BossAI(creature, DATA_VEXALLUS)
|
||||
{
|
||||
//used for check, when Vexallus cast adds 85%, 70%, 55%, 40%, 25%
|
||||
if (!HealthAbovePct(100 - INTERVAL_MODIFIER * IntervalHealthAmount))
|
||||
_intervalHealthAmount = 1;
|
||||
_enraged = false;
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
_intervalHealthAmount = 1;
|
||||
_enraged = false;
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/) override
|
||||
{
|
||||
Talk(SAY_KILL);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
{
|
||||
Talk(SAY_AGGRO);
|
||||
_EnterCombat();
|
||||
|
||||
events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 8000);
|
||||
events.ScheduleEvent(EVENT_ARCANE_SHOCK, 5000);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned) override
|
||||
{
|
||||
if (Unit* temp = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
summoned->GetMotionMaster()->MoveFollow(temp, 0, 0);
|
||||
|
||||
summons.Summon(summoned);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* /*who*/, uint32& damage) override
|
||||
{
|
||||
if (_enraged)
|
||||
return;
|
||||
|
||||
// 85%, 70%, 55%, 40%, 25%
|
||||
if (!HealthAbovePct(100 - INTERVAL_MODIFIER * _intervalHealthAmount))
|
||||
{
|
||||
//increase amount, unless we're at 10%, then we switch and return
|
||||
if (IntervalHealthAmount == INTERVAL_SWITCH)
|
||||
// increase amount, unless we're at 10%, then we switch and return
|
||||
if (_intervalHealthAmount == INTERVAL_SWITCH)
|
||||
{
|
||||
Enraged = true;
|
||||
_enraged = true;
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_OVERLOAD, 1200);
|
||||
return;
|
||||
}
|
||||
else
|
||||
++IntervalHealthAmount;
|
||||
++_intervalHealthAmount;
|
||||
|
||||
Talk(SAY_ENERGY);
|
||||
Talk(EMOTE_DISCHARGE_ENERGY);
|
||||
|
||||
if (IsHeroic())
|
||||
{
|
||||
DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1, false);
|
||||
DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2, false);
|
||||
DoCast(me, H_SPELL_SUMMON_PURE_ENERGY1);
|
||||
DoCast(me, H_SPELL_SUMMON_PURE_ENERGY2);
|
||||
}
|
||||
else
|
||||
DoCast(me, SPELL_SUMMON_PURE_ENERGY, false);
|
||||
DoCast(me, SPELL_SUMMON_PURE_ENERGY);
|
||||
}
|
||||
}
|
||||
|
||||
//below are workaround summons, remove when summoning spells w/implicitTarget 73 implemented in the core
|
||||
me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (IsHeroic())
|
||||
me->SummonCreature(NPC_PURE_ENERGY, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_CORPSE_DESPAWN, 0);
|
||||
events.Update(diff);
|
||||
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_CHAIN_LIGHTNING:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
|
||||
DoCast(target, SPELL_CHAIN_LIGHTNING);
|
||||
events.ScheduleEvent(EVENT_CHAIN_LIGHTNING, 8000);
|
||||
break;
|
||||
case EVENT_ARCANE_SHOCK:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 20.0f, true))
|
||||
DoCast(target, SPELL_ARCANE_SHOCK);
|
||||
events.ScheduleEvent(EVENT_ARCANE_SHOCK, 8000);
|
||||
break;
|
||||
case EVENT_OVERLOAD:
|
||||
DoCastVictim(SPELL_OVERLOAD);
|
||||
events.ScheduleEvent(EVENT_OVERLOAD, 2000);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ChainLightningTimer <= diff)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
DoCast(target, SPELL_CHAIN_LIGHTNING);
|
||||
|
||||
ChainLightningTimer = 8000;
|
||||
} else ChainLightningTimer -= diff;
|
||||
|
||||
if (ArcaneShockTimer <= diff)
|
||||
{
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||
if (target)
|
||||
DoCast(target, SPELL_ARCANE_SHOCK);
|
||||
|
||||
ArcaneShockTimer = 8000;
|
||||
} else ArcaneShockTimer -= diff;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OverloadTimer <= diff)
|
||||
{
|
||||
DoCastVictim(SPELL_OVERLOAD);
|
||||
|
||||
OverloadTimer = 2000;
|
||||
} else OverloadTimer -= diff;
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
private:
|
||||
uint32 _intervalHealthAmount;
|
||||
bool _enraged;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetInstanceAI<boss_vexallusAI>(creature);
|
||||
};
|
||||
};
|
||||
|
||||
enum NpcPureEnergy
|
||||
{
|
||||
SPELL_ENERGY_BOLT = 46156,
|
||||
SPELL_ENERGY_FEEDBACK = 44335,
|
||||
SPELL_PURE_ENERGY_PASSIVE = 44326
|
||||
};
|
||||
|
||||
class npc_pure_energy : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_pure_energy() : CreatureScript("npc_pure_energy") { }
|
||||
public:
|
||||
npc_pure_energy() : CreatureScript("npc_pure_energy") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_pure_energyAI(creature);
|
||||
};
|
||||
|
||||
struct npc_pure_energyAI : public ScriptedAI
|
||||
{
|
||||
npc_pure_energyAI(Creature* creature) : ScriptedAI(creature)
|
||||
struct npc_pure_energyAI : public ScriptedAI
|
||||
{
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
|
||||
}
|
||||
|
||||
void Reset() override { }
|
||||
|
||||
void JustDied(Unit* slayer) override
|
||||
{
|
||||
if (Unit* temp = me->GetOwner())
|
||||
npc_pure_energyAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
if (temp && temp->IsAlive())
|
||||
slayer->CastSpell(slayer, SPELL_ENERGY_FEEDBACK, true, 0, 0, temp->GetGUID());
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid2);
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override { }
|
||||
void MoveInLineOfSight(Unit* /*who*/) override { }
|
||||
void JustDied(Unit* killer) override
|
||||
{
|
||||
killer->CastSpell(killer, SPELL_ENERGY_FEEDBACK, true);
|
||||
me->RemoveAurasDueToSpell(SPELL_PURE_ENERGY_PASSIVE);
|
||||
}
|
||||
};
|
||||
|
||||
void AttackStart(Unit* /*who*/) override { }
|
||||
};
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_pure_energyAI(creature);
|
||||
};
|
||||
};
|
||||
|
||||
void AddSC_boss_vexallus()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -16,19 +15,10 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
SDName: Instance_Magisters_Terrace
|
||||
SD%Complete: 60
|
||||
SDComment: Designed only for Selin Fireheart
|
||||
SDCategory: Magister's Terrace
|
||||
EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "magisters_terrace.h"
|
||||
|
||||
#define MAX_ENCOUNTER 4
|
||||
|
||||
/*
|
||||
0 - Selin Fireheart
|
||||
1 - Vexallus
|
||||
@@ -36,281 +26,223 @@ EndScriptData */
|
||||
3 - Kael'thas Sunstrider
|
||||
*/
|
||||
|
||||
enum Creatures
|
||||
DoorData const doorData[] =
|
||||
{
|
||||
NPC_SELIN = 24723,
|
||||
NPC_DELRISSA = 24560,
|
||||
NPC_FELCRYSTALS = 24722
|
||||
};
|
||||
|
||||
enum GameObjects
|
||||
{
|
||||
GO_VEXALLUS_DOOR = 187896,
|
||||
GO_SELIN_DOOR = 187979,
|
||||
GO_SELIN_ENCOUNTER_DOOR = 188065,
|
||||
GO_DELRISSA_DOOR = 187770,
|
||||
GO_KAEL_DOOR = 188064,
|
||||
GO_KAEL_STATUE_1 = 188165,
|
||||
GO_KAEL_STATUE_2 = 188166,
|
||||
GO_ESCAPE_ORB = 188173
|
||||
{ GO_SELIN_DOOR, DATA_SELIN, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
|
||||
{ GO_SELIN_ENCOUNTER_DOOR, DATA_SELIN, DOOR_TYPE_ROOM, BOUNDARY_NONE },
|
||||
{ GO_VEXALLUS_DOOR, DATA_VEXALLUS, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
|
||||
{ GO_DELRISSA_DOOR, DATA_DELRISSA, DOOR_TYPE_PASSAGE, BOUNDARY_NONE },
|
||||
{ GO_KAEL_DOOR, DATA_KAELTHAS, DOOR_TYPE_ROOM, BOUNDARY_NONE },
|
||||
{ 0, 0, DOOR_TYPE_ROOM, BOUNDARY_NONE } // END
|
||||
};
|
||||
|
||||
class instance_magisters_terrace : public InstanceMapScript
|
||||
{
|
||||
public:
|
||||
instance_magisters_terrace() : InstanceMapScript("instance_magisters_terrace", 585) { }
|
||||
public:
|
||||
instance_magisters_terrace() : InstanceMapScript("instance_magisters_terrace", 585) { }
|
||||
|
||||
struct instance_magisters_terrace_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map) { }
|
||||
|
||||
uint32 Encounter[MAX_ENCOUNTER];
|
||||
uint32 DelrissaDeathCount;
|
||||
|
||||
std::vector<uint64> FelCrystals;
|
||||
|
||||
uint64 SelinGUID;
|
||||
uint64 DelrissaGUID;
|
||||
uint64 VexallusDoorGUID;
|
||||
uint64 SelinDoorGUID;
|
||||
uint64 SelinEncounterDoorGUID;
|
||||
uint64 DelrissaDoorGUID;
|
||||
uint64 KaelDoorGUID;
|
||||
uint64 KaelStatue[2];
|
||||
uint64 EscapeOrbGUID;
|
||||
uint32 StatuesState;
|
||||
uint8 felCristalIndex;
|
||||
|
||||
void Initialize() override
|
||||
struct instance_magisters_terrace_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
memset(&Encounter, 0, sizeof(Encounter));
|
||||
|
||||
FelCrystals.clear();
|
||||
|
||||
DelrissaDeathCount = 0;
|
||||
|
||||
SelinGUID = 0;
|
||||
DelrissaGUID = 0;
|
||||
VexallusDoorGUID = 0;
|
||||
SelinDoorGUID = 0;
|
||||
SelinEncounterDoorGUID = 0;
|
||||
DelrissaDoorGUID = 0;
|
||||
KaelDoorGUID = 0;
|
||||
KaelStatue[0] = 0;
|
||||
KaelStatue[1] = 0;
|
||||
EscapeOrbGUID = 0;
|
||||
StatuesState = 0;
|
||||
felCristalIndex = 0;
|
||||
}
|
||||
|
||||
bool IsEncounterInProgress() const override
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (Encounter[i] == IN_PROGRESS)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 identifier) const
|
||||
{
|
||||
switch (identifier)
|
||||
instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
case DATA_SELIN_EVENT:
|
||||
return Encounter[0];
|
||||
case DATA_VEXALLUS_EVENT:
|
||||
return Encounter[1];
|
||||
case DATA_DELRISSA_EVENT:
|
||||
return Encounter[2];
|
||||
case DATA_KAELTHAS_EVENT:
|
||||
return Encounter[3];
|
||||
case DATA_DELRISSA_DEATH_COUNT:
|
||||
return DelrissaDeathCount;
|
||||
case DATA_FEL_CRYSTAL_SIZE:
|
||||
return FelCrystals.size();
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadDoorData(doorData);
|
||||
|
||||
FelCrystals.clear();
|
||||
DelrissaDeathCount = 0;
|
||||
|
||||
SelinGUID = 0;
|
||||
DelrissaGUID = 0;
|
||||
EscapeOrbGUID = 0;
|
||||
FelCristalIndex = 0;
|
||||
|
||||
memset(KaelStatue, 0, 2 * sizeof(uint64));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 identifier, uint32 data)
|
||||
{
|
||||
switch (identifier)
|
||||
uint32 GetData(uint32 type) const override
|
||||
{
|
||||
case DATA_SELIN_EVENT:
|
||||
if (data == DONE)
|
||||
switch (type)
|
||||
{
|
||||
case DATA_DELRISSA_DEATH_COUNT:
|
||||
return DelrissaDeathCount;
|
||||
case DATA_FEL_CRYSTAL_SIZE:
|
||||
return FelCrystals.size();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data) override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DATA_DELRISSA_DEATH_COUNT:
|
||||
if (data == SPECIAL)
|
||||
++DelrissaDeathCount;
|
||||
else
|
||||
DelrissaDeathCount = 0;
|
||||
break;
|
||||
case DATA_KAELTHAS_STATUES:
|
||||
HandleGameObject(KaelStatue[0], data);
|
||||
HandleGameObject(KaelStatue[1], data);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_SELIN:
|
||||
SelinGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_DELRISSA:
|
||||
DelrissaGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_FELCRYSTALS:
|
||||
FelCrystals.push_back(creature->GetGUID());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go) override
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_VEXALLUS_DOOR:
|
||||
case GO_SELIN_DOOR:
|
||||
case GO_SELIN_ENCOUNTER_DOOR:
|
||||
case GO_DELRISSA_DOOR:
|
||||
case GO_KAEL_DOOR:
|
||||
AddDoor(go, true);
|
||||
break;
|
||||
case GO_KAEL_STATUE_1:
|
||||
KaelStatue[0] = go->GetGUID();
|
||||
break;
|
||||
case GO_KAEL_STATUE_2:
|
||||
KaelStatue[1] = go->GetGUID();
|
||||
break;
|
||||
case GO_ESCAPE_ORB:
|
||||
EscapeOrbGUID = go->GetGUID();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool SetBossState(uint32 type, EncounterState state) override
|
||||
{
|
||||
if (!InstanceScript::SetBossState(type, state))
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DATA_DELRISSA:
|
||||
if (type == IN_PROGRESS)
|
||||
DelrissaDeathCount = 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "M T " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
if (dataHead1 == 'M' && dataHead2 == 'T')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
HandleGameObject(SelinEncounterDoorGUID, true);
|
||||
HandleGameObject(SelinDoorGUID, true);
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
else if (data == IN_PROGRESS)
|
||||
HandleGameObject(SelinEncounterDoorGUID, false);
|
||||
else if (data == NOT_STARTED)
|
||||
HandleGameObject(SelinEncounterDoorGUID, true);
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
Encounter[0] = data;
|
||||
break;
|
||||
case DATA_VEXALLUS_EVENT:
|
||||
if (data == DONE)
|
||||
HandleGameObject(VexallusDoorGUID, true);
|
||||
Encounter[1] = data;
|
||||
break;
|
||||
case DATA_DELRISSA_EVENT:
|
||||
if (data == DONE)
|
||||
HandleGameObject(DelrissaDoorGUID, true);
|
||||
if (data == IN_PROGRESS)
|
||||
DelrissaDeathCount = 0;
|
||||
Encounter[2] = data;
|
||||
break;
|
||||
case DATA_KAELTHAS_EVENT:
|
||||
if (data == NOT_STARTED || data == DONE)
|
||||
HandleGameObject(KaelDoorGUID, true);
|
||||
else if (data == IN_PROGRESS)
|
||||
HandleGameObject(KaelDoorGUID, false);
|
||||
Encounter[3] = data;
|
||||
break;
|
||||
case DATA_DELRISSA_DEATH_COUNT:
|
||||
if (data == SPECIAL)
|
||||
++DelrissaDeathCount;
|
||||
else
|
||||
DelrissaDeathCount = 0;
|
||||
break;
|
||||
case DATA_KAELTHAS_STATUES:
|
||||
HandleGameObject(KaelStatue[0], data);
|
||||
HandleGameObject(KaelStatue[1], data);
|
||||
StatuesState = data;
|
||||
break;
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
uint64 GetData64(uint32 type) const override
|
||||
{
|
||||
case NPC_SELIN:
|
||||
SelinGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_DELRISSA:
|
||||
DelrissaGUID = creature->GetGUID();
|
||||
break;
|
||||
case NPC_FELCRYSTALS:
|
||||
FelCrystals.push_back(creature->GetGUID());
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case DATA_SELIN:
|
||||
return SelinGUID;
|
||||
case DATA_DELRISSA:
|
||||
return DelrissaGUID;
|
||||
case DATA_KAEL_STATUE_LEFT:
|
||||
return KaelStatue[0];
|
||||
case DATA_KAEL_STATUE_RIGHT:
|
||||
return KaelStatue[1];
|
||||
case DATA_ESCAPE_ORB:
|
||||
return EscapeOrbGUID;
|
||||
case DATA_FEL_CRYSTAL:
|
||||
if (FelCrystals.size() < FelCristalIndex)
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "Magisters Terrace: No Fel Crystals loaded in Inst Data");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go) override
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
return FelCrystals.at(FelCristalIndex);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData64(uint32 type, uint64 value) override
|
||||
{
|
||||
case GO_VEXALLUS_DOOR:
|
||||
VexallusDoorGUID = go->GetGUID();
|
||||
break;
|
||||
case GO_SELIN_DOOR:
|
||||
SelinDoorGUID = go->GetGUID();
|
||||
break;
|
||||
case GO_SELIN_ENCOUNTER_DOOR:
|
||||
SelinEncounterDoorGUID = go->GetGUID();
|
||||
break;
|
||||
case GO_DELRISSA_DOOR:
|
||||
DelrissaDoorGUID = go->GetGUID();
|
||||
break;
|
||||
case GO_KAEL_DOOR:
|
||||
KaelDoorGUID = go->GetGUID();
|
||||
break;
|
||||
case GO_KAEL_STATUE_1:
|
||||
KaelStatue[0] = go->GetGUID();
|
||||
break;
|
||||
case GO_KAEL_STATUE_2:
|
||||
KaelStatue[1] = go->GetGUID();
|
||||
break;
|
||||
case GO_ESCAPE_ORB:
|
||||
EscapeOrbGUID = go->GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3] << ' ' << StatuesState;
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
if (type == DATA_FEL_CRYSTAL)
|
||||
FelCristalIndex = value;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
protected:
|
||||
std::vector<uint64> FelCrystals;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
uint64 SelinGUID;
|
||||
uint64 DelrissaGUID;
|
||||
uint64 KaelStatue[2];
|
||||
uint64 EscapeOrbGUID;
|
||||
uint32 DelrissaDeathCount;
|
||||
uint8 FelCristalIndex;
|
||||
};
|
||||
|
||||
for (uint32 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetData(i, tmpState);
|
||||
}
|
||||
|
||||
loadStream >> StatuesState;
|
||||
SetData(DATA_KAELTHAS_STATUES, StatuesState);
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier) const
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
{
|
||||
switch (identifier)
|
||||
{
|
||||
case DATA_SELIN:
|
||||
return SelinGUID;
|
||||
case DATA_DELRISSA:
|
||||
return DelrissaGUID;
|
||||
case DATA_VEXALLUS_DOOR:
|
||||
return VexallusDoorGUID;
|
||||
case DATA_DELRISSA_DOOR:
|
||||
return DelrissaDoorGUID;
|
||||
case DATA_KAEL_DOOR:
|
||||
return KaelDoorGUID;
|
||||
case DATA_KAEL_STATUE_LEFT:
|
||||
return KaelStatue[0];
|
||||
case DATA_KAEL_STATUE_RIGHT:
|
||||
return KaelStatue[1];
|
||||
case DATA_ESCAPE_ORB:
|
||||
return EscapeOrbGUID;
|
||||
case DATA_FEL_CRYSTAL:
|
||||
if (FelCrystals.size() < felCristalIndex)
|
||||
{
|
||||
TC_LOG_ERROR("scripts", "Magisters Terrace: No Fel Crystals loaded in Inst Data");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return FelCrystals.at(felCristalIndex);
|
||||
}
|
||||
return 0;
|
||||
return new instance_magisters_terrace_InstanceMapScript(map);
|
||||
}
|
||||
|
||||
void SetData64(uint32 identifier, uint64 value)
|
||||
{
|
||||
if (identifier == DATA_FEL_CRYSTAL)
|
||||
felCristalIndex = value;
|
||||
}
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
{
|
||||
return new instance_magisters_terrace_InstanceMapScript(map);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_instance_magisters_terrace()
|
||||
|
||||
@@ -19,24 +19,17 @@
|
||||
#ifndef DEF_MAGISTERS_TERRACE_H
|
||||
#define DEF_MAGISTERS_TERRACE_H
|
||||
|
||||
#define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy."
|
||||
uint32 const EncounterCount = 4;
|
||||
|
||||
enum Data
|
||||
enum DataTypes
|
||||
{
|
||||
DATA_SELIN_EVENT,
|
||||
DATA_VEXALLUS_EVENT,
|
||||
DATA_DELRISSA_EVENT,
|
||||
DATA_KAELTHAS_EVENT,
|
||||
|
||||
DATA_SELIN,
|
||||
DATA_VEXALLUS,
|
||||
DATA_DELRISSA,
|
||||
DATA_KAELTHAS,
|
||||
|
||||
DATA_FEL_CRYSTAL,
|
||||
DATA_FEL_CRYSTAL_SIZE,
|
||||
|
||||
DATA_VEXALLUS_DOOR,
|
||||
DATA_DELRISSA,
|
||||
DATA_DELRISSA_DOOR,
|
||||
|
||||
DATA_KAEL_DOOR,
|
||||
DATA_KAEL_STATUE_LEFT,
|
||||
DATA_KAEL_STATUE_RIGHT,
|
||||
|
||||
@@ -45,4 +38,23 @@ enum Data
|
||||
DATA_ESCAPE_ORB
|
||||
};
|
||||
|
||||
enum CreatureIds
|
||||
{
|
||||
NPC_SELIN = 24723,
|
||||
NPC_DELRISSA = 24560,
|
||||
NPC_FELCRYSTALS = 24722
|
||||
};
|
||||
|
||||
enum GameObjectIds
|
||||
{
|
||||
GO_VEXALLUS_DOOR = 187896,
|
||||
GO_SELIN_DOOR = 187979,
|
||||
GO_SELIN_ENCOUNTER_DOOR = 188065,
|
||||
GO_DELRISSA_DOOR = 187770,
|
||||
GO_KAEL_DOOR = 188064,
|
||||
GO_KAEL_STATUE_1 = 188165,
|
||||
GO_KAEL_STATUE_2 = 188166,
|
||||
GO_ESCAPE_ORB = 188173
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user