private void TryQueueNextMessage() { if (SimpleIncident is VotingHelper) { return; } if (SimpleIncident != null) { Purchase_Handler.QueuePlayerMessage(SimpleIncident.Viewer, SimpleIncident.message); } if (VariablesIncident != null) { Purchase_Handler.QueuePlayerMessage(VariablesIncident.Viewer, VariablesIncident.message, VariablesIncident.storeIncident.variables); } }
public override void Tick() { try { if (_game == null || _mod == null) { return; } _mod.Tick(); var minutes = (int)(_game.Info.RealPlayTimeInteracting / 60f); double getTime = (double)Time.time / 60f; int time = Convert.ToInt32(Math.Truncate(getTime)); if (IncidentHelpers.Count > 0) { for (int i = 0; i < IncidentHelpers.Count; i++) { var incidentHelper = IncidentHelpers.Dequeue(); if (!(incidentHelper is VotingHelper)) { Purchase_Handler.QueuePlayerMessage(incidentHelper.Viewer, incidentHelper.message); } incidentHelper.TryExecute(); } Helper.playerMessages = new List <string>(); } if (IncidentHelperVariables.Count > 0) { for (int i = 0; i < IncidentHelperVariables.Count; i++) { var incidentHelper = IncidentHelperVariables.Dequeue(); Purchase_Handler.QueuePlayerMessage(incidentHelper.Viewer, incidentHelper.message, incidentHelper.storeIncident.variables); incidentHelper.TryExecute(); if (Purchase_Handler.viewerNamesDoingVariableCommands.Contains(incidentHelper.Viewer.username)) { Purchase_Handler.viewerNamesDoingVariableCommands.Remove(incidentHelper.Viewer.username); } } Helper.playerMessages = new List <string>(); } if (Incidents.Count > 0) { var incident = Incidents.Dequeue(); IncidentParms incidentParms = new IncidentParms(); incidentParms.target = Helper.AnyPlayerMap; incident.TryExecute(incidentParms); } if (FiringIncidents.Count > 0) { Helper.Log("Firing " + FiringIncidents.First().def.defName); var incident = FiringIncidents.Dequeue(); incident.def.Worker.TryExecute(incident.parms); } VoteHandler.CheckForQueuedVotes(); if (_lastCoinReward < 0) { _lastCoinReward = time; } else if (ToolkitSettings.EarningCoins && ((time - _lastCoinReward) >= ToolkitSettings.CoinInterval) && Viewers.jsonallviewers != null) { _lastCoinReward = time; Viewers.AwardViewersCoins(); } if (_lastMinute < 0) { _lastMinute = time; } else if (_lastMinute < time) { _lastMinute = time; Toolkit.JobManager.CheckAllJobs(); Viewers.RefreshViewers(); } } catch (Exception ex) { Helper.Log("Exception: " + ex.Message + ex.StackTrace); } }