mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-13 03:32:28 -04:00
Scripts/Misc: Fix uninitialized values
Fix uninitialized values in scripts reported by valgrind. Fix target and GetOwner() NULL dereferences .
This commit is contained in:
@@ -170,11 +170,12 @@ public:
|
||||
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
SpawnedAdds = 0;
|
||||
|
||||
if (me->GetMapId() == 469)
|
||||
{
|
||||
if (!me->FindNearestCreature(NPC_NEFARIAN, 1000.0f, true))
|
||||
_Reset();
|
||||
SpawnedAdds = 0;
|
||||
|
||||
me->SetVisible(true);
|
||||
me->SetPhaseMask(1, true);
|
||||
|
||||
@@ -500,6 +500,8 @@ public:
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
ArcanagosGUID = 0;
|
||||
EventStarted = false;
|
||||
YellTimer = 0;
|
||||
|
||||
if (instance && instance->GetData64(DATA_IMAGE_OF_MEDIVH) == 0)
|
||||
{
|
||||
|
||||
@@ -382,6 +382,7 @@ public:
|
||||
boss_headless_horsemanAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
headGUID = 0;
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
@@ -67,6 +67,8 @@ public:
|
||||
void Reset() OVERRIDE
|
||||
{
|
||||
ShadowWordPain_Timer = 5000;
|
||||
Yell60 = false;
|
||||
Yell30 = false;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
|
||||
@@ -593,6 +593,7 @@ public:
|
||||
DespawnTimer = 15000;
|
||||
SpellTimer = 5000;
|
||||
Phase = 0;
|
||||
NeedForAHack = 0;
|
||||
|
||||
me->AddUnitState(UNIT_STATE_STUNNED);
|
||||
DoCastAOE(SPELL_BLACKHOLE_SPAWN, true);
|
||||
|
||||
@@ -229,10 +229,14 @@ class boss_akilzon : public CreatureScript
|
||||
case EVENT_STATIC_DISRUPTION:
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
|
||||
if (!target) target = me->GetVictim();
|
||||
TargetGUID = target->GetGUID();
|
||||
DoCast(target, SPELL_STATIC_DISRUPTION, false);
|
||||
me->SetInFront(me->GetVictim());
|
||||
if (!target)
|
||||
target = me->GetVictim();
|
||||
if (target)
|
||||
{
|
||||
TargetGUID = target->GetGUID();
|
||||
DoCast(target, SPELL_STATIC_DISRUPTION, false);
|
||||
me->SetInFront(me->GetVictim());
|
||||
}
|
||||
/*if (float dist = me->IsWithinDist3d(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 5.0f) dist = 5.0f;
|
||||
SDisruptAOEVisual_Timer = 1000 + floor(dist / 30 * 1000.0f);*/
|
||||
events.ScheduleEvent(EVENT_STATIC_DISRUPTION, urand(10000, 18000));
|
||||
@@ -241,8 +245,10 @@ class boss_akilzon : public CreatureScript
|
||||
case EVENT_GUST_OF_WIND:
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
|
||||
if (!target) target = me->GetVictim();
|
||||
DoCast(target, SPELL_GUST_OF_WIND);
|
||||
if (!target)
|
||||
target = me->GetVictim();
|
||||
if (target)
|
||||
DoCast(target, SPELL_GUST_OF_WIND);
|
||||
events.ScheduleEvent(EVENT_GUST_OF_WIND, urand(20000, 30000));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,6 @@ class boss_anubarak_trial : public CreatureScript
|
||||
|
||||
void JustSummoned(Creature* summoned) OVERRIDE
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true);
|
||||
switch (summoned->GetEntry())
|
||||
{
|
||||
case NPC_BURROW:
|
||||
@@ -255,9 +254,12 @@ class boss_anubarak_trial : public CreatureScript
|
||||
summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid2);
|
||||
break;
|
||||
case NPC_SPIKE:
|
||||
summoned->CombatStart(target);
|
||||
summoned->SetDisplayId(summoned->GetCreatureTemplate()->Modelid1);
|
||||
Talk(EMOTE_SPIKE, target);
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
|
||||
{
|
||||
summoned->CombatStart(target);
|
||||
Talk(EMOTE_SPIKE, target);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1377,7 +1377,7 @@ public:
|
||||
|
||||
void EnterEvadeMode() OVERRIDE
|
||||
{
|
||||
if (!me->GetOwner()->HasAura(AURA_HALLUCINATION))
|
||||
if (me->GetOwner() && !me->GetOwner()->HasAura(AURA_HALLUCINATION))
|
||||
npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ public:
|
||||
{
|
||||
boss_ormorokAI(Creature* creature) : BossAI(creature, DATA_ORMOROK_EVENT) { }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
BossAI::Reset();
|
||||
frenzy = false;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) OVERRIDE
|
||||
{
|
||||
_EnterCombat();
|
||||
|
||||
@@ -748,6 +748,7 @@ public:
|
||||
npc_ashtongue_sorcererAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
startedBanishing = false;
|
||||
}
|
||||
|
||||
void Reset() OVERRIDE
|
||||
|
||||
@@ -320,6 +320,7 @@ public:
|
||||
boss_fathomguard_sharkkisAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
SummonedPet = 0;
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
|
||||
Reference in New Issue
Block a user