Exemplo n.º 1
0
 public static void Execute(string name)
 {
     if (name == "help")
     {
         Logger.WriteColor1("The following scripts were found:");
         Logger.Write(PatternsManager.ToString());
         Logger.WriteColor1("Apply game settings? Type 'apply settings'");
     }
     else if (name.ToLower() == "apply settings")
     {
         Game.Settings.LeagueManager.ApplySettings();
     }
     else if (name == "Restart")
     {
         ProcessStartInfo startInfo = new ProcessStartInfo("LeagueBot.exe");
         startInfo.Arguments = "StartCoop";
         Process.Start(startInfo);
         Environment.Exit(0);
     }
     else if (!Scripts.ContainsKey(name))
     {
         Logger.Write("Unable to execute " + name + EXTENSION + ". Script not found.", MessageState.WARNING);
     }
     else
     {
         PatternScript script = (PatternScript)Activator.CreateInstance(Scripts[name]);
         script.bot    = new BotApi();
         script.client = new ClientApi();
         script.game   = new GameApi();
         script.io     = new FileIO(Directory.GetCurrentDirectory() + "\\champlist.txt");
         script.Execute();
     }
 }
 public static void Execute(string name)
 {
     if (name == "help")
     {
         Logger.WriteColor1("The following scripts were found:");
         Logger.Write(PatternsManager.ToString());
         Logger.WriteColor1("Apply game settings? Type 'apply settings'");
     }
     else if (name.ToLower() == "apply settings")
     {
         try
         {
             Game.Settings.LeagueManager.ApplySettings();
         }
         catch (UnauthorizedAccessException e)
         {
             Logger.Write("<ERROR> - Permission denied.");
         }
         catch (Exception e)
         {
             Logger.Write(e.ToString());
         }
     }
     else if (name == "Restart")
     {
         Globals.numberOfGames--;
         if (Globals.numberOfGames != 0)
         {
             ProcessStartInfo startInfo = new ProcessStartInfo("LeagueBot.exe");
             startInfo.Arguments = "StartCoop " + Globals.numberOfGames.ToString();
             Process.Start(startInfo);
         }
         Environment.Exit(0);
     }
     else if (name == "StartCoopLimited")
     {
         int gamesnumber;
         Logger.Write("Enter the number of games to play before stopping the bot.", MessageState.INFO);
         while (!int.TryParse(Console.ReadLine(), out gamesnumber))
         {
             Console.WriteLine("That was invalid. Enter an integer to continue.");
         }
         Globals.numberOfGames = gamesnumber;
         PatternsManager.Execute("StartCoop");
     }
     else if (!Scripts.ContainsKey(name))
     {
         Logger.Write("Unable to execute " + name + EXTENSION + ". Script not found.", MessageState.WARNING);
     }
     else
     {
         PatternScript script = (PatternScript)Activator.CreateInstance(Scripts[name]);
         script.bot    = new BotApi();
         script.client = new LCU();
         script.game   = new GameApi();
         script.io     = new FileIO(Directory.GetCurrentDirectory() + "\\champlist.txt");
         script.Execute();
     }
 }
Exemplo n.º 3
0
 public static void Execute(string name)
 {
     if (name == "help")
     {
         Logger.WriteColor1("The following scripts were found:");
         Logger.Write(PatternsManager.ToString());
     }
     else if (!Scripts.ContainsKey(name))
     {
         Logger.Write("Unable to execute " + name + EXTENSION + ". Script not found.", MessageState.WARNING);
     }
     else
     {
         PatternScript script = (PatternScript)Activator.CreateInstance(Scripts[name]);
         script.bot    = new BotApi();
         script.client = new ClientApi();
         script.game   = new GameApi();
         script.Execute();
     }
 }
Exemplo n.º 4
0
 public static void Execute(string name)
 {
     if (name == "help")
     {
         Logger.WriteColor1("The following scripts were found:");
         Logger.Write(PatternsManager.ToString());
         Logger.WriteColor1("Apply game settings? Type 'apply settings'");
     }
     else if (name.ToLower() == "apply settings")
     {
         try
         {
             Game.Settings.LeagueManager.ApplySettings();
         }
         catch (UnauthorizedAccessException e)
         {
             Logger.Write("<ERROR> - Permission denied.");
         }
         catch (Exception e)
         {
             Logger.Write(e.ToString());
         }
     }
     else if (name == "Restart")
     {
         ProcessStartInfo startInfo = new ProcessStartInfo("LeagueBot.exe");
         startInfo.Arguments = "StartCoop";
         Process.Start(startInfo);
         Environment.Exit(0);
     }
     else if (!Scripts.ContainsKey(name))
     {
         Logger.Write("Unable to execute " + name + EXTENSION + ". Script not found.", MessageState.WARNING);
     }
     else if (name == "start")
     {
         /*
          * // Start Script
          *
          * Process.Start("C:\\Riot Games\\League of Legends\\LeagueClient.exe");
          * BotApi.waitProcessOpen("RiotClientServices");
          *
          * BotHelper.Wait(3000);
          * LoginHandler.Login("elighnothy", "test1234");
          * BotHelper.Wait(3000);
          * if (TextHelper.TextExists(769, 271, 262, 41, "TERMS OF SERVICE"))
          * {
          *   Logger.Write("Accept the Terms of Service!");
          *   for (int i = 0; i < 100; i++)
          *   {
          *       if (ImageHelper.GetColor(816, 739) == "#BC252A")
          *           break;
          *
          *       InputHelper.LeftClick(1168, 642);
          *   }
          *   InputHelper.LeftClick(816, 739);
          * }
          *
          * BotApi.waitProcessOpen("LeagueClientUX");
          * BotApi.bringProcessToFront("LeagueClientUX");
          * BotApi.centerProcess("LeagueClientUX");
          *
          * Logger.Write("Bot is ready!");
          * BotHelper.Wait(10000);
          *
          * // 421 220
          * InputHelper.LeftClick(421, 220);
          * BotHelper.Wait(1000);
          * // 464 285
          * InputHelper.LeftClick(464, 285);
          * BotHelper.Wait(1000);
          * // 765 676
          * InputHelper.LeftClick(765, 676);
          * BotHelper.Wait(1000);
          * // 824 870
          * InputHelper.LeftClick(824, 870);
          * BotHelper.Wait(2000);
          * InputHelper.LeftClick(824, 870);
          *
          * TextHelper.WaitForText(827, 555, 267, 36, "MATCH FOUND");
          * Logger.Write("MATCH FOUND!");
          * InputHelper.LeftClick(960, 741);
          * Logger.Write("MATCH ACCEPTED!");
          */
     }
     else
     {
         PatternScript script = (PatternScript)Activator.CreateInstance(Scripts[name]);
         script.bot    = new BotApi();
         script.client = new LCU();
         script.game   = new GameApi();
         script.io     = new FileIO(Directory.GetCurrentDirectory() + "\\champlist.txt");
         script.Execute();
     }
 }
Exemplo n.º 5
0
 public void executePattern(string filename)
 {
     PatternsManager.Execute(filename);
 }