public static void ExitGame(DiabloWindow diabloWindow) { // Escape Thread.Sleep(100); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Escape)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Escape)); // Up Thread.Sleep(200); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Up)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Up)); // Enter Thread.Sleep(200); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Enter)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Enter)); }
public static void QuitFromChat(DiabloWindow diabloWindow) { // Escape Thread.Sleep(400); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Escape)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Escape)); // Escape Thread.Sleep(400); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Escape)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Escape)); // Escape Thread.Sleep(400); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Escape)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Escape)); }
private void OnKeyDown(object sender, KeyEventArgs e) { if (diabloWindow != null) { if (!e.Handled) { diabloWindow.SendKeyDown(e); } } }
public static void CreateGame(string gameName, string password, string difficulty, DiabloWindow diabloWindow) { //Click Create Thread.Sleep(200); DiabloInteraction.ClickButton(Diablo2Button.Create, diabloWindow); // Game Name Thread.Sleep(200); DiabloInteraction.WriteString(gameName, diabloWindow); // Tab Thread.Sleep(200); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Tab)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Tab)); // Password Thread.Sleep(200); DiabloInteraction.WriteString(password, diabloWindow); // Difficulty Thread.Sleep(200); switch (difficulty) { case "Normal": DiabloInteraction.ClickButton(Diablo2Button.Normal, diabloWindow); break; case "Nightmare": DiabloInteraction.ClickButton(Diablo2Button.Nightmare, diabloWindow); break; case "Hell": DiabloInteraction.ClickButton(Diablo2Button.Hell, diabloWindow); break; } // Enter Thread.Sleep(200); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Enter)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Enter)); }
public static void JoinGame(string gameName, string password, DiabloWindow diabloWindow) { // Click Join Thread.Sleep(5000); DiabloInteraction.ClickButton(Diablo2Button.Join, diabloWindow); // Game Name Thread.Sleep(1000); DiabloInteraction.WriteString(gameName, diabloWindow); // Tab Thread.Sleep(1000); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Tab)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Tab)); // Password Thread.Sleep(1000); DiabloInteraction.WriteString(password, diabloWindow); // Enter Thread.Sleep(1000); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Enter)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Enter)); }
public static void LoginToBattleNet(string defaultAccount, int delay, DiabloWindow diabloWindow) { if (!string.IsNullOrEmpty(defaultAccount)) { string username = string.Empty; string password = string.Empty; string charslot = string.Empty; string master = string.Empty; foreach (string accountString in BlueVex2.Properties.Settings.Default.Accounts) { if (accountString.StartsWith(defaultAccount + ",")) { string[] parts = accountString.Split(','); username = parts[0]; password = parts[1]; charslot = parts[2]; master = parts[3]; } } if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { return; } Thread.Sleep((int)delay); ConsoleTab.WriteLine("Logging into Battle Net as " + username); // Click to load menu Thread.Sleep(2000); DiabloInteraction.ClickButton(DiabloInteraction.Diablo2Button.BattleNet, diabloWindow); // Click BattleNet button Thread.Sleep(500); DiabloInteraction.ClickButton(DiabloInteraction.Diablo2Button.BattleNet, diabloWindow); // Tab Thread.Sleep(2000); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Tab)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Tab)); //Username Thread.Sleep(500); DiabloInteraction.WriteString(username, diabloWindow); //Tab Thread.Sleep(500); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Tab)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Tab)); //Password Thread.Sleep(500); DiabloInteraction.WriteString(password, diabloWindow); // Enter Thread.Sleep(500); diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Enter)); diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Enter)); // Double Click Character Slot Thread.Sleep(5000); switch (charslot) { case "1": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot1, diabloWindow); break; case "2": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot2, diabloWindow); break; case "3": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot3, diabloWindow); break; case "4": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot4, diabloWindow); break; case "5": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot5, diabloWindow); break; case "6": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot6, diabloWindow); break; case "7": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot7, diabloWindow); break; case "8": DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot8, diabloWindow); break; default: DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot1, diabloWindow); break; } } }