Scripts/Spells: fix Seaforium Blast script crash

Port From (https://github.com/TrinityCore/TrinityCore/commit/6d3a11e1d1f849d1594a76f184ec2af6eb601fef)
This commit is contained in:
hondacrx
2021-09-21 18:54:31 -04:00
parent 8a1cfbaeb1
commit 7322c0bd83
+4 -4
View File
@@ -2550,19 +2550,19 @@ namespace Scripts.Spells.Generic
public override bool Load()
{
// OriginalCaster is always available in Spell.prepare
return GetOriginalCaster().IsTypeId(TypeId.Player);
return GetGObjCaster().GetOwnerGUID().IsPlayer();
}
void AchievementCredit(uint effIndex)
{
// but in effect handling OriginalCaster can become null
Unit originalCaster = GetOriginalCaster();
if (originalCaster)
Unit owner = GetGObjCaster().GetOwner();
if (owner != null)
{
GameObject go = GetHitGObj();
if (go)
if (go.GetGoInfo().type == GameObjectTypes.DestructibleBuilding)
originalCaster.CastSpell(originalCaster, SpellIds.PlantChargesCreditAchievement, true);
owner.CastSpell(null, SpellIds.PlantChargesCreditAchievement, true);
}
}