Skip to content

Commit

Permalink
Final tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Aug 13, 2024
1 parent c255917 commit 9d0197d
Show file tree
Hide file tree
Showing 22 changed files with 30 additions and 44 deletions.
14 changes: 3 additions & 11 deletions lang/Jailbreak.English/LastRequest/CoinflipLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
};
}
Expand All @@ -18,23 +18,15 @@ public IView GuardChose(CCSPlayerController guard, bool choice) {
return new SimpleView {
PREFIX,
guard,
" chose " + ChatColors.Green,
"chose" + ChatColors.Green,
choice ? "Heads" : "Tails",
ChatColors.Default + ", flipping..."
};
}

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"
};
}
}
6 changes: 3 additions & 3 deletions lang/Jailbreak.English/LastRequest/LastRequestLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
Expand Down
5 changes: 2 additions & 3 deletions mod/Jailbreak.Debug/Subcommands/DebugZone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDayCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public virtual IView ArmoryReminder

override protected IZone GetZone() {
var manager = provider.GetRequiredService<IZoneManager>();
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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public virtual IView CellReminder

override protected IZone GetZone() {
var manager = provider.GetRequiredService<IZoneManager>();
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(
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/CustomDay.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/FFADay.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/GunGameDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Jailbreak.Formatting.Views;
using Jailbreak.Formatting.Views.SpecialDay;

namespace Jailbreak.SpecialDay.SpecialDays;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/InfectionDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/NoScopeDay.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/OneInTheChamberDay.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/TeleportDay.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/WardayDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.Trail/ActivePlayerTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ virtual protected void Tick() {
}

DidntMoveTicks = 0;
if (dist < 5000) { return; }
if (dist < 5000) return;

AddTrailPoint(pos);
}
Expand Down
1 change: 0 additions & 1 deletion mod/Jailbreak.Warden/Global/WardenBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ public HookResult OnRoundStart(EventRoundStart ev, GameEventInfo info) {
firstWarden = true;
preWardenStats = null;


return HookResult.Continue;
}

Expand Down
2 changes: 2 additions & 0 deletions mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions public/Jailbreak.Formatting/Views/LastRequest/ILRLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions public/Jailbreak.Public/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
18 changes: 9 additions & 9 deletions public/Jailbreak.Validator/WeaponValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9d0197d

Please sign in to comment.