public override void InitStats(uint duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem Player owner = GetOwner().ToPlayer(); if (owner) { if (m_Properties.Slot >= (int)SummonSlot.Totem && m_Properties.Slot < SharedConst.MaxTotemSlot) { TotemCreated packet = new TotemCreated(); packet.Totem = GetGUID(); packet.Slot = (byte)(m_Properties.Slot - (int)SummonSlot.Totem); packet.Duration = duration; packet.SpellID = GetUInt32Value(UnitFields.CreatedBySpell); owner.ToPlayer().SendPacket(packet); } // set display id depending on caster's race SpellInfo createdBySpell = Global.SpellMgr.GetSpellInfo(GetUInt32Value(UnitFields.CreatedBySpell)); if (createdBySpell != null) { SpellEffectInfo[] effects = createdBySpell.GetEffectsForDifficulty(Difficulty.None); var summonEffect = effects.FirstOrDefault(effect => { return(effect != null && effect.IsEffect(SpellEffectName.Summon)); }); if (summonEffect != null) { SetDisplayId(owner.GetModelForTotem((PlayerTotemType)summonEffect.MiscValueB)); } } } base.InitStats(duration); // Get spell cast by totem SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell()); if (totemSpell != null) { if (totemSpell.CalcCastTime(getLevel()) != 0) // If spell has cast time . its an active totem { m_type = TotemType.Active; } } m_duration = duration; SetLevel(GetOwner().getLevel()); }
public override void InitStats(uint duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem Player owner = GetOwner().ToPlayer(); if (owner) { if (m_Properties.Slot >= (int)SummonSlot.Totem && m_Properties.Slot < SharedConst.MaxTotemSlot) { TotemCreated packet = new TotemCreated(); packet.Totem = GetGUID(); packet.Slot = (byte)(m_Properties.Slot - (int)SummonSlot.Totem); packet.Duration = duration; packet.SpellID = GetUInt32Value(UnitFields.CreatedBySpell); owner.ToPlayer().SendPacket(packet); } // set display id depending on caster's race uint totemDisplayId = Global.SpellMgr.GetModelForTotem(GetUInt32Value(UnitFields.CreatedBySpell), owner.GetRace()); if (totemDisplayId == 0) { Log.outError(LogFilter.Spells, $"Spell {GetUInt32Value(UnitFields.CreatedBySpell)} with RaceID ({owner.GetRace()}) have no totem model data defined, set to default model."); } else { SetDisplayId(totemDisplayId); } } base.InitStats(duration); // Get spell cast by totem SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell()); if (totemSpell != null) { if (totemSpell.CalcCastTime(getLevel()) != 0) // If spell has cast time . its an active totem { m_type = TotemType.Active; } } m_duration = duration; SetLevel(GetOwner().getLevel()); }
public override void InitStats(uint duration) { // client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem Player owner = GetOwner().ToPlayer(); if (owner) { if (m_Properties.Slot >= (int)SummonSlot.Totem && m_Properties.Slot < SharedConst.MaxTotemSlot) { TotemCreated packet = new TotemCreated(); packet.Totem = GetGUID(); packet.Slot = (byte)(m_Properties.Slot - (int)SummonSlot.Totem); packet.Duration = duration; packet.SpellID = m_unitData.CreatedBySpell; owner.ToPlayer().SendPacket(packet); } // set display id depending on caster's race uint totemDisplayId = Global.SpellMgr.GetModelForTotem(m_unitData.CreatedBySpell, owner.GetRace()); if (totemDisplayId != 0) { SetDisplayId(totemDisplayId); } } base.InitStats(duration); // Get spell cast by totem SpellInfo totemSpell = Global.SpellMgr.GetSpellInfo(GetSpell()); if (totemSpell != null) { if (totemSpell.CalcCastTime(GetLevel()) != 0) // If spell has cast time . its an active totem { m_type = TotemType.Active; } } m_duration = duration; SetLevel(GetOwner().GetLevel()); }