private void OnTriggerExit(Collider other) { if (other.CompareTag("Respawn")) { status = BotStatus.RunOutside; } }
public Comedian() { initialize(); AuthorName = "Que Trac"; PluginName = "Comedian Follower Plugin"; PluginVersion = "1.0"; FontColor = Color.Green; Users = new SortedList <string, User>(); accounts = new SortedList <string, UserAccount>(); OutgoingMessage = new Queue <ChatMessage>(); stateTimer = new Timer(); stateTimer.Interval = 2000; // 2 seconds stateTimer.Elapsed += new ElapsedEventHandler(stateTimer_Elapsed); Sources = new SortedList <string, IChatSource>(); Profile = new Profile(GlobalSettings.grabSetting("name")); WakeTime = Convert.ToDateTime(GlobalSettings.grabSetting("waketime")).TimeOfDay; SleepTime = Convert.ToDateTime(GlobalSettings.grabSetting("sleeptime")).TimeOfDay; WorkTime = Convert.ToDateTime(GlobalSettings.grabSetting("worktime")).TimeOfDay; OffWorkTime = Convert.ToDateTime(GlobalSettings.grabSetting("offworktime")).TimeOfDay; status = BotStatus.Sleep; currentState = BotState.StateFactory.getBotState("Initiate", this); }
public void GiveChip(GameObject chip) { chips.Add(chip); if (chips.Count == 1) { // Reparent the chip to the left claw and position correctly chip.transform.parent = leftClaw.transform; chip.transform.localPosition = new Vector3(0f, 0.85f, 0f); } if (chips.Count == 2) { // Reparent the chip to the right claw asnd position correctly chip.transform.parent = rightClaw.transform; chip.transform.localPosition = new Vector3(0f, 0.85f, 0f); // Check if the question can be answered int chip0Value = chips[0].GetComponent <Chip>().value; int chip1Value = chips[1].GetComponent <Chip>().value; if ( (chip0Value == manager.answerLowChipValue && chip1Value == manager.answerHighChipValue) || (chip1Value == manager.answerLowChipValue && chip0Value == manager.answerHighChipValue) ) { // Found the answer Debug.Log(botId); GetComponentInChildren <SpriteRenderer>().color = Color.red; } // Chip capacity reached, start delivering chips status = BotStatus.DELIVER_LOW; } }
/// <summary> /// The on bot status changed. /// </summary> /// <param name="oldStatus"> /// The old status. /// </param> /// <param name="newStatus"> /// The new status. /// </param> protected virtual void OnBotStatusChanged(BotStatus oldStatus, BotStatus newStatus) { if (this.BotStatusChanged != null) { this.BotStatusChanged(this, new BotStatusChangedEventArgs(oldStatus, newStatus)); } }
void StopRunning() { if (status == BotStatus.RunOutside) { timeWaiting = UnityEngine.Random.Range(0, MaxWaitingTime); status = BotStatus.Waiting; } }
/// <summary> /// Creates a ValidData object after a valid check. /// </summary> /// <param name="data">The data line that was used in the check</param> /// <param name="proxy">The proxy that was used for the check (empty string if none)</param> /// <param name="result">The result of the check</param> /// <param name="capturedData">The data captured during the check</param> /// <param name="source">The last page source code of the check</param> /// <param name="log">The detailed log of the check</param> public ValidData(string data, string proxy, BotStatus result, string capturedData, string source, List <LogEntry> log) { Data = data; Proxy = proxy; Result = result; CapturedData = capturedData; UnixDate = (int)Math.Round((DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds); Source = source; Log = log; }
private void CheckWaitingTime() { if (status == BotStatus.Waiting) { timeWaiting -= Time.fixedDeltaTime; if (timeWaiting <= 0) { status = BotStatus.RunOnTrigger; } } }
private Bot( ImmutableList <IChannel> channels, ImmutableList <IIntentFilter> intentFilters, ImmutableList <IBulbTriggerFilter> bulbTriggers, CancellationToken cancel, Brain brain, BotStatus status, Exception fault) { this.Channels = channels; this.IntentFilters = intentFilters; this.BulbTriggers = bulbTriggers; this.Cancel = cancel; this.Brain = brain; this.Status = status; this.Fault = fault; }
public static BotStatus[] GetAllowedStatuses(this BotStatus status) { var statusList = new List <BotStatus> { BotStatus.Draft, BotStatus.Private, BotStatus.Public, BotStatus.Open }; if (status != BotStatus.Draft) { statusList.Remove(BotStatus.Draft); } return(statusList.ToArray()); }
private BotStatus ParseBotStatusNode(XmlNode botStatusNode) { try { BotStatus botStatus = new BotStatus(); foreach (XmlNode xmlNode in botStatusNode.ChildNodes) { switch (xmlNode.Name) { case Tags.IsBot: botStatus.isBotField = GenericFunctions.ConvertStringToBool(xmlNode.InnerText); break; } } return(botStatus); } catch (Exception ex) { throw ex; } }
public static bool IsPublicStatus(this BotStatus status) { return(GetPublicStatuses().Contains(status)); }
public static bool IsAllowedStatus(this BotStatus status, BotStatus newStatus) { return(status != newStatus && status.GetAllowedStatuses().Contains(newStatus)); }
public void OnTriggerEnter2D(Collider2D other) { if (status != BotStatus.IDLE) { if (other.gameObject == lowTarget && !deliveredLow) { if (chips.Count == 1) { GiveChipTo(0, lowTarget); deliveredLow = true; status = BotStatus.IDLE; } else if (chips.Count == 2) { if (chips[0].GetComponent <Chip>().value > chips[1].GetComponent <Chip>().value) { GiveChipTo(1, lowTarget); deliveredLow = true; status = BotStatus.DELIVER_HIGH; } else { GiveChipTo(0, lowTarget); deliveredLow = true; status = BotStatus.DELIVER_HIGH; } } else { status = BotStatus.IDLE; } } if (other.gameObject == highTarget && !deliveredHigh) { if (chips.Count == 1) { GiveChipTo(0, highTarget); deliveredHigh = true; status = BotStatus.IDLE; } else if (chips.Count == 2) { if (chips[0].GetComponent <Chip>().value > chips[1].GetComponent <Chip>().value) { GiveChipTo(0, highTarget); deliveredHigh = true; status = BotStatus.DELIVER_LOW; } else { GiveChipTo(1, highTarget); deliveredHigh = true; status = BotStatus.DELIVER_LOW; } } else { status = BotStatus.IDLE; } } } }
public void UpdateField(string json) { if (string.IsNullOrEmpty(json)) { return; } if (json.IsContain("{Status:")) { if (json.IsContain("Removed")) { itemBotStatus = BotStatus.Removed; } else if (json.IsContain("Timeout")) { itemBotStatus = BotStatus.Timeout; } else if (json.IsContain("ServerError")) { itemBotStatus = BotStatus.Timeout; } else if (json.IsContain("Ok")) { itemBotStatus = BotStatus.Ok; } else if (json.IsContain("StructureChanged")) { itemBotStatus = BotStatus.StructureChanged; } } if (json.IsContain("SoldNum:")) { ItemSold30Days = json.SubAfter("SoldNum").ExInt(); } if (json.IsContain("Buyer:")) { string buyer = json.SubAfter(":").SubBefore("Product:").GetTrimed(); if (string.IsNullOrEmpty(buyer)) { return; } string package = json.SubAfter("Product:").SubBefore("Price:").GetTrimed(); if (string.IsNullOrEmpty(package)) { return; } double?price = json.SubAfter("Price:").SubBefore("Num:").ExDouble(); if (!price.HasValue) { return; } int? num = json.SubAfter("Num:").SubBefore("At:").ExInt(); string at = json.SubAfter("At:").SubBefore("}").GetTrimed(); if (string.IsNullOrEmpty(at)) { return; } DateTime dt = DateTime.ParseExact(at, "yyyy-MM-dd HH:mm:ss", null); if (SalesRecords.Any(x => x.Buyer == buyer && x.SettleDT == dt)) { return; } SalesRecords.Add(new XSalesRecord { Buyer = buyer, Count = num.Value, Price = price.Value, PakageName = package, SettleDT = dt }); } if (json.IsContain("Img:")) { string img = json.SubAfter("Img:").SubBefore("}").GetTrimed(); if (!ProdImgs.Contains(img)) { ProdImgs.Add(img); } } if (json.IsContain("Poster:")) { string poster = json.SubAfter("Poster:").SubBefore("Content:").GetTrimed(); if (string.IsNullOrEmpty(poster)) { return; } string content = json.SubAfter("Content:").SubAfter("At:"); if (string.IsNullOrEmpty(content)) { return; } int?at = json.SubAfter("At:").SubBefore("}").GetDigital().GetTrimedStart('0').ToInt(); if (!at.HasValue) { return; } if (at < 10000) { at = DateTime.Now.Year * 10000 + at; } if (ItemCommentList.Any(x => x.Poster == poster && x.PostAt == at)) { return; } ItemCommentList.Add(new ItemComment { PostAt = at, Poster = poster, Content = content }); } }
/// <summary> /// Initializes a new instance of the <see cref="BotStatusChangedEventArgs"/> class. /// </summary> /// <param name="oldStatus"> /// The old status. /// </param> /// <param name="newStatus"> /// The new status. /// </param> public BotStatusChangedEventArgs(BotStatus oldStatus, BotStatus newStatus) { this.OldStatus = oldStatus; this.NewStatus = newStatus; }
public BotStatusChangedEventArgs(BotStatus newBotStatus, BotStatus oldBotStatus) { this.oldBotStatus = oldBotStatus; this.newBotStatus = newBotStatus; }
public BotStatusChangedEventArgs(BotStatus oldStatus, BotStatus newStatus) { OldStatus = oldStatus; NewStatus = newStatus; }
/// <summary> /// Kill all our modules, stop all our IPC. /// </summary> /// /// <param name="shutdownMessage">An optional shutdown message to be passed to any IRCDs we may be connected to.</param> public void Shutdown(string shutdownMessage) { _logger.InfoFormat("Shutdown: {0}.", shutdownMessage); BotStatus = BotStatus.Stopping; CommunicationManager.Quit(shutdownMessage); BotStatus = BotStatus.Stopped; _logger.Info("Shutdown completed."); }
private void UpdateStatus(LogType status, string info) { if (InvokeRequired) { UpdateStatusCallback method = UpdateStatus; Invoke(method, new object[] {status, info}); } else { switch (status) { case LogType.JustMessage: AddMessage(info); return; case LogType.ScanFound: AddMessage(string.Format(Resource.MainForm_updateStatus_Item_X_found, info)); return; case LogType.PlungedScanFound: AddMessage(string.Format(Resource.MainForm_updateStatus_Plunged_item_X_found, info)); return; case LogType.RottedSuppliesScanFound: AddMessage(string.Format(Resource.MainForm_updateStatus_RottedSupply_item_X_found, info)); return; case LogType.ScanProductionFound: AddMessage(string.Format(Resource.MainForm_updateStatus_Production_item_X_found, info)); return; case LogType.ScanStart: _botStatus = BotStatus.Scan; labelStatus.Text = Resource.MainForm_updateStatus_Bot_Scanning; AddMessage(Resource.MainForm_updateStatus_Started_scanning); return; case LogType.ScanProductionStart: _botStatus = BotStatus.ScanProd; labelStatus.Text = Resource.MainForm_updateStatus_Bot_Scanning_production; AddMessage(Resource.MainForm_updateStatus_Started_scanning_for_production); return; case LogType.ClickProductionStart: _botStatus = BotStatus.ClickProd; labelStatus.Text = Resource.MainForm_updateStatus_Bot_Clicking_production; AddMessage(Resource.MainForm_updateStatus_Started_clicking_production_items); return; case LogType.ClickProductionSelect: AddMessage(string.Format(Resource.MainForm_updateStatus_Selected_production_item_X, info)); return; case LogType.ClickProductionDone: AddMessage(Resource.MainForm_updateStatus_Selected_production_type); return; case LogType.ScanStop: _botStatus = BotStatus.Idle; labelStatus.Text = string.Format(Resource.MainForm_updateStatus_Bot_Scanning_done,info); AddMessage(string.Format(Resource.MainForm_updateStatus_Scanning_done,info)); return; case LogType.ScanProductionStop: _botStatus = BotStatus.Idle; labelStatus.Text = string.Format(Resource.MainForm_updateStatus_Bot_Production_scanning_done,info); AddMessage(string.Format(Resource.MainForm_updateStatus_Production_scanning_done, info)); return; case LogType.ClickDone: AddMessage(string.Format(Resource.MainForm_updateStatus_Clicked_item_X, info)); return; case LogType.ClickStart: _botStatus = BotStatus.Click; labelStatus.Text = Resource.MainForm_updateStatus_Bot_Clicking; AddMessage(Resource.MainForm_updateStatus_Started_clicking); return; case LogType.ClickStop: _botStatus = BotStatus.Idle; labelStatus.Text = Resource.MainForm_updateStatus_Bot_Done_clicking; AddMessage(Resource.MainForm_updateStatus_Bot_Done_clicking); return; case LogType.BotIdle: _botStatus = BotStatus.Idle; labelStatus.Text = Resource.MainForm_updateStatus_Bot_Idle; AddMessage(string.Format(Resource.MainForm_updateStatus_Bot_Idle_for_X_min, Settings.CheckEveryXMinutes)); return; case LogType.ZoomingIn: labelStatus.Text = Resource.MainForm_updateStatus_Bot_Zooming; AddMessage(string.Format(Resource.MainForm_updateStatus_Trying_to_zoom_in)); return; case LogType.CheckForZoom: labelStatus.Text = Resource.MainForm_updateStatus_Check_for_zoom; AddMessage(string.Format(Resource.MainForm_updateStatus_Check_for_zoom)); return; case LogType.BotInPause: labelStatus.Text = string.Format(Resource.MainForm_updateStatus_Bot_Paused,Settings.PauseCountdownForXSeconds); AddMessage(string.Format(Resource.MainForm_updateStatus_Bot_Paused_for_X_min, Settings.PauseCountdownForXSeconds)); return; } } }
private void ButtonPauseResumeClick(object sender, EventArgs e) { if (_botStatus!=BotStatus.Pause) { timerPauseCountdown.Stop(); timerBotCountdown.Stop(); buttonPauseResume.Text = Resource.MainForm_buttonStartBot_Resume_Timer; buttonStartBot.Enabled = true; buttonStartBot.Text = Resource.MainForm_buttonStartBot_Restart_Bot; _botStatus = BotStatus.Pause; } else { timerPauseCountdown.Stop(); timerBotCountdown.Start(); buttonStartBot.Enabled = false; buttonStartBot.Text = Resource.MainForm_buttonStartBot_Running; buttonPauseResume.Text = Resource.MainForm_botStart_Pause_Timer; _botStatus = BotStatus.Idle; UpdateStatus(LogType.BotIdle,null); } }
private Bot WithStatus(BotStatus newStatus) { return(new Bot(Channels, IntentFilters, BulbTriggers, Cancel, Brain, newStatus, Fault)); }
protected virtual void OnBotStatusChanged(BotStatus oldStatus, BotStatus newStatus) { if (BotStatusChanged != null) BotStatusChanged(this, new BotStatusChangedEventArgs(oldStatus, newStatus)); }
void BotStatus(BotStatus newStatus) { _writer.Event("STATE", input: newStatus); }
/// <summary> /// Attempt to spin up all our subsystems and connect to any networks configured. /// </summary> public void Start() { _logger.Trace("Start called..."); // Make sure we're not trying to double start. if (BotStatus != BotStatus.Stopped) { throw new Exception(string.Format("Current BotStatus is : '{0}'. To start the bot the BotStatus must be 'Stopped'.", _botStatus)); } BotStatus = BotStatus.Starting; // Spin up our subsystems. _logger.Trace("Attempting to load all modules..."); ModuleManager.LoadModules(); _logger.Trace("Connecting to networks..."); CommunicationManager.Connect(); // Alright, we're cooking now. BotStatus = BotStatus.Started; _logger.Trace("Start completed."); }
private static string Stringify(BotStatus status) => status switch {