From 1b36a12038f43294c777abb9c6a30e26a797138f Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 18:43:41 -0700 Subject: [PATCH 1/6] Misc. changes --- .../SpecialDay/SpeedrunDayLocale.cs | 11 ++++- .../SpecialDay/TeamDayLocale.cs | 9 ++++- .../SpecialDays/GunGameDay.cs | 5 ++- .../SpecialDays/SpeedrunDay.cs | 40 ++++++++++++++++++- mod/Jailbreak.Trail/ActivePlayerTrail.cs | 2 +- .../Views/SpecialDay/ISpeedDayLocale.cs | 3 +- .../Extensions/StringExtensions.cs | 7 +--- .../Mod/Trail/AbstractTrail.cs | 4 ++ 8 files changed, 68 insertions(+), 13 deletions(-) diff --git a/lang/Jailbreak.English/SpecialDay/SpeedrunDayLocale.cs b/lang/Jailbreak.English/SpecialDay/SpeedrunDayLocale.cs index b3ec791a..c5ff0498 100644 --- a/lang/Jailbreak.English/SpecialDay/SpeedrunDayLocale.cs +++ b/lang/Jailbreak.English/SpecialDay/SpeedrunDayLocale.cs @@ -69,7 +69,7 @@ public IView RunnerAssigned(CCSPlayerController player) { }; } - public IView RunnerReassigned(CCSPlayerController player) { + public IView RunnerLeftAndReassigned(CCSPlayerController player) { return new SimpleView { PREFIX, "The original speedrunner left, so", @@ -78,6 +78,15 @@ public IView RunnerReassigned(CCSPlayerController player) { }; } + public IView RunnerAFKAndReassigned(CCSPlayerController player) { + return new SimpleView { + PREFIX, + "The original speedrunner isn't moving, so", + player, + "is now the speedrunner!" + }; + } + public IView PlayerTime(CCSPlayerController player, int position, float time) { var place = position switch { diff --git a/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs b/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs index 54f09a74..1095e057 100644 --- a/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs +++ b/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs @@ -1,6 +1,7 @@ using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.Formatting.Base; using Jailbreak.Formatting.Views.SpecialDay; +using Jailbreak.Public.Extensions; using Jailbreak.Public.Utils; namespace Jailbreak.English.SpecialDay; @@ -29,7 +30,13 @@ public virtual IView BeginsIn(int seconds) { } public IView GenerateStartMessage() { - var result = new SimpleView { PREFIX, { "Today is a", Name, "day!" } }; + // Put "an" if name starts with a vowel + var result = new SimpleView { + PREFIX, + { "Today is a" + (Name.ToLower()[0].IsVowel() ? "n" : ""), Name, "day!" } + }; + + // var result = new SimpleView { PREFIX, { "Today is a" + Name.ToLower()[0].), Name, "day!" } }; if (description.Length == 0) return result; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs index 2a034f04..e6c0e029 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs @@ -115,7 +115,8 @@ private HookResult OnDeath(EventPlayerDeath @event, GameEventInfo info) { int playerIndex; if (!progressions.TryGetValue(player.Slot, out playerIndex)) playerIndex = 0; - if (attacker == null || !attacker.IsValid || attacker.Slot == player.Slot) { + if (attacker == null || !attacker.IsValid) return HookResult.Continue; + if (attacker.Slot == player.Slot) { if (playerIndex <= 0) return HookResult.Continue; playerIndex--; msg.DemotedDueToSuicide.ToChat(player); @@ -167,7 +168,7 @@ private HookResult OnDeath(EventPlayerDeath @event, GameEventInfo info) { msg.PlayerOnLastPromotion(attacker).ToAllChat(); msg.PromotedTo(weaponProgression[attackerProgress].GetFriendlyWeaponName(), - weaponProgression.Count - attackerProgress - 1) + weaponProgression.Count - attackerProgress) .ToChat(attacker); attacker.RemoveWeapons(); diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs index 57f16e9c..ff185eed 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs @@ -168,7 +168,7 @@ public override void Setup() { } speedrunner.SetColor(Color.DodgerBlue); - msg.RunnerReassigned(speedrunner).ToAllChat(); + msg.RunnerLeftAndReassigned(speedrunner).ToAllChat(); msg.YouAreRunner(CvInitialSpeedrunTime.Value).ToChat(speedrunner); } @@ -254,6 +254,42 @@ private ActivePlayerTrail createFirstTrail( var tps = 1 / trail.UpdateRate; var didntMoveSeconds = (int)Math.Ceiling(trail.DidntMoveTicks / tps); var thresholdTicks = (int)Math.Ceiling(tps * 3); + if (trail.GetTrailLengthSquared() < 500) { + if (trail.DidntMoveTicks <= tps * 10) return; + // If the player left mid-run, we need to pick the nearest player + // to continue the run + var end = trail.GetEndSegment()?.GetEnd() ?? start; + if (end == null) { + panic("Speedrunner is invalid, and we cannot find the start"); + return; + } + + var furthest = PlayerUtil.GetAlive() + .Where(p => p.Pawn.IsValid && p.Pawn.Value != null) + .Where(p => p.Pawn.Value!.IsValid && p.Pawn.Value.AbsOrigin != null) + .MinBy(p => p.Pawn.Value!.AbsOrigin!.DistanceSquared(end)); + + if (furthest == null) { + panic("Speedrunner is invalid, and we cannot find a new one"); + return; + } + + speedrunner = furthest; + foreach (var p in PlayerUtil.GetAlive()) { + if (p.Slot == speedrunner.Slot) continue; + p.Teleport(furthest); + } + + start = furthest.Pawn.Value?.AbsOrigin!.Clone(); + furthest.Pawn.Value?.Teleport(end); + furthest.SetColor(Color.DodgerBlue); + msg.RunnerAFKAndReassigned(furthest).ToAllChat(); + msg.YouAreRunner(RoundUtil.GetTimeRemaining()).ToChat(furthest); + trail.StartTracking(furthest); + + return; + } + if (trail.DidntMoveTicks < thresholdTicks) return; if (trail.DidntMoveTicks == thresholdTicks) msg.StayStillToSpeedup.ToChat(trail.Player); @@ -284,7 +320,7 @@ private ActivePlayerTrail createFirstTrail( speedrunner = nearest; nearest.Pawn.Value?.Teleport(end); nearest.SetColor(Color.DodgerBlue); - msg.RunnerReassigned(nearest).ToAllChat(); + msg.RunnerLeftAndReassigned(nearest).ToAllChat(); msg.YouAreRunner(RoundUtil.GetTimeRemaining()).ToChat(nearest); trail.StartTracking(nearest); }; diff --git a/mod/Jailbreak.Trail/ActivePlayerTrail.cs b/mod/Jailbreak.Trail/ActivePlayerTrail.cs index 4d0cb957..ee6445c7 100644 --- a/mod/Jailbreak.Trail/ActivePlayerTrail.cs +++ b/mod/Jailbreak.Trail/ActivePlayerTrail.cs @@ -42,7 +42,7 @@ virtual protected void Tick() { pos = pos.Clone(); var end = GetEndSegment(); var dist = end?.GetStart().DistanceSquared(pos) ?? float.MaxValue; - if (dist < 1000) { + if (dist < 2000) { // Still want to remove old segments Cleanup(); DidntMoveTicks++; diff --git a/public/Jailbreak.Formatting/Views/SpecialDay/ISpeedDayLocale.cs b/public/Jailbreak.Formatting/Views/SpecialDay/ISpeedDayLocale.cs index e3f60803..17b41c64 100644 --- a/public/Jailbreak.Formatting/Views/SpecialDay/ISpeedDayLocale.cs +++ b/public/Jailbreak.Formatting/Views/SpecialDay/ISpeedDayLocale.cs @@ -12,7 +12,8 @@ public interface ISpeedDayLocale : ISDInstanceLocale { public IView YouAreRunner(int seconds); - public IView RunnerReassigned(CCSPlayerController player); + public IView RunnerLeftAndReassigned(CCSPlayerController player); + public IView RunnerAFKAndReassigned(CCSPlayerController player); public IView RuntimeLeft(int seconds); diff --git a/public/Jailbreak.Public/Extensions/StringExtensions.cs b/public/Jailbreak.Public/Extensions/StringExtensions.cs index 192e6271..0b89d68e 100644 --- a/public/Jailbreak.Public/Extensions/StringExtensions.cs +++ b/public/Jailbreak.Public/Extensions/StringExtensions.cs @@ -7,10 +7,7 @@ public static string Sanitize(this string unknown) { return unknown.Replace("<", "<"); } - public static string Repeat(this string stringToRepeat, int repeat) { - var builder = new StringBuilder(repeat * stringToRepeat.Length); - for (var i = 0; i < repeat; i++) builder.Append(stringToRepeat); - - return builder.ToString(); + public static bool IsVowel(this char c) { + return "aeiouAEIOU".IndexOf(c) >= 0; } } \ No newline at end of file diff --git a/public/Jailbreak.Public/Mod/Trail/AbstractTrail.cs b/public/Jailbreak.Public/Mod/Trail/AbstractTrail.cs index 9fddff66..7c5519be 100644 --- a/public/Jailbreak.Public/Mod/Trail/AbstractTrail.cs +++ b/public/Jailbreak.Public/Mod/Trail/AbstractTrail.cs @@ -82,6 +82,10 @@ public virtual float GetTrailLength(float since, int max = 0) { return MathF.Sqrt(GetTrailLengthSquared(since, max)); } + public float GetTrailLengthSquared() { + return GetTrailLengthSquared(Lifetime); + } + public float GetTrailLengthSquared(float since, int max = 0) { var length = 0f; var last = default(Vector); From 842ff414a8a52846912bcecb2dfff3e21a5027ae Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 18:44:45 -0700 Subject: [PATCH 2/6] Remove unused lines --- lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs b/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs index 1095e057..db32ee34 100644 --- a/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs +++ b/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs @@ -30,14 +30,11 @@ public virtual IView BeginsIn(int seconds) { } public IView GenerateStartMessage() { - // Put "an" if name starts with a vowel var result = new SimpleView { PREFIX, { "Today is a" + (Name.ToLower()[0].IsVowel() ? "n" : ""), Name, "day!" } }; - // var result = new SimpleView { PREFIX, { "Today is a" + Name.ToLower()[0].), Name, "day!" } }; - if (description.Length == 0) return result; result.Add(description[0]); From a63183e20fc5ffa1c10e25854cbc8ecb5dbc9551 Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 19:14:58 -0700 Subject: [PATCH 3/6] Detect when speedrunner is afk --- .../SpecialDay/SoloDayLocale.cs | 6 +++++- .../SpecialDays/SpeedrunDay.cs | 19 +++++++++++++------ mod/Jailbreak.Trail/ActivePlayerTrail.cs | 2 +- .../Mod/SpecialDay/AbstractSpecialDay.cs | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs b/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs index 8d5ef5d9..d42c769f 100644 --- a/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs +++ b/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs @@ -1,5 +1,6 @@ using Jailbreak.Formatting.Base; using Jailbreak.Formatting.Views.SpecialDay; +using Jailbreak.Public.Extensions; using Jailbreak.Public.Utils; namespace Jailbreak.English.SpecialDay; @@ -27,7 +28,10 @@ public virtual IView BeginsIn(int seconds) { } public IView GenerateStartMessage() { - var result = new SimpleView { PREFIX, { "Today is a", Name, "day!" } }; + var result = new SimpleView { + PREFIX, + { "Today is a" + (Name.ToLower()[0].IsVowel() ? "n" : ""), Name, "day!" } + }; if (description.Length == 0) return result; diff --git a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs index ff185eed..8afa173c 100644 --- a/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs +++ b/mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs @@ -254,10 +254,15 @@ private ActivePlayerTrail createFirstTrail( var tps = 1 / trail.UpdateRate; var didntMoveSeconds = (int)Math.Ceiling(trail.DidntMoveTicks / tps); var thresholdTicks = (int)Math.Ceiling(tps * 3); - if (trail.GetTrailLengthSquared() < 500) { + if (start == null) { + panic("start is null"); + return; + } + + if (start.DistanceSquared(speedrunner?.Pawn.Value?.AbsOrigin!) < 100) { if (trail.DidntMoveTicks <= tps * 10) return; - // If the player left mid-run, we need to pick the nearest player - // to continue the run + // If the player is afk, we need to pick the closet player + // that has moved to continue the run var end = trail.GetEndSegment()?.GetEnd() ?? start; if (end == null) { panic("Speedrunner is invalid, and we cannot find the start"); @@ -267,6 +272,9 @@ private ActivePlayerTrail createFirstTrail( var furthest = PlayerUtil.GetAlive() .Where(p => p.Pawn.IsValid && p.Pawn.Value != null) .Where(p => p.Pawn.Value!.IsValid && p.Pawn.Value.AbsOrigin != null) + .Where(p + => p.Pawn.Value!.AbsOrigin!.DistanceSquared(speedrunner?.Pawn.Value! + .AbsOrigin!) > 100) // Ensure they have moved .MinBy(p => p.Pawn.Value!.AbsOrigin!.DistanceSquared(end)); if (furthest == null) { @@ -277,16 +285,15 @@ private ActivePlayerTrail createFirstTrail( speedrunner = furthest; foreach (var p in PlayerUtil.GetAlive()) { if (p.Slot == speedrunner.Slot) continue; - p.Teleport(furthest); + p.Teleport(speedrunner); } - start = furthest.Pawn.Value?.AbsOrigin!.Clone(); furthest.Pawn.Value?.Teleport(end); furthest.SetColor(Color.DodgerBlue); msg.RunnerAFKAndReassigned(furthest).ToAllChat(); msg.YouAreRunner(RoundUtil.GetTimeRemaining()).ToChat(furthest); trail.StartTracking(furthest); - + trail.DidntMoveTicks = 0; return; } diff --git a/mod/Jailbreak.Trail/ActivePlayerTrail.cs b/mod/Jailbreak.Trail/ActivePlayerTrail.cs index ee6445c7..f247db57 100644 --- a/mod/Jailbreak.Trail/ActivePlayerTrail.cs +++ b/mod/Jailbreak.Trail/ActivePlayerTrail.cs @@ -23,7 +23,7 @@ public ActivePlayerTrail(BasePlugin plugin, CCSPlayerController player, } public float UpdateRate { get; protected set; } - public int DidntMoveTicks { get; protected set; } + public int DidntMoveTicks { get; set; } public CCSPlayerController? Player { get; protected set; } public event Action OnPlayerInvalid = () => { }; diff --git a/public/Jailbreak.Public/Mod/SpecialDay/AbstractSpecialDay.cs b/public/Jailbreak.Public/Mod/SpecialDay/AbstractSpecialDay.cs index 2dd5db54..671587dc 100644 --- a/public/Jailbreak.Public/Mod/SpecialDay/AbstractSpecialDay.cs +++ b/public/Jailbreak.Public/Mod/SpecialDay/AbstractSpecialDay.cs @@ -284,7 +284,8 @@ protected void SetConvarValue(ConVar? cvar, object value) { break; } - if (cvar.Name is "mp_teammates_are_enemies" or "sv_autobunnyhopping") { + if (cvar.Name is "mp_teammates_are_enemies" or "sv_autobunnyhopping" + or "mp_death_drop_gun") { // These convars require a frame to take effect, otherwise client-side // stuff is not properly updated var opposite = !(bool)value; From c25591751cb421d03bc34e15abec199de3aa7c17 Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 19:16:19 -0700 Subject: [PATCH 4/6] More strict distance requirement --- mod/Jailbreak.Trail/ActivePlayerTrail.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/Jailbreak.Trail/ActivePlayerTrail.cs b/mod/Jailbreak.Trail/ActivePlayerTrail.cs index f247db57..33ed1b56 100644 --- a/mod/Jailbreak.Trail/ActivePlayerTrail.cs +++ b/mod/Jailbreak.Trail/ActivePlayerTrail.cs @@ -42,7 +42,7 @@ virtual protected void Tick() { pos = pos.Clone(); var end = GetEndSegment(); var dist = end?.GetStart().DistanceSquared(pos) ?? float.MaxValue; - if (dist < 2000) { + if (dist < 1000) { // Still want to remove old segments Cleanup(); DidntMoveTicks++; @@ -51,6 +51,8 @@ virtual protected void Tick() { } DidntMoveTicks = 0; + if (dist < 5000) { return; } + AddTrailPoint(pos); } From 9d0197d5ede7159a0624f66aaf40c27663011d18 Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 19:33:34 -0700 Subject: [PATCH 5/6] 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; } From 1b15b2aef0a5215fa903b120a5865ee744bf7dbf Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 12 Aug 2024 19:35:13 -0700 Subject: [PATCH 6/6] Dont lowercase unnecessarily --- lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs | 3 +-- lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs b/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs index d42c769f..5738cb82 100644 --- a/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs +++ b/lang/Jailbreak.English/SpecialDay/SoloDayLocale.cs @@ -29,8 +29,7 @@ public virtual IView BeginsIn(int seconds) { public IView GenerateStartMessage() { var result = new SimpleView { - PREFIX, - { "Today is a" + (Name.ToLower()[0].IsVowel() ? "n" : ""), Name, "day!" } + PREFIX, { "Today is a" + (Name[0].IsVowel() ? "n" : ""), Name, "day!" } }; if (description.Length == 0) return result; diff --git a/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs b/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs index db32ee34..a10a2808 100644 --- a/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs +++ b/lang/Jailbreak.English/SpecialDay/TeamDayLocale.cs @@ -31,8 +31,7 @@ public virtual IView BeginsIn(int seconds) { public IView GenerateStartMessage() { var result = new SimpleView { - PREFIX, - { "Today is a" + (Name.ToLower()[0].IsVowel() ? "n" : ""), Name, "day!" } + PREFIX, { "Today is a" + (Name[0].IsVowel() ? "n" : ""), Name, "day!" } }; if (description.Length == 0) return result;