public override void Pulse() { if (SecondaryBot != null) { SecondaryBot.Pulse(); } }
public override void Start() { PBLog.Debug("Start Called"); IsRunning = true; AttachEvents(); // make sure bank frame is closed on start to ensure Util.IsGBankFrameOpen is synced Util.CloseBankFrames(); if (IsExecutingActionWhileHonorbuddyIsStopped) { IsExecutingActionWhileHonorbuddyIsStopped = false; ResetSecondaryBot(); } else { // reset all actions Reset(); if (DynamicCodeCompiler.CodeIsModified) { DynamicCodeCompiler.GenorateDynamicCode(); } } if (MainForm.IsValid) { MainForm.Instance.UpdateControls(); } if (!SecondaryBot.Initialized) { SecondaryBot.DoInitialize(); } }
public override void Stop() { IsRunning = false; Debug("Stop Called"); if (MainForm.IsValid) { MainForm.Instance.UpdateControls(); } if (SecondaryBot != null) { SecondaryBot.Stop(); } }
public async Task <OkResult> Webhook([FromBody] Update update) { var client = await SecondaryBot.Get(); var commands = SecondaryBot.Commands; var callbackHandlers = SecondaryBot.CallbackHandlers; var inlineQueryHandler = new CutInlineQueryHandler(); if (update.CallbackQuery != null) { if (update.CallbackQuery.Data != null) { foreach (var handler in callbackHandlers) { if (handler.Is(update.CallbackQuery.Data)) { Console.WriteLine("Result: {0}, {1}", update.CallbackQuery.Data, update.CallbackQuery.From.Id); handler.Execute(update.CallbackQuery, client, context); } } } } if (update.InlineQuery != null) { inlineQueryHandler.Execute(update.InlineQuery, client); } if (update != null) { if (update.Message != null) { if (update.Message.Text != null) { foreach (var command in commands) { if (command.Contains(update.Message.Text)) { Console.WriteLine("Incoming message from:" + update.Message.From.FirstName + " " + update.Message.From.LastName + " @" + update.Message.From.Username + "(" + update.Message.From.Id + "), in chat: " + update.Message.Chat.Title + "(" + update.Message.Chat.Id + ")\r\n" + update.Message.Text); command.Execute(update.Message, client, context); break; } } } } } return(Ok()); }
public override void Stop() { //Styx.BotEvents.Profile.OnNewOuterProfileLoaded -= new BotEvents.Profile.NewProfileLoadedDelegate(Profile_OnNewOuterProfileLoaded); //Styx.Logic.Profiles.Profile.OnUnknownProfileElement -= new EventHandler<UnknownProfileElementEventArgs>(Profile_OnUnknownProfileElement); IsRunning = false; Debug("Stop Called"); if (MainForm.IsValid) { MainForm.Instance.UpdateControls(); } //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); if (SecondaryBot != null) { SecondaryBot.Stop(); } }
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()); } }