Scripts/BlackTemple: minor cleanup and corrections after recent PRs

plus a ninja tabs to spaces cleanup
(cherry picked from commit 4bc60e650d)

Scripts/BlackTemple: 4bc60e650d followup
(cherry picked from commit 62e97c4551)

Scripts/BT: Fix noPCH build
(cherry picked from commit 8a7b0f198c)
This commit is contained in:
ccrs
2016-11-30 14:05:07 +01:00
committed by DoctorKraft
parent 8491172cd4
commit 1ed65753df
6 changed files with 108 additions and 98 deletions

View File

@@ -0,0 +1 @@
UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry`=23123;

View File

@@ -16,13 +16,14 @@
*/
#include "ScriptMgr.h"
#include "black_temple.h"
#include "GridNotifiers.h"
#include "ObjectAccessor.h"
#include "PassiveAI.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "black_temple.h"
enum Says
{
SAY_AGGRO = 0,
@@ -185,7 +186,7 @@ public:
events.Update(diff);
while (uint32 eventId = events.ExecuteEvent())
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
@@ -236,8 +237,7 @@ public:
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
}
//Solo attempts dont change phase (he reset first phase spells)
else
else // If no other targets are found, reset phase 1
{
events.SetPhase(PHASE_1);
events.CancelEventGroup(GROUP_PHASE_2);
@@ -290,21 +290,23 @@ public:
me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, false);
ScheduleEvents();
//When phase 2 ends, he need attack back the tanker of the first phase
if (Unit* target = ObjectAccessor::GetUnit(*me, _oldTargetGUID))
if (Unit* phase2tanker = ObjectAccessor::GetUnit(*me, _targetGUID))
// Attack the stored target
if (Unit* oldTarget = ObjectAccessor::GetUnit(*me, _oldTargetGUID))
if (Unit* currentTarget = ObjectAccessor::GetUnit(*me, _targetGUID))
{
DoModifyThreatPercent(phase2tanker, -100);
AttackStart(target);
me->AddThreat(target, _oldThreat);
DoModifyThreatPercent(currentTarget, -100);
AttackStart(oldTarget);
me->AddThreat(oldTarget, _oldThreat);
Initialize();
}
}
}
private:
ObjectGuid _targetGUID;
ObjectGuid _oldTargetGUID;
float _oldThreat;
private:
ObjectGuid _targetGUID;
ObjectGuid _oldTargetGUID;
float _oldThreat;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -331,7 +333,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_fel_geyserAI(creature);
return GetBlackTempleAI<npc_fel_geyserAI>(creature);
}
};

View File

@@ -241,7 +241,7 @@ public:
events.Reset();
summons.DespawnAll();
for (ObjectGuid const& spawnerGuid : _spawners)
for (ObjectGuid const spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_DESPAWN_ALL_SPAWNS);
@@ -273,7 +273,7 @@ public:
me->SetWalk(false);
events.ScheduleEvent(EVENT_ADD_THREAT, Milliseconds(100));
for (ObjectGuid const& spawnerGuid : _spawners)
for (ObjectGuid const spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_STOP_SPAWNING);
}
@@ -286,7 +286,7 @@ public:
if (Creature* akama = instance->GetCreature(DATA_AKAMA_SHADE))
akama->AI()->DoAction(ACTION_SHADE_OF_AKAMA_DEAD);
for (ObjectGuid const& spawnerGuid : _spawners)
for (ObjectGuid const spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_DESPAWN_ALL_SPAWNS);
@@ -328,11 +328,11 @@ public:
}
case EVENT_START_CHANNELERS_AND_SPAWNERS:
{
for (ObjectGuid const& summonGuid : summons)
for (ObjectGuid const summonGuid : summons)
if (Creature* channeler = ObjectAccessor::GetCreature(*me, summonGuid))
channeler->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
for (ObjectGuid const& spawnerGuid : _spawners)
for (ObjectGuid const spawnerGuid : _spawners)
if (Creature* spawner = ObjectAccessor::GetCreature(*me, spawnerGuid))
spawner->AI()->DoAction(ACTION_START_SPAWNING);
@@ -354,9 +354,9 @@ public:
DoMeleeAttackIfReady();
}
private:
GuidVector _spawners;
bool _isInPhaseOne;
private:
GuidVector _spawners;
bool _isInPhaseOne;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -565,14 +565,14 @@ public:
}
}
private:
InstanceScript* _instance;
EventMap _events;
SummonList _summons;
DummyEntryCheckPredicate _pred;
ObjectGuid _chosen; //Creature that should yell the speech special.
bool _isInCombat;
bool _hasYelledOnce;
private:
InstanceScript* _instance;
EventMap _events;
SummonList _summons;
DummyEntryCheckPredicate _pred;
ObjectGuid _chosen; //Creature that should yell the speech special.
bool _isInCombat;
bool _hasYelledOnce;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -616,9 +616,9 @@ public:
_scheduler.Update(diff);
}
private:
InstanceScript* _instance;
TaskScheduler _scheduler;
private:
InstanceScript* _instance;
TaskScheduler _scheduler;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -713,10 +713,10 @@ public:
}
}
private:
EventMap _events;
SummonList _summons;
bool _leftSide;
private:
EventMap _events;
SummonList _summons;
bool _leftSide;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -817,11 +817,11 @@ public:
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
TaskScheduler _scheduler;
bool _switchToCombat;
bool _inBanish;
private:
InstanceScript* _instance;
TaskScheduler _scheduler;
bool _switchToCombat;
bool _inBanish;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -897,9 +897,9 @@ public:
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
EventMap _events;
private:
InstanceScript* _instance;
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -966,9 +966,9 @@ public:
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
EventMap _events;
private:
InstanceScript* _instance;
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1035,9 +1035,9 @@ public:
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
EventMap _events;
private:
InstanceScript* _instance;
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -1134,11 +1134,11 @@ public:
DoMeleeAttackIfReady();
}
private:
InstanceScript* _instance;
EventMap _events;
bool _spiritMend;
bool _chainHeal;
private:
InstanceScript* _instance;
EventMap _events;
bool _spiritMend;
bool _chainHeal;
};
CreatureAI* GetAI(Creature* creature) const override

View File

@@ -202,7 +202,7 @@ public:
void InitializeAI() override
{
float x, y, z;
me->GetNearPoint(me, x, y, z, 1, 100.0f, float(M_PI * 2 * rand_norm()));
me->GetNearPoint(me, x, y, z, 1, 100.0f, frand(0.f, 2.f * float(M_PI)));
me->GetMotionMaster()->MovePoint(0, x, y, z);
DoCastSelf(SPELL_MOLTEN_FLAME, true);
}
@@ -210,7 +210,7 @@ public:
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_molten_flameAI(creature);
return GetBlackTempleAI<npc_molten_flameAI>(creature);
}
};

View File

@@ -89,6 +89,12 @@ enum Events
EVENT_FINISH_INTRO
};
enum Phases
{
PHASE_INTRO = 1,
PHASE_COMBAT
};
enum Actions
{
ACTION_START_INTRO = 1
@@ -111,15 +117,15 @@ public:
{
boss_teron_gorefiendAI(Creature* creature) : BossAI(creature, DATA_TERON_GOREFIEND), _intro(false)
{
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_PASSIVE);
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
creature->SetReactState(REACT_PASSIVE);
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
Talk(SAY_AGGRO);
events.SetPhase(PHASE_COMBAT);
events.ScheduleEvent(EVENT_ENRAGE, Minutes(10));
events.ScheduleEvent(EVENT_INCINERATE, Seconds(12));
events.ScheduleEvent(EVENT_SUMMON_DOOM_BLOSSOM, Seconds(8));
@@ -140,6 +146,7 @@ public:
{
_intro = true;
Talk(SAY_INTRO);
events.SetPhase(PHASE_INTRO);
events.ScheduleEvent(EVENT_FINISH_INTRO, Seconds(20));
}
}
@@ -159,6 +166,9 @@ public:
void UpdateAI(uint32 diff) override
{
if (!events.IsInPhase(PHASE_INTRO) && !UpdateVictim())
return;
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
@@ -193,8 +203,7 @@ public:
events.Repeat(Seconds(18), Seconds(30));
break;
case EVENT_FINISH_INTRO:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_AGGRESSIVE);
break;
default:
@@ -205,13 +214,11 @@ public:
return;
}
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
private:
bool _intro;
private:
bool _intro;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -227,18 +234,16 @@ public:
struct npc_doom_blossomAI : public NullCreatureAI
{
npc_doom_blossomAI(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript())
npc_doom_blossomAI(Creature* creature) : NullCreatureAI(creature), _instance(me->GetInstanceScript()) { }
void Reset() override
{
/* Workaround - Until SMSG_SET_PLAY_HOVER_ANIM be implemented */
me->SetDisableGravity(true);
Position pos;
pos.Relocate(me);
pos.m_positionZ += 8.0f;
me->GetMotionMaster()->MoveTakeoff(0, pos);
}
void Reset() override
{
DoCast(SPELL_SUMMON_BLOSSOM_MOVE_TARGET);
_scheduler.CancelAll();
me->SetInCombatWithZone();
@@ -274,13 +279,14 @@ class npc_shadowy_construct : public CreatureScript
{
public:
npc_shadowy_construct() : CreatureScript("npc_shadowy_construct") { }
struct npc_shadowy_constructAI : public ScriptedAI
{
npc_shadowy_constructAI(Creature* creature) : ScriptedAI(creature), _instance(me->GetInstanceScript())
npc_shadowy_constructAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
{
//This creature must be immune everything, except spells of Vengeful Spirit.
me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
me->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_MAGIC, true);
creature->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_MAGIC, true);
}
void Reset() override
@@ -339,7 +345,6 @@ public:
me->AddThreat(target, 1000000.0f);
targetGUID = target->GetGUID();
}
//He only should target Vengeful Spirits if has no other player available
else if (Unit* target = teron->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0))
{
DoResetThreat();
@@ -354,7 +359,6 @@ public:
TaskScheduler _scheduler;
InstanceScript* _instance;
ObjectGuid targetGUID;
};
CreatureAI* GetAI(Creature* creature) const override
@@ -453,8 +457,8 @@ class spell_teron_gorefiend_spiritual_vengeance : public SpellScriptLoader
void Register() override
{
AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_spiritual_vengeance_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_POSSESS, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_spiritual_vengeance_AuraScript::OnRemove, EFFECT_2, SPELL_AURA_MOD_PACIFY_SILENCE, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_spiritual_vengeance_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_POSSESS, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_teron_gorefiend_spiritual_vengeance_AuraScript::OnRemove, EFFECT_2, SPELL_AURA_MOD_PACIFY_SILENCE, AURA_EFFECT_HANDLE_REAL);
}
};

View File

@@ -43,16 +43,16 @@ DoorData const doorData[] =
BossBoundaryData const boundaries =
{
{ DATA_HIGH_WARLORD_NAJENTUS, new RectangleBoundary(394.0f, 479.4f, 707.8f, 859.1f) },
{ DATA_SUPREMUS, new RectangleBoundary(556.1f, 850.2f, 542.0f, 1001.0f) },
{ DATA_SHADE_OF_AKAMA, new RectangleBoundary(406.8f, 564.0f, 327.9f, 473.5f) },
{ DATA_TERON_GOREFIEND, new RectangleBoundary(512.5f, 613.3f, 373.2f, 432.0f) },
{ DATA_TERON_GOREFIEND, new ZRangeBoundary(179.5f, 223.6f) },
{ DATA_GURTOGG_BLOODBOIL, new RectangleBoundary(720.5f, 864.5f, 159.3f, 316.0f) },
{ DATA_RELIQUARY_OF_SOULS, new RectangleBoundary(435.9f, 558.8f, 113.3f, 229.6f) },
{ DATA_MOTHER_SHAHRAZ, new RectangleBoundary(903.4f, 982.1f, 92.4f, 476.7f) },
{ DATA_ILLIDARI_COUNCIL, new EllipseBoundary(Position(696.6f, 305.0f), 70.0 , 85.0) },
{ DATA_ILLIDAN_STORMRAGE, new EllipseBoundary(Position(694.8f, 309.0f), 70.0 , 85.0) }
{ DATA_HIGH_WARLORD_NAJENTUS, new RectangleBoundary(394.0f, 479.4f, 707.8f, 859.1f) },
{ DATA_SUPREMUS, new RectangleBoundary(556.1f, 850.2f, 542.0f, 1001.0f) },
{ DATA_SHADE_OF_AKAMA, new RectangleBoundary(406.8f, 564.0f, 327.9f, 473.5f) },
{ DATA_TERON_GOREFIEND, new RectangleBoundary(512.5f, 613.3f, 373.2f, 432.0f) },
{ DATA_TERON_GOREFIEND, new ZRangeBoundary(179.5f, 223.6f) },
{ DATA_GURTOGG_BLOODBOIL, new RectangleBoundary(720.5f, 864.5f, 159.3f, 316.0f) },
{ DATA_RELIQUARY_OF_SOULS, new RectangleBoundary(435.9f, 558.8f, 113.3f, 229.6f) },
{ DATA_MOTHER_SHAHRAZ, new RectangleBoundary(903.4f, 982.1f, 92.4f, 476.7f) },
{ DATA_ILLIDARI_COUNCIL, new EllipseBoundary(Position(696.6f, 305.0f), 70.0 , 85.0) },
{ DATA_ILLIDAN_STORMRAGE, new EllipseBoundary(Position(694.8f, 309.0f), 70.0 , 85.0) }
};
ObjectData const creatureData[] =
@@ -79,9 +79,9 @@ ObjectData const creatureData[] =
ObjectData const gameObjectData[] =
{
{ GO_ILLIDAN_GATE, DATA_GO_ILLIDAN_GATE },
{ GO_DEN_OF_MORTAL_DOOR, DATA_GO_DEN_OF_MORTAL_DOOR },
{ 0, 0 } //END
{ GO_ILLIDAN_GATE, DATA_GO_ILLIDAN_GATE },
{ GO_DEN_OF_MORTAL_DOOR, DATA_GO_DEN_OF_MORTAL_DOOR },
{ 0, 0 } //END
};
class instance_black_temple : public InstanceMapScript
@@ -103,15 +103,17 @@ class instance_black_temple : public InstanceMapScript
void OnGameObjectCreate(GameObject* go) override
{
InstanceScript::OnGameObjectCreate(go);
if (go->GetEntry() == GO_DEN_OF_MORTAL_DOOR)
if(CheckDenOfMortalDoor())
go->SetGoState(GO_STATE_ACTIVE);
if (CheckDenOfMortalDoor())
HandleGameObject(ObjectGuid::Empty, true, go);
}
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
return false;
switch (type)
{
case DATA_HIGH_WARLORD_NAJENTUS:
@@ -128,13 +130,14 @@ class instance_black_temple : public InstanceMapScript
if (Creature* trigger = GetCreature(DATA_BLACK_TEMPLE_TRIGGER))
trigger->AI()->Talk(EMOTE_DEN_OF_MORTAL_DOOR_OPEN);
if(GameObject* go = GetGameObject(DATA_GO_DEN_OF_MORTAL_DOOR))
go->SetGoState(GO_STATE_ACTIVE);
if (GameObject* door = GetGameObject(DATA_GO_DEN_OF_MORTAL_DOOR))
HandleGameObject(ObjectGuid::Empty, true, door);
}
break;
default:
break;
}
return true;
}