internal void addProfession(Profession profession, Professions professions) { if (profession.Name != "") { switch (profession.Name) { case "Mining": professions.addPProfession(profession); break; case "Skinning": professions.addPProfession(profession); break; case "Herbalism": professions.addPProfession(profession); break; case "Alchemy": professions.addPProfession(profession); break; case "Blacksmithing": professions.addPProfession(profession); break; case "Engineering": professions.addPProfession(profession); break; case "Enchanting": professions.addPProfession(profession); break; case "Inscription": professions.addPProfession(profession); break; case "Jewelcrafting": professions.addPProfession(profession); break; case "Leatherworking": professions.addPProfession(profession); break; case "Tailoring": professions.addPProfession(profession); break; case "Cooking": professions.Secondary3 = profession; break; case "Archaeology": professions.Secondary1 = profession; break; case "First Aid": professions.Secondary4 = profession; break; case "Fishing": professions.Secondary2 = profession; break; } } }
internal Boolean removeProfession(String name) { Boolean found = false; Profession remove = null; foreach (Profession p in this._pProfessions) { if (p.Name == name) { remove = p; found = true; } } if (found) { this._pProfessions.Remove(remove); } else { switch (name) { case "Cooking": this.Secondary3 = null; found = true; break; case "Archaeology": this.Secondary1 = null; found = true; break; case "First Aid": this.Secondary4 = null; found = true; break; case "Fishing": this.Secondary2 = null; found = true; break; } } this.parseProfession(); return found; }
internal void setSecondaryProfession4(Profession profession) { this.Secondary4 = profession; }
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(); }
internal void addPProfession(Profession profession) { this._pProfessions.Add(profession); }
internal void setPrimaryProfession2(Profession profession) { this.Primary2 = profession; this.addPProfession(profession); }
/// <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; }
internal void setSecondaryProfession3(Profession profession) { this.Secondary3 = profession; }
internal void setPrimaryProfession2(Profession profession) { this.Primary2 = profession; this.addPProfession(profession); }
internal void addPProfession(Profession profession) { this._pProfessions.Add(profession); }
/// <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); }