Core/Objects: Added ToWorldObject and ToItem

Port From (https://github.com/TrinityCore/TrinityCore/commit/6f6af6a1a1508508d0e42b90f0acf4f363cf91bd)
This commit is contained in:
hondacrx
2024-03-14 11:26:01 -04:00
parent 4bbf49a17a
commit 9d7a84d3a3
8 changed files with 56 additions and 56 deletions
+10 -9
View File
@@ -300,7 +300,7 @@ namespace Game.Spells
{
return $"Base: {(GetBase() != null ? GetBase().GetDebugInfo() : "NULL")}\nTarget: {(GetTarget() != null ? GetTarget().GetDebugInfo() : "NULL")}";
}
public Unit GetTarget() { return _target; }
public Aura GetBase() { return _base; }
@@ -2153,7 +2153,7 @@ namespace Game.Spells
script._FinishScriptCall();
}
}
public void CallScriptEffectAbsorbHandlers(AuraEffect aurEff, AuraApplication aurApp, DamageInfo dmgInfo, ref uint absorbAmount, ref bool defaultPrevented)
{
foreach (var auraScript in m_loadedScripts)
@@ -2209,7 +2209,7 @@ namespace Game.Spells
auraScript._FinishScriptCall();
}
}
public void CallScriptEffectManaShieldHandlers(AuraEffect aurEff, AuraApplication aurApp, DamageInfo dmgInfo, ref uint absorbAmount, ref bool defaultPrevented)
{
foreach (var auraScript in m_loadedScripts)
@@ -2264,7 +2264,7 @@ namespace Game.Spells
loadedScript._FinishScriptCall();
}
}
public bool CallScriptCheckProcHandlers(AuraApplication aurApp, ProcEventInfo eventInfo)
{
bool result = true;
@@ -2406,7 +2406,7 @@ namespace Game.Spells
Cypher.Assert(GetAuraType() == AuraObjectType.DynObj);
return m_owner.ToDynamicObject();
}
public void SetCastItemGUID(ObjectGuid guid)
{
m_castItemGuid = guid;
@@ -2608,10 +2608,11 @@ namespace Game.Spells
createInfo.CasterGUID = createInfo.Caster.GetGUID();
// check if aura can be owned by owner
if (createInfo.GetOwner().IsTypeMask(TypeMask.Unit))
if (!createInfo.GetOwner().IsInWorld || createInfo.GetOwner().ToUnit().IsDuringRemoveFromWorld())
Unit ownerUnit = createInfo.GetOwner().ToUnit();
if (ownerUnit != null)
if (!ownerUnit.IsInWorld || ownerUnit.IsDuringRemoveFromWorld())
// owner not in world so don't allow to own not self casted single target auras
if (createInfo.CasterGUID != createInfo.GetOwner().GetGUID() && createInfo.GetSpellInfo().IsSingleTarget())
if (createInfo.CasterGUID != ownerUnit.GetGUID() && createInfo.GetSpellInfo().IsSingleTarget())
return null;
Aura aura;
@@ -2805,7 +2806,7 @@ namespace Game.Spells
case SpellEffectName.ApplyAuraOnPet:
{
Unit pet = Global.ObjAccessor.GetUnit(GetUnitOwner(), GetUnitOwner().GetPetGUID());
if (pet != null)
if (pet != null)
if (condList == null || Global.ConditionMgr.IsObjectMeetToConditions(pet, refe, condList))
units.Add(pet);
break;