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() public override bool Load()
{ {
// OriginalCaster is always available in Spell.prepare // OriginalCaster is always available in Spell.prepare
return GetOriginalCaster().IsTypeId(TypeId.Player); return GetGObjCaster().GetOwnerGUID().IsPlayer();
} }
void AchievementCredit(uint effIndex) void AchievementCredit(uint effIndex)
{ {
// but in effect handling OriginalCaster can become null // but in effect handling OriginalCaster can become null
Unit originalCaster = GetOriginalCaster(); Unit owner = GetGObjCaster().GetOwner();
if (originalCaster) if (owner != null)
{ {
GameObject go = GetHitGObj(); GameObject go = GetHitGObj();
if (go) if (go)
if (go.GetGoInfo().type == GameObjectTypes.DestructibleBuilding) if (go.GetGoInfo().type == GameObjectTypes.DestructibleBuilding)
originalCaster.CastSpell(originalCaster, SpellIds.PlantChargesCreditAchievement, true); owner.CastSpell(null, SpellIds.PlantChargesCreditAchievement, true);
} }
} }