Scripts/Serpentshrine Cavern: Fixed crash in boss_leotheras_the_blind caused by uninitialized variable; also replaced unsafe AI typecasting with Get/SetGUID
This commit is contained in:
+18
-2
@@ -53,6 +53,7 @@ EndScriptData */
|
||||
#define MODEL_NIGHTELF 20514
|
||||
#define DEMON_FORM 21875
|
||||
#define MOB_SPELLBINDER 21806
|
||||
#define INNER_DEMON_VICTIM 1
|
||||
|
||||
#define SAY_AGGRO -1548009
|
||||
#define SAY_SWITCH_TO_DEMON -1548010
|
||||
@@ -94,6 +95,20 @@ public:
|
||||
ShadowBolt_Timer = 10000;
|
||||
Link_Timer = 1000;
|
||||
}
|
||||
|
||||
void SetGUID(uint64 guid, int32 id/* = 0 */)
|
||||
{
|
||||
if (id == INNER_DEMON_VICTIM)
|
||||
victimGUID = guid;
|
||||
}
|
||||
|
||||
uint64 GetGUID(int32 id/* = 0 */)
|
||||
{
|
||||
if (id == INNER_DEMON_VICTIM)
|
||||
return victimGUID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*victim*/)
|
||||
{
|
||||
Unit* unit = Unit::GetUnit((*me), victimGUID);
|
||||
@@ -219,6 +234,7 @@ public:
|
||||
IsFinalForm = false;
|
||||
NeedThreatReset = false;
|
||||
EnrageUsed = false;
|
||||
memset(InnderDemon, 0, sizeof(InnderDemon));
|
||||
InnerDemon_Count = 0;
|
||||
me->SetSpeed(MOVE_RUN, 2.0f, true);
|
||||
me->SetDisplayId(MODEL_NIGHTELF);
|
||||
@@ -357,7 +373,7 @@ public:
|
||||
Creature* unit = Unit::GetCreature((*me), InnderDemon[i]);
|
||||
if (unit && unit->isAlive())
|
||||
{
|
||||
Unit* unit_target = Unit::GetUnit(*unit, CAST_AI(mob_inner_demon::mob_inner_demonAI, unit->AI())->victimGUID);
|
||||
Unit* unit_target = Unit::GetUnit(*unit, unit->AI()->GetGUID(INNER_DEMON_VICTIM));
|
||||
if (unit_target && unit_target->isAlive())
|
||||
{
|
||||
unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true);
|
||||
@@ -525,7 +541,7 @@ public:
|
||||
if (demon)
|
||||
{
|
||||
demon->AI()->AttackStart((*itr));
|
||||
CAST_AI(mob_inner_demon::mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID();
|
||||
demon->AI()->SetGUID((*itr)->GetGUID(), INNER_DEMON_VICTIM);
|
||||
|
||||
(*itr)->AddAura(SPELL_INSIDIOUS_WHISPER, *itr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user