Core/Spells: Implemented summoning a personal gameobject effect
Port From (https://github.com/TrinityCore/TrinityCore/commit/e601c6d1f9b9743e92e9562abd9f2d24d9aaf175)
This commit is contained in:
@@ -2177,7 +2177,7 @@ namespace Framework.Constants
|
|||||||
AllowControlPet = 168,
|
AllowControlPet = 168,
|
||||||
DestroyItem = 169,
|
DestroyItem = 169,
|
||||||
UpdateZoneAurasPhases = 170,
|
UpdateZoneAurasPhases = 170,
|
||||||
Effect171 = 171, // Summons Gamebject
|
SummonPersonalGameobject = 171, // Summons Gameobject
|
||||||
ResurrectWithAura = 172, // Aoe Ressurection
|
ResurrectWithAura = 172, // Aoe Ressurection
|
||||||
UnlockGuildVaultTab = 173, // Guild Tab Unlocked (Guild Perk)
|
UnlockGuildVaultTab = 173, // Guild Tab Unlocked (Guild Perk)
|
||||||
ApplyAuraOnPet = 174,
|
ApplyAuraOnPet = 174,
|
||||||
|
|||||||
@@ -2800,6 +2800,10 @@ namespace Game.Entities
|
|||||||
void SetRespawnCompatibilityMode(bool mode = true) { m_respawnCompatibilityMode = mode; }
|
void SetRespawnCompatibilityMode(bool mode = true) { m_respawnCompatibilityMode = mode; }
|
||||||
public bool GetRespawnCompatibilityMode() { return m_respawnCompatibilityMode; }
|
public bool GetRespawnCompatibilityMode() { return m_respawnCompatibilityMode; }
|
||||||
|
|
||||||
|
public void SetVisibleByUnitOnly(ObjectGuid unit) { m_visibleByUnitOnly = unit; }
|
||||||
|
public bool IsVisibleByUnitOnly() { return !m_visibleByUnitOnly.IsEmpty(); }
|
||||||
|
public ObjectGuid GetVisibleByUnitOnly() { return m_visibleByUnitOnly; }
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
protected GameObjectFieldData m_gameObjectData;
|
protected GameObjectFieldData m_gameObjectData;
|
||||||
protected GameObjectValue m_goValue;
|
protected GameObjectValue m_goValue;
|
||||||
@@ -2834,6 +2838,7 @@ namespace Game.Entities
|
|||||||
bool m_respawnCompatibilityMode;
|
bool m_respawnCompatibilityMode;
|
||||||
ushort _animKitId;
|
ushort _animKitId;
|
||||||
uint _worldEffectID;
|
uint _worldEffectID;
|
||||||
|
ObjectGuid m_visibleByUnitOnly;
|
||||||
|
|
||||||
GameObjectState m_prevGoState; // What state to set whenever resetting
|
GameObjectState m_prevGoState; // What state to set whenever resetting
|
||||||
|
|
||||||
|
|||||||
@@ -1147,6 +1147,11 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameObject go = obj.ToGameObject();
|
||||||
|
if ( go != null)
|
||||||
|
if (go.IsVisibleByUnitOnly() && GetGUID() != go.GetVisibleByUnitOnly())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (viewpoint == null)
|
if (viewpoint == null)
|
||||||
viewpoint = this;
|
viewpoint = this;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ namespace Game.Spells
|
|||||||
[SpellEffectHandler(SpellEffectName.Portal)]
|
[SpellEffectHandler(SpellEffectName.Portal)]
|
||||||
[SpellEffectHandler(SpellEffectName.BindSight)]
|
[SpellEffectHandler(SpellEffectName.BindSight)]
|
||||||
[SpellEffectHandler(SpellEffectName.CallPet)]
|
[SpellEffectHandler(SpellEffectName.CallPet)]
|
||||||
[SpellEffectHandler(SpellEffectName.Effect171)]
|
|
||||||
[SpellEffectHandler(SpellEffectName.Effect177)]
|
[SpellEffectHandler(SpellEffectName.Effect177)]
|
||||||
[SpellEffectHandler(SpellEffectName.PortalTeleport)]
|
[SpellEffectHandler(SpellEffectName.PortalTeleport)]
|
||||||
[SpellEffectHandler(SpellEffectName.RitualBase)]
|
[SpellEffectHandler(SpellEffectName.RitualBase)]
|
||||||
@@ -117,6 +116,7 @@ namespace Game.Spells
|
|||||||
m_caster.DealDamage(unitTarget, (uint)unitTarget.GetHealth(), null, DamageEffectType.NoDamage, SpellSchoolMask.Normal, null, false);
|
m_caster.DealDamage(unitTarget, (uint)unitTarget.GetHealth(), null, DamageEffectType.NoDamage, SpellSchoolMask.Normal, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SpellEffectHandler(SpellEffectName.EnvironmentalDamage)]
|
||||||
void EffectEnvironmentalDMG(uint effIndex)
|
void EffectEnvironmentalDMG(uint effIndex)
|
||||||
{
|
{
|
||||||
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
|
||||||
@@ -5253,6 +5253,57 @@ namespace Game.Spells
|
|||||||
guild.HandleBuyBankTab(caster.GetSession(), (byte)(damage - 1)); // Bank tabs start at zero internally
|
guild.HandleBuyBankTab(caster.GetSession(), (byte)(damage - 1)); // Bank tabs start at zero internally
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SpellEffectHandler(SpellEffectName.SummonPersonalGameobject)]
|
||||||
|
void EffectSummonPersonalGameObject(uint effIndex)
|
||||||
|
{
|
||||||
|
if (effectHandleMode != SpellEffectHandleMode.Hit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint goId = (uint)effectInfo.MiscValue;
|
||||||
|
if (goId == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
float x, y, z;
|
||||||
|
if (m_targets.HasDst())
|
||||||
|
destTarget.GetPosition(out x, out y, out z);
|
||||||
|
else
|
||||||
|
m_caster.GetClosePoint(out x, out y, out z, SharedConst.DefaultPlayerBoundingRadius);
|
||||||
|
|
||||||
|
Map map = m_caster.GetMap();
|
||||||
|
Position pos = new Position(x, y, z, m_caster.GetOrientation());
|
||||||
|
Quaternion rot = Quaternion.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f);
|
||||||
|
GameObject go = GameObject.CreateGameObject(goId, map, pos, rot, 255, GameObjectState.Ready);
|
||||||
|
|
||||||
|
if (!go)
|
||||||
|
{
|
||||||
|
Log.outWarn(LogFilter.Spells, $"SpellEffect Failed to summon personal gameobject. SpellId {m_spellInfo.Id}, effect {effIndex}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PhasingHandler.InheritPhaseShift(go, m_caster);
|
||||||
|
|
||||||
|
int duration = m_spellInfo.CalcDuration(m_caster);
|
||||||
|
|
||||||
|
go.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
|
||||||
|
go.SetSpellId(m_spellInfo.Id);
|
||||||
|
go.SetVisibleByUnitOnly(m_caster.GetGUID());
|
||||||
|
|
||||||
|
ExecuteLogEffectSummonObject(effIndex, go);
|
||||||
|
|
||||||
|
map.AddToMap(go);
|
||||||
|
|
||||||
|
GameObject linkedTrap = go.GetLinkedTrap();
|
||||||
|
if (linkedTrap != null)
|
||||||
|
{
|
||||||
|
PhasingHandler.InheritPhaseShift(linkedTrap, m_caster);
|
||||||
|
|
||||||
|
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
|
||||||
|
linkedTrap.SetSpellId(m_spellInfo.Id);
|
||||||
|
|
||||||
|
ExecuteLogEffectSummonObject(effIndex, linkedTrap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[SpellEffectHandler(SpellEffectName.ResurrectWithAura)]
|
[SpellEffectHandler(SpellEffectName.ResurrectWithAura)]
|
||||||
void EffectResurrectWithAura(uint effIndex)
|
void EffectResurrectWithAura(uint effIndex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4266,7 +4266,7 @@ namespace Game.Spells
|
|||||||
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 168 SPELL_EFFECT_168
|
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 168 SPELL_EFFECT_168
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.Caster, SpellTargetObjectTypes.Unit), // 169 SPELL_EFFECT_DESTROY_ITEM
|
new StaticData(SpellEffectImplicitTargetTypes.Caster, SpellTargetObjectTypes.Unit), // 169 SPELL_EFFECT_DESTROY_ITEM
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 170 SPELL_EFFECT_170
|
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 170 SPELL_EFFECT_170
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.Dest), // 171 SPELL_EFFECT_171
|
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.Dest), // 171 SPELL_EFFECT_SUMMON_PERSONAL_GAMEOBJECT
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 172 SPELL_EFFECT_172
|
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 172 SPELL_EFFECT_172
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None), // 173 SPELL_EFFECT_UNLOCK_GUILD_VAULT_TAB
|
new StaticData(SpellEffectImplicitTargetTypes.None, SpellTargetObjectTypes.None), // 173 SPELL_EFFECT_UNLOCK_GUILD_VAULT_TAB
|
||||||
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 174 SPELL_EFFECT_174
|
new StaticData(SpellEffectImplicitTargetTypes.Explicit, SpellTargetObjectTypes.Unit), // 174 SPELL_EFFECT_174
|
||||||
|
|||||||
Reference in New Issue
Block a user