diff --git a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs index e06cddc40..6d3b502fd 100644 --- a/Source/Game/Entities/AreaTrigger/AreaTrigger.cs +++ b/Source/Game/Entities/AreaTrigger/AreaTrigger.cs @@ -1467,6 +1467,7 @@ namespace Game.Entities public AreaTriggerCreateProperties GetCreateProperties() { return _areaTriggerCreateProperties; } + public override ObjectGuid GetCreatorGUID() { return GetCasterGuid(); } public override ObjectGuid GetOwnerGUID() { return GetCasterGuid(); } public ObjectGuid GetCasterGuid() { return m_areaTriggerData.Caster; } diff --git a/Source/Game/Entities/Conversation.cs b/Source/Game/Entities/Conversation.cs index 1591cf11b..6d5f16946 100644 --- a/Source/Game/Entities/Conversation.cs +++ b/Source/Game/Entities/Conversation.cs @@ -341,8 +341,8 @@ namespace Game.Entities TimeSpan GetDuration() { return _duration; } public uint GetTextureKitId() { return _textureKitId; } - public ObjectGuid GetCreatorGuid() { return _creatorGuid; } - public override ObjectGuid GetOwnerGUID() { return GetCreatorGuid(); } + public override ObjectGuid GetCreatorGUID() { return _creatorGuid; } + public override ObjectGuid GetOwnerGUID() { return GetCreatorGUID(); } public override uint GetFaction() { return 0; } public override float GetStationaryX() { return _stationaryPosition.GetPositionX(); } diff --git a/Source/Game/Entities/Corpse.cs b/Source/Game/Entities/Corpse.cs index 32cf0b192..98ba7ebf6 100644 --- a/Source/Game/Entities/Corpse.cs +++ b/Source/Game/Entities/Corpse.cs @@ -81,7 +81,7 @@ namespace Game.Entities public override void Update(uint diff) { base.Update(diff); - + loot?.Update(); } @@ -284,6 +284,7 @@ namespace Game.Entities public void SetCorpseDynamicFlag(CorpseDynFlags dynamicFlags) { SetUpdateFieldFlagValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.DynamicFlags), (uint)dynamicFlags); } public void RemoveCorpseDynamicFlag(CorpseDynFlags dynamicFlags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.DynamicFlags), (uint)dynamicFlags); } public void ReplaceAllCorpseDynamicFlags(CorpseDynFlags dynamicFlags) { SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.DynamicFlags), (uint)dynamicFlags); } + public override ObjectGuid GetCreatorGUID() { return m_corpseData.Owner; } public override ObjectGuid GetOwnerGUID() { return m_corpseData.Owner; } public void SetOwnerGUID(ObjectGuid owner) { SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.Owner), owner); } public void SetPartyGUID(ObjectGuid partyGuid) { SetUpdateFieldValue(m_values.ModifyValue(m_corpseData).ModifyValue(m_corpseData.PartyGUID), partyGuid); } @@ -317,8 +318,8 @@ namespace Game.Entities public CellCoord GetCellCoord() { return _cellCoord; } public void SetCellCoord(CellCoord cellCoord) { _cellCoord = cellCoord; } - public override Loot GetLootForPlayer(Player player) { return loot; } - + public override Loot GetLootForPlayer(Player player) { return loot; } + public CorpseData m_corpseData; public Loot loot; diff --git a/Source/Game/Entities/DynamicObject.cs b/Source/Game/Entities/DynamicObject.cs index fee725fc5..b59ada84f 100644 --- a/Source/Game/Entities/DynamicObject.cs +++ b/Source/Game/Entities/DynamicObject.cs @@ -305,6 +305,7 @@ namespace Game.Entities public Unit GetCaster() { return _caster; } public uint GetSpellId() { return m_dynamicObjectData.SpellID; } public ObjectGuid GetCasterGUID() { return m_dynamicObjectData.Caster; } + public override ObjectGuid GetCreatorGUID() { return GetCasterGUID(); } public override ObjectGuid GetOwnerGUID() { return GetCasterGUID(); } public float GetRadius() { return m_dynamicObjectData.Radius; } diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 5766656e2..02dab75b6 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -3678,6 +3678,7 @@ namespace Game.Entities public Quaternion GetLocalRotation() { return m_localRotation; } public long GetPackedLocalRotation() { return m_packedRotation; } + public override ObjectGuid GetCreatorGUID() { return m_gameObjectData.CreatedBy; } public void SetOwnerGUID(ObjectGuid owner) { // Owner already found and different than expected owner - remove object from old owner diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 6ee556edd..b99d850a2 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -3121,6 +3121,7 @@ namespace Game.Entities public virtual bool LoadFromDB(ulong spawnId, Map map, bool addToMap, bool allowDuplicate) { return true; } + public virtual ObjectGuid GetCreatorGUID() { return default; } public virtual ObjectGuid GetOwnerGUID() { return default; } public virtual ObjectGuid GetCharmerOrOwnerGUID() { return GetOwnerGUID(); } diff --git a/Source/Game/Entities/SceneObject.cs b/Source/Game/Entities/SceneObject.cs index 037b733a7..4acbb5105 100644 --- a/Source/Game/Entities/SceneObject.cs +++ b/Source/Game/Entities/SceneObject.cs @@ -185,6 +185,7 @@ namespace Game.Entities base.ClearUpdateMask(remove); } + public override ObjectGuid GetCreatorGUID() { return m_sceneObjectData.CreatedBy; } public override ObjectGuid GetOwnerGUID() { return m_sceneObjectData.CreatedBy; } public override uint GetFaction() { return 0; } diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index 6c602d219..fd60ba294 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -2077,7 +2077,7 @@ namespace Game.Entities udata.BuildPacket(out packet); player.SendPacket(packet); } - public ObjectGuid GetCreatorGUID() { return m_unitData.CreatedBy; } + public override ObjectGuid GetCreatorGUID() { return m_unitData.CreatedBy; } public void SetCreatorGUID(ObjectGuid creator) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.CreatedBy), creator); } public ObjectGuid GetMinionGUID() { return m_unitData.Summon; } public void SetMinionGUID(ObjectGuid guid) { SetUpdateFieldValue(m_values.ModifyValue(m_unitData).ModifyValue(m_unitData.Summon), guid); } diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 3e1f7a5f1..64093a733 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -4403,7 +4403,7 @@ namespace Game.Spells spellChannelStart.InterruptImmunities = interruptImmunities; } - if (m_spellInfo.HasAttribute(SpellAttr8.HealPrediction) && m_casttime != 0 && m_caster.IsUnit()) + if (m_spellInfo.HasAttribute(SpellAttr8.HealPrediction) && m_caster.IsUnit()) { SpellTargetedHealPrediction healPrediction = new(); if (unitCaster.m_unitData.ChannelObjects.Size() == 1 && unitCaster.m_unitData.ChannelObjects[0].IsUnit()) diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 5b49d671d..00cddda1c 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -1006,8 +1006,19 @@ namespace Game.Spells Unit unitTarget = target.ToUnit(); if (HasAttribute(SpellAttr8.OnlyTargetIfSameCreator)) - if (caster != target && caster.GetGUID() != target.GetOwnerGUID()) + { + ObjectGuid getCreatorOrSelf(WorldObject obj) + { + ObjectGuid creator = obj.GetCreatorGUID(); + if (creator.IsEmpty()) + creator = obj.GetGUID(); + + return creator; + }; + + if (getCreatorOrSelf(caster) != getCreatorOrSelf(target)) return SpellCastResult.BadTargets; + } // creature/player specific target checks if (unitTarget != null) @@ -4109,7 +4120,7 @@ namespace Game.Spells { public int MaxTargets; // The amount of targets after the damage decreases by the Square Root AOE formula public int NumNonDiminishedTargets; // The amount of targets that still take the full amount before the damage decreases by the Square Root AOE formula - } + } } public class SpellEffectInfo