mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 23:26:23 +00:00
fix(Core/Misc): bunch of crashfixes (#7307)
This commit is contained in:
@@ -216,7 +216,7 @@ public:
|
||||
events.Reset();
|
||||
|
||||
if (me->ToTempSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (summoner->GetEntry() == me->GetEntry())
|
||||
{
|
||||
me->CastSpell(me, RAND(SPELL_SUMMON_ANUBAR_CHAMPION, SPELL_SUMMON_ANUBAR_CRYPT_FIEND, SPELL_SUMMON_ANUBAR_NECROMANCER), true);
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
void EnterCombat(Unit*) override
|
||||
{
|
||||
if (me->ToTempSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (summoner->GetEntry() != me->GetEntry())
|
||||
{
|
||||
summoner->GetAI()->DoAction(ACTION_START_EVENT);
|
||||
|
||||
@@ -237,7 +237,7 @@ public:
|
||||
summon->CastSpell(summon, SPELL_METEOR_STRIKE_FIRE_AURA_2, true);
|
||||
if (summons.GetEntryCount(NPC_METEOR_STRIKE_FLAME) <= 16)
|
||||
summon->CastSpell(summon, SPELL_METEOR_STRIKE_SPREAD, true);
|
||||
if (Unit* summoner = summon->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = summon->ToTempSummon()->GetSummonerUnit())
|
||||
summon->SetOrientation(summoner->GetAngle(summon));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
if (me->ToTempSummon())
|
||||
{
|
||||
if (who->GetTypeId() == TYPEID_PLAYER || who->GetOwnerGUID().IsPlayer())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
summoner->GetAI()->DoAction(ACTION_INFORM);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ public:
|
||||
return;
|
||||
|
||||
if (TempSummon* summ = me->ToTempSummon())
|
||||
if (Unit* trapped = summ->GetSummoner())
|
||||
if (Unit* trapped = summ->GetSummonerUnit())
|
||||
{
|
||||
Position exitPos = {me->GetPositionX(), me->GetPositionY(), 60.0f, me->GetOrientation()};
|
||||
trapped->UpdateAllowedPositionZ(exitPos.GetPositionX(), exitPos.GetPositionY(), exitPos.m_positionZ);
|
||||
@@ -430,7 +430,7 @@ public:
|
||||
|
||||
if (TempSummon* summ = me->ToTempSummon())
|
||||
{
|
||||
if (Unit* trapped = summ->GetSummoner())
|
||||
if (Unit* trapped = summ->GetSummonerUnit())
|
||||
{
|
||||
if (!trapped->IsOnVehicle(me) || !trapped->IsAlive() || !me->GetInstanceScript() || me->GetInstanceScript()->GetBossState(DATA_LORD_MARROWGAR) != IN_PROGRESS || trapped->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
{
|
||||
|
||||
@@ -373,7 +373,7 @@ public:
|
||||
DoResetThreat();
|
||||
me->SetInCombatWithZone();
|
||||
if (TempSummon* ts = me->ToTempSummon())
|
||||
if (Unit* summoner = ts->GetSummoner())
|
||||
if (Unit* summoner = ts->GetSummonerUnit())
|
||||
{
|
||||
me->AddThreat(summoner, 500000.0f);
|
||||
AttackStart(summoner);
|
||||
|
||||
@@ -2312,7 +2312,7 @@ public:
|
||||
bool valid = false;
|
||||
me->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL, true);
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (Unit* summoner = summon->GetSummonerUnit())
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
|
||||
{
|
||||
valid = true;
|
||||
@@ -2373,7 +2373,7 @@ public:
|
||||
{
|
||||
bool valid = false;
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (Unit* summoner = summon->GetSummonerUnit())
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER && summoner->IsAlive() && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
|
||||
{
|
||||
valid = true;
|
||||
@@ -3038,7 +3038,7 @@ public:
|
||||
return;
|
||||
|
||||
if (TempSummon* summon = GetCaster()->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (Unit* summoner = summon->GetSummonerUnit())
|
||||
summoner->GetAI()->SetData(DATA_VILE, 1);
|
||||
|
||||
if (Creature* c = GetCaster()->ToCreature())
|
||||
@@ -3154,7 +3154,7 @@ public:
|
||||
|
||||
if (TempSummon* summ = me->ToTempSummon())
|
||||
{
|
||||
if (Unit* summoner = summ->GetSummoner())
|
||||
if (Unit* summoner = summ->GetSummonerUnit())
|
||||
{
|
||||
bool buff = _instance->GetBossState(DATA_THE_LICH_KING) == IN_PROGRESS && summoner->GetTypeId() == TYPEID_PLAYER && (!summoner->IsAlive() || summoner->ToPlayer()->IsBeingTeleported() || summoner->FindMap() != me->GetMap());
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER && !summoner->ToPlayer()->IsBeingTeleported() && summoner->FindMap() == me->GetMap())
|
||||
@@ -3191,7 +3191,7 @@ public:
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
if (TempSummon* summ = me->ToTempSummon())
|
||||
if (Unit* summoner = summ->GetSummoner())
|
||||
if (Unit* summoner = summ->GetSummonerUnit())
|
||||
{
|
||||
if (summoner->IsAlive() && summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
||||
@@ -663,7 +663,7 @@ public:
|
||||
timer = 2500;
|
||||
if (me->IsSummon())
|
||||
{
|
||||
if (Unit* s = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* s = me->ToTempSummon()->GetSummonerUnit())
|
||||
{
|
||||
if ((s->GetTypeId() == TYPEID_PLAYER && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_PLAYER)) || (s->GetTypeId() == TYPEID_UNIT && !s->HasAura(SPELL_FLASH_FREEZE_TRAPPED_NPC)))
|
||||
me->DespawnOrUnsummon(2000);
|
||||
|
||||
@@ -2405,7 +2405,7 @@ public:
|
||||
case SPELL_WATER_SPRAY:
|
||||
{
|
||||
if (me->IsSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (Creature* c = summoner->ToCreature())
|
||||
if (c->AI())
|
||||
CAST_AI(npc_ulduar_flames_initial::npc_ulduar_flames_initialAI, c->AI())->RemoveFlame(me->GetGUID());
|
||||
|
||||
@@ -1769,7 +1769,7 @@ public:
|
||||
void JustDied(Unit*) override
|
||||
{
|
||||
if (me->IsSummon())
|
||||
if (Unit* sara = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* sara = me->ToTempSummon()->GetSummonerUnit())
|
||||
sara->GetAI()->DoAction(ACTION_INFLUENCE_TENTACLE_DIED);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
npc_frost_tombAI(Creature* c) : NullCreatureAI(c)
|
||||
{
|
||||
if (TempSummon* t = c->ToTempSummon())
|
||||
if (Unit* s = t->GetSummoner())
|
||||
if (Unit* s = t->GetSummonerUnit())
|
||||
{
|
||||
PrisonerGUID = s->GetGUID();
|
||||
if( me->GetInstanceScript() && me->GetInstanceScript()->instance->IsHeroic() )
|
||||
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
checkTimer = 5000;
|
||||
bool good = false;
|
||||
if (me->IsSummon())
|
||||
if (Unit* s = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* s = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (s->IsAlive())
|
||||
good = true;
|
||||
if (!good)
|
||||
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
void InitializeAI() override
|
||||
{
|
||||
if (me->ToTempSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
{
|
||||
summonerGUID = summoner->GetGUID();
|
||||
float x, y, z;
|
||||
@@ -478,8 +478,8 @@ public:
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
if (me->ToTempSummon() && me->ToTempSummon()->GetSummoner())
|
||||
me->setFaction(me->ToTempSummon()->GetSummoner()->getFaction());
|
||||
if (me->ToTempSummon() && me->ToTempSummon()->GetSummonerUnit())
|
||||
me->setFaction(me->ToTempSummon()->GetSummonerUnit()->getFaction());
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* who) override
|
||||
@@ -568,7 +568,7 @@ public:
|
||||
me->RemoveAllAuras();
|
||||
me->DespawnOrUnsummon(1000);
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* owner = summon->GetSummoner())
|
||||
if (Unit* owner = summon->GetSummonerUnit())
|
||||
if (Player* player = owner->ToPlayer())
|
||||
player->KilledMonsterCredit(me->GetEntry());
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
{
|
||||
me->SetDisableGravity(true);
|
||||
if (me->IsSummon())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummonerUnit())
|
||||
me->GetMotionMaster()->MovePoint(0, *owner);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
cow->CastSpell(cow, 44460, true);
|
||||
cow->DespawnOrUnsummon(10000);
|
||||
if (me->IsSummon())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummonerUnit())
|
||||
owner->CastSpell(owner, 44463, true);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public:
|
||||
|
||||
void setphase(short newPhase)
|
||||
{
|
||||
Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummoner() : nullptr;
|
||||
Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummonerUnit() : nullptr;
|
||||
if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
@@ -271,7 +271,7 @@ public:
|
||||
{
|
||||
ObjectGuid summonerGUID;
|
||||
if (me->IsSummon())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
summonerGUID = summoner->GetGUID();
|
||||
|
||||
|
||||
@@ -1258,7 +1258,7 @@ public:
|
||||
Unit* GetSummoner()
|
||||
{
|
||||
if (TempSummon* tempSummon = me->ToTempSummon())
|
||||
return tempSummon->GetSummoner();
|
||||
return tempSummon->GetSummonerUnit();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -2072,7 +2072,7 @@ public:
|
||||
|
||||
if (id == POINT_GRAB_DECOY)
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (Unit* summoner = summon->GetSummonerUnit())
|
||||
DoCast(summoner, SPELL_GRAB);
|
||||
}
|
||||
|
||||
|
||||
@@ -680,7 +680,7 @@ public:
|
||||
return;
|
||||
|
||||
if (TempSummon* summ = me->ToTempSummon())
|
||||
if (Unit* summoner = summ->GetSummoner())
|
||||
if (Unit* summoner = summ->GetSummonerUnit())
|
||||
me->GetMotionMaster()->MovePoint(0, summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ());
|
||||
|
||||
Reset();
|
||||
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
break;
|
||||
case 19:
|
||||
me->MonsterTextEmote("The frosthound has located the thief's hiding place. Confront him!", 0, true);
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit())
|
||||
summoner->ToPlayer()->KilledMonsterCredit(29677);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
ghoul->GetMotionMaster()->MoveTargetedHome();
|
||||
}
|
||||
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummonerUnit())
|
||||
if (Player* player = owner->ToPlayer())
|
||||
player->KilledMonsterCredit(me->GetEntry());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user