C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using System;
using System.Collections.Generic;
using System.Linq;
using System.Globalization;
using System.Collections;
using UnityEngine;
using Oxide.Core;
using Oxide.Game.Rust.Cui;
using Oxide.Core.Plugins;
namespace Oxide.Plugins {
[Info("GUIAnnouncements", "JoeSheep", "2.0.3", ResourceId = 1222)]
[Description("Creates announcements with custom messages across the top of player's screens.")]
class GUIAnnouncements : RustPlugin {
#region Configuration
#region Permissions
const string PermAnnounce = "GUIAnnouncements.announce";
const string PermAnnounceToggle = "GUIAnnouncements.toggle";
const string PermAnnounceGetNextRestart = "GUIAnnouncements.getnextrestart";
const string PermAnnounceJoinLeave = "GUIAnnouncements.announcejoinleave";
#endregion
#region Global Declerations
private Dictionary<ulong, string> Exclusions = new Dictionary<ulong, string>();
private HashSet<ulong> JustJoined = new HashSet<ulong>();
private HashSet<ulong> GlobalTimerPlayerList = new HashSet<ulong>();
private Dictionary<BasePlayer, Timer> PrivateTimers = new Dictionary<BasePlayer, Timer>();
private Dictionary<BasePlayer, Timer> NewPlayerPrivateTimers = new Dictionary<BasePlayer, Timer>();
private Dictionary<BasePlayer, Timer> PlayerRespawnedTimers = new Dictionary<BasePlayer, Timer>();
private Timer PlayerTimer;
private Timer GlobalTimer;
private Timer NewPlayerTimer;
private Timer PlayerRespawnedTimer;
private Timer RealTimeTimer;
private bool RealTimeTimerStarted = false;
private Timer SixtySecondsTimer;
private Timer AutomaticAnnouncementsTimer;
private Timer GetNextRestartTimer;
private string HeliLastHitPlayer = String.Empty;
private string CH47LastHitPlayer = String.Empty;
private string APCLastHitPlayer = String.Empty;
private HashSet<uint> HeliNetIDs = new HashSet<uint>();
private HashSet<uint> CH47NetIDs = new HashSet<uint>();
private HashSet<uint> KilledCH47NetIDs = new HashSet<uint>();
private bool ConfigUpdated;
private static readonly int WorldSize = ConVar.Server.worldsize;
private List<DateTime> RestartTimes = new List<DateTime>();
private Dictionary<DateTime, TimeSpan> CalcNextRestartDict = new Dictionary<DateTime, TimeSpan>();
private DateTime NextRestart;
List<TimeSpan> RestartAnnouncementsTimeSpans = new List<TimeSpan>();
private int LastHour;
private int LastMinute;
private bool RestartCountdown;
private bool RestartJustScheduled = false;
private bool RestartScheduled = false;
private string RestartReason = String.Empty;
private List<string> RestartAnnouncementsWhenStrings;
private DateTime ScheduledRestart;
private TimeSpan AutomaticTimedAnnouncementsRepeatTimeSpan;
private bool RestartSuspended = false;
private bool DontCheckNextRestart = false;
private bool MutingBans = false;
private bool AnnouncingGameTime = false;
private string LastGameTime;
private int GameTimeCurrentCount = 0;
private bool AnnouncingRealTime = false;
private string LastRealTime;
private int RealTimeCurrentCount = 0;
private List<string> GameTimes = new List<string>();
private List<string> RealTimes = new List<string>();
private IEnumerator<List<string>> ATALEnum;
private List<List<string>> AutomaticTimedAnnouncementsStringList = new List<List<string>>();
string BannerTintGrey = "0.1 0.1 0.1 0.7";
string BannerTintRed = "0.5 0.1 0.1 0.7";
string BannerTintOrange = "0.95294 0.37255 0.06275 0.7";
string BannerTintYellow = "1 0.92 0.016 0.7";
string BannerTintGreen = "0.1 0.4 0.1 0.5";
string BannerTintCyan = "0 1 1 0.7";
string BannerTintBlue = "0.09020 0.07843 0.71765 0.7";
string BannerTintPurple = "0.53333 0.07843 0.77647 0.7";
string TextRed = "0.5 0.2 0.2";
string TextOrange = "0.8 0.5 0.1";
string TextYellow = "1 0.92 0.016";
string TextGreen = "0 1 0";
string TextCyan = "0 1 1";
string TextBlue = "0.09020 0.07843 0.71765";
string TextPurple = "0.53333 0.07843 0.77647";
string TextWhite = "1 1 1";
string BannerAnchorMaxX = "1.026 ";
string BannerAnchorMaxYDefault = "0.9743";
string BannerAnchorMaxY = "0.9743";
string BannerAnchorMinX = "-0.027 ";
string BannerAnchorMinYDefault = "0.915";
string BannerAnchorMinY = "0.915";
string TextAnchorMaxX = "0.868 ";
string TextAnchorMaxYDefault = "0.9743";
string TextAnchorMaxY = "0.9743";
string TextAnchorMinX = "0.131 ";
string TextAnchorMinYDefault = "0.915";
string TextAnchorMinY = "0.915";
string TABannerAnchorMaxY = "0.9743";
string TABannerAnchorMinY = "0.915";
string TATextAnchorMaxY = "0.9743";
string TATextAnchorMinY = "0.915";
#endregion
//============================================================================================================
#region Config Option Declerations
//Color List
public string BannerColorList {
get;
private set;
}
= "Grey, Red, Orange, Yellow, Green, Cyan, Blue, Purple";
public string TextColorList {
get;
private set;
}
= "White, Red, Orange, Yellow, Green, Cyan, Blue, Purple";
//Airdrop Announcements
public bool AirdropAnnouncementsEnabled {
get;
private set;
}
= false;
public bool AirdropAnnouncementsLocation {
get;
private set;
}
= false;
public string AirdropAnnouncementsText {
get;
private set;
}
= "Airdrop en route!";
public string AirdropAnnouncementsTextWithGrid {
get;
private set;
}
= "Airdrop en route to {grid}.";
public string AirdropAnnouncementsBannerColor {
get;
private set;
}
= "Green";
public string AirdropAnnouncementsTextColor {
get;
private set;
}
= "Yellow";
//Automatic Game Time Announcements
public bool AutomaticGameTimeAnnouncementsEnabled {
get;
private set;
}
= false;
public Dictionary<string, List<object>> AutomaticGameTimeAnnouncementsList {
get;
private set;
}
= new Dictionary<string, List<object>> {
{
"18:15", new List<object> {
"The in game time is 18:15 announcement 1.", "The in game time is 18:15 announcement 2.", "The in game time is 18:15 announcement 3."
}
}
, {
"00:00", new List<object> {
"The in game time is 00:00 announcement 1.", "The in game time is 00:00 announcement 2.", "The in game time is 00:00 announcement 3."
}
}
, {
"12:00", new List<object> {
"The in game time is 12:00 announcement 1.", "The in game time is 12:00 announcement 2.", "The in game time is 12:00 announcement 3."
}
}
,
}
;
public string AutomaticGameTimeAnnouncementsBannerColor {
get;
private set;
}
= "Grey";
public string AutomaticGameTimeAnnouncementsTextColor {
get;
private set;
}
= "White";
//Automatic Timed Announcements
public bool AutomaticTimedAnnouncementsEnabled {
get;
private set;
}
= false;
public static List<object> AutomaticTimedAnnouncementsList {
get;
private set;
}
= new List<object> {
new List<object> {
"1st Automatic Timed Announcement 1", "1st Automatic Timed Announcement 2"
}
, new List<object> {
"2nd Automatic Timed Announcement 1", "2nd Automatic Timed Announcement 2"
}
, new List<object> {
"3rd Automatic Timed Announcement 1", "3rd Automatic Timed Announcement 2"
}
,
}
;
public string AutomaticTimedAnnouncementsRepeat {
get;
private set;
}
= "00:30:00";
public string AutomaticTimedAnnouncementsBannerColor {
get;
private set;
}
= "Grey";
public string AutomaticTimedAnnouncementsTextColor {
get;
private set;
}
= "White";
//Automatic Realtime Announcements
public bool AutomaticRealtimeAnnouncementsEnabled {
get;
private set;
}
= false;
public Dictionary<string, List<object>> AutomaticRealTimeAnnouncementsList {
get;
private set;
}
= new Dictionary<string, List<object>> {
{
"18:15", new List<object> {
"The local time is 18:15 announcement 1.", "The local time is 18:15 announcement 2.", "The local time is 18:15 announcement 3."
}
}
, {
"00:00", new List<object> {
"The local time is 00:00 announcement 1.", "The local time is 00:00 announcement 2.", "The local time is 00:00 announcement 3."
}
}
, {
"12:00", new List<object> {
"The local time is 12:00 announcement 1.", "The local time is 12:00 announcement 2.", "The local time is 12:00 announcement 3."
}
}
,
}
;
public string AutomaticRealTimeAnnouncementsBannerColor {
get;
private set;
}
= "Grey";
public string AutomaticRealTimeAnnouncementsTextColor {
get;
private set;
}
= "White";
//Christmas Stocking Refill Announcement
public bool StockingRefillAnnouncementsEnabled {
get;
private set;
}
= false;
public string StockingRefillAnnouncementText {
get;
private set;
}
= "Santa has refilled your stockings.Go check what you've got!";
public string StockingRefillAnnouncementBannerColor {
get;
private set;
}
= "Green";
public string StockingRefillAnnouncementTextColor {
get;
private set;
}
= "Red";
//General Settings
public float AnnouncementDuration {
get;
private set;
}
= 10f;
public int FontSize {
get;
private set;
}
= 18;
public float FadeOutTime {
get;
private set;
}
= 0.5f;
public float FadeInTime {
get;
private set;
}
= 0.5f;
public static float AdjustVPosition {
get;
private set;
}
= 0.0f;
//Global Join/Leave Announcements
public bool GlobalLeaveAnnouncementsEnabled {
get;
private set;
}
= false;
public bool GlobalJoinAnnouncementsEnabled {
get;
private set;
}
= false;
public bool GlobalJoinLeavePermissionOnly {
get;
private set;
}
= true;
public string GlobalLeaveText {
get;
private set;
}
= "{rank} {playername} has left.";
public string GlobalJoinText {
get;
private set;
}
= "{rank} {playername} has joined.";
public string GlobalLeaveAnnouncementBannerColor {
get;
private set;
}
= "Grey";
public string GlobalLeaveAnnouncementTextColor {
get;
private set;
}
= "White";
public string GlobalJoinAnnouncementBannerColor {
get;
private set;
}
= "Grey";
public string GlobalJoinAnnouncementTextColor {
get;
private set;
}
= "White";
//Helicopter Announcements
public bool HelicopterSpawnAnnouncementEnabled {
get;
private set;
}
= false;
public bool HelicopterDespawnAnnouncementEnabled {
get;
private set;
}
= false;
public bool HelicopterDestroyedAnnouncementEnabled {
get;
private set;
}
= false;
public bool HelicopterDestroyedAnnouncementWithDestroyer {
get;
private set;
}
= false;
public string HelicopterSpawnAnnouncementText {
get;
private set;
}
= "Patrol Helicopter Inbound!";
public string HelicopterDespawnAnnouncementText {
get;
private set;
}
= "The patrol helicopter has left.";
public string HelicopterDestroyedAnnouncementText {
get;
private set;
}
= "The patrol helicopter has been taken down!";
public string HelicopterDestroyedAnnouncementWithDestroyerText {
get;
private set;
}
= "{playername} got the last shot on the helicopter taking it down!";
public string HelicopterSpawnAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string HelicopterSpawnAnnouncementTextColor {
get;
private set;
}
= "Orange";
public string HelicopterDestroyedAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string HelicopterDestroyedAnnouncementTextColor {
get;
private set;
}
= "White";
public string HelicopterDespawnAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string HelicopterDespawnAnnouncementTextColor {
get;
private set;
}
= "White";
//Chinook Announcements
public bool CH47SpawnAnnouncementsEnabled {
get;
private set;
}
= false;
public bool CH47DespawnAnnouncementsEnabled {
get;
private set;
}
= false;
public bool CH47DestroyedAnnouncementsEnabled {
get;
private set;
}
= false;
public bool CH47DestroyedAnnouncementsWithDestroyer {
get;
private set;
}
= false;
public bool CH47CrateDroppedAnnouncementsEnabled {
get;
private set;
}
= false;
public bool CH47CrateDroppedAnnouncementsWithLocation {
get;
private set;
}
= false;
public string CH47SpawnAnnouncementText {
get;
private set;
}
= "Chinook inbound!";
public string CH47DespawnAnnouncementText {
get;
private set;
}
= "The Chinook has left.";
public string CH47DestroyedAnnouncementText {
get;
private set;
}
= "The Chinook has been taken down!";
public string CH47DestroyedAnnouncementWithDestroyerText {
get;
private set;
}
= "{playername} got the last shot on the Chinook taking it down!";
public string CH47CrateDroppedAnnouncementText {
get;
private set;
}
= "The Chinook has dropped a crate!";
public string CH47CrateDroppedAnnouncementTextWithGrid {
get;
private set;
}
= "The Chinook has dropped a crate in {grid}.";
public string CH47SpawnAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string CH47SpawnAnnouncementTextColor {
get;
private set;
}
= "Yellow";
public string CH47DestroyedAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string CH47DestroyedAnnouncementTextColor {
get;
private set;
}
= "White";
public string CH47DespawnAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string CH47DespawnAnnouncementTextColor {
get;
private set;
}
= "White";
public string CH47CrateDroppedAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string CH47CrateDroppedAnnouncementTextColor {
get;
private set;
}
= "Yellow";
//Bradley APC Announcements
public bool APCSpawnAnnouncementsEnabled {
get;
private set;
}
= false;
public bool APCDestroyedAnnouncementsEnabled {
get;
private set;
}
= false;
public bool APCDestroyedAnnouncementsWithDestroyer {
get;
private set;
}
= false;
public string APCSpawnAnnouncementText {
get;
private set;
}
= "An APC is patrolling the launch site!";
public string APCDestroyedAnnouncementText {
get;
private set;
}
= "The APC has been destroyed.";
public string APCDestroyedAnnouncementWithDestroyerText {
get;
private set;
}
= "{playername} got the last shot on the APC destroying it!";
public string APCSpawnAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string APCSpawnAnnouncementTextColor {
get;
private set;
}
= "Yellow";
public string APCDestroyedAnnouncementBannerColor {
get;
private set;
}
= "Red";
public string APCDestroyedAnnouncementTextColor {
get;
private set;
}
= "White";
//Cargoship Announcements
public bool CargoshipSpawnAnnouncementsEnabled {
get;
private set;
}
= false;
public bool CargoshipEgressAnnouncementsEnabled {
get;
private set;
}
= false;
public string CargoshipSpawnAnnouncementText {
get;
private set;
}
= "Cargoship ahoy!";
public string CargoshipEgressAnnouncementText {
get;
private set;
}
= "The cargoship is departing.";
public string CargoshipSpawnAnnouncementBannerColor {
get;
private set;
}
= "Blue";
public string CargoshipSpawnAnnouncementTextColor {
get;
private set;
}
= "Yellow";
public string CargoshipEgressAnnouncementBannerColor {
get;
private set;
}
= "Blue";
public string CargoshipEgressAnnouncementTextColor {
get;
private set;
}
= "White";
//Crate Hack Announcements
public bool CrateHackAnnouncementsEnabled {
get;
private set;
}
= false;
public bool CrateHackSpecifyOilRig {
get;
private set;
}
= false;
public string CrateHackAnnouncementText {
get;
private set;
}
= "An oil rig crate is being hacked!";
public string CrateHackAnnouncementSmallOilRigText {
get;
private set;
}
= "The small oil rig crate is being hacked!";
public string CrateHackAnnouncementLargeOilRigText {
get;
private set;
}
= "The large oil rig crate is being hacked!";
public string CrateHackAnnouncementBannerColor {
get;
private set;
}
= "Orange";
public string CrateHackAnnouncementTextColor {
get;
private set;
}
= "Yellow";
//New Player Announcements
public bool NewPlayerAnnouncementsEnabled {
get;
private set;
}
= false;
public string NewPlayerAnnouncementsBannerColor {
get;
private set;
}
= "Grey";
public string NewPlayerAnnouncementsTextColor {
get;
private set;
}
= "White";
public Dictionary<int, List<object>> NewPlayerAnnouncementsList {
get;
private set;
}
= new Dictionary<int, List<object>> {
{
1, new List<object> {
"1st Join {rank} {playername} New player announcement 1.", "1st Join {rank} {playername} New player announcement 2.", "1st Join {rank} {playername} New player announcement 3."
}
}
, {
2, new List<object> {
"2nd Join {rank} {playername} New player announcement 1.", "2nd Join {rank} {playername} New player announcement 2.", "2nd Join {rank} {playername} New player announcement 3."
}
}
, {
3, new List<object> {
"3rd Join {rank} {playername} New player announcement 1.", "3rd Join {rank} {playername} New player announcement 2.", "3rd Join {rank} {playername} New player announcement 3."
}
}
,
}
;
//Player Banned Announcement
public bool PlayerBannedAnnouncementsEnabled {
get;
private set;
}
= false;
public string PlayerBannedAnnouncmentText {
get;
private set;
}
= "{playername} has been banned.{reason}.";
public string PlayerBannedAnnouncementBannerColor {
get;
private set;
}
= "Grey";
public string PlayerBannedAnnouncementTextColor {
get;
private set;
}
= "Red";
//Respawn Announcements
public bool RespawnAnnouncementsEnabled {
get;
private set;
}
= false;
public string RespawnAnnouncementsBannerColor {
get;
private set;
}
= "Grey";
public string RespawnAnnouncementsTextColor {
get;
private set;
}
= "White";
public List<object> RespawnAnnouncementsList {
get;
private set;
}
= new List<object> {
"{playername} Respawn announcement 1.", "{playername} Respawn announcement 2.", "{playername} Respawn announcement 3."
}
;
//Restart Announcements
public bool RestartAnnouncementsEnabled {
get;
private set;
}
= false;
public string RestartAnnouncementsFormat {
get;
private set;
}
= "Restarting in {time}";
public string RestartAnnouncementsBannerColor {
get;
private set;
}
= "Grey";
public string RestartAnnouncementsTextColor {
get;
private set;
}
= "White";
public List<object> RestartTimesList {
get;
private set;
}
= new List<object> {
"08:00:00", "20:00:00"
}
;
public List<object> RestartAnnouncementsTimes {
get;
private set;
}
= new List<object> {
"12:00:00", "11:00:00", "10:00:00", "09:00:00", "08:00:00", "07:00:00", "06:00:00", "05:00:00", "04:00:00", "03:00:00", "02:00:00", "01:00:00", "00:45:00", "00:30:00", "00:15:00", "00:05:00"
}
;
public bool RestartServer {
get;
private set;
}
= false;
public string RestartSuspendedAnnouncement {
get;
private set;
}
= "The restart in {time} has been suspended.";
public string RestartCancelledAnnouncement {
get;
private set;
}
= "The restart in {time} has been cancelled.";
//Test Announcement
public float TestAnnouncementDuration {
get;
private set;
}
= 10f;
public int TestAnnouncementFontSize {
get;
private set;
}
= 18;
public float TestAnnouncementFadeOutTime {
get;
private set;
}
= 0.5f;
public float TestAnnouncementFadeInTime {
get;
private set;
}
= 0.5f;
public static float TestAnnouncementAdjustVPosition {
get;
private set;
}
= 0.0f;
public string TestAnnouncementBannerColor {
get;
private set;
}
= "Grey";
public string TestAnnouncementsTextColor {
get;
private set;
}
= "White";
//Third Party Plugin Support
public bool DoNotOverlayLustyMap {
get;
private set;
}
= false;
public string LustyMapPosition {
get;
private set;
}
= "Left";
//Welcome Announcement
public bool WelcomeAnnouncementsEnabled {
get;
private set;
}
= false;
public string WelcomeAnnouncementText {
get;
private set;
}
= "Welcome {playername}! There are {playercount} player(s) online.";
public string WelcomeBackAnnouncementText {
get;
private set;
}
= "Welcome back {playername}! There are {playercount} player(s) online.";
public string WelcomeAnnouncementBannerColor {
get;
private set;
}
= "Grey";
public string WelcomeAnnouncementTextColor {
get;
private set;
}
= "White";
public float WelcomeAnnouncementDuration {
get;
private set;
}
= 20f;
public float WelcomeAnnouncementDelay {
get;
private set;
}
= 0f;
public bool WelcomeBackAnnouncement {
get;
private set;
}
= false;
#endregion
//============================================================================================================
#region LoadConfig
private void LoadGUIAnnouncementsConfig() {
string BColor;
string TColor;
string Category;
string Setting;
//Color List
BannerColorList = GetConfig("A List Of Available Colors To Use (DO NOT CHANGE)", "Banner Colors", BannerColorList);
if (BannerColorList != "Grey, Red, Orange, Yellow, Green, Cyan, Blue, Purple") {
PrintWarning("Banner color list changed.Reverting changes.");
Config["A List Of Available Colors To Use(DO NOT CHANGE)", "Banner Colors"] = "Grey, Red, Orange, Yellow, Green, Cyan, Blue, Purple";
ConfigUpdated = true;
}
TextColorList = GetConfig("A List Of Available Colors To Use (DO NOT CHANGE)", "Text Colors", TextColorList);
if (TextColorList != "White, Red, Orange, Yellow, Green, Cyan, Blue, Purple") {
PrintWarning("Text color list changed.Reverting changes.");
Config["A List Of Available Colors To Use(DO NOT CHANGE)", "Text Colors"] = "White, Red, Orange, Yellow, Green, Cyan, Blue, Purple";
ConfigUpdated = true;
}
//Airdrop Announcements
AirdropAnnouncementsEnabled = GetConfig("Public Airdrop Announcements", "Enabled", AirdropAnnouncementsEnabled);
AirdropAnnouncementsText = GetConfig("Public Airdrop Announcements", "Text", AirdropAnnouncementsText);
AirdropAnnouncementsTextWithGrid = GetConfig("Public Airdrop Announcements", "Text With Grid", AirdropAnnouncementsTextWithGrid);
AirdropAnnouncementsLocation = GetConfig("Public Airdrop Announcements", "Show Location", AirdropAnnouncementsLocation);
BColor = AirdropAnnouncementsBannerColor;
Category = "Public Airdrop Announcements";
Setting = "Banner Color";
AirdropAnnouncementsBannerColor = GetConfig(Category, Setting, AirdropAnnouncementsBannerColor);
CheckBannerColor(AirdropAnnouncementsBannerColor, Category, Setting, BColor);
TColor = AirdropAnnouncementsTextColor;
Category = "Public Airdrop Announcements";
Setting = "Text Color";
AirdropAnnouncementsTextColor = GetConfig(Category, Setting, AirdropAnnouncementsTextColor);
CheckTextColor(AirdropAnnouncementsTextColor, Category, Setting, TColor);
//Automatic Game Time Announcements
AutomaticGameTimeAnnouncementsEnabled = GetConfig("Public Automatic Game Time Announcements", "Enabled", AutomaticGameTimeAnnouncementsEnabled);
AutomaticGameTimeAnnouncementsList = GetConfig("Public Automatic Game Time Announcements", "Announcement List (Show at this in game time : Announcements to show)", AutomaticGameTimeAnnouncementsList);
BColor = AutomaticGameTimeAnnouncementsBannerColor;
Category = "Public Automatic Game Time Announcements";
Setting = "Banner Color";
AutomaticGameTimeAnnouncementsBannerColor = GetConfig(Category, Setting, AutomaticGameTimeAnnouncementsBannerColor);
CheckBannerColor(AutomaticGameTimeAnnouncementsBannerColor, Category, Setting, BColor);
TColor = AutomaticGameTimeAnnouncementsTextColor;
Category = "Public Automatic Game Time Announcements";
Setting = "Text Color";
AutomaticGameTimeAnnouncementsTextColor = GetConfig(Category, Setting, AutomaticGameTimeAnnouncementsTextColor);
CheckTextColor(AutomaticGameTimeAnnouncementsTextColor, Category, Setting, TColor);
//Automatic Timed Announcements
AutomaticTimedAnnouncementsEnabled = GetConfig("Public Automatic Timed Announcements", "Enabled", AutomaticTimedAnnouncementsEnabled);
AutomaticTimedAnnouncementsList = GetConfig("Public Automatic Timed Announcements", "Announcement List", AutomaticTimedAnnouncementsList);
AutomaticTimedAnnouncementsRepeat = GetConfig("Public Automatic Timed Announcements", "Show Every (HH:MM:SS)", AutomaticTimedAnnouncementsRepeat);
if (!TimeSpan.TryParse(AutomaticTimedAnnouncementsRepeat, out AutomaticTimedAnnouncementsRepeatTimeSpan)) {
PrintWarning("Config: \"Automatic Timed Announcements - Show Every (HH:MM:SS)\" is not of the correct format HH:MM:SS, or has numbers out of range and should not be higher than 23:59:59.Resetting to default.");
Config["Public Automatic Timed Announcements", "Show Every (HH:MM:SS)"] = "00:30:00";
ConfigUpdated = true;
}
BColor = AutomaticTimedAnnouncementsBannerColor;
Category = "Public Automatic Timed Announcements";
Setting = "Banner Color";
AutomaticTimedAnnouncementsBannerColor = GetConfig(Category, Setting, AutomaticTimedAnnouncementsBannerColor);
CheckBannerColor(AutomaticTimedAnnouncementsBannerColor, Category, Setting, BColor);
TColor = AutomaticTimedAnnouncementsTextColor;
Category = "Public Automatic Timed Announcements";
Setting = "Text Color";
AutomaticTimedAnnouncementsTextColor = GetConfig(Category, Setting, AutomaticTimedAnnouncementsTextColor);
CheckTextColor(AutomaticTimedAnnouncementsTextColor, Category, Setting, TColor);
//Automatic Realtime Announcements
AutomaticRealtimeAnnouncementsEnabled = GetConfig("Public Automatic Real Time Announcements", "Enabled", AutomaticRealtimeAnnouncementsEnabled);
AutomaticRealTimeAnnouncementsList = GetConfig("Public Automatic Real Time Announcements", "Announcement List (Show at this local time : Announcements to show)", AutomaticRealTimeAnnouncementsList);
BColor = AutomaticRealTimeAnnouncementsBannerColor;
Category = "Public Automatic Real Time Announcements";
Setting = "Banner Color";
AutomaticRealTimeAnnouncementsBannerColor = GetConfig(Category, Setting, AutomaticRealTimeAnnouncementsBannerColor);
CheckBannerColor(AutomaticRealTimeAnnouncementsBannerColor, Category, Setting, BColor);
TColor = AutomaticRealTimeAnnouncementsTextColor;
Category = "Public Automatic Real Time Announcements";
Setting = "Text Color";
AutomaticRealTimeAnnouncementsTextColor = GetConfig(Category, Setting, AutomaticRealTimeAnnouncementsTextColor);
CheckTextColor(AutomaticRealTimeAnnouncementsTextColor, Category, Setting, TColor);
//Christmas Stocking Refill Announcement
StockingRefillAnnouncementsEnabled = GetConfig("Public Christmas Stocking Refill Announcement", "Enabled", StockingRefillAnnouncementsEnabled);
StockingRefillAnnouncementText = GetConfig("Public Christmas Stocking Refill Announcement", "Text", StockingRefillAnnouncementText);
BColor = StockingRefillAnnouncementBannerColor;
Category = "Public Christmas Stocking Refill Announcement";
Setting = "Banner Color";
StockingRefillAnnouncementBannerColor = GetConfig(Category, Setting, StockingRefillAnnouncementBannerColor);
CheckBannerColor(StockingRefillAnnouncementBannerColor, Category, Setting, BColor);
TColor = StockingRefillAnnouncementTextColor;
Category = "Public Christmas Stocking Refill Announcement";
Setting = "Text Color";
StockingRefillAnnouncementTextColor = GetConfig(Category, Setting, StockingRefillAnnouncementTextColor);
CheckTextColor(StockingRefillAnnouncementTextColor, Category, Setting, TColor);
//General Settings
AnnouncementDuration = GetConfig("General Settings", "Announcement Duration", AnnouncementDuration);
if (AnnouncementDuration == 0) {
PrintWarning("Config: \"General Settings - Announcement Duration\" set to 0, resetting to 10f.");
Config["General Settings", "Announcement Duration"] = 10f;
ConfigUpdated = true;
}
FontSize = GetConfig("General Settings", "Font Size", FontSize);
if (FontSize > 33 | FontSize == 0) {
PrintWarning("Config: \"General Settings - Font Size\" greater than 28 or 0, resetting to 18.");
Config["General Settings", "Font Size"] = 18;
ConfigUpdated = true;
}
FadeInTime = GetConfig("General Settings", "Fade In Time", FadeInTime);
if (FadeInTime > AnnouncementDuration / 2) {
PrintWarning("Config: \"General Settings - Fade In Time\" is greater than half of AnnouncementShowDuration, resetting to half of AnnouncementShowDuration.");
Config["General Settings", "Fade In Time"] = AnnouncementDuration / 2;
ConfigUpdated = true;
}
FadeOutTime = GetConfig("General Settings", "Fade Out Time", FadeOutTime);
if (FadeOutTime > AnnouncementDuration / 2) {
PrintWarning("Config: \"General Settings - Fade Out Time\" is greater than half of AnnouncementShowDuration, resetting to half of AnnouncementShowDuration.");
Config["General Settings", "Fade Out Time"] = AnnouncementDuration / 2;
ConfigUpdated = true;
}
AdjustVPosition = GetConfig("General Settings", "Adjust Vertical Position", AdjustVPosition);
if (AdjustVPosition != 0f) {
BannerAnchorMaxY = (float.Parse(BannerAnchorMaxYDefault) + AdjustVPosition).ToString();
BannerAnchorMinY = (float.Parse(BannerAnchorMinYDefault) + AdjustVPosition).ToString();
TextAnchorMaxY = (float.Parse(TextAnchorMaxYDefault) + AdjustVPosition).ToString();
TextAnchorMinY = (float.Parse(TextAnchorMinYDefault) + AdjustVPosition).ToString();
}
//Global Join/Leave Announcements
GlobalLeaveAnnouncementsEnabled = GetConfig("Public Join/Leave Announcements", "Leave Enabled", GlobalLeaveAnnouncementsEnabled);
GlobalLeaveText = GetConfig("Public Join/Leave Announcements", "Leave Text", GlobalLeaveText);
GlobalJoinLeavePermissionOnly = GetConfig("Public Join/Leave Announcements", "Announce Only Players With Permission", GlobalJoinLeavePermissionOnly);
BColor = GlobalLeaveAnnouncementBannerColor;
Category = "Public Join/Leave Announcements";
Setting = "Leave Banner Color";
GlobalLeaveAnnouncementBannerColor = GetConfig(Category, Setting, GlobalLeaveAnnouncementBannerColor);
CheckBannerColor(GlobalLeaveAnnouncementBannerColor, Category, Setting, BColor);
TColor = GlobalLeaveAnnouncementTextColor;
Category = "Public Join/Leave Announcements";
Setting = "Leave Text Color";
GlobalLeaveAnnouncementTextColor = GetConfig(Category, Setting, GlobalLeaveAnnouncementTextColor);
CheckTextColor(GlobalLeaveAnnouncementTextColor, Category, Setting, TColor);
GlobalJoinAnnouncementsEnabled = GetConfig("Public Join/Leave Announcements", "Join Enabled", GlobalJoinAnnouncementsEnabled);
GlobalJoinText = GetConfig("Public Join/Leave Announcements", "Join Text", GlobalJoinText);
BColor = GlobalJoinAnnouncementBannerColor;
Category = "Public Join/Leave Announcements";
Setting = "Join Banner Color";
GlobalJoinAnnouncementBannerColor = GetConfig(Category, Setting, GlobalJoinAnnouncementBannerColor);
CheckBannerColor(GlobalJoinAnnouncementBannerColor, Category, Setting, BColor);
TColor = GlobalJoinAnnouncementTextColor;
Category = "Public Join/Leave Announcements";
Setting = "Join Text Color";
GlobalJoinAnnouncementTextColor = GetConfig(Category, Setting, GlobalJoinAnnouncementTextColor);
CheckTextColor(GlobalJoinAnnouncementTextColor, Category, Setting, TColor);
//Helicopter Announcements
HelicopterSpawnAnnouncementEnabled = GetConfig("Public Helicopter Announcements", "Spawn", HelicopterSpawnAnnouncementEnabled);
HelicopterSpawnAnnouncementText = GetConfig("Public Helicopter Announcements", "Spawn Text", HelicopterSpawnAnnouncementText);
HelicopterDespawnAnnouncementEnabled = GetConfig("Public Helicopter Announcements", "Despawn", HelicopterDespawnAnnouncementEnabled);
HelicopterDespawnAnnouncementText = GetConfig("Public Helicopter Announcements", "Despawn Text", HelicopterDespawnAnnouncementText);
HelicopterDestroyedAnnouncementEnabled = GetConfig("Public Helicopter Announcements", "Destroyed", HelicopterDestroyedAnnouncementEnabled);
HelicopterDestroyedAnnouncementWithDestroyer = GetConfig("Public Helicopter Announcements", "Show Destroyer", HelicopterDestroyedAnnouncementWithDestroyer);
HelicopterDestroyedAnnouncementText = GetConfig("Public Helicopter Announcements", "Destroyed Text", HelicopterDestroyedAnnouncementText);
HelicopterDestroyedAnnouncementWithDestroyerText = GetConfig("Public Helicopter Announcements", "Destroyed Text With Destroyer", HelicopterDestroyedAnnouncementWithDestroyerText);
BColor = HelicopterSpawnAnnouncementBannerColor;
Category = "Public Helicopter Announcements";
Setting = "Spawn Banner Color";
HelicopterSpawnAnnouncementBannerColor = GetConfig(Category, Setting, HelicopterSpawnAnnouncementBannerColor);
CheckBannerColor(HelicopterSpawnAnnouncementBannerColor, Category, Setting, BColor);
TColor = HelicopterSpawnAnnouncementTextColor;
Category = "Public Helicopter Announcements";
Setting = "Spawn Text Color";
HelicopterSpawnAnnouncementTextColor = GetConfig(Category, Setting, HelicopterSpawnAnnouncementTextColor);
CheckTextColor(HelicopterSpawnAnnouncementTextColor, Category, Setting, TColor);
BColor = HelicopterDespawnAnnouncementBannerColor;
Category = "Public Helicopter Announcements";
Setting = "Despawn Banner Color";
HelicopterDespawnAnnouncementBannerColor = GetConfig(Category, Setting, HelicopterDespawnAnnouncementBannerColor);
CheckBannerColor(HelicopterDespawnAnnouncementBannerColor, Category, Setting, BColor);
TColor = HelicopterDespawnAnnouncementTextColor;
Category = "Public Helicopter Announcements";
Setting = "Despawn Text Color";
HelicopterDespawnAnnouncementTextColor = GetConfig(Category, Setting, HelicopterDespawnAnnouncementTextColor);
CheckTextColor(HelicopterDespawnAnnouncementTextColor, Category, Setting, TColor);
BColor = HelicopterDestroyedAnnouncementBannerColor;
Category = "Public Helicopter Announcements";
Setting = "Destroyed Banner Color";
HelicopterDestroyedAnnouncementBannerColor = GetConfig(Category, Setting, HelicopterDestroyedAnnouncementBannerColor);
CheckBannerColor(HelicopterDestroyedAnnouncementBannerColor, Category, Setting, BColor);
TColor = HelicopterDestroyedAnnouncementTextColor;
Category = "Public Helicopter Announcements";
Setting = "Destroyed Text Color";
HelicopterDestroyedAnnouncementTextColor = GetConfig(Category, Setting, HelicopterDestroyedAnnouncementTextColor);
CheckTextColor(HelicopterDestroyedAnnouncementTextColor, Category, Setting, TColor);
//Chinook Announcements
CH47SpawnAnnouncementsEnabled = GetConfig("Public Chinook Announcements", "Spawn", CH47SpawnAnnouncementsEnabled);
CH47DespawnAnnouncementsEnabled = GetConfig("Public Chinook Announcements", "Despawn", CH47DespawnAnnouncementsEnabled);
CH47DestroyedAnnouncementsEnabled = GetConfig("Public Chinook Announcements", "Destroyed", CH47DestroyedAnnouncementsEnabled);
CH47DestroyedAnnouncementsWithDestroyer = GetConfig("Public Chinook Announcements", "Show Destroyer", CH47DestroyedAnnouncementsWithDestroyer);
CH47CrateDroppedAnnouncementsEnabled = GetConfig("Public Chinook Announcements", "Announce Crate Drops", CH47CrateDroppedAnnouncementsEnabled);
CH47CrateDroppedAnnouncementsWithLocation = GetConfig("Public Chinook Announcements", "Show Crate Drop Location", CH47CrateDroppedAnnouncementsWithLocation);
CH47SpawnAnnouncementText = GetConfig("Public Chinook Announcements", "Spawn Text", CH47SpawnAnnouncementText);
CH47DespawnAnnouncementText = GetConfig("Public Chinook Announcements", "Despawn Text", CH47DespawnAnnouncementText);
CH47DestroyedAnnouncementText = GetConfig("Public Chinook Announcements", "Destroyed Text", CH47DestroyedAnnouncementText);
CH47DestroyedAnnouncementWithDestroyerText = GetConfig("Public Chinook Announcements", "Destroyed Text With Destroyer", CH47DestroyedAnnouncementWithDestroyerText);
CH47CrateDroppedAnnouncementText = GetConfig("Public Chinook Announcements", "Crate Dropped Text", CH47CrateDroppedAnnouncementText);
CH47CrateDroppedAnnouncementTextWithGrid = GetConfig("Public Chinook Announcements", "Crate Dropped Text With Grid", CH47CrateDroppedAnnouncementTextWithGrid);
BColor = CH47SpawnAnnouncementBannerColor;
Category = "Public Chinook Announcements";
Setting = "Spawn Banner Color";
CH47SpawnAnnouncementBannerColor = GetConfig(Category, Setting, CH47SpawnAnnouncementBannerColor);
CheckBannerColor(CH47SpawnAnnouncementBannerColor, Category, Setting, BColor);
TColor = CH47SpawnAnnouncementTextColor;
Category = "Public Chinook Announcements";
Setting = "Spawn Text Color";
CH47SpawnAnnouncementTextColor = GetConfig(Category, Setting, CH47SpawnAnnouncementTextColor);
CheckTextColor(CH47SpawnAnnouncementTextColor, Category, Setting, TColor);
BColor = CH47DespawnAnnouncementBannerColor;
Category = "Public Chinook Announcements";
Setting = "Despawn Banner Color";
CH47DespawnAnnouncementBannerColor = GetConfig(Category, Setting, CH47DespawnAnnouncementBannerColor);
CheckBannerColor(CH47DespawnAnnouncementBannerColor, Category, Setting, BColor);
TColor = CH47DespawnAnnouncementTextColor;
Category = "Public Chinook Announcements";
Setting = "Despawn Text Color";
CH47DespawnAnnouncementTextColor = GetConfig(Category, Setting, CH47DespawnAnnouncementTextColor);
CheckTextColor(CH47DespawnAnnouncementTextColor, Category, Setting, TColor);
BColor = CH47DestroyedAnnouncementBannerColor;
Category = "Public Chinook Announcements";
Setting = "Destroyed Banner Color";
CH47DestroyedAnnouncementBannerColor = GetConfig(Category, Setting, C
// ... [Code preview truncated due to length. Full source in attached file] ...