mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-13 21:49:49 +01:00
Scripts/Achievements: Fixed a crash in Heigan's achievement script & more possible crashes & small improvements to handling datas for achievements
This commit is contained in:
@@ -539,6 +539,9 @@ class achievement_watch_him_die : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
InstanceScript* instance = target->GetInstanceScript();
|
||||
Creature* Watcher[3];
|
||||
if (!instance)
|
||||
|
||||
@@ -127,12 +127,6 @@ class boss_elder_nadox : public CreatureScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 id, uint32 data)
|
||||
{
|
||||
if (id == DATA_RESPECT_YOUR_ELDERS)
|
||||
respectYourElders = data ? true : false;
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
@@ -311,6 +305,9 @@ class achievement_respect_your_elders : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Nadox = target->ToCreature())
|
||||
if (Nadox->AI()->GetData(DATA_RESPECT_YOUR_ELDERS))
|
||||
return true;
|
||||
|
||||
@@ -606,6 +606,9 @@ class achievement_volunteer_work : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Jedoga = target->ToCreature())
|
||||
if (Jedoga->AI()->GetData(DATA_VOLUNTEER_WORK))
|
||||
return true;
|
||||
|
||||
@@ -1707,6 +1707,9 @@ class achievement_twilight_assist : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* player, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Sartharion = target->ToCreature())
|
||||
if (Sartharion->AI()->GetData(TWILIGHT_ACHIEVEMENTS) >= 1)
|
||||
return true;
|
||||
@@ -1724,6 +1727,9 @@ class achievement_twilight_duo : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* player, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Sartharion = target->ToCreature())
|
||||
if (Sartharion->AI()->GetData(TWILIGHT_ACHIEVEMENTS) >= 2)
|
||||
return true;
|
||||
@@ -1741,6 +1747,9 @@ class achievement_twilight_zone : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* player, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Sartharion = target->ToCreature())
|
||||
if (Sartharion->AI()->GetData(TWILIGHT_ACHIEVEMENTS) == 3)
|
||||
return true;
|
||||
|
||||
@@ -283,6 +283,9 @@ class achievement_king_dred : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Dred = target->ToCreature())
|
||||
if (Dred->AI()->GetData(DATA_KING_DRED) >= 6)
|
||||
return true;
|
||||
|
||||
@@ -352,6 +352,9 @@ class achievement_oh_novos : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Novos = target->ToCreature())
|
||||
if (Novos->AI()->GetData(DATA_OH_NOVOS))
|
||||
return true;
|
||||
|
||||
@@ -204,6 +204,9 @@ class achievement_consumption_junction : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Trollgore = target->ToCreature())
|
||||
if (Trollgore->AI()->GetData(DATA_CONSUMPTION_JUNCTION))
|
||||
return true;
|
||||
|
||||
@@ -375,6 +375,9 @@ class achievement_three_faced : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Devourer = target->ToCreature())
|
||||
if (Devourer->AI()->GetData(DATA_THREE_FACED))
|
||||
return true;
|
||||
|
||||
@@ -293,6 +293,9 @@ class achievement_share_the_love : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* GalDarah = target->ToCreature())
|
||||
if (GalDarah->AI()->GetData(DATA_SHARE_THE_LOVE) >= 5)
|
||||
return true;
|
||||
|
||||
@@ -179,6 +179,9 @@ class achievement_less_rabi : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Moorabi = target->ToCreature())
|
||||
if (Moorabi->AI()->GetData(DATA_LESS_RABI))
|
||||
return true;
|
||||
|
||||
@@ -216,6 +216,9 @@ class achievement_safety_dance : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Heigan = target->ToCreature())
|
||||
if (Heigan->AI()->GetData(DATA_SAFETY_DANCE))
|
||||
return true;
|
||||
|
||||
@@ -263,6 +263,9 @@ class achievement_chaos_theory : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Anomalus = target->ToCreature())
|
||||
if (Anomalus->AI()->GetData(DATA_CHAOS_THEORY))
|
||||
return true;
|
||||
|
||||
@@ -346,6 +346,9 @@ class achievement_split_personality : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Telestra = target->ToCreature())
|
||||
if (Telestra->AI()->GetData(DATA_SPLIT_PERSONALITY) == 2)
|
||||
return true;
|
||||
|
||||
@@ -327,6 +327,9 @@ class achievement_abuse_the_ooze : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Sjonnir = target->ToCreature())
|
||||
if (Sjonnir->AI()->GetData(DATA_ABUSE_THE_OOZE) >= 5)
|
||||
return true;
|
||||
|
||||
@@ -744,6 +744,9 @@ class achievement_brann_spankin_new : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Brann = target->ToCreature())
|
||||
if (Brann->AI()->GetData(DATA_BRANN_SPARKLIN_NEWS))
|
||||
return true;
|
||||
|
||||
@@ -544,6 +544,9 @@ class achievement_nine_lives : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Auriaya = target->ToCreature())
|
||||
if (Auriaya->AI()->GetData(DATA_NINE_LIVES))
|
||||
return true;
|
||||
@@ -561,6 +564,9 @@ class achievement_crazy_cat_lady : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Auriaya = target->ToCreature())
|
||||
if (Auriaya->AI()->GetData(DATA_CRAZY_CAT_LADY))
|
||||
return true;
|
||||
|
||||
@@ -1620,6 +1620,9 @@ class achievement_knock_on_wood : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Freya = target->ToCreature())
|
||||
if (Freya->AI()->GetData(DATA_KNOCK_ON_WOOD) >= 1)
|
||||
return true;
|
||||
@@ -1637,6 +1640,9 @@ class achievement_knock_knock_on_wood : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Freya = target->ToCreature())
|
||||
if (Freya->AI()->GetData(DATA_KNOCK_ON_WOOD) >= 2)
|
||||
return true;
|
||||
@@ -1654,6 +1660,9 @@ class achievement_knock_knock_knock_on_wood : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Freya = target->ToCreature())
|
||||
if (Freya->AI()->GetData(DATA_KNOCK_ON_WOOD) == 3)
|
||||
return true;
|
||||
@@ -1671,6 +1680,9 @@ class achievement_getting_back_to_nature : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Freya = target->ToCreature())
|
||||
if (Freya->AI()->GetData(DATA_GETTING_BACK_TO_NATURE) >= 25)
|
||||
return true;
|
||||
|
||||
@@ -203,7 +203,7 @@ class boss_general_vezax : public CreatureScript
|
||||
void SpellHitTarget(Unit* who, SpellEntry const* spell)
|
||||
{
|
||||
if (who && who->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_SHADOW_CRASH_HIT)
|
||||
SetData(DATA_SHADOWDODGER, 0);
|
||||
shadowDodger = false;
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*who*/)
|
||||
@@ -245,25 +245,12 @@ class boss_general_vezax : public CreatureScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 id, uint32 data)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case DATA_SHADOWDODGER:
|
||||
shadowDodger = data ? true : false;
|
||||
break;
|
||||
case DATA_SMELL_SARONITE:
|
||||
smellSaronite = data ? true : false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 const action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case ACTION_VAPORS_DIE:
|
||||
SetData(DATA_SMELL_SARONITE, 0);
|
||||
smellSaronite = false;
|
||||
break;
|
||||
case ACTION_ANIMUS_DIE:
|
||||
me->RemoveAurasDueToSpell(SPELL_SARONITE_BARRIER);
|
||||
@@ -487,6 +474,9 @@ class achievement_shadowdodger : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Vezax = target->ToCreature())
|
||||
if (Vezax->AI()->GetData(DATA_SHADOWDODGER))
|
||||
return true;
|
||||
@@ -504,6 +494,9 @@ class achievement_smell_saronite : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Vezax = target->ToCreature())
|
||||
if (Vezax->AI()->GetData(DATA_SMELL_SARONITE))
|
||||
return true;
|
||||
|
||||
@@ -194,13 +194,7 @@ public:
|
||||
void SpellHitTarget(Unit* who, SpellEntry const* spell)
|
||||
{
|
||||
if (who && who->GetTypeId() == TYPEID_PLAYER && spell->Id == 59302)
|
||||
SetData(DATA_KINGS_BANE, 0);
|
||||
}
|
||||
|
||||
void SetData(uint32 id, uint32 data)
|
||||
{
|
||||
if (id == DATA_KINGS_BANE)
|
||||
kingsBane = data ? true : false;
|
||||
kingsBane = false;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
@@ -406,6 +400,9 @@ class achievement_kings_bane : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Ymiron = target->ToCreature())
|
||||
if (Ymiron->AI()->GetData(DATA_KINGS_BANE))
|
||||
return true;
|
||||
|
||||
@@ -404,6 +404,9 @@ class achievement_dehydration : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Ichoron = target->ToCreature())
|
||||
if (Ichoron->AI()->GetData(DATA_DEHYDRATION))
|
||||
return true;
|
||||
|
||||
@@ -154,13 +154,7 @@ public:
|
||||
void SummonedCreatureDies(Creature* summoned, Unit* /*who*/)
|
||||
{
|
||||
if (summoned->GetEntry() == CREATURE_VOID_SENTRY)
|
||||
SetData(DATA_VOID_DANCE, 0);
|
||||
}
|
||||
|
||||
void SetData(uint32 id, uint32 data)
|
||||
{
|
||||
if (id == DATA_VOID_DANCE)
|
||||
voidDance = data ? true : false;
|
||||
voidDance = false;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
@@ -217,6 +211,9 @@ class achievement_void_dance : public AchievementCriteriaScript
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (Creature* Zuramat = target->ToCreature())
|
||||
if (Zuramat->AI()->GetData(DATA_VOID_DANCE))
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user