public override void Run() { if (_wowManager.Throttled) { return; } if (ReactivateAccountDialogVisible) { _wowManager.Profile.Log("Account has no game time, pausing."); _wowManager.Profile.Pause(); return; } // trial account will have a promotion frame that requires clicking a 'Play Trial' button to enter game. if (ClickPlayTrial()) { return; } var btnStarter = CustomUtility.GetVisibleButtonByName("StarterEditionPopUpExitButton", _wowManager); if (btnStarter != null && _wowManager.GlueScreen == GlueScreen.CharSelect) { if (CustomUtility.SleepUntilVisible(btnStarter, TimeSpan.FromSeconds(60))) { CustomUtility.ClickButton(btnStarter, _wowManager); CustomUtility.Sleep(TimeSpan.FromSeconds(2)); } } if (ShouldChangeRealm) { ChangeRealm(); return; } //CustomUtility.Sleep(TimeSpan.FromSeconds(2)); HandleCharacterSelect(); }
private bool TryCreateChar() { //var names = CustomUtility.GetVisibleObjectNames(_wowManager); //var types = CustomUtility.GetVisibleObjectsTypeNames(_wowManager); //var texts = CustomUtility.GetVisibleObjectsTexts(_wowManager); //var objects = CustomUtility.GetVisibleObjects(_wowManager); var btnCreateChar = CustomUtility.GetVisibleButtonByName("CharSelectCreateCharacterButton", _wowManager); if (btnCreateChar != null && _wowManager.GlueScreen == GlueScreen.CharSelect) { if (CustomUtility.SleepUntilVisible(btnCreateChar, TimeSpan.FromSeconds(60))) { CustomUtility.Sleep(TimeSpan.FromSeconds(2)); _wowManager.Profile.Log("Try to Create new Char..."); CustomUtility.ClickButton(btnCreateChar, _wowManager); return(true); } } return(false); }
public override void Run() { var characterCreateFrame = UIObject.GetUIObjectByName <Frame>(_wowManager, "CharacterCreateFrame"); if (characterCreateFrame != null && characterCreateFrame.IsVisible) { if (_wowManager.CharAutoCreationFailed) { CustomUtility.EscKeyPress(_wowManager); } //var names = CustomStateLib.GetVisibleObjectNames(_wowManager); //var types = CustomStateLib.GetVisibleObjectsTypeNames(_wowManager); //var texts = CustomStateLib.GetVisibleObjectsTexts(_wowManager); //var objects = CustomStateLib.GetVisibleObjects(_wowManager); var raceName = _wowManager.Profile.Settings.WowSettings.RaceName; var className = _wowManager.Profile.Settings.WowSettings.ClassName; var btnOkay = CustomUtility.GetVisibleButtonByName("CharCreateOkayButton", _wowManager); if (btnOkay != null && _wowManager.GlueScreen == GlueScreen.CharCreate) { CustomUtility.SleepUntilVisible(btnOkay, TimeSpan.FromSeconds(60)); var editCharBox = CustomUtility.GetVisibleEditBoxByName("CharacterCreateNameEdit", _wowManager); if (editCharBox == null && _wowManager.GlueScreen == GlueScreen.CharCreate) { if (raceName != null) { var raceBtn = CustomUtility.findObjectByText(raceName, _wowManager); raceBtn = CustomUtility.findObjectByText(raceName, _wowManager); if (raceBtn != null && _wowManager.GlueScreen == GlueScreen.CharCreate) { if (CustomUtility.SleepUntilVisible(raceBtn, TimeSpan.FromSeconds(60))) { CustomUtility.Sleep(TimeSpan.FromSeconds(4)); if (!CustomUtility.ClickButton(raceBtn, _wowManager)) { CustomUtility.EscKeyPress(_wowManager); return; } } CustomUtility.Sleep(TimeSpan.FromSeconds(4)); if (className != null && _wowManager.GlueScreen == GlueScreen.CharCreate) { var classBtn = CustomUtility.findObjectByText(className, _wowManager); classBtn = CustomUtility.findObjectByText(className, _wowManager); if (classBtn != null) { if (CustomUtility.SleepUntilVisible(classBtn, TimeSpan.FromSeconds(60))) { if (!CustomUtility.ClickButton(classBtn, _wowManager)) { CustomUtility.EscKeyPress(_wowManager); return; } } } else { _wowManager.CharAutoCreationFailed = true; _wowManager.Profile.Log("Char Class was not founded with this Name {0}", className); CustomUtility.EscKeyPress(_wowManager); return; } } } else { _wowManager.CharAutoCreationFailed = true; _wowManager.Profile.Log("Char Race was not founded with this Name {0}", raceName); CustomUtility.EscKeyPress(_wowManager); return; } } _wowManager.Profile.Log("Selecting char type"); if (!CustomUtility.ClickButton(btnOkay, _wowManager)) { _wowManager.CharAutoCreationFailed = true; _wowManager.Profile.Log("Could not click BtnOk {0}", btnOkay.Name); CustomUtility.EscKeyPress(_wowManager); return; } } else { CustomUtility.Sleep(TimeSpan.FromSeconds(2)); var btnDlgOkay = CustomUtility.GetVisibleButtonByName("GlueDialogButton1", _wowManager); if (btnDlgOkay == null) { if (CustomUtility.Visible("CharacterCreateNameEdit", _wowManager)) { var btnRundomChar = CustomUtility.GetVisibleButtonByName("CharCreateRandomizeButton", _wowManager); CustomUtility.SleepUntil(btnRundomChar.IsVisible, TimeSpan.FromSeconds(60)); _wowManager.Profile.Log("Rundomize char"); CustomUtility.ClickButton(btnRundomChar, _wowManager); CustomUtility.Sleep(TimeSpan.FromSeconds(2)); CustomUtility.EnterText("CharacterCreateNameEdit", _wowManager.Profile.Settings.WowSettings.CharacterName, _wowManager); CustomUtility.Sleep(TimeSpan.FromSeconds(2)); _wowManager.Profile.Log("Try Create Char with given Name {0}", _wowManager.Profile.Settings.WowSettings.CharacterName); CustomUtility.ClickButton(btnOkay, _wowManager); CustomUtility.Sleep(TimeSpan.FromSeconds(2)); } } else { CustomUtility.ClickButton(btnDlgOkay, _wowManager); CustomUtility.Sleep(TimeSpan.FromSeconds(2)); _wowManager.CharAutoCreationFailed = true; _wowManager.Profile.Log("Char Already Exists with this Name {0}", _wowManager.Profile.Settings.WowSettings.CharacterName); CustomUtility.EscKeyPress(_wowManager); CustomUtility.EscKeyPress(_wowManager); return; } } } } }