public override void Start() { Debug("Start Called"); IsRunning = true; if (!_isChangingBot) { // reset all actions PbBehavior.Reset(); if (DynamicCodeCompiler.CodeWasModified) { DynamicCodeCompiler.GenorateDynamicCode(); } } if (MainForm.IsValid) { MainForm.Instance.UpdateControls(); } try { try { if (SecondaryBot != null) { SecondaryBot.Start(); } } catch (Exception ex) { Logging.WriteDebug(ex.ToString()); } } catch (Exception ex) { if (SecondaryBot != null) { Err("{0} {1}", SecondaryBot.Name, ex); } } }
public override void Start() { Debug("Start Called"); IsRunning = true; // reattach lua events on bot start in case it they get destroyed from loging out of game Lua.Events.DetachEvent("BAG_UPDATE", OnBagUpdate); Lua.Events.DetachEvent("SKILL_LINES_CHANGED", OnSkillUpdate); Lua.Events.DetachEvent("SPELLS_CHANGED", OnSpellsChanged); Lua.Events.DetachEvent("BANKFRAME_OPENED", Util.OnBankFrameOpened); Lua.Events.DetachEvent("BANKFRAME_CLOSED", Util.OnBankFrameClosed); Lua.Events.AttachEvent("BAG_UPDATE", OnBagUpdate); Lua.Events.AttachEvent("SKILL_LINES_CHANGED", OnSkillUpdate); Lua.Events.AttachEvent("SPELLS_CHANGED", OnSpellsChanged); Lua.Events.AttachEvent("BANKFRAME_OPENED", Util.OnBankFrameOpened); Lua.Events.AttachEvent("BANKFRAME_CLOSED", Util.OnBankFrameClosed); if (!_isChangingBot) { // reset all actions PbBehavior.Reset(); if (DynamicCodeCompiler.CodeWasModified) { DynamicCodeCompiler.GenorateDynamicCode(); } } if (MainForm.IsValid) { MainForm.Instance.UpdateControls(); } if (!_firstStartDone) { try { if (!string.IsNullOrEmpty(_profileToLoad)) { LoadPBProfile(_profileToLoad); LastProfileIsHBProfile = false; } else if (!string.IsNullOrEmpty(MySettings.LastProfile)) { LoadPBProfile(MySettings.LastProfile); } } catch (Exception ex) { Err(ex.ToString()); } _firstStartDone = true; } try { if (SecondaryBot != null) { SecondaryBot.Start(); } } catch (Exception ex) { Logging.WriteDebug(ex.ToString()); } }