internal static void ReloadFrames(Object proObj) { Professions professions = (Professions)proObj; InterfaceHelper.ReloadFrames(); Thread.Sleep(2000); ClickHooked("SpellbookMicroButton"); ClickHooked("SpellBookFrameTabButton2"); List <Frame> mainFrames = new List <Frame>(); List <Frame> statusFrames = new List <Frame>(); mainFrames.Add(ClickHooked("PrimaryProfession1")); mainFrames.Add(ClickHooked("PrimaryProfession2")); mainFrames.Add(ClickHooked("SecondaryProfession1")); mainFrames.Add(ClickHooked("SecondaryProfession2")); mainFrames.Add(ClickHooked("SecondaryProfession3")); mainFrames.Add(ClickHooked("SecondaryProfession4")); //foreach(Frame frame in InterfaceHelper.GetFrames) //{ // Debug.WriteLine(frame.GetName); //} statusFrames.Add(ClickHooked("PrimaryProfession1StatusBar")); statusFrames.Add(ClickHooked("PrimaryProfession2StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession1StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession2StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession3StatusBar")); statusFrames.Add(ClickHooked("SecondaryProfession4StatusBar")); int x = 0; foreach (Frame frame in mainFrames) { List <Frame> frameChildren = frame.GetChilds; Profession profession = new Profession(); profession.Name = frameChildren.ElementAt(0).GetText; int p = x > 1 ? 1 : 3; profession.Rank = RankFactory.getRank(frameChildren.ElementAt(p).GetText); Frame statusFrame = statusFrames.ElementAt(x); List <Frame> statusChildren = statusFrame.GetChilds; String[] levels = statusChildren.ElementAt(0).GetText.Split('/'); profession.Level = int.Parse(levels[0]); professions.addProfession(profession, professions); x++; } //ClickHooked("PrimaryProfession1"); //ClickHooked("PrimaryProfession1StatusBar"); //ClickHooked("ArchaeologyFrameSummaryPageRace4"); professions.parseProfession(); Thread.Sleep(1000); CloseFrames(); Thread.Sleep(1000); professions.callback(); }
/// <summary> /// Parses Messages to update professions maining pass in the BlueChat msg /// </summary> /// <param name="msg">String to be parsed</param> /// <returns>True if update occured false otherwise</returns> public Boolean MsgUpdate(String msg) { String name; if (msg.Contains("You have u")) { name = msg.Substring(msg.IndexOf("[") + 1, msg.IndexOf("]") - 1 - msg.IndexOf("[")); return(this.removeProfession(name)); // this.parseProfession(); } else if (msg.Contains("You have g")) { name = msg.Substring(msg.IndexOf("he ") + 3, msg.IndexOf(" s") - msg.IndexOf("he ") - 3); Profession p = new Profession(); p.Name = name; p.Level = 1; p.Rank = RankFactory.getRank(RankFactory.RANK_APPRENTICE); this.addProfession(p, this); this.parseProfession(); } else if (msg.Contains("Your s")) { name = msg.Substring(msg.IndexOf("in ") + 3, msg.IndexOf(" has") - msg.IndexOf("in ") - 3); int start = msg.IndexOf("to ") + 3; int end = msg.IndexOf("."); int diff = end - start; int level = int.Parse(msg.Substring(start, diff)); Boolean found = false; foreach (Profession p in this._pProfessions) { if (p.Name == name) { p.Level = level; found = true; } } if (!found) { switch (name) { case "Cooking": this.Secondary3.Level = level; found = true; break; case "Archaeology": this.Secondary1.Level = level; found = true; break; case "First Aid": this.Secondary4.Level = level; found = true; break; case "Fishing": this.Secondary2.Level = level; found = true; break; } } if (!found) { return(false); } } else if (msg.Contains("You have learned a new ability")) { name = msg.Substring(msg.IndexOf("[") + 1, msg.IndexOf("]") - 1 - msg.IndexOf("[")); // Profession p1 = null; foreach (Profession p in this._pProfessions) { if (p.Name == name) { p.Rank++; } } switch (name) { case "Cooking": this.Secondary3.Rank++; break; case "Archaeology": this.Secondary1.Rank++; break; case "First Aid": this.Secondary4.Rank++; break; case "Fishing": this.Secondary2.Rank++; break; } } else { return(false); } return(true); }
public static Rank operator ++(Rank c1) { return(RankFactory.promote(c1)); }