Skip to content

Commit

Permalink
Scripts/Ruby Sanctum:
Browse files Browse the repository at this point in the history
* Fixed a crash caused by the grid.
* Update spawnmasks.
* Misc updates and corrections.

Closes #8079.
Closes #8078.
Closes #8081.
Closes #8077.
  • Loading branch information
Warpten committed Oct 22, 2012
1 parent 71f6b7d commit a664a35
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 54 deletions.
10 changes: 10 additions & 0 deletions sql/updates/world/2012_10_14_00_world_creature.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Spawnmask updates
UPDATE `creature` SET `spawnMask`=15 WHERE `id` IN(40091, 40081);

-- Auras updates (Now in script, can't be used in creature_addon because dynamically spawned)
DELETE FROM `creature_template_addon` WHERE `entry` IN(39863, 40142);

-- Blazing Aura
-- NOTE: This still does not work, no clue why. Probably a core-side bug ?
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(13,2,75886,0,0,31,0,3,40683,0,0,0, '', 'Blazing Aura can only target Living Embers');
4 changes: 4 additions & 0 deletions src/server/game/Spells/SpellMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3607,6 +3607,10 @@ void SpellMgr::LoadDbcDataCorrections()
spellInfo->AttributesEx6 |= SPELL_ATTR6_CAN_TARGET_INVISIBLE;
spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS;
break;
case 75888: // Awaken Flames
case 75889: // Awaken Flames
spellInfo->AttributesEx |= SPELL_ATTR1_CANT_TARGET_SELF;
break;
// ENDOF RUBY SANCTUM SPELLS
//
case 40055: // Introspection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ enum Spells
SPELL_SUMMON_EXIT_PORTALS = 74805, // Custom spell created in spell_dbc.
SPELL_TWILIGHT_MENDING = 75509,
SPELL_TWILIGHT_REALM = 74807,
SPELL_DUSK_SHROUD = 75476,
SPELL_TWILIGHT_PRECISION = 78243,
SPELL_COPY_DAMAGE = 74810 // Aura not found in DBCs.
};

Expand Down Expand Up @@ -226,19 +228,24 @@ struct generic_halionAI : public BossAI
{
generic_halionAI(Creature* creature, uint32 bossId) : BossAI(creature, bossId), _canEvade(false) { }

void EnterCombat(Unit* /*who*/)
void EnterCombat(Unit* who)
{
Talk(SAY_AGGRO);
_EnterCombat();
BossAI::EnterCombat(who);
_canEvade = false;
events.Reset();
events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000));
events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
}

void Reset()
{
_canEvade = false;
BossAI::Reset();
}

void EnterEvadeMode()
{
BossAI::EnterEvadeMode();
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
_EnterEvadeMode();
}

void ExecuteEvent(uint32 const eventId)
Expand All @@ -249,6 +256,10 @@ struct generic_halionAI : public BossAI
DoCastVictim(SPELL_CLEAVE);
events.ScheduleEvent(EVENT_CLEAVE, urand(8000, 10000));
break;
case EVENT_TAIL_LASH:
DoCastAOE(SPELL_TAIL_LASH);
events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
break;
}
}

Expand Down Expand Up @@ -297,52 +308,54 @@ class boss_halion : public CreatureScript

struct boss_halionAI : public generic_halionAI
{
boss_halionAI(Creature* creature) : generic_halionAI(creature, DATA_HALION) { }
boss_halionAI(Creature* creature) : generic_halionAI(creature, DATA_HALION)
{
me->SetHomePosition(HalionSpawnPos);
}

void Reset()
{
generic_halionAI::Reset();
me->SetReactState(REACT_DEFENSIVE);

instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);

me->RemoveAurasDueToSpell(SPELL_TWILIGHT_PHASING);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
me->AddAura(SPELL_TWILIGHT_PRECISION, me);
}

void EnterEvadeMode()
{
// Phase 1: We always can evade. Phase 2 & 3: We can evade if and only if the controller tells us to.
// Controller has absolute priority over the phasemask.
if ((events.GetPhaseMask() & PHASE_ONE_MASK) || _canEvade)
generic_halionAI::EnterEvadeMode();
}

