From 9d0197d5ede7159a0624f66aaf40c27663011d18 Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 19:33:34 -0700 Subject: [PATCH] Final tidy up --- .../LastRequest/CoinflipLocale.cs | 14 +++----------- .../LastRequest/LastRequestLocale.cs | 6 +++--- mod/Jailbreak.Debug/Subcommands/DebugZone.cs | 5 ++--- mod/Jailbreak.SpecialDay/SpecialDayCommand.cs | 1 - .../SpecialDays/AbstractArmoryRestrictedDay.cs | 4 +++- .../SpecialDays/AbstractCellRestrictedDay.cs | 4 +++- .../SpecialDays/CustomDay.cs | 1 - mod/Jailbreak.SpecialDay/SpecialDays/FFADay.cs | 1 - .../SpecialDays/GunGameDay.cs | 1 - .../SpecialDays/HideAndSeekDay.cs | 1 - .../SpecialDays/ISpecialDayMessageProvider.cs | 1 - .../SpecialDays/InfectionDay.cs | 1 - .../SpecialDays/NoScopeDay.cs | 1 - .../SpecialDays/OneInTheChamberDay.cs | 1 - .../SpecialDays/TeleportDay.cs | 1 - .../SpecialDays/WardayDay.cs | 1 - mod/Jailbreak.Trail/ActivePlayerTrail.cs | 2 +- mod/Jailbreak.Warden/Global/WardenBehavior.cs | 1 - .../Selection/WardenSelectionBehavior.cs | 2 ++ .../Views/LastRequest/ILRLocale.cs | 3 +++ .../Extensions/StringExtensions.cs | 4 +--- public/Jailbreak.Validator/WeaponValidator.cs | 18 +++++++++--------- 22 files changed, 30 insertions(+), 44 deletions(-) diff --git a/lang/Jailbreak.English/LastRequest/CoinflipLocale.cs b/lang/Jailbreak.English/LastRequest/CoinflipLocale.cs index fae98ba1..1658beaf 100644 --- a/lang/Jailbreak.English/LastRequest/CoinflipLocale.cs +++ b/lang/Jailbreak.English/LastRequest/CoinflipLocale.cs @@ -9,7 +9,7 @@ public class CoinflipLocale : LastRequestLocale, ILRCFLocale { public IView FailedToChooseInTime(bool choice) { return new SimpleView { PREFIX, - "You failed to choose in time, defaulting to " + ChatColors.Green, + "You failed to choose in time, defaulting to" + ChatColors.Green, choice ? "Heads" : "Tails" }; } @@ -18,7 +18,7 @@ public IView GuardChose(CCSPlayerController guard, bool choice) { return new SimpleView { PREFIX, guard, - " chose " + ChatColors.Green, + "chose" + ChatColors.Green, choice ? "Heads" : "Tails", ChatColors.Default + ", flipping..." }; @@ -26,15 +26,7 @@ public IView GuardChose(CCSPlayerController guard, bool choice) { public IView CoinLandsOn(bool heads) { return new SimpleView { - PREFIX, "The coin lands on " + ChatColors.Green, heads ? "Heads" : "Tails" - }; - } - - public IView FailedToChooseInTime(string choice) { - return new SimpleView { - PREFIX, - "You failed to choose in time, defaulting to " + ChatColors.Green, - choice + PREFIX, "The coin lands on" + ChatColors.Green, heads ? "Heads" : "Tails" }; } } \ No newline at end of file diff --git a/lang/Jailbreak.English/LastRequest/LastRequestLocale.cs b/lang/Jailbreak.English/LastRequest/LastRequestLocale.cs index 3a2f2425..209f79b9 100644 --- a/lang/Jailbreak.English/LastRequest/LastRequestLocale.cs +++ b/lang/Jailbreak.English/LastRequest/LastRequestLocale.cs @@ -52,9 +52,9 @@ public IView InformLastRequest(AbstractLastRequest lr) { return new SimpleView { PREFIX, lr.Prisoner, - "is preparing a", - lr.Type.ToFriendlyString(), - "Last Request against", + ChatColors.Grey + "is preparing a", + ChatColors.White + lr.Type.ToFriendlyString(), + ChatColors.Grey + "Last Request against", lr.Guard }; } diff --git a/mod/Jailbreak.Debug/Subcommands/DebugZone.cs b/mod/Jailbreak.Debug/Subcommands/DebugZone.cs index 68956aa6..d0e12b27 100644 --- a/mod/Jailbreak.Debug/Subcommands/DebugZone.cs +++ b/mod/Jailbreak.Debug/Subcommands/DebugZone.cs @@ -48,7 +48,7 @@ public override void OnCommand(CCSPlayerController? executor, specifiedType = success; } - string map = Server.MapName; + var map = Server.MapName; switch (info.GetArg(1).ToLower()) { case "finish": case "done": @@ -190,8 +190,7 @@ await zoneManager.PushZoneWithID(innerZone, innerPair.Value.Item2, info.ReplyToCommand("Removing " + toRemove.Count + " auto-generated zones"); Server.NextFrameAsync(async () => { - foreach (var z in toRemove) - await zoneManager.DeleteZone(z.Id, map); + foreach (var z in toRemove) await zoneManager.DeleteZone(z.Id, map); }); return; } diff --git a/mod/Jailbreak.SpecialDay/SpecialDayCommand.cs b/mod/Jailbreak.SpecialDay/SpecialDayCommand.cs index c57acc7d..69b299d3 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDayCommand.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDayCommand.cs @@ -6,7 +6,6 @@ using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Menu; using Jailbreak.Formatting.Extensions; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Formatting.Views.Warden; using Jailbreak.Public.Behaviors; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/AbstractArmoryRestrictedDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/AbstractArmoryRestrictedDay.cs index 1f64b69f..bc75c72a 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/AbstractArmoryRestrictedDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/AbstractArmoryRestrictedDay.cs @@ -31,7 +31,9 @@ public virtual IView ArmoryReminder override protected IZone GetZone() { var manager = provider.GetRequiredService(); - var zones = manager.GetZones(Server.MapName, ZoneType.ARMORY).GetAwaiter().GetResult(); + var zones = manager.GetZones(Server.MapName, ZoneType.ARMORY) + .GetAwaiter() + .GetResult(); if (zones.Count > 0) return new MultiZoneWrapper(zones); var bounds = new DistanceZone( diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/AbstractCellRestrictedDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/AbstractCellRestrictedDay.cs index 4ad1eaa1..ec58eaba 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/AbstractCellRestrictedDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/AbstractCellRestrictedDay.cs @@ -30,7 +30,9 @@ public virtual IView CellReminder override protected IZone GetZone() { var manager = provider.GetRequiredService(); - var zones = manager.GetZones(Server.MapName, ZoneType.CELL).GetAwaiter().GetResult(); + var zones = manager.GetZones(Server.MapName, ZoneType.CELL) + .GetAwaiter() + .GetResult(); if (zones.Count > 0) return new MultiZoneWrapper(zones); var bounds = new DistanceZone( diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/CustomDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/CustomDay.cs index 85f7e8a5..f3c0e359 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/CustomDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/CustomDay.cs @@ -1,6 +1,5 @@ using CounterStrikeSharp.API.Core; using Jailbreak.English.SpecialDay; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Mod.SpecialDay; using Jailbreak.Public.Mod.SpecialDay.Enums; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/FFADay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/FFADay.cs index f2024996..06135f73 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/FFADay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/FFADay.cs @@ -1,7 +1,6 @@ using CounterStrikeSharp.API.Core; using Jailbreak.English.SpecialDay; using Jailbreak.Formatting.Extensions; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Mod.SpecialDay; using Jailbreak.Public.Mod.SpecialDay.Enums; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs index e6c0e029..7d07443c 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs @@ -3,7 +3,6 @@ using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.English.SpecialDay; using Jailbreak.Formatting.Extensions; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs index df392521..08f63d44 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs @@ -3,7 +3,6 @@ using Jailbreak.English.SpecialDay; using Jailbreak.Formatting.Base; using Jailbreak.Formatting.Extensions; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/ISpecialDayMessageProvider.cs b/mod/Jailbreak.SpecialDay/SpecialDays/ISpecialDayMessageProvider.cs index 4f9fde51..3d40dbd6 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/ISpecialDayMessageProvider.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/ISpecialDayMessageProvider.cs @@ -1,4 +1,3 @@ -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; namespace Jailbreak.SpecialDay.SpecialDays; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/InfectionDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/InfectionDay.cs index d95287ec..65714458 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/InfectionDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/InfectionDay.cs @@ -4,7 +4,6 @@ using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.English.SpecialDay; using Jailbreak.Formatting.Extensions; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/NoScopeDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/NoScopeDay.cs index 490900a6..484290e7 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/NoScopeDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/NoScopeDay.cs @@ -1,7 +1,6 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using Jailbreak.English.SpecialDay; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/OneInTheChamberDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/OneInTheChamberDay.cs index cdc79960..897a6a63 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/OneInTheChamberDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/OneInTheChamberDay.cs @@ -1,6 +1,5 @@ using CounterStrikeSharp.API.Core; using Jailbreak.English.SpecialDay; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/TeleportDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/TeleportDay.cs index 15c5a900..ff1a410b 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/TeleportDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/TeleportDay.cs @@ -1,6 +1,5 @@ using CounterStrikeSharp.API.Core; using Jailbreak.English.SpecialDay; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/WardayDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/WardayDay.cs index 5a0701d5..b40aaa77 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/WardayDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/WardayDay.cs @@ -2,7 +2,6 @@ using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.English.SpecialDay; using Jailbreak.Formatting.Extensions; -using Jailbreak.Formatting.Views; using Jailbreak.Formatting.Views.SpecialDay; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.SpecialDay; diff --git a/mod/Jailbreak.Trail/ActivePlayerTrail.cs b/mod/Jailbreak.Trail/ActivePlayerTrail.cs index 33ed1b56..557a0990 100644 --- a/mod/Jailbreak.Trail/ActivePlayerTrail.cs +++ b/mod/Jailbreak.Trail/ActivePlayerTrail.cs @@ -51,7 +51,7 @@ virtual protected void Tick() { } DidntMoveTicks = 0; - if (dist < 5000) { return; } + if (dist < 5000) return; AddTrailPoint(pos); } diff --git a/mod/Jailbreak.Warden/Global/WardenBehavior.cs b/mod/Jailbreak.Warden/Global/WardenBehavior.cs index 1df179a9..cd258650 100644 --- a/mod/Jailbreak.Warden/Global/WardenBehavior.cs +++ b/mod/Jailbreak.Warden/Global/WardenBehavior.cs @@ -374,7 +374,6 @@ public HookResult OnRoundStart(EventRoundStart ev, GameEventInfo info) { firstWarden = true; preWardenStats = null; - return HookResult.Continue; } diff --git a/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs b/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs index d3556b12..3ba0aac0 100644 --- a/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs +++ b/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs @@ -8,6 +8,7 @@ using Jailbreak.Public.Behaviors; using Jailbreak.Public.Generic; using Jailbreak.Public.Mod.Warden; +using Jailbreak.Public.Utils; using Microsoft.Extensions.Logging; namespace Jailbreak.Warden.Selection; @@ -78,6 +79,7 @@ public bool InQueue(CCSPlayerController player) { [GameEventHandler] public HookResult OnRoundStart(EventRoundStart ev, GameEventInfo info) { + if (RoundUtil.IsWarmup()) return HookResult.Continue; // Enable the warden queue queueInactive = false; diff --git a/public/Jailbreak.Formatting/Views/LastRequest/ILRLocale.cs b/public/Jailbreak.Formatting/Views/LastRequest/ILRLocale.cs index 91aea8de..0e8c9a3d 100644 --- a/public/Jailbreak.Formatting/Views/LastRequest/ILRLocale.cs +++ b/public/Jailbreak.Formatting/Views/LastRequest/ILRLocale.cs @@ -16,7 +16,10 @@ public interface ILRLocale { public IView LastRequestNotEnabled(); public IView InvalidLastRequest(string query); public IView InformLastRequest(AbstractLastRequest lr); + + [Obsolete("Unused, use InformLastRequest instead")] public IView AnnounceLastRequest(AbstractLastRequest lr); + public IView LastRequestDecided(AbstractLastRequest lr, LRResult result); public IView CannotLR(string reason); public IView CannotLR(CCSPlayerController player, string reason); diff --git a/public/Jailbreak.Public/Extensions/StringExtensions.cs b/public/Jailbreak.Public/Extensions/StringExtensions.cs index 0b89d68e..b0ce89fb 100644 --- a/public/Jailbreak.Public/Extensions/StringExtensions.cs +++ b/public/Jailbreak.Public/Extensions/StringExtensions.cs @@ -1,6 +1,4 @@ -using System.Text; - -namespace Jailbreak.Public.Extensions; +namespace Jailbreak.Public.Extensions; public static class StringExtensions { public static string Sanitize(this string unknown) { diff --git a/public/Jailbreak.Validator/WeaponValidator.cs b/public/Jailbreak.Validator/WeaponValidator.cs index 4bc90916..edaf151e 100644 --- a/public/Jailbreak.Validator/WeaponValidator.cs +++ b/public/Jailbreak.Validator/WeaponValidator.cs @@ -36,16 +36,16 @@ public bool Validate(string value, out string? errorMessage) { errorMessage = $"invalid {nameof(type).ToLower()}: {weapon}"; var result = type switch { - WeaponType.GRENADE => Tag.GRENADES.Contains(weapon), - WeaponType.UTILITY => Tag.UTILITY.Contains(weapon), - WeaponType.WEAPON => Tag.WEAPONS.Contains(weapon), - WeaponType.SNIPERS => Tag.SNIPERS.Contains(weapon), - WeaponType.RIFLES => Tag.RIFLES.Contains(weapon), - WeaponType.PISTOLS => Tag.PISTOLS.Contains(weapon), + WeaponType.GRENADE => Tag.GRENADES.Contains(weapon), + WeaponType.UTILITY => Tag.UTILITY.Contains(weapon), + WeaponType.WEAPON => Tag.WEAPONS.Contains(weapon), + WeaponType.SNIPERS => Tag.SNIPERS.Contains(weapon), + WeaponType.RIFLES => Tag.RIFLES.Contains(weapon), + WeaponType.PISTOLS => Tag.PISTOLS.Contains(weapon), WeaponType.SHOTGUNS => Tag.SHOTGUNS.Contains(weapon), - WeaponType.SMGS => Tag.SMGS.Contains(weapon), - WeaponType.HEAVY => Tag.HEAVY.Contains(weapon), - _ => throw new ArgumentOutOfRangeException(nameof(weapon)) + WeaponType.SMGS => Tag.SMGS.Contains(weapon), + WeaponType.HEAVY => Tag.HEAVY.Contains(weapon), + _ => throw new ArgumentOutOfRangeException(nameof(weapon)) }; if (!result) return false; }