Scripts/Nexus: Properly fixed achievement Chaos Theory and small cleanup
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
DELETE FROM `disables` WHERE `entry`=7316 AND `sourceType`=4;
|
||||||
|
|
||||||
|
DELETE FROM `achievement_criteria_data` WHERE `criteria_id`=7316 AND `type`=11;
|
||||||
|
INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`)
|
||||||
|
VALUES
|
||||||
|
(7316,11,0,0,'achievement_chaos_theory');
|
||||||
@@ -246,7 +246,7 @@ class mob_ahnkahar_nerubian : public CreatureScript
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(uint32 const diff)
|
||||||
{
|
{
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
@@ -311,7 +311,6 @@ class achievement_respect_your_elders : public AchievementCriteriaScript
|
|||||||
|
|
||||||
bool OnCheck(Player* /*player*/, Unit* target)
|
bool OnCheck(Player* /*player*/, Unit* target)
|
||||||
{
|
{
|
||||||
sLog->outString("OnCheck()");
|
|
||||||
if (Creature* Nadox = target->ToCreature())
|
if (Creature* Nadox = target->ToCreature())
|
||||||
if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS))
|
if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -283,7 +283,6 @@ class achievement_king_dred : public AchievementCriteriaScript
|
|||||||
|
|
||||||
bool OnCheck(Player* /*player*/, Unit* target)
|
bool OnCheck(Player* /*player*/, Unit* target)
|
||||||
{
|
{
|
||||||
sLog->outString("OnCheck()");
|
|
||||||
if (Creature* Dred = target->ToCreature())
|
if (Creature* Dred = target->ToCreature())
|
||||||
if (Dred->AI()->GetData(DATA_KING_DRED) >= 6)
|
if (Dred->AI()->GetData(DATA_KING_DRED) >= 6)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
enum Spells
|
enum Spells
|
||||||
{
|
{
|
||||||
//Spells
|
|
||||||
SPELL_SPARK = 47751,
|
SPELL_SPARK = 47751,
|
||||||
H_SPELL_SPARK = 57062,
|
H_SPELL_SPARK = 57062,
|
||||||
SPELL_RIFT_SHIELD = 47748,
|
SPELL_RIFT_SHIELD = 47748,
|
||||||
@@ -35,21 +34,23 @@ enum Adds
|
|||||||
MOB_CRAZED_MANA_WRAITH = 26746,
|
MOB_CRAZED_MANA_WRAITH = 26746,
|
||||||
MOB_CHAOTIC_RIFT = 26918
|
MOB_CHAOTIC_RIFT = 26918
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Yells
|
enum Yells
|
||||||
{
|
{
|
||||||
//Yell
|
|
||||||
SAY_AGGRO = -1576010,
|
SAY_AGGRO = -1576010,
|
||||||
SAY_DEATH = -1576011,
|
SAY_DEATH = -1576011,
|
||||||
SAY_RIFT = -1576012,
|
SAY_RIFT = -1576012,
|
||||||
SAY_SHIELD = -1576013
|
SAY_SHIELD = -1576013
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Achievs
|
enum RiftSpells
|
||||||
{
|
{
|
||||||
ACHIEV_CHAOS_THEORY = 2037
|
SPELL_CHAOTIC_ENERGY_BURST = 47688,
|
||||||
|
SPELL_CHARGED_CHAOTIC_ENERGY_BURST = 47737,
|
||||||
|
SPELL_ARCANEFORM = 48019, //Chaotic Rift visual
|
||||||
};
|
};
|
||||||
|
|
||||||
const Position RiftLocation[6] =
|
Position const RiftLocation[6] =
|
||||||
{
|
{
|
||||||
{ 652.64f, -273.70f, -8.75f, 0.0f },
|
{ 652.64f, -273.70f, -8.75f, 0.0f },
|
||||||
{ 634.45f, -265.94f, -8.44f, 0.0f },
|
{ 634.45f, -265.94f, -8.44f, 0.0f },
|
||||||
@@ -59,65 +60,77 @@ const Position RiftLocation[6] =
|
|||||||
{ 651.72f, -297.44f, -9.37f, 0.0f }
|
{ 651.72f, -297.44f, -9.37f, 0.0f }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ACTION_RIFT_DEAD 1
|
||||||
|
#define DATA_CHAOS_THEORY 2
|
||||||
|
|
||||||
class boss_anomalus : public CreatureScript
|
class boss_anomalus : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
boss_anomalus() : CreatureScript("boss_anomalus") { }
|
boss_anomalus() : CreatureScript("boss_anomalus") { }
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const
|
|
||||||
{
|
|
||||||
return new boss_anomalusAI (pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct boss_anomalusAI : public ScriptedAI
|
struct boss_anomalusAI : public ScriptedAI
|
||||||
{
|
{
|
||||||
boss_anomalusAI(Creature *c) : ScriptedAI(c)
|
boss_anomalusAI(Creature* creature) : ScriptedAI(creature)
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
instance = me->GetInstanceScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceScript* pInstance;
|
InstanceScript* instance;
|
||||||
|
|
||||||
uint8 Phase;
|
uint8 Phase;
|
||||||
uint32 uiSparkTimer;
|
uint32 uiSparkTimer;
|
||||||
uint32 uiCreateRiftTimer;
|
uint32 uiCreateRiftTimer;
|
||||||
uint64 uiChaoticRiftGUID;
|
uint64 uiChaoticRiftGUID;
|
||||||
|
bool chaosTheory;
|
||||||
bool bDeadChaoticRift; // needed for achievement: Chaos Theory(2037)
|
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
Phase = 0;
|
Phase = 0;
|
||||||
uiSparkTimer = 5*IN_MILLISECONDS;
|
uiSparkTimer = 5000;
|
||||||
uiChaoticRiftGUID = 0;
|
uiChaoticRiftGUID = 0;
|
||||||
|
chaosTheory = true;
|
||||||
|
|
||||||
bDeadChaoticRift = false;
|
if (instance)
|
||||||
|
instance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED);
|
||||||
if (pInstance)
|
|
||||||
pInstance->SetData(DATA_ANOMALUS_EVENT, NOT_STARTED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnterCombat(Unit* /*who*/)
|
void EnterCombat(Unit* /*who*/)
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_AGGRO, me);
|
DoScriptText(SAY_AGGRO, me);
|
||||||
|
|
||||||
if (pInstance)
|
if (instance)
|
||||||
pInstance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS);
|
instance->SetData(DATA_ANOMALUS_EVENT, IN_PROGRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/)
|
void JustDied(Unit* /*who*/)
|
||||||
{
|
{
|
||||||
DoScriptText(SAY_DEATH, me);
|
DoScriptText(SAY_DEATH, me);
|
||||||
|
|
||||||
if (pInstance)
|
if (instance)
|
||||||
{
|
instance->SetData(DATA_ANOMALUS_EVENT, DONE);
|
||||||
if (IsHeroic() && !bDeadChaoticRift)
|
|
||||||
pInstance->DoCompleteAchievement(ACHIEV_CHAOS_THEORY);
|
|
||||||
pInstance->SetData(DATA_ANOMALUS_EVENT, DONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void DoAction(int32 const action)
|
||||||
|
{
|
||||||
|
if (action == ACTION_RIFT_DEAD)
|
||||||
|
chaosTheory = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 GetData(uint32 type)
|
||||||
|
{
|
||||||
|
if (type == DATA_CHAOS_THEORY)
|
||||||
|
return chaosTheory ? 1 : 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetData(uint32 id, uint32 data)
|
||||||
|
{
|
||||||
|
if (id == DATA_CHAOS_THEORY)
|
||||||
|
chaosTheory = data ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateAI(uint32 const diff)
|
||||||
{
|
{
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
@@ -133,7 +146,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (uiChaoticRiftGUID)
|
if (uiChaoticRiftGUID)
|
||||||
{
|
{
|
||||||
Unit* Rift = Unit::GetUnit((*me), uiChaoticRiftGUID);
|
Creature* Rift = ObjectAccessor::GetCreature(*me, uiChaoticRiftGUID);
|
||||||
if (Rift && Rift->isDead())
|
if (Rift && Rift->isDead())
|
||||||
{
|
{
|
||||||
me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
|
me->RemoveAurasDueToSpell(SPELL_RIFT_SHIELD);
|
||||||
@@ -141,7 +154,8 @@ public:
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
uiChaoticRiftGUID = 0;
|
uiChaoticRiftGUID = 0;
|
||||||
|
|
||||||
if ((Phase == 0) && HealthBelowPct(50))
|
if ((Phase == 0) && HealthBelowPct(50))
|
||||||
@@ -149,12 +163,11 @@ public:
|
|||||||
Phase = 1;
|
Phase = 1;
|
||||||
DoScriptText(SAY_SHIELD, me);
|
DoScriptText(SAY_SHIELD, me);
|
||||||
DoCast(me, SPELL_RIFT_SHIELD);
|
DoCast(me, SPELL_RIFT_SHIELD);
|
||||||
Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0, 5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS);
|
if (Creature* Rift = me->SummonCreature(MOB_CHAOTIC_RIFT, RiftLocation[urand(0, 5)], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
|
||||||
if (Rift)
|
|
||||||
{
|
{
|
||||||
//DoCast(Rift, SPELL_CHARGE_RIFT);
|
//DoCast(Rift, SPELL_CHARGE_RIFT);
|
||||||
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||||
Rift->AI()->AttackStart(pTarget);
|
Rift->AI()->AttackStart(target);
|
||||||
uiChaoticRiftGUID = Rift->GetGUID();
|
uiChaoticRiftGUID = Rift->GetGUID();
|
||||||
DoScriptText(SAY_RIFT , me);
|
DoScriptText(SAY_RIFT , me);
|
||||||
}
|
}
|
||||||
@@ -162,22 +175,21 @@ public:
|
|||||||
|
|
||||||
if (uiSparkTimer <= diff)
|
if (uiSparkTimer <= diff)
|
||||||
{
|
{
|
||||||
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||||
DoCast(pTarget, SPELL_SPARK);
|
DoCast(target, SPELL_SPARK);
|
||||||
uiSparkTimer = 5*IN_MILLISECONDS;
|
uiSparkTimer = 5000;
|
||||||
} else uiSparkTimer -= diff;
|
}
|
||||||
|
else
|
||||||
|
uiSparkTimer -= diff;
|
||||||
|
|
||||||
DoMeleeAttackIfReady();
|
DoMeleeAttackIfReady();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
CreatureAI* GetAI(Creature* creature) const
|
||||||
|
|
||||||
enum RiftSpells
|
|
||||||
{
|
{
|
||||||
SPELL_CHAOTIC_ENERGY_BURST = 47688,
|
return new boss_anomalusAI(creature);
|
||||||
SPELL_CHARGED_CHAOTIC_ENERGY_BURST = 47737,
|
}
|
||||||
SPELL_ARCANEFORM = 48019 //Chaotic Rift visual
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class mob_chaotic_rift : public CreatureScript
|
class mob_chaotic_rift : public CreatureScript
|
||||||
@@ -185,76 +197,96 @@ class mob_chaotic_rift : public CreatureScript
|
|||||||
public:
|
public:
|
||||||
mob_chaotic_rift() : CreatureScript("mob_chaotic_rift") { }
|
mob_chaotic_rift() : CreatureScript("mob_chaotic_rift") { }
|
||||||
|
|
||||||
CreatureAI* GetAI(Creature* pCreature) const
|
|
||||||
{
|
|
||||||
return new mob_chaotic_riftAI (pCreature);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct mob_chaotic_riftAI : public Scripted_NoMovementAI
|
struct mob_chaotic_riftAI : public Scripted_NoMovementAI
|
||||||
{
|
{
|
||||||
mob_chaotic_riftAI(Creature *c) : Scripted_NoMovementAI(c)
|
mob_chaotic_riftAI(Creature* creature) : Scripted_NoMovementAI(creature)
|
||||||
{
|
{
|
||||||
pInstance = c->GetInstanceScript();
|
instance = me->GetInstanceScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceScript* pInstance;
|
InstanceScript* instance;
|
||||||
|
|
||||||
uint32 uiChaoticEnergyBurstTimer;
|
uint32 uiChaoticEnergyBurstTimer;
|
||||||
uint32 uiSummonCrazedManaWraithTimer;
|
uint32 uiSummonCrazedManaWraithTimer;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS;
|
uiChaoticEnergyBurstTimer = 1000;
|
||||||
uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS;
|
uiSummonCrazedManaWraithTimer = 5000;
|
||||||
//me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different.
|
//me->SetDisplayId(25206); //For some reason in DB models for ally and horde are different.
|
||||||
//Model for ally (1126) does not show auras. Horde model works perfect.
|
//Model for ally (1126) does not show auras. Horde model works perfect.
|
||||||
//Set model to horde number
|
//Set model to horde number
|
||||||
DoCast(me, SPELL_ARCANEFORM, false);
|
DoCast(me, SPELL_ARCANEFORM, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustDied(Unit* /*killer*/)
|
void JustDied(Unit* /*who*/)
|
||||||
{
|
{
|
||||||
if (Creature* pAnomalus = Unit::GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0))
|
if (Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS)))
|
||||||
CAST_AI(boss_anomalus::boss_anomalusAI, pAnomalus->AI())->bDeadChaoticRift = true;
|
Anomalus->AI()->DoAction(ACTION_RIFT_DEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(uint32 const diff)
|
||||||
{
|
{
|
||||||
if (!UpdateVictim())
|
if (!UpdateVictim())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (uiChaoticEnergyBurstTimer <= diff)
|
if (uiChaoticEnergyBurstTimer <= diff)
|
||||||
{
|
{
|
||||||
Unit* pAnomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0);
|
Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS));
|
||||||
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||||
{
|
{
|
||||||
if (pAnomalus && pAnomalus->HasAura(SPELL_RIFT_SHIELD))
|
if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
|
||||||
DoCast(pTarget, SPELL_CHARGED_CHAOTIC_ENERGY_BURST);
|
DoCast(target, SPELL_CHARGED_CHAOTIC_ENERGY_BURST);
|
||||||
else
|
else
|
||||||
DoCast(pTarget, SPELL_CHAOTIC_ENERGY_BURST);
|
DoCast(target, SPELL_CHAOTIC_ENERGY_BURST);
|
||||||
}
|
}
|
||||||
uiChaoticEnergyBurstTimer = 1*IN_MILLISECONDS;
|
uiChaoticEnergyBurstTimer = 1000;
|
||||||
} else uiChaoticEnergyBurstTimer -= diff;
|
}
|
||||||
|
else
|
||||||
|
uiChaoticEnergyBurstTimer -= diff;
|
||||||
|
|
||||||
if (uiSummonCrazedManaWraithTimer <= diff)
|
if (uiSummonCrazedManaWraithTimer <= diff)
|
||||||
{
|
{
|
||||||
Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX()+1, me->GetPositionY()+1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS);
|
if (Creature* Wraith = me->SummonCreature(MOB_CRAZED_MANA_WRAITH, me->GetPositionX() + 1, me->GetPositionY() + 1, me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000))
|
||||||
if (Wraith)
|
|
||||||
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0))
|
||||||
Wraith->AI()->AttackStart(pTarget);
|
Wraith->AI()->AttackStart(pTarget);
|
||||||
Unit* Anomalus = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_ANOMALUS) : 0);
|
Creature* Anomalus = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_ANOMALUS));
|
||||||
if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
|
if (Anomalus && Anomalus->HasAura(SPELL_RIFT_SHIELD))
|
||||||
uiSummonCrazedManaWraithTimer = 5*IN_MILLISECONDS;
|
uiSummonCrazedManaWraithTimer = 5000;
|
||||||
else
|
else
|
||||||
uiSummonCrazedManaWraithTimer = 10*IN_MILLISECONDS;
|
uiSummonCrazedManaWraithTimer = 10000;
|
||||||
} else uiSummonCrazedManaWraithTimer -= diff;
|
}
|
||||||
|
else
|
||||||
|
uiSummonCrazedManaWraithTimer -= diff;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CreatureAI* GetAI(Creature* creature) const
|
||||||
|
{
|
||||||
|
return new mob_chaotic_riftAI(creature);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class achievement_chaos_theory : public AchievementCriteriaScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
achievement_chaos_theory() : AchievementCriteriaScript("achievement_chaos_theory")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnCheck(Player* /*player*/, Unit* target)
|
||||||
|
{
|
||||||
|
if (Creature* Anomalus = target->ToCreature())
|
||||||
|
if (Anomalus->AI()->GetData(DATA_CHAOS_THEORY))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_boss_anomalus()
|
void AddSC_boss_anomalus()
|
||||||
{
|
{
|
||||||
new boss_anomalus();
|
new boss_anomalus();
|
||||||
new mob_chaotic_rift();
|
new mob_chaotic_rift();
|
||||||
|
new achievement_chaos_theory();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user