public static void DoTalents() { try { if (GetNumUnspentTalents() == 0) { return; } if (Others.ExistFile(Application.StartupPath + "\\CombatClasses\\Talents\\" + ObjectManager.ObjectManager.Me.WowSpecialization() + ".talents.txt")) { Lua.RunMacroText("/click PlayerTalentFrameCloseButton"); // Make sure it's already closed. Thread.Sleep(400); Lua.RunMacroText("/click TalentMicroButton"); string advised = Others.ReadFile(Application.StartupPath + "\\CombatClasses\\Talents\\" + ObjectManager.ObjectManager.Me.WowSpecialization() + ".talents.txt"); var talents = advised.Split('|'); foreach (string s in talents) { Lua.LuaDoString("PlayerTalentFrame_SelectTalent(" + s + ")"); } Lua.RunMacroText("/click PlayerTalentFrameTalentsLearnButton"); Thread.Sleep(400); Lua.RunMacroText("/click PlayerTalentFrameCloseButton"); } } catch (Exception exception) { Logging.WriteError("DoTalents(): " + exception); } }
private void Translate() { try { LangSelection.Items.Clear(); foreach (string l in Others.GetFilesDirectory(Application.StartupPath + "\\Data\\Lang\\", "*.xml")) { Application.DoEvents(); LangSelection.Items.Add(l.Remove(l.Length - 1 - 3)); } string langSelected = "English.xml"; if (Others.ExistFile(Application.StartupPath + "\\Settings\\lang.txt")) { string langTemp = Others.ReadFile(Application.StartupPath + "\\Settings\\lang.txt"); if (!string.IsNullOrEmpty(langTemp)) { if (Others.ExistFile(Application.StartupPath + "\\Data\\Lang\\" + langTemp)) { langSelected = langTemp; } } } if (!nManager.Translate.Load(langSelected)) { return; } LangSelection.Text = langSelected.Remove(langSelected.Length - 1 - 3); LangSelection.SelectedIndexChanged += LangSelection_SelectedIndexChanged; MainHeader.TitleText = nManager.Translate.Get(nManager.Translate.Id.LoginFormTitle) + @" - " + Information.MainTitle; Text = MainHeader.TitleText; Identifier.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormDefaultIdentifier); Remember.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormRemember); SetToolTypeIfNeeded(Remember); Register.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormRegister); SetToolTypeIfNeeded(Register); LoginButton.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormStart); SetToolTypeIfNeeded(LoginButton); RefreshButton.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormRefresh); SetToolTypeIfNeeded(RefreshButton); WebsiteLink.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormWebsite); SetToolTypeIfNeeded(WebsiteLink); ForumLink.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormForum); SetToolTypeIfNeeded(ForumLink); UseKey.Text = nManager.Translate.Get(nManager.Translate.Id.LoginFormUseKey); SetToolTypeIfNeeded(UseKey); } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public static bool IsGatherBuddyProfile(string path) { try { if (File.Exists(path)) { string text = Others.ReadFile(path); if (text.Contains("<HBProfile") || text.Contains("<GlideProfile")) { return(true); } } else { MessageBox.Show(nManager.Translate.Get(nManager.Translate.Id.File_not_found) + "."); } } catch { } return(false); }
public static bool IsMMoLazyFlyerProfile(string path) { try { if (File.Exists(path)) { string text = Others.ReadFile(path); if (text.Contains("<GatherProfile") && text.Contains("<Waypoints_Normal>")) { return(true); } } else { MessageBox.Show(nManager.Translate.Get(nManager.Translate.Id.File_not_found) + "."); } } catch { } return(false); }
public static bool IsWowRobotGatherFlyProfile(string path) { try { if (File.Exists(path)) { string text = Others.ReadFile(path); if (text.Contains("<Profile") && text.Contains("<Points>")) { return(true); } } else { MessageBox.Show(string.Format("{0}.", nManager.Translate.Get(nManager.Translate.Id.File_not_found))); } } catch { } return(false); }
public static bool IsPiroxFlyGathererProfile(string path) { try { if (File.Exists(path)) { string text = Others.ReadFile(path); if (text.Contains("[GoTo]") && text.Contains("UseFlyMount")) { return(true); } } else { MessageBox.Show(string.Format("{0}.", nManager.Translate.Get(nManager.Translate.Id.File_not_found))); } } catch { } return(false); }
internal static bool Run(string script, int questId, ref QuestObjective qObjective) { try { if (string.IsNullOrWhiteSpace(script)) { return(true); } string originalScript = script; if (CachedScripts.ContainsKey(originalScript) && CachedScripts[originalScript] != null) { return(CachedScripts[originalScript].Script(ref qObjective)); } string scriptName = script; // Either the full script if it's a single line script, or the file name. if (script[0] == '=') { scriptName = script.Replace("=", ""); script = Others.ReadFile(Application.StartupPath + "\\Profiles\\Quester\\Scripts\\" + script.Replace("=", ""), true); // this is for loading a file that will be added inside a method. } // or 1-line script directly from the field. // Example: "return (Usefuls.ContinentId == 1440);" CodeDomProvider cc = new CSharpCodeProvider(); var cp = new CompilerParameters(); IEnumerable <string> assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic && !a.CodeBase.Contains((Process.GetCurrentProcess().ProcessName + ".exe"))).Select(a => a.Location); cp.ReferencedAssemblies.AddRange(assemblies.ToArray()); string toCompile = "using System; " + Environment.NewLine + "using System.Threading; " + Environment.NewLine + "using System.Windows.Forms; " + Environment.NewLine + "using System.Collections.Generic; " + Environment.NewLine + "using System.Diagnostics; " + Environment.NewLine + "using System.Linq; " + Environment.NewLine + "using nManager; " + Environment.NewLine + "using nManager.Wow.Class; " + Environment.NewLine + "using nManager.Helpful; " + Environment.NewLine + "using nManager.Wow; " + Environment.NewLine + "using nManager.Wow.Bot.Tasks; " + Environment.NewLine + "using nManager.Wow.Enums; " + Environment.NewLine + "using nManager.Wow.Helpers; " + Environment.NewLine + "using nManager.Wow.ObjectManager; " + Environment.NewLine + "using Quester.Profile; " + Environment.NewLine + "using Timer = nManager.Helpful.Timer;" + Environment.NewLine + "public class Main : Quester.Tasks.IScript " + Environment.NewLine + "{ " + Environment.NewLine + " public bool Script(ref QuestObjective questObjective) " + Environment.NewLine + " { " + Environment.NewLine + " try " + Environment.NewLine + " { " + Environment.NewLine + " int QuestID = " + questId + "; " + Environment.NewLine + " " + script + " " + Environment.NewLine + " } " + Environment.NewLine + " catch (Exception e) " + Environment.NewLine + " { " + Environment.NewLine + " Logging.Write(\"Error :\\n\" + e.ToString()); " + Environment.NewLine + " } " + Environment.NewLine + " return true; " + Environment.NewLine + " } " + Environment.NewLine + "} " + Environment.NewLine; //Logging.WriteDebug(toCompile); CompilerResults cr = cc.CompileAssemblyFromSource(cp, toCompile); if (cr.Errors.HasErrors) { String text = cr.Errors.Cast <CompilerError>().Aggregate("Compilator Error :\n", (current, err) => current + (err + "\n")); Logging.Write("Script: " + scriptName + " " + text); return(true); } Assembly assembly = cr.CompiledAssembly; object obj = assembly.CreateInstance("Main", true); var instanceFromOtherAssembly = obj as IScript; CachedScripts.Add(originalScript, instanceFromOtherAssembly); return(instanceFromOtherAssembly != null && CachedScripts[originalScript].Script(ref qObjective)); } catch (Exception e) { Logging.WriteError("internal static bool Run(string script, int questId, ref QuestObjective qObjective): " + e); } return(true); }