/// <summary> /// Initializes a new instance of the <see cref="Spell"/> class. This class management an spell of your wow player. /// </summary> /// <param name="spellId">The spell ID.</param> public Spell(uint spellId) { lock (this) { try { Id = spellId; DBCStruct.SpellRec spellRec = DBCSpell.GetRow((int)Id); if (spellRec.SpellId >= 0) { if (spellId == spellRec.SpellId) { DBCStruct.SpellCastTimesRec castTimeRec = DBCSpellCastTimes.GetRow(DBCSpellMisc.GetRow(spellRec.SpellMiscId).SpellCastTimesId); try { CastTime = (float)castTimeRec.CastTime / 1000; } catch { CastTime = 0; } DBCStruct.SpellRangeRec range = DBCSpellRange.GetRow(DBCSpellMisc.GetRow(spellRec.SpellMiscId).SpellRangeId); if (range.Id != 0) { MaxRangeHostile = range.MaxRangeHostile; MinRangeHostile = range.MinRangeHostile; MaxRangeFriend = range.MaxRangeFriend; MinRangeFriend = range.MinRangeFriend; } else { MaxRangeHostile = 0; MinRangeHostile = 0; MaxRangeFriend = 0; MinRangeFriend = 0; } Name = SpellManager.SpellListManager.SpellNameById(spellId); try { NameInGame = Memory.WowMemory.Memory.ReadUTF8String(spellRec.Name); } catch { NameInGame = ""; } if (MaxRangeHostile < 5.0f) { MaxRangeHostile = 5.0f; } if (MaxRangeFriend < 5.0f) { MaxRangeFriend = 5.0f; } KnownSpell = SpellManager.ExistSpellBookLUA(NameInGame); Ids.AddRange(SpellManager.SpellListManager.SpellIdByName(Name)); Ids.Add(Id); return; } } } catch (Exception exception) { Logging.WriteError("Spell(uint spellId): " + exception); } CastTime = 0; MaxRangeHostile = 5.0f; MinRangeHostile = 0f; MaxRangeFriend = 5.0f; MinRangeFriend = 0f; NameInGame = ""; } }