fix(Core/Misc): bunch of crashfixes (#7307)

This commit is contained in:
Viste
2021-09-14 15:38:56 +03:00
committed by GitHub
parent bd956b5a57
commit a9796af174
56 changed files with 435 additions and 328 deletions

View File

@@ -851,7 +851,7 @@ public:
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
PreventDefaultAction();
if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner())
if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummonerUnit())
{
GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, owner->GetUInt32Value(PLAYER_VISIBLE_ITEM_16_ENTRYID));
GetUnitOwner()->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, owner->GetUInt32Value(PLAYER_VISIBLE_ITEM_17_ENTRYID));

View File

@@ -224,7 +224,7 @@ public:
// xinef: chance of success stores proper amount of damage increase
// xinef: little hack because GetSpellModOwner will return nullptr pointer at this point (early summoning stage)
if (GetUnitOwner()->IsSummon())
if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummoner())
if (Unit* owner = GetUnitOwner()->ToTempSummon()->GetSummonerUnit())
if (Player* player = owner->GetSpellModOwner())
player->ApplySpellMod(SPELL_DRUID_BARKSKIN, SPELLMOD_CHANCE_OF_SUCCESS, amount);
}

View File

@@ -3847,7 +3847,7 @@ public:
{
if (Unit* caster = GetCaster())
if (TempSummon* vehicle = caster->ToTempSummon())
if (Unit* rider = vehicle->GetSummoner())
if (Unit* rider = vehicle->GetSummonerUnit())
rider->RemoveAurasDueToSpell(GetId());
}

View File

@@ -580,7 +580,7 @@ public:
if (Unit* unitTarget = GetHitUnit())
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, GetCaster()->GetGUID()))
{
aur->GetBase()->RefreshTimersWithMods();
aur->GetBase()->RefreshTimers();
aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false);
}
}

View File

@@ -239,7 +239,7 @@ public:
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
{
if (Unit* target = GetHitUnit())
if (Unit* owner = target->ToTempSummon()->GetSummoner())
if (Unit* owner = target->ToTempSummon()->GetSummonerUnit())
if (owner->GetTypeId() == TYPEID_PLAYER)
owner->ToPlayer()->KilledMonsterCredit(23327); // Some trigger, just count
}

View File

@@ -764,7 +764,7 @@ public:
// Refresh corruption on target
if (AuraEffect* aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, GetCaster()->GetGUID()))
{
aur->GetBase()->RefreshTimersWithMods();
aur->GetBase()->RefreshTimers();
aur->ChangeAmount(aur->CalculateAmount(aur->GetCaster()), false);
}
}