void EnterCombat(Unit* who)
{
Talk(SAY_AGGRO);

events.Reset();
events.SetPhase(PHASE_ONE);

generic_halionAI::EnterCombat(who);

instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1);
instance->SetBossState(DATA_HALION, IN_PROGRESS);

events.SetPhase(PHASE_ONE);
events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 10000);
events.ScheduleEvent(EVENT_ACTIVATE_FIREWALL, 5000);
events.ScheduleEvent(EVENT_FLAME_BREATH, urand(10000, 12000));
events.ScheduleEvent(EVENT_METEOR_STRIKE, urand(20000, 25000));
events.ScheduleEvent(EVENT_FIERY_COMBUSTION, urand(15000, 18000));
events.ScheduleEvent(EVENT_TAIL_LASH, 10000);

if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
controller->AI()->SetData(DATA_FIGHT_PHASE, PHASE_ONE);
}

void JustDied(Unit* /*killer*/)
void JustDied(Unit* killer)
{
_JustDied();
BossAI::JustDied(killer);

Talk(SAY_DEATH);
instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
me->Kill(controller);
Expand Down Expand Up @@ -390,21 +403,15 @@ class boss_halion : public CreatureScript
switch (eventId)
{
case EVENT_ACTIVATE_FIREWALL:
{
// Flame ring is activated 10 seconds after starting encounter, DOOR_TYPE_ROOM is only instant.
// Flame ring is activated 5 seconds after starting encounter, DOOR_TYPE_ROOM is only instant.
for (uint8 i = DATA_FLAME_RING; i <= DATA_TWILIGHT_FLAME_RING; ++i)
if (GameObject* flameRing = ObjectAccessor::GetGameObject(*me, instance->GetData64(i)))
instance->HandleGameObject(instance->GetData64(DATA_FLAME_RING), false, flameRing);
break;
}
case EVENT_FLAME_BREATH:
DoCast(me, SPELL_FLAME_BREATH);
events.ScheduleEvent(EVENT_FLAME_BREATH, 25000);
break;
case EVENT_TAIL_LASH:
DoCastAOE(SPELL_TAIL_LASH);
events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
break;
case EVENT_METEOR_STRIKE:
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, -SPELL_TWILIGHT_REALM))
Expand Down Expand Up @@ -466,29 +473,32 @@ class boss_twilight_halion : public CreatureScript
if (!halion)
return;

// We use explicit targeting here to avoid conditions + SPELL_ATTR6_CANT_TARGET_SELF.
// Using AddAura because no spell cast packet in sniffs.
halion->AddAura(SPELL_COPY_DAMAGE, me);
halion->AddAura(SPELL_COPY_DAMAGE, me); // We use explicit targeting here to avoid conditions + SPELL_ATTR6_CANT_TARGET_SELF.
me->AddAura(SPELL_COPY_DAMAGE, halion);
me->AddAura(SPELL_DUSK_SHROUD, me);

me->SetHealth(halion->GetHealth());
me->SetPhaseMask(0x20, true);
me->SetReactState(REACT_AGGRESSIVE);
}

instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2);

void EnterCombat(Unit* who)
{
events.Reset();
events.SetPhase(PHASE_TWO);

generic_halionAI::EnterCombat(who);

events.ScheduleEvent(EVENT_DARK_BREATH, urand(10000, 15000));
events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000);
events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
}

void EnterEvadeMode()
{
// We don't care about evading, we will be despawned.
instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 2);
}

// Never evade
void EnterEvadeMode() { }

void KilledUnit(Unit* victim)
{
if (victim->GetTypeId() == TYPEID_PLAYER)
Expand Down Expand Up @@ -565,10 +575,6 @@ class boss_twilight_halion : public CreatureScript
DoCast(target, SPELL_SOUL_CONSUMPTION);
events.ScheduleEvent(EVENT_SOUL_CONSUMPTION, 20000);
break;
case EVENT_TAIL_LASH:
DoCastAOE(SPELL_TAIL_LASH);
events.ScheduleEvent(EVENT_TAIL_LASH, 10000);
break;
default:
generic_halionAI::ExecuteEvent(eventId);
break;
Expand Down Expand Up @@ -1186,10 +1192,19 @@ class npc_living_inferno : public CreatureScript
{
npc_living_infernoAI(Creature* creature) : ScriptedAI(creature) { }

void JustSummoned(Creature* /*summoner*/)
void IsSummonedBy(Unit* /*summoner*/)
{
me->SetInCombatWithZone();
DoCast(me, SPELL_BLAZING_AURA);
me->CastSpell(me, SPELL_BLAZING_AURA, true);

if (InstanceScript* instance = me->GetInstanceScript())
if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
}

void JustDied(Unit* /*killer*/)
{
me->DespawnOrUnsummon(1);
}
};

Expand Down Expand Up @@ -1220,6 +1235,18 @@ class npc_living_ember : public CreatureScript
_hasEnraged = false;
}

void IsSummonedBy(Unit* /*summoner*/)
{
if (InstanceScript* instance = me->GetInstanceScript())
if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
controller->AI()->JustSummoned(me);
}

void JustDied(Unit* /*killer*/)
{
me->DespawnOrUnsummon(1);
}

void UpdateAI(uint32 const diff)
{
if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class instance_ruby_sanctum : public InstanceMapScript
OrbCarrierGUID = 0;
OrbRotationFocusGUID = 0;
HalionControllerGUID = 0;
CombatStalkerGUID = 0;
CrystalChannelTargetGUID = 0;
XerestraszaGUID = 0;
BaltharusSharedHealth = 0;
Expand All @@ -56,6 +55,13 @@ class instance_ruby_sanctum : public InstanceMapScript
memset(BurningTreeGUID, 0, 4 * sizeof(uint64));
}

void OnPlayerEnter(Player* /*player*/)
{
if (!GetData64(DATA_HALION_CONTROLLER) && GetBossState(DATA_HALION) != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE)
if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos))
halionController->AI()->DoAction(ACTION_INTRO_HALION);
}

void OnCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
Expand Down Expand Up @@ -84,9 +90,6 @@ class instance_ruby_sanctum : public InstanceMapScript
case NPC_ORB_ROTATION_FOCUS:
OrbRotationFocusGUID = creature->GetGUID();
break;
case NPC_COMBAT_STALKER:
CombatStalkerGUID = creature->GetGUID();
break;
case NPC_BALTHARUS_TARGET:
CrystalChannelTargetGUID = creature->GetGUID();
break;
Expand Down Expand Up @@ -195,8 +198,6 @@ class instance_ruby_sanctum : public InstanceMapScript
return FlameRingGUID;
case DATA_TWILIGHT_FLAME_RING:
return TwilightFlameRingGUID;
case DATA_COMBAT_STALKER:
return CombatStalkerGUID;
default:
break;
}
Expand All @@ -207,14 +208,7 @@ class instance_ruby_sanctum : public InstanceMapScript
bool SetBossState(uint32 type, EncounterState state)
{
if (!InstanceScript::SetBossState(type, state))
{
// Summon Halion on instance loading if conditions are met. Without those lines,
// InstanceScript::SetBossState returns false, thus preventing the switch from being called.
if (type == DATA_HALION && state != DONE && GetBossState(DATA_GENERAL_ZARITHRIAN) == DONE && !GetData64(DATA_HALION_CONTROLLER))
if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos))
halionController->AI()->DoAction(ACTION_INTRO_HALION);
return false;
}

switch (type)
{
Expand Down Expand Up @@ -353,7 +347,6 @@ class instance_ruby_sanctum : public InstanceMapScript
uint64 BurningTreeGUID[4];
uint64 FlameRingGUID;
uint64 TwilightFlameRingGUID;
uint64 CombatStalkerGUID;

uint32 BaltharusSharedHealth;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ enum DataTypes
DATA_BURNING_TREE_4 = 16,
DATA_FLAME_RING = 17,
DATA_TWILIGHT_FLAME_RING = 18,
DATA_COMBAT_STALKER = 19,
};

enum SharedActions
Expand Down Expand Up @@ -97,7 +96,7 @@ enum CreaturesIds
NPC_METEOR_STRIKE_FLAME = 40055,
NPC_COMBUSTION = 40001,
NPC_CONSUMPTION = 40135,
NPC_COMBAT_STALKER = 40151,
NPC_COMBAT_STALKER = 40151, // Seen in sniffs but not used, so no wonder.

// Xerestrasza
NPC_XERESTRASZA = 40429,
Expand Down

0 comments on commit a664a35

Please sign in to comment.