/// <summary> /// loads WOW Talent and Spec info into cached list /// </summary> public static void Update() { using (StyxWoW.Memory.AcquireFrame()) { // With Legion, Low levels are an auto selected spec now. We want to keep using Lowbie behaviors pre level 10 CurrentSpec = StyxWoW.Me.Level < 10 ? WoWSpec.None : StyxWoW.Me.Specialization; Talents.Clear(); TalentId = new int[7]; // Always 21 talents. 7 rows of 3 talents. for (int row = 0; row < 7; row++) { for (int col = 0; col < 3; col++) { var selected = Lua.GetReturnVal <bool>(string.Format("local t = select(4, GetTalentInfo({0}, {1}, GetActiveSpecGroup())) if t then return 1 end return nil", row + 1, col + 1), 0); int index = 1 + row * 3 + col; var t = new Talent { Index = index, Selected = selected }; Talents.Add(t); if (selected) { TalentId[row] = index; } } } SpellCount = (uint)SpellManager.Spells.Count; SpellBookSignature = CalcSpellBookSignature(); } }
public override void Dispose() { Talents.ForEach((talentImage) => talentImage = null); Talents.Clear(); base.Dispose(); }
public override void Dispose() { Talents.ForEach((talentImage) => talentImage.Dispose()); Talents.Clear(); TalentNames.Clear(); TalentShortTooltips.Clear(); TalentFullTooltips.Clear(); TalentSubInfo.Clear(); base.Dispose(); }
public static void Update() { // Keep the frame stuck so we can do a bunch of injecting at once. using (StyxWoW.Memory.AcquireFrame()) { CurrentSpec = StyxWoW.Me.Specialization; Talents.Clear(); TalentId = new int[6]; // Always 18 talents. 6 rows of 3 talents. for (int index = 1; index <= 6 * 3; index++) { var selected = Lua.GetReturnVal <bool>( string.Format( "local t= select(5,GetTalentInfo({0})) if t == true then return 1 end return nil", index), 0); var t = new Talent { Index = index, Selected = selected }; Talents.Add(t); TalentId[(index - 1) / 3] = index; } Glyphs.Clear(); GlyphId = new int[6]; // 6 glyphs all the time. Plain and simple! for (int i = 1; i <= 6; i++) { List <string> glyphInfo = Lua.GetReturnValues(String.Format("return GetGlyphSocketInfo({0})", i)); // add check for 4 members before access because empty sockets weren't returning 'nil' as documented if (glyphInfo != null && glyphInfo.Count >= 4 && glyphInfo[3] != "nil" && !string.IsNullOrEmpty(glyphInfo[3])) { GlyphId[i - 1] = int.Parse(glyphInfo[3]); Glyphs.Add(WoWSpell.FromId(GlyphId[i - 1]).Name.Replace("Glyph of ", "")); } } } }
public static void Update() { // Don't bother if we're < 10 if (StyxWoW.Me.Level < 10) { CurrentSpec = TalentSpec.Lowbie; return; } WoWClass myClass = StyxWoW.Me.Class; int treeOne = 0, treeTwo = 0, treeThree = 0; bool isExtraSpec = false; // Keep the frame stuck so we can do a bunch of injecting at once. using (new FrameLock()) { Talents.Clear(); for (int tab = 1; tab <= 3; tab++) { var numTalents = Lua.GetReturnVal <int>("return GetNumTalents(" + tab + ")", 0); for (int index = 1; index <= numTalents; index++) { var rank = Lua.GetReturnVal <int>(string.Format("return GetTalentInfo({0}, {1})", tab, index), 4); var t = new Talent { Tab = tab - 1, Index = index - 1, Count = rank }; Talents.Add(t); // Thick Hide - Only used by tanking druids if (myClass == WoWClass.Druid && tab == 2 && index == 11 && rank != 0) { isExtraSpec = true; } // Renewed Hope if (myClass == WoWClass.Priest && tab == 1 && index == 8 && rank != 0) { isExtraSpec = true; } switch (tab) { case 1: treeOne += rank; break; case 2: treeTwo += rank; break; case 3: treeThree += rank; break; } } } Glyphs.Clear(); var glyphCount = Lua.GetReturnVal <int>("return GetNumGlyphSockets()", 0); if (glyphCount != 0) { for (int i = 1; i <= glyphCount; i++) { List <string> glyphInfo = Lua.GetReturnValues(String.Format("return GetGlyphSocketInfo({0})", i)); if (glyphInfo != null && glyphInfo[3] != "nil" && !string.IsNullOrEmpty(glyphInfo[3])) { Glyphs.Add(WoWSpell.FromId(int.Parse(glyphInfo[3])).Name.Replace("Glyph of ", "")); } } } } if (treeOne == 0 && treeTwo == 0 && treeThree == 0) { CurrentSpec = TalentSpec.Lowbie; return; } int max = Math.Max(Math.Max(treeOne, treeTwo), treeThree); // Altarboy.Logger.Log("[Talents] Best Tree: " + max); // Altarboy.Logger.Log("[Talents] Is Special Spec: " + isExtraSpec); int specMask = ((int)StyxWoW.Me.Class << 8); // Bear tanks, healing disc priests, etc. if (isExtraSpec) { specMask += TalentFlagIsextraspec; } if (max == treeOne) { CurrentSpec = (TalentSpec)(specMask + 0); } else if (max == treeTwo) { CurrentSpec = (TalentSpec)(specMask + 1); } else { CurrentSpec = (TalentSpec)(specMask + 2); } }
public static void Update() { // Don't bother if we're < 10 if (StyxWoW.Me.Level < 10) { CurrentSpec = WoWSpec.None; return; } // Keep the frame stuck so we can do a bunch of injecting at once. using (StyxWoW.Memory.AcquireFrame()) { CurrentSpec = StyxWoW.Me.Specialization; Talents.Clear(); var numTalents = Lua.GetReturnVal <int>("return GetNumTalents()", 0); for (int index = 0; index <= numTalents; index++) { var selected = Lua.GetReturnVal <int>(string.Format("return GetTalentInfo({0})", index), 4); switch (selected) { case 1: { var t = new Talent { Index = index, Count = 1 }; //Name = talentName CLULogger.TroubleshootLog("[TalentManager] - Talent {0} chosen", index); Talents.Add(t); } break; } } foreach (var talent in Talents) { if (StyxWoW.Me.Class == WoWClass.DeathKnight) { // Set the Blood DK Tier one Talent here switch (talent.Index) { case 1: CLUSettings.Instance.DeathKnight.DeathKnightTierOneTalent = DeathKnightTierOneTalent.RoilingBlood; CLULogger.TroubleshootLog("TalentManager - Setting DeathKnightTierOneTalent to {0}", DeathKnightTierOneTalent.RoilingBlood); break; case 2: CLUSettings.Instance.DeathKnight.DeathKnightTierOneTalent = DeathKnightTierOneTalent.PlagueLeech; CLULogger.TroubleshootLog("TalentManager - Setting DeathKnightTierOneTalent to {0}", DeathKnightTierOneTalent.PlagueLeech); break; case 3: CLUSettings.Instance.DeathKnight.DeathKnightTierOneTalent = DeathKnightTierOneTalent.UnholyBlight; CLULogger.TroubleshootLog("TalentManager - Setting DeathKnightTierOneTalent to {0}", DeathKnightTierOneTalent.UnholyBlight); break; } } } Glyphs.Clear(); var glyphCount = Lua.GetReturnVal <int>("return GetNumGlyphSockets()", 0); CLULogger.TroubleshootLog("Glyphdetection - GetNumGlyphSockets {0}", glyphCount); if (glyphCount != 0) { for (int i = 1; i <= glyphCount; i++) { List <string> glyphInfo = Lua.GetReturnValues(String.Format("return GetGlyphSocketInfo({0})", i), "glyphs.lua"); var lua = String.Format("local enabled, glyphType, glyphTooltipIndex, glyphSpellID, icon = GetGlyphSocketInfo({0});if (enabled) then return glyphSpellID else return 0 end", i); var glyphSpellId = Lua.GetReturnVal <int>(lua, 0); try { if (glyphSpellId > 0) { CLULogger.TroubleshootLog("Glyphdetection - SpellId: {0},Name:{1} ,WoWSpell: {2}", glyphSpellId, WoWSpell.FromId(glyphSpellId).Name, WoWSpell.FromId(glyphSpellId)); Glyphs.Add(WoWSpell.FromId(glyphSpellId).Name.Replace("Glyph of ", "")); } else { CLULogger.TroubleshootLog("Glyphdetection - Couldn't find all values to detect the Glyph in slot {0}", i); } } catch (Exception ex) { CLULogger.DiagnosticLog("We couldn't detect your Glyphs"); CLULogger.DiagnosticLog("Report this message to us: " + ex); } } } } }