private static void DutyStateChange(bool OnDuty) { //This only runs if the player is onDuty if (!OnDuty) { return; } Game.LogTrivial($"--------------------------------------{Globals.Application.PluginName} startup log--------------------------------------"); if (!Globals.Application.IsPluginInBeta) { //Checks for an update var versionStatus = Updater.CheckUpdate(); switch (versionStatus) { case -1: Notifier.StartUpNotificationOutdated(); Logger.Log($"Plugin is out of date. (Current Version: {Globals.Application.CurrentVersion}) - (Latest Version: {Globals.Application.LatestVersion})"); break; case -2: Logger.Log("There was an issue checking plugin versions, the plugin may be out of date!"); break; case 1: Logger.Log("Current version of plugin is higher than the version reported on the official GitHub, this could be an error that you may want to report!"); Notifier.StartUpNotification(); break; default: Notifier.StartUpNotification(); Logger.Log($"Plugin version v{Globals.Application.CurrentVersion} loaded successfully"); break; } } if (Globals.Application.IsPluginInBeta) { //Checks for an update var betaVersionStatus = Updater.CheckBetaUpdate(); var versionStatus = Updater.CheckUpdate(); if (betaVersionStatus == -1 || versionStatus == -1) { Notifier.StartUpNotificationBetaOutdated(); Logger.Log($"Plugin is out of date."); Logger.Log( $"(Current Beta Version: {Globals.Application.CurrentVersion}{Globals.Application.CurrentBetaVersion})"); Logger.Log( $"(Latest Beta Version: {Globals.Application.LatestVersion}{Globals.Application.LatestBetaVersion})"); } else if (betaVersionStatus == -2 || betaVersionStatus == 0 || versionStatus == -2) { Logger.Log("There was an issue checking plugin versions, the plugin may be out of date!"); } else if (betaVersionStatus == 1 || versionStatus == 1) { Notifier.StartUpNotificationBeta(); Logger.Log( $"Plugin Version v{Globals.Application.CurrentVersion}{Globals.Application.CurrentBetaVersion} loaded successfully"); Logger.Log("Plugin is in beta!"); } } //Loads the config file (.ini file) Settings.LoadSettings(); GameFiber.StartNew(delegate { Availability.Main(); if (Common.IsLspdfrPluginRunning("PoliceSmartRadio")) { PoliceSmartRadioFunctions.AddActionToButton(new Action(ChangeAvailability), "ChangeAvailability"); PoliceSmartRadioFunctions.AddActionToButton(new Action(ForceCallout), "ForceCallout"); } while (true) { GameFiber.Yield(); if (Common.IsKeyDown(Globals.Controls.EndCalloutModifier, Globals.Controls.EndCalloutKey) && Functions.IsCalloutRunning()) { Functions.StopCurrentCallout(); } if (Common.IsKeyDown(Globals.Controls.ForceCalloutModifier, Globals.Controls.ForceCalloutKey)) { RandomCallouts.StartRandomCallout(); } if (!Common.IsKeyDown(Globals.Controls.AvailabilityModifier, Globals.Controls.AvailabilityKey)) { continue; } Logger.DebugLog("AvailabilityKey Pressed"); Globals.Status.FirstEvent = true; if (Functions.IsPlayerAvailableForCalls()) { Functions.SetPlayerAvailableForCalls(false); if (!Globals.Config.AvailableForCalloutsText) { Notifier.DisplayNotification("Status", "You are ~r~not available~s~ for calls"); } Logger.DebugLog("CallAvailability is set to " + Functions.IsPlayerAvailableForCalls()); } else { Functions.SetPlayerAvailableForCalls(true); if (!Globals.Config.AvailableForCalloutsText) { Notifier.DisplayNotification("Status", "You are ~g~available~s~ for calls"); } Logger.DebugLog("CallAvailability is set to " + Functions.IsPlayerAvailableForCalls()); } } }); }
public static void StartRandomCallout() { RandomCallouts.StartRandomCallout(); }
private static void ForceCallout() { RandomCallouts.StartRandomCallout(); }