private void btnStop_Click(object sender, System.EventArgs e) { btnRest.Enabled = false; btnPatrolArea.Enabled = false; btnTravelPath.Enabled = false; btnTravel.Enabled = false; btnClassSettings.Enabled = false; btnFlee.Enabled = false; btnDistances.Enabled = false; btnLoot.Enabled = false; bRunning = false; //just in case _ak.StopRunning(); if (_botbase != null) { //pause the bot _botbase.bPaused = true; switch (_profile.GetString("Class")) { case "Necro": // _chatlogparser.LogLine -= new LogLineDelegate(((WoW_Rogue)_botbase).OnChatLogLine); break; case "Scout": // _chatlogparser.LogLine -= new LogLineDelegate(((WoW_Warrior)_botbase).ParseChatLogLine); break; } } // Remove the botbase _botbase = null; // Unregister Remote Chat //moved to dispose //_chatlogparser.LogLine -= new LogLineDelegate(_frmRemoteChat.ParseChatLogLine); if (_ak.GameProcess > 0) { _ak.StopInit(); } btnInitialize.Enabled = true; btnStart.Enabled = false; btnStop.Enabled = false; btnPause.Enabled = false; notifyIconMenuItem1.Enabled = false; notifyIconMenuItem2.Enabled = false; notifyIconMenuItem3.Enabled = true; notifyIconMenuItem1.Text = "Start"; this.notifyIconTimer.Stop(); }
private void btnStart_Click(object sender, System.EventArgs e) { btnStart.Enabled = false; btnStop.Enabled = true; btnPatrolArea.Enabled = false; btnTravelPath.Enabled = false; btnTravel.Enabled = false; btnLoot.Enabled = false; btnPause.Enabled = true; notifyIconMenuItem2.Enabled = true; notifyIconMenuItem1.Text = "Stop"; this.notifyIconTimer.Start(); //lets trigger saving all patrolareas to xml here assuming the user has settings //they like if they are starting the bot _patrolareas.SavePatrolAreas(); switch (_profile.GetString("Class")) { case "Necro": _botbase = new DAoC_Necro(_ak, _profile, _patrolareas); // _chatlogparser.LogLine += new LogLineDelegate(((WoW_Rogue)_botbase).OnChatLogLine); break; case "Scout": _botbase = new DAoC_Scout(_ak, _profile, _patrolareas); //// _chatlogparser.LogLine += new LogLineDelegate(((WoW_Mage)_botbase).ParseChatLogLine); break; } //add the statistics form's delegate to the new _botbase _frmStatistics.ConnectDelegates(_botbase); _frmStatistics.Focus(); }
private void btnInitialize_Click(object sender, System.EventArgs e) { if (_profile.ProfileName == null || _profile.ProfileName == "") { MessageBox.Show("Please create or select a profile first."); btnGeneral_Click(null, null); return; } // if( _ak.GameProcess == 0 ) // return; if (_frmStatistics != null) { _frmStatistics.AddMessage("Connecting..."); } Cursor currentCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; _botbase = null; _ak.RegKey = _profile.GetString("Password"); _ak.GamePath = _profile.GetString("GamePath"); string Client = _profile.GetString("Client"); if (Client == "ToA") { _ak.EnableToA = true; } else if (Client == "Catacombs") { _ak.EnableCatacombs = true; } string Location = _profile.GetString("Location"); if (Location != "US") { _ak.EnableEuro = true; } _ak.EnableAutoQuery = true; _ak.UseRegEx = true; _ak.AddString(0, "experience points"); _ak.AddString(1, " kills the "); _ak.AddString(2, "You have died"); _ak.AddString(3, "You can't see your target"); _ak.AddString(4, "can't see its target!"); _ak.AddString(5, "You can't cast while sitting"); _ak.AddString(6, "\\@\\@"); _ak.AddString(7, "You prepare your shot"); _ak.AddString(8, "You miss"); _ak.AddString(9, "You move and interrupt"); _ak.AddString(10, "You shoot"); _ak.AddString(11, "Your servant is too far away from you "); _ak.AddString(12, " you block the blow"); _ak.AddString(13, "You hit "); _ak.AddString(14, "You attack "); _ak.AddString(15, "You fumble "); _ak.AddString(16, "You prepare to perform "); try { _ak.DoInit(); btnRest.Enabled = true; btnPatrolArea.Enabled = true; btnTravelPath.Enabled = true; btnTravel.Enabled = true; btnClassSettings.Enabled = true; btnLoot.Enabled = true; btnFlee.Enabled = true; btnDistances.Enabled = true; btnInitialize.Enabled = false; btnStart.Enabled = true; btnStop.Enabled = false; btnPause.Enabled = false; notifyIconMenuItem1.Enabled = true; notifyIconMenuItem2.Enabled = true; notifyIconMenuItem3.Enabled = false; _ak.OnPetWindowUpdate += new clsAutoKillerScript.OnPetWindowUpdateEventHandler(petupdate); bRunning = true; } catch (Exception ex) { MessageBox.Show(string.Format("Unable to start AutoKillerscript:\n{0}", ex.Message)); } finally { Cursor.Current = currentCursor; } if (_frmStatistics != null) { _frmStatistics.AddMessage("Connected"); } }
internal void ConnectDelegates(DAoC_BotBase botbase) { //TODO: okay I know there must be a right way to do this, like the inherited profile class // but we also need to time this correctly after botbase is (re)created botbase.UpdateStatus += new DAoC_BotBase.UpdateStatusDelegate(AddMessage); }