diff --git a/Jailbreak.sln.DotSettings b/Jailbreak.sln.DotSettings
index 256efc9f..f2391294 100644
--- a/Jailbreak.sln.DotSettings
+++ b/Jailbreak.sln.DotSettings
@@ -72,6 +72,7 @@
True
API
IO
+ LG
LR
ST
<Policy><Descriptor Staticness="Any" AccessRightKinds="Private, ProtectedInternal, Internal, PrivateProtected" Description="Non-Public Methods"><ElementKinds><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
@@ -83,6 +84,10 @@
<Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Parameters"><ElementKinds><Kind Name="PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="_" Suffix="" Style="aaBb" /></Policy></Policy>
<Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum members"><ElementKinds><Kind Name="ENUM_MEMBER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy>
<Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></Policy>
+ True
+ True
+ True
+ True
diff --git a/lang/Jailbreak.English/LastGuard/LastGuardNotifications.cs b/lang/Jailbreak.English/LastGuard/LastGuardNotifications.cs
index 31cf64aa..73a8d838 100644
--- a/lang/Jailbreak.English/LastGuard/LastGuardNotifications.cs
+++ b/lang/Jailbreak.English/LastGuard/LastGuardNotifications.cs
@@ -9,14 +9,14 @@ namespace Jailbreak.English.LastGuard;
public class LastGuardNotifications : ILastGuardNotifications,
ILanguage {
- public static readonly FormatObject PREFIX =
+ private static readonly FormatObject PREFIX =
new HiddenFormatObject(
$" {ChatColors.DarkRed}[{ChatColors.LightRed}Last Guard{ChatColors.DarkRed}]") {
// Hide in panorama and center text
Plain = false, Panorama = false, Chat = true
};
- public IView LG_STARTED(int ctHealth, int tHealth) {
+ public IView LGStarted(int ctHealth, int tHealth) {
return new SimpleView {
PREFIX,
$"{ChatColors.Red}Last Guard has been activated! Last guard has",
diff --git a/lang/Jailbreak.English/LastRequest/LastRequestMessages.cs b/lang/Jailbreak.English/LastRequest/LastRequestMessages.cs
index a25e4aca..324a5f2c 100644
--- a/lang/Jailbreak.English/LastRequest/LastRequestMessages.cs
+++ b/lang/Jailbreak.English/LastRequest/LastRequestMessages.cs
@@ -89,6 +89,22 @@ public IView LastRequestDecided(AbstractLastRequest lr, LRResult result) {
};
}
+ public IView CannotLR(string reason) {
+ return new SimpleView {
+ PREFIX,
+ $"{ChatColors.Red}You cannot LR: {ChatColors.White + reason + ChatColors.Red}."
+ };
+ }
+
+ public IView CannotLR(CCSPlayerController player, string reason) {
+ return new SimpleView {
+ PREFIX,
+ ChatColors.Red + "You cannot LR",
+ player,
+ ": " + ChatColors.White + reason + ChatColors.Red + "."
+ };
+ }
+
public IView DamageBlockedInsideLastRequest
=> new SimpleView { PREFIX, "You or they are in LR, damage blocked." };
diff --git a/lang/Jailbreak.English/LastRequest/RaceLRMessages.cs b/lang/Jailbreak.English/LastRequest/RaceLRMessages.cs
index 7fd52796..6f80ea4f 100644
--- a/lang/Jailbreak.English/LastRequest/RaceLRMessages.cs
+++ b/lang/Jailbreak.English/LastRequest/RaceLRMessages.cs
@@ -34,4 +34,20 @@ public IView RaceStartingMessage(CCSPlayerController prisoner) {
}
};
}
+
+ public IView NotInRaceLR()
+ => new SimpleView {
+ {
+ LastRequestMessages.PREFIX,
+ $"You must be in a race {ChatColors.Blue + "!lr" + ChatColors.White} to use this command"
+ }
+ };
+
+ public IView NotInPendingState()
+ => new SimpleView {
+ {
+ LastRequestMessages.PREFIX,
+ "You must be in the pending state to use this command."
+ }
+ };
}
\ No newline at end of file
diff --git a/lang/Jailbreak.English/Mute/PeaceMessages.cs b/lang/Jailbreak.English/Mute/PeaceMessages.cs
index 96a0fcb9..46dc2ba8 100644
--- a/lang/Jailbreak.English/Mute/PeaceMessages.cs
+++ b/lang/Jailbreak.English/Mute/PeaceMessages.cs
@@ -17,13 +17,13 @@ public class PeaceMessages : IPeaceMessages,
public IView PeaceEnactedByAdmin(int seconds) {
return new SimpleView {
- PREFIX, "An admin has enacted peace for", seconds, "seconds."
+ PREFIX, "An admin enacted peace for", seconds, "seconds."
};
}
public IView WardenEnactedPeace(int seconds) {
return new SimpleView {
- PREFIX, "Warden has enacted peace for", seconds, "seconds."
+ PREFIX, "Warden enacted peace for", seconds, "seconds."
};
}
diff --git a/lang/Jailbreak.English/Rebel/JihadC4Notifications.cs b/lang/Jailbreak.English/Rebel/JihadC4Notifications.cs
index b9a42880..6c99ecb6 100644
--- a/lang/Jailbreak.English/Rebel/JihadC4Notifications.cs
+++ b/lang/Jailbreak.English/Rebel/JihadC4Notifications.cs
@@ -7,7 +7,6 @@ namespace Jailbreak.English.Rebel;
public class JihadC4Notifications : IJihadC4Notifications,
ILanguage {
- // public IView JIHAD_C4_DROPPED => new SimpleView { RebelNotifications.PREFIX, "You dropped your Jihad C4!" };
public IView JihadC4Pickup
=> new SimpleView {
RebelNotifications.PREFIX, "You picked up a Jihad C4!"
@@ -21,11 +20,4 @@ public IView JihadC4Usage1
RebelNotifications.PREFIX,
$"To detonate it, hold it out and press {ChatColors.Yellow + "E" + ChatColors.Default}."
};
- // public IView JIHAD_C4_USAGE2 => new SimpleView { RebelNotifications.PREFIX, $"You can drop the C4 to other players with {ChatColors.Yellow + "G" + ChatColors.Default}." };
-
-
- // public IView PlayerDetonateC4(CCSPlayerController player)
- // {
- // return new SimpleView { RebelNotifications.PREFIX, $"{player.PlayerName} has detonated a Jihad C4!" };
- // }
}
\ No newline at end of file
diff --git a/lang/Jailbreak.English/Warden/SpecialTreatmentNotifications.cs b/lang/Jailbreak.English/Warden/SpecialTreatmentNotifications.cs
index 1b5cd05a..69bd087f 100644
--- a/lang/Jailbreak.English/Warden/SpecialTreatmentNotifications.cs
+++ b/lang/Jailbreak.English/Warden/SpecialTreatmentNotifications.cs
@@ -33,7 +33,7 @@ public IView GrantedTo(CCSPlayerController player) {
return new SimpleView {
PREFIX,
player,
- $"now has {ChatColors.Grey}Special Treatment{ChatColors.White}!"
+ $"now has {ChatColors.Green}Special Treatment{ChatColors.White}!"
};
}
diff --git a/lang/Jailbreak.English/Warden/WardenNotifications.cs b/lang/Jailbreak.English/Warden/WardenNotifications.cs
index a772cea4..8ecba9ce 100644
--- a/lang/Jailbreak.English/Warden/WardenNotifications.cs
+++ b/lang/Jailbreak.English/Warden/WardenNotifications.cs
@@ -17,7 +17,7 @@ public class WardenNotifications : IWardenNotifications,
Plain = false, Panorama = false, Chat = true
};
- public IView PICKING_SHORTLY
+ public IView PickingShortly
=> new SimpleView {
{ PREFIX, $"{ChatColors.Grey}Picking a warden shortly..." },
SimpleView.NEWLINE, {
@@ -26,59 +26,59 @@ public IView PICKING_SHORTLY
}
};
- public IView NO_WARDENS
+ public IView NoWardens
=> new SimpleView {
PREFIX,
$"No wardens in queue! The next player to run {ChatColors.Blue}!warden{ChatColors.White} will become a warden."
};
- public IView WARDEN_LEFT
+ public IView WardenLeft
=> new SimpleView { PREFIX, "The warden has left the game." };
- public IView WARDEN_DIED
+ public IView WardenDied
=> new SimpleView {
PREFIX,
$"{ChatColors.Red}The warden has {ChatColors.DarkRed}died{ChatColors.Red}! CTs must pursue {ChatColors.Blue}!warden{ChatColors.Red}."
};
- public IView BECOME_NEXT_WARDEN
+ public IView BecomeNextWarden
=> new SimpleView {
PREFIX,
$"{ChatColors.Grey}Type {ChatColors.Blue}!warden{ChatColors.Grey} to become the next warden"
};
- public IView JOIN_RAFFLE
+ public IView JoinRaffle
=> new SimpleView {
PREFIX,
$"{ChatColors.Grey}You've {ChatColors.Green}joined {ChatColors.Grey}the warden raffle."
};
- public IView LEAVE_RAFFLE
+ public IView LeaveRaffle
=> new SimpleView {
PREFIX,
$"{ChatColors.Grey}You've {ChatColors.Red}left {ChatColors.Grey}the warden raffle."
};
- public IView NOT_WARDEN
+ public IView NotWarden
=> new SimpleView {
PREFIX, $"{ChatColors.LightRed}You are not the warden."
};
- public IView FIRE_COMMAND_FAILED
+ public IView FireCommandFailed
=> new SimpleView {
PREFIX, "The fire command has failed to work for some unknown reason..."
};
- public IView PASS_WARDEN(CCSPlayerController player) {
+ public IView PassWarden(CCSPlayerController player) {
return new SimpleView { PREFIX, player, "resigned from being warden." };
}
- public IView FIRE_WARDEN(CCSPlayerController player) {
+ public IView FireWarden(CCSPlayerController player) {
return new SimpleView { PREFIX, player, "was fired from being warden." };
}
- public IView FIRE_WARDEN(CCSPlayerController player,
- CCSPlayerController admin) {
+ public IView
+ FireWarden(CCSPlayerController player, CCSPlayerController admin) {
return new SimpleView {
PREFIX,
admin,
@@ -88,17 +88,17 @@ public IView FIRE_WARDEN(CCSPlayerController player,
};
}
- public IView NEW_WARDEN(CCSPlayerController player) {
+ public IView NewWarden(CCSPlayerController player) {
return new SimpleView { PREFIX, player, "is now the warden!" };
}
- public IView CURRENT_WARDEN(CCSPlayerController? player) {
- if (player is not null)
- return new SimpleView { PREFIX, "The warden is", player, "." };
- return new SimpleView { PREFIX, "There is no warden." };
+ public IView CurrentWarden(CCSPlayerController? player) {
+ return player is not null ?
+ new SimpleView { PREFIX, "The warden is", player, "." } :
+ new SimpleView { PREFIX, "There is no warden." };
}
- public IView FIRE_COMMAND_SUCCESS(CCSPlayerController player) {
+ public IView FireCommandSuccess(CCSPlayerController player) {
return new SimpleView {
PREFIX, player, "was fired and is no longer the warden."
};
diff --git a/mod/Jailbreak.Debug/Subcommands/AbstractCommand.cs b/mod/Jailbreak.Debug/Subcommands/AbstractCommand.cs
index 3afa1ae8..b75e57fc 100644
--- a/mod/Jailbreak.Debug/Subcommands/AbstractCommand.cs
+++ b/mod/Jailbreak.Debug/Subcommands/AbstractCommand.cs
@@ -75,14 +75,11 @@ public abstract void OnCommand(CCSPlayerController? executor,
return null;
}
- if (matches.Count() > 1) {
- if (command.CallingPlayer != null)
- lang.PlayerFoundMultiple(command.GetArg(argIndex))
- .ToPlayerChat(command.CallingPlayer);
- return null;
- }
-
- return matches;
+ if (matches.Count() <= 1) return matches;
+ if (command.CallingPlayer != null)
+ lang.PlayerFoundMultiple(command.GetArg(argIndex))
+ .ToPlayerChat(command.CallingPlayer);
+ return null;
}
protected string GetTargetLabel(WrappedInfo info, int argIndex = 1) {
@@ -126,7 +123,7 @@ protected string GetTargetLabels(WrappedInfo info, int argIndex = 1) {
protected string GetTargetLabels(CommandInfo info, int argIndex = 1) {
var label = GetTargetLabel(info, argIndex);
- if (label.ToLower().EndsWith("s")) return label + "'";
+ if (label.ToLower().EndsWith('s')) return label + "'";
return label + "'s";
}
}
diff --git a/mod/Jailbreak.Debug/Subcommands/LastRequest.cs b/mod/Jailbreak.Debug/Subcommands/LastRequest.cs
index e1534f32..4fdabdf2 100644
--- a/mod/Jailbreak.Debug/Subcommands/LastRequest.cs
+++ b/mod/Jailbreak.Debug/Subcommands/LastRequest.cs
@@ -35,22 +35,25 @@ public override void OnCommand(CCSPlayerController? executor,
WrappedInfo info) {
if (executor == null || !executor.IsReal()) return;
- if (info.ArgCount == 1) {
- MenuManager.OpenCenterHtmlMenu(plugin, executor, menuSelector.GetMenu());
- return;
- }
+ switch (info.ArgCount) {
+ case 1:
+ MenuManager.OpenCenterHtmlMenu(plugin, executor,
+ menuSelector.GetMenu());
+ return;
+ case 2:
+ switch (info.GetArg(1).ToLower()) {
+ case "enable":
+ manager.EnableLR();
+ info.ReplyToCommand("Last Request enabled.");
+ return;
+ case "disable":
+ manager.DisableLR();
+ info.ReplyToCommand("Last Request disabled.");
+ return;
+ }
- if (info.ArgCount == 2)
- switch (info.GetArg(1).ToLower()) {
- case "enable":
- manager.EnableLR();
- info.ReplyToCommand("Last Request enabled.");
- return;
- case "disable":
- manager.DisableLR();
- info.ReplyToCommand("Last Request disabled.");
- return;
- }
+ break;
+ }
var type = LRTypeExtensions.FromString(info.GetArg(1));
if (type is null) {
@@ -69,7 +72,7 @@ public override void OnCommand(CCSPlayerController? executor,
if (fromPlayer == null) return;
switch (info.ArgCount) {
- case 3 when executor != null: {
+ case 3: {
if (executor.Team == CsTeam.Terrorist)
manager.InitiateLastRequest(executor, fromPlayer.First(), type.Value);
else // They aren't necessarily on different teams, but this is debug so that's OK
diff --git a/mod/Jailbreak.LastGuard/LastGuard.cs b/mod/Jailbreak.LastGuard/LastGuard.cs
index 7654a885..cdc98a06 100644
--- a/mod/Jailbreak.LastGuard/LastGuard.cs
+++ b/mod/Jailbreak.LastGuard/LastGuard.cs
@@ -11,84 +11,94 @@
namespace Jailbreak.LastGuard;
-public class LastGuard(LastGuardConfig config, ILastGuardNotifications notifications, ILastRequestManager lrManager)
- : ILastGuardService, IPluginBehavior
-{
- private bool canStart;
-
- [GameEventHandler]
- public HookResult OnPlayerDeathEvent(EventPlayerDeath @event, GameEventInfo info)
- {
- checkLastGuard(@event.Userid);
- return HookResult.Continue;
- }
-
- [GameEventHandler]
- public HookResult OnPlayerDisconnect(EventPlayerDisconnect @event, GameEventInfo info)
- {
- checkLastGuard(@event.Userid);
- return HookResult.Continue;
- }
-
- private void checkLastGuard(CCSPlayerController? poi)
- {
- if (poi == null) return;
- if (poi.Team != CsTeam.CounterTerrorist) return;
- var aliveCts = Utilities.GetPlayers()
- .Count(plr => plr.IsReal() && plr is { PawnIsAlive: true, Team: CsTeam.CounterTerrorist }) - 1;
-
- if (aliveCts != 1 || lrManager.IsLREnabled) return;
- var lastGuard = Utilities.GetPlayers().First(plr =>
- plr.IsReal() && plr != poi && plr is { PawnIsAlive: true, Team: CsTeam.CounterTerrorist });
-
- if (canStart)
- StartLastGuard(lastGuard);
- }
-
- [GameEventHandler]
- public HookResult OnRoundStartEvent(EventRoundStart @event, GameEventInfo info)
- {
- canStart = Utilities.GetPlayers()
- .Count(plr => plr.IsReal() && plr is { PawnIsAlive: true, Team: CsTeam.CounterTerrorist }) >=
- config.MinimumCTs;
- return HookResult.Continue;
- }
-
- public int CalculateHealth()
- {
- var aliveTerrorists = Utilities.GetPlayers()
- .Where(plr => plr.IsReal() && plr is { PawnIsAlive: true, Team: CsTeam.Terrorist }).ToList();
-
- return aliveTerrorists.Select(player => player.PlayerPawn?.Value?.Health ?? 0)
- .Select(playerHealth => (int)(Math.Min(playerHealth, 200) * 0.8)).Sum();
- }
-
- public void StartLastGuard(CCSPlayerController lastGuard)
- {
- var guardPlayerPawn = lastGuard.PlayerPawn.Value;
-
- if (guardPlayerPawn == null || !guardPlayerPawn.IsValid) return;
-
- var guardCalcHealth = CalculateHealth();
-
- guardPlayerPawn.Health = guardCalcHealth;
- Utilities.SetStateChanged(guardPlayerPawn, "CBaseEntity", "m_iHealth");
-
- // foreach (var player in Utilities.GetPlayers().Where(p => p.IsReal()))
- // player.ExecuteClientCommand("play sounds/lastct");
-
- var aliveTerrorists = Utilities.GetPlayers()
- .Where(p => p.IsReal() && p is { PawnIsAlive: true, Team: CsTeam.Terrorist }).ToList();
-
- var prisonerHp = aliveTerrorists.Sum(prisoner => prisoner.PlayerPawn?.Value?.Health ?? 0);
-
- notifications.LG_STARTED(guardCalcHealth, prisonerHp).ToAllCenter().ToAllChat();
-
- if (string.IsNullOrEmpty(config.LastGuardWeapon)) return;
-
- foreach (var player in aliveTerrorists)
- {
- player.GiveNamedItem(config.LastGuardWeapon);
- }
- }
+public class LastGuard(LastGuardConfig config,
+ ILastGuardNotifications notifications, ILastRequestManager lrManager)
+ : ILastGuardService, IPluginBehavior {
+ private bool canStart;
+
+ public int CalculateHealth() {
+ var aliveTerrorists = Utilities.GetPlayers()
+ .Where(plr
+ => plr.IsReal() && plr is { PawnIsAlive: true, Team: CsTeam.Terrorist })
+ .ToList();
+
+ return aliveTerrorists
+ .Select(player => player.PlayerPawn?.Value?.Health ?? 0)
+ .Select(playerHealth => (int)(Math.Min(playerHealth, 200) * 0.8))
+ .Sum();
+ }
+
+ public void StartLastGuard(CCSPlayerController lastGuard) {
+ var guardPlayerPawn = lastGuard.PlayerPawn.Value;
+
+ if (guardPlayerPawn == null || !guardPlayerPawn.IsValid) return;
+
+ var guardCalcHealth = CalculateHealth();
+
+ guardPlayerPawn.Health = guardCalcHealth;
+ Utilities.SetStateChanged(guardPlayerPawn, "CBaseEntity", "m_iHealth");
+
+ // foreach (var player in Utilities.GetPlayers().Where(p => p.IsReal()))
+ // player.ExecuteClientCommand("play sounds/lastct");
+
+ var aliveTerrorists = Utilities.GetPlayers()
+ .Where(p
+ => p.IsReal() && p is { PawnIsAlive: true, Team: CsTeam.Terrorist })
+ .ToList();
+
+ var prisonerHp =
+ aliveTerrorists.Sum(prisoner => prisoner.PlayerPawn?.Value?.Health ?? 0);
+
+ notifications.LGStarted(guardCalcHealth, prisonerHp)
+ .ToAllCenter()
+ .ToAllChat();
+
+ if (string.IsNullOrEmpty(config.LastGuardWeapon)) return;
+
+ foreach (var player in aliveTerrorists)
+ player.GiveNamedItem(config.LastGuardWeapon);
+ }
+
+ [GameEventHandler]
+ public HookResult OnPlayerDeathEvent(EventPlayerDeath @event,
+ GameEventInfo info) {
+ checkLastGuard(@event.Userid);
+ return HookResult.Continue;
+ }
+
+ [GameEventHandler]
+ public HookResult OnPlayerDisconnect(EventPlayerDisconnect @event,
+ GameEventInfo info) {
+ checkLastGuard(@event.Userid);
+ return HookResult.Continue;
+ }
+
+ private void checkLastGuard(CCSPlayerController? poi) {
+ if (poi == null) return;
+ if (poi.Team != CsTeam.CounterTerrorist) return;
+ var aliveCts = Utilities.GetPlayers()
+ .Count(plr
+ => plr.IsReal() && plr is {
+ PawnIsAlive: true, Team: CsTeam.CounterTerrorist
+ }) - 1;
+
+ if (aliveCts != 1 || lrManager.IsLREnabled) return;
+ var lastGuard = Utilities.GetPlayers()
+ .First(plr => plr.IsReal() && plr != poi && plr is {
+ PawnIsAlive: true, Team: CsTeam.CounterTerrorist
+ });
+
+ if (canStart) StartLastGuard(lastGuard);
+ }
+
+ [GameEventHandler]
+ public HookResult OnRoundStartEvent(EventRoundStart @event,
+ GameEventInfo info) {
+ canStart = Utilities.GetPlayers()
+ .Count(plr
+ => plr.IsReal() && plr is {
+ PawnIsAlive: true, Team: CsTeam.CounterTerrorist
+ }) >= config.MinimumCTs;
+ return HookResult.Continue;
+ }
}
\ No newline at end of file
diff --git a/mod/Jailbreak.LastRequest/EndRaceCommand.cs b/mod/Jailbreak.LastRequest/EndRaceCommand.cs
index 958bf106..53ba6440 100644
--- a/mod/Jailbreak.LastRequest/EndRaceCommand.cs
+++ b/mod/Jailbreak.LastRequest/EndRaceCommand.cs
@@ -1,13 +1,16 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Commands;
+using Jailbreak.Formatting.Extensions;
+using Jailbreak.Formatting.Views;
using Jailbreak.Public.Behaviors;
using Jailbreak.Public.Mod.LastRequest;
using Jailbreak.Public.Mod.LastRequest.Enums;
namespace Jailbreak.LastRequest;
-public class EndRaceCommand(ILastRequestManager lrManager) : IPluginBehavior {
+public class EndRaceCommand(ILastRequestManager lrManager,
+ IRaceLRMessages messages) : IPluginBehavior {
[ConsoleCommand("css_endrace", "Used to set the end point of a race LR")]
[CommandHelper(whoCanExecute: CommandUsage.CLIENT_ONLY)]
public void Command_EndRace(CCSPlayerController? executor, CommandInfo info) {
@@ -15,13 +18,12 @@ public void Command_EndRace(CCSPlayerController? executor, CommandInfo info) {
var lr = lrManager.GetActiveLR(executor);
if (lr is not { Type: LRType.RACE }) {
- info.ReplyToCommand("You must be in a race LR to use this command.");
+ messages.NotInRaceLR().ToPlayerChat(executor);
return;
}
if (lr.State != LRState.PENDING) {
- info.ReplyToCommand(
- "You must be in the pending state to use this command.");
+ messages.NotInPendingState().ToPlayerChat(executor);
return;
}
diff --git a/mod/Jailbreak.LastRequest/LastRequestCommand.cs b/mod/Jailbreak.LastRequest/LastRequestCommand.cs
index acaaee77..d01994ff 100644
--- a/mod/Jailbreak.LastRequest/LastRequestCommand.cs
+++ b/mod/Jailbreak.LastRequest/LastRequestCommand.cs
@@ -31,28 +31,29 @@ public void Start(BasePlugin basePlugin) {
public void Command_LastRequest(CCSPlayerController? executor,
CommandInfo info) {
if (executor == null || !executor.IsReal()) return;
- if (executor.Team != CsTeam.Terrorist) {
- info.ReplyToCommand("You must be a terrorist to LR.");
+ if (!manager.IsLREnabled) {
+ messages.LastRequestNotEnabled().ToPlayerChat(executor);
return;
}
- if (!executor.PawnIsAlive) {
- info.ReplyToCommand("You must be alive to LR.");
+ if (executor.Team != CsTeam.Terrorist) {
+ messages.CannotLR("You are not a Prisoner").ToPlayerChat(executor);
return;
}
- if (!manager.IsLREnabled) {
- messages.LastRequestNotEnabled().ToPlayerChat(executor);
+ if (!executor.PawnIsAlive) {
+ messages.CannotLR("You are not alive").ToPlayerChat(executor);
return;
}
+
if (!playerSelector!.WouldHavePlayers()) {
- info.ReplyToCommand("There are no players available to LR.");
+ messages.CannotLR("No players available to LR").ToPlayerChat(executor);
return;
}
if (manager.IsInLR(executor)) {
- info.ReplyToCommand("You are already in an LR!");
+ messages.CannotLR("You are already in an LR").ToPlayerChat(executor);
return;
}
@@ -89,23 +90,18 @@ public void Command_LastRequest(CCSPlayerController? executor,
var player = target.Players.First();
if (player.Team != CsTeam.CounterTerrorist) {
- messages.InvalidPlayerChoice(player, "They're not on CT!");
+ messages.CannotLR(player, "They are not a Guard").ToPlayerChat(executor);
return;
}
if (!player.PawnIsAlive) {
- messages.InvalidPlayerChoice(player, "They're not alive!");
+ messages.CannotLR(player, "They are not alive").ToPlayerChat(executor);
return;
}
if (manager.IsInLR(player)) {
- messages.InvalidPlayerChoice(player, "They're already in an LR!");
- return;
- }
-
- //One final check in case they got the menu open in the last round
- if (!manager.IsLREnabled) {
- messages.LastRequestNotEnabled().ToPlayerChat(executor);
+ messages.CannotLR(player, "They are already in an LR")
+ .ToPlayerChat(executor);
return;
}
diff --git a/mod/Jailbreak.LastRequest/LastRequestManager.cs b/mod/Jailbreak.LastRequest/LastRequestManager.cs
index 0e5c19c3..a563eecf 100644
--- a/mod/Jailbreak.LastRequest/LastRequestManager.cs
+++ b/mod/Jailbreak.LastRequest/LastRequestManager.cs
@@ -31,14 +31,13 @@ public bool ShouldBlockDamage(CCSPlayerController player,
// Neither of them is in an LR
return false;
- if (playerLR == null != (attackerLR == null)) {
+ if ((playerLR == null) != (attackerLR == null)) {
// One of them is in an LR
messages.DamageBlockedInsideLastRequest.ToPlayerCenter(attacker);
return true;
}
- // Both of them are in LR
- // verify they're in same LR
+ // Both of them are in LR, verify they're in same LR
if (playerLR == null) return false;
if (playerLR.Prisoner.Equals(attacker) || playerLR.Guard.Equals(attacker))
@@ -75,31 +74,25 @@ public void EnableLR(CCSPlayerController? died = null) {
public bool InitiateLastRequest(CCSPlayerController prisoner,
CCSPlayerController guard, LRType type) {
- try {
- var lr = factory!.CreateLastRequest(prisoner, guard, type);
- lr.Setup();
- ActiveLRs.Add(lr);
-
- if (prisoner.Pawn.Value != null) {
- prisoner.Pawn.Value.Health = 100;
- prisoner.PlayerPawn.Value!.ArmorValue = 0;
- Utilities.SetStateChanged(prisoner.Pawn.Value, "CBaseEntity",
- "m_iHealth");
- }
-
-
- if (guard.Pawn.Value != null) {
- guard.Pawn.Value.Health = 100;
- guard.PlayerPawn.Value!.ArmorValue = 0;
- Utilities.SetStateChanged(guard.Pawn.Value, "CBaseEntity", "m_iHealth");
- }
+ var lr = factory!.CreateLastRequest(prisoner, guard, type);
+ lr.Setup();
+ ActiveLRs.Add(lr);
+
+ if (prisoner.Pawn.Value != null) {
+ prisoner.Pawn.Value.Health = 100;
+ prisoner.PlayerPawn.Value!.ArmorValue = 0;
+ Utilities.SetStateChanged(prisoner.Pawn.Value, "CBaseEntity",
+ "m_iHealth");
+ }
- messages.InformLastRequest(lr).ToAllChat();
- return true;
- } catch (ArgumentException e) {
- Console.WriteLine(e);
- return false;
+ if (guard.Pawn.Value != null) {
+ guard.Pawn.Value.Health = 100;
+ guard.PlayerPawn.Value!.ArmorValue = 0;
+ Utilities.SetStateChanged(guard.Pawn.Value, "CBaseEntity", "m_iHealth");
}
+
+ messages.InformLastRequest(lr).ToAllChat();
+ return true;
}
public bool EndLastRequest(AbstractLastRequest lr, LRResult result) {
@@ -156,11 +149,11 @@ public HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info) {
if (IsLREnabled) {
// Handle active LRs
var activeLr = ((ILastRequestManager)this).GetActiveLR(player);
- if (activeLr != null && activeLr.State != LRState.COMPLETED) {
- var isPrisoner = activeLr.Prisoner.Slot == player.Slot;
- EndLastRequest(activeLr,
- isPrisoner ? LRResult.GUARD_WIN : LRResult.PRISONER_WIN);
- }
+ if (activeLr == null || activeLr.State == LRState.COMPLETED)
+ return HookResult.Continue;
+ var isPrisoner = activeLr.Prisoner.Slot == player.Slot;
+ EndLastRequest(activeLr,
+ isPrisoner ? LRResult.GUARD_WIN : LRResult.PRISONER_WIN);
return HookResult.Continue;
}
@@ -184,15 +177,15 @@ public HookResult OnPlayerDisconnect(EventPlayerDisconnect @event,
if (!player.IsReal() || ServerExtensions.GetGameRules().WarmupPeriod)
return HookResult.Continue;
- if (IsLREnabled) return HookResult.Continue;
-
- var activeLr = ((ILastRequestManager)this).GetActiveLR(player);
+ if (IsLREnabled) {
+ var activeLr = ((ILastRequestManager)this).GetActiveLR(player);
+ if (activeLr != null) {
+ EndLastRequest(activeLr,
+ player.Team == CsTeam.Terrorist ?
+ LRResult.GUARD_WIN :
+ LRResult.PRISONER_WIN);
+ }
- if (activeLr != null && activeLr.State != LRState.ACTIVE) {
- EndLastRequest(activeLr,
- player.Team == CsTeam.Terrorist ?
- LRResult.GUARD_WIN :
- LRResult.PRISONER_WIN);
return HookResult.Continue;
}
diff --git a/mod/Jailbreak.LastRequest/LastRequestPlayerSelector.cs b/mod/Jailbreak.LastRequest/LastRequestPlayerSelector.cs
index fb1cf0a6..a984fcbc 100644
--- a/mod/Jailbreak.LastRequest/LastRequestPlayerSelector.cs
+++ b/mod/Jailbreak.LastRequest/LastRequestPlayerSelector.cs
@@ -13,13 +13,12 @@ public CenterHtmlMenu CreateMenu(CCSPlayerController player,
Func command) {
var menu = new CenterHtmlMenu(command.Invoke("[Player]"), plugin);
- foreach (var target in Utilities.GetPlayers()) {
- if (!target.IsReal()) continue;
- if (!target.PawnIsAlive
- || target.Team != CsTeam.CounterTerrorist && !debug)
- continue;
+ foreach (var target in Utilities.GetPlayers()
+ .Where(target => target.IsReal())
+ .Where(target => target.PawnIsAlive
+ && (target.Team == CsTeam.CounterTerrorist || debug))) {
menu.AddMenuOption(target.PlayerName,
- (_, _) => OnSelect(player, command, target.UserId.ToString()),
+ (_, _) => onSelect(player, command, target.UserId.ToString()),
!debug && manager.IsInLR(target));
}
@@ -33,7 +32,7 @@ public bool WouldHavePlayers() {
});
}
- private void OnSelect(CCSPlayerController player,
+ private void onSelect(CCSPlayerController player,
Func command, string? value) {
MenuManager.CloseActiveMenu(player);
player.ExecuteClientCommandFromServer(command.Invoke(value));
diff --git a/mod/Jailbreak.Logs/Listeners/LogEntityParentListeners.cs b/mod/Jailbreak.Logs/Listeners/LogEntityParentListeners.cs
index 6276a252..9ca9d771 100644
--- a/mod/Jailbreak.Logs/Listeners/LogEntityParentListeners.cs
+++ b/mod/Jailbreak.Logs/Listeners/LogEntityParentListeners.cs
@@ -53,11 +53,13 @@ public void OnEntityParentChanged(CEntityInstance affectedEntity,
?.OriginalController.Get();
if (weaponPickerUpper == null) return;
- if (weaponPickerUpper == weaponOwner)
- {
- logs.Append(weaponPickerUpper, $"picked up their {weaponEntity.ToFriendlyString()}");
- return;
+ if (weaponPickerUpper == weaponOwner) {
+ logs.Append(weaponPickerUpper,
+ $"picked up their {weaponEntity.ToFriendlyString()}");
+ return;
}
- logs.Append(weaponPickerUpper, "picked up", logs.Player(weaponOwner), $"{weaponEntity.ToFriendlyString()}");
+
+ logs.Append(weaponPickerUpper, "picked up", logs.Player(weaponOwner),
+ $"{weaponEntity.ToFriendlyString()}");
}
}
\ No newline at end of file
diff --git a/mod/Jailbreak.Logs/LogsManager.cs b/mod/Jailbreak.Logs/LogsManager.cs
index 8676dcd7..10f76f43 100644
--- a/mod/Jailbreak.Logs/LogsManager.cs
+++ b/mod/Jailbreak.Logs/LogsManager.cs
@@ -11,19 +11,12 @@
namespace Jailbreak.Logs;
-public class LogsManager : IPluginBehavior, IRichLogService {
+public class LogsManager(ILogMessages messages, IRichPlayerTag richPlayerTag)
+ : IPluginBehavior, IRichLogService {
private readonly List logMessages = [];
- private readonly ILogMessages messages;
-
- private readonly IRichPlayerTag richPlayerTag;
-
- public LogsManager(ILogMessages messages, IRichPlayerTag richPlayerTag) {
- this.messages = messages;
- this.richPlayerTag = richPlayerTag;
- }
public void Append(string message) {
- logMessages.Add(messages.CREATE_LOG(message));
+ logMessages.Add(messages.CreateLog(message));
}
public IEnumerable GetMessages() {
@@ -37,7 +30,6 @@ public void PrintLogs(CCSPlayerController? player) {
messages.BeginJailbreakLogs.ToServerConsole();
foreach (var log in logMessages) log.ToServerConsole();
messages.EndJailbreakLogs.ToServerConsole();
-
return;
}
@@ -48,7 +40,7 @@ public void PrintLogs(CCSPlayerController? player) {
}
public void Append(params FormatObject[] objects) {
- logMessages.Add(messages.CREATE_LOG(objects));
+ logMessages.Add(messages.CreateLog(objects));
}
public FormatObject Player(CCSPlayerController playerController) {
@@ -67,7 +59,6 @@ public HookResult OnRoundEnd(EventRoundEnd @event, GameEventInfo info) {
foreach (var log in logMessages) log.ToServerConsole().ToAllConsole();
messages.EndJailbreakLogs.ToServerConsole().ToAllConsole();
-
return HookResult.Continue;
}
diff --git a/mod/Jailbreak.Logs/LogsServiceExtension.cs b/mod/Jailbreak.Logs/LogsServiceExtension.cs
index caa470ef..cc64d2ba 100644
--- a/mod/Jailbreak.Logs/LogsServiceExtension.cs
+++ b/mod/Jailbreak.Logs/LogsServiceExtension.cs
@@ -13,15 +13,15 @@ public static void AddJailbreakLogs(this IServiceCollection services) {
services.AddTransient(provider
=> provider.GetRequiredService());
- services.AddPluginBehavior();
+ services.AddPluginBehavior();
- services.AddPluginBehavior();
- services.AddPluginBehavior();
- services.AddPluginBehavior();
+ services.AddPluginBehavior();
+ services.AddPluginBehavior();
+ services.AddPluginBehavior();
- // PlayerTagHelper is a lower-level class that avoids dependency loops.
- services.AddTransient();
- services.AddTransient();
- }
+ // PlayerTagHelper is a lower-level class that avoids dependency loops.
+ services.AddTransient();
+ services.AddTransient();
+ }
}
\ No newline at end of file
diff --git a/mod/Jailbreak.Logs/Tags/PlayerTagHelper.cs b/mod/Jailbreak.Logs/Tags/PlayerTagHelper.cs
index ac29d73d..87c1e178 100644
--- a/mod/Jailbreak.Logs/Tags/PlayerTagHelper.cs
+++ b/mod/Jailbreak.Logs/Tags/PlayerTagHelper.cs
@@ -10,21 +10,17 @@
namespace Jailbreak.Logs.Tags;
-public class PlayerTagHelper : IRichPlayerTag {
- private readonly Lazy rebelService;
- private readonly Lazy stService;
- private readonly Lazy wardenService;
-
- public PlayerTagHelper(IServiceProvider provider) {
- // Lazy-load dependencies to avoid loops, since we are a lower-level class.
- wardenService =
- new Lazy(provider.GetRequiredService);
- rebelService =
- new Lazy(provider.GetRequiredService);
- stService =
- new Lazy(provider
- .GetRequiredService);
- }
+public class PlayerTagHelper(IServiceProvider provider) : IRichPlayerTag {
+ private readonly Lazy rebelService =
+ new(provider.GetRequiredService);
+
+ private readonly Lazy stService =
+ new(provider.GetRequiredService);
+
+ private readonly Lazy wardenService =
+ new(provider.GetRequiredService);
+
+ // Lazy-load dependencies to avoid loops, since we are a lower-level class.
public FormatObject Rich(CCSPlayerController player) {
if (wardenService.Value.IsWarden(player))
diff --git a/mod/Jailbreak.Mute/MuteSystem.cs b/mod/Jailbreak.Mute/MuteSystem.cs
index 7c89be7f..fb9f8cab 100644
--- a/mod/Jailbreak.Mute/MuteSystem.cs
+++ b/mod/Jailbreak.Mute/MuteSystem.cs
@@ -162,18 +162,16 @@ private void OnPlayerSpeak(int playerSlot) {
return;
}
- if (bypassMute(player)) {
- // Warn admins if they're not muted
- if (IsPeaceEnabled()) {
- if (player.Team == CsTeam.CounterTerrorist
- && DateTime.Now >= ctPeaceEnd)
- return;
- messages!.PeaceReminder.ToPlayerCenter(player);
- }
-
- if (!player.PawnIsAlive)
- messages!.AdminDeadReminder.ToPlayerCenter(player);
+ if (!bypassMute(player)) return;
+
+ // Warn admins if they're not muted
+ if (IsPeaceEnabled()) {
+ if (player.Team == CsTeam.CounterTerrorist && DateTime.Now >= ctPeaceEnd)
+ return;
+ messages!.PeaceReminder.ToPlayerCenter(player);
}
+
+ if (!player.PawnIsAlive) messages!.AdminDeadReminder.ToPlayerCenter(player);
}
private bool isMuted(CCSPlayerController player) {
diff --git a/mod/Jailbreak.Warden/Commands/PeaceCommandsBehavior.cs b/mod/Jailbreak.Warden/Commands/PeaceCommandsBehavior.cs
index f4c34414..93189832 100644
--- a/mod/Jailbreak.Warden/Commands/PeaceCommandsBehavior.cs
+++ b/mod/Jailbreak.Warden/Commands/PeaceCommandsBehavior.cs
@@ -32,7 +32,7 @@ public void Command_Peace(CCSPlayerController? executor, CommandInfo info) {
if (!warden.IsWarden(executor)
&& !AdminManager.PlayerHasPermissions(executor, "@css/chat")) {
- notifications.NOT_WARDEN.ToPlayerChat(executor);
+ notifications.NotWarden.ToPlayerChat(executor);
return;
}
diff --git a/mod/Jailbreak.Warden/Commands/RollCommandBehavior.cs b/mod/Jailbreak.Warden/Commands/RollCommandBehavior.cs
index 49ae9c1b..293b5f6e 100644
--- a/mod/Jailbreak.Warden/Commands/RollCommandBehavior.cs
+++ b/mod/Jailbreak.Warden/Commands/RollCommandBehavior.cs
@@ -21,7 +21,7 @@ public void Command_Toggle(CCSPlayerController? player, CommandInfo command) {
if (player == null) return;
if (!warden.IsWarden(player)) {
- wardenNotifications.NOT_WARDEN.ToPlayerChat(player);
+ wardenNotifications.NotWarden.ToPlayerChat(player);
return;
}
diff --git a/mod/Jailbreak.Warden/Commands/SpecialTreatmentCommandsBehavior.cs b/mod/Jailbreak.Warden/Commands/SpecialTreatmentCommandsBehavior.cs
index 10e09fb9..b62390ee 100644
--- a/mod/Jailbreak.Warden/Commands/SpecialTreatmentCommandsBehavior.cs
+++ b/mod/Jailbreak.Warden/Commands/SpecialTreatmentCommandsBehavior.cs
@@ -21,7 +21,7 @@ public void Command_Toggle(CCSPlayerController? player, CommandInfo command) {
if (player == null) return;
if (!warden.IsWarden(player)) {
- wardenNotifs.NOT_WARDEN.ToPlayerChat(player).ToPlayerConsole(player);
+ wardenNotifs.NotWarden.ToPlayerChat(player).ToPlayerConsole(player);
return;
}
diff --git a/mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs b/mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs
index 77d0f7a6..69e859cc 100644
--- a/mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs
+++ b/mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs
@@ -34,14 +34,14 @@ public void Command_Pass(CCSPlayerController? player, CommandInfo command) {
if (!warden.IsWarden(player)) return;
// Handle warden pass
- notifications.PASS_WARDEN(player).ToAllChat().ToAllCenter();
+ notifications.PassWarden(player).ToAllChat().ToAllCenter();
// GetPlayers() returns valid players, no need to error check here.
foreach (var clients in Utilities.GetPlayers())
clients.ExecuteClientCommand(
$"play sounds/{config.WardenPassedSoundName}");
- notifications.BECOME_NEXT_WARDEN.ToAllChat();
+ notifications.BecomeNextWarden.ToAllChat();
if (!warden.TryRemoveWarden(true))
Server.PrintToChatAll("[BUG] Couldn't remove warden :^(");
@@ -55,7 +55,7 @@ public void Command_Fire(CCSPlayerController? player, CommandInfo command) {
if (player == null) return;
if (!warden.HasWarden || warden.Warden == null) {
- notifications.CURRENT_WARDEN(null).ToPlayerChat(player);
+ notifications.CurrentWarden(null).ToPlayerChat(player);
return;
}
@@ -66,15 +66,15 @@ public void Command_Fire(CCSPlayerController? player, CommandInfo command) {
foreach (var client in Utilities.GetPlayers().Where(p => p.IsReal())) {
if (AdminManager.PlayerHasPermissions(client, "@css/chat"))
- notifications.FIRE_WARDEN(warden.Warden, player).ToPlayerChat(client);
+ notifications.FireWarden(warden.Warden, player).ToPlayerChat(client);
else
- notifications.FIRE_WARDEN(warden.Warden).ToPlayerChat(client);
+ notifications.FireWarden(warden.Warden).ToPlayerChat(client);
client.ExecuteClientCommand(
$"play sounds/{config.WardenPassedSoundName}");
}
- notifications.BECOME_NEXT_WARDEN.ToAllChat();
+ notifications.BecomeNextWarden.ToAllChat();
lastPassCommand[warden.Warden] = DateTime.Now;
@@ -106,13 +106,13 @@ public void Command_Warden(CCSPlayerController? player, CommandInfo command) {
if (queue.Active) {
if (!queue.InQueue(player)) {
if (queue.TryEnter(player))
- notifications.JOIN_RAFFLE.ToPlayerChat(player);
+ notifications.JoinRaffle.ToPlayerChat(player);
return;
}
if (queue.InQueue(player))
if (queue.TryExit(player))
- notifications.LEAVE_RAFFLE.ToPlayerChat(player);
+ notifications.LeaveRaffle.ToPlayerChat(player);
return;
}
@@ -122,7 +122,7 @@ public void Command_Warden(CCSPlayerController? player, CommandInfo command) {
if (warden.TrySetWarden(player))
return;
- notifications.CURRENT_WARDEN(warden.Warden).ToPlayerChat(player);
+ notifications.CurrentWarden(warden.Warden).ToPlayerChat(player);
}
///
diff --git a/mod/Jailbreak.Warden/Extensions/WardenFormatWriterExtensions.cs b/mod/Jailbreak.Warden/Extensions/WardenFormatWriterExtensions.cs
deleted file mode 100644
index 2736bc3c..00000000
--- a/mod/Jailbreak.Warden/Extensions/WardenFormatWriterExtensions.cs
+++ /dev/null
@@ -1,3 +0,0 @@
-namespace Jailbreak.Warden.Extensions;
-
-public class WardenFormatWriterExtensions { }
\ No newline at end of file
diff --git a/mod/Jailbreak.Warden/Global/WardenBehavior.cs b/mod/Jailbreak.Warden/Global/WardenBehavior.cs
index 4bd7b2bb..fe562321 100644
--- a/mod/Jailbreak.Warden/Global/WardenBehavior.cs
+++ b/mod/Jailbreak.Warden/Global/WardenBehavior.cs
@@ -71,7 +71,7 @@ public bool TrySetWarden(CCSPlayerController controller) {
"m_clrRender");
}
- notifications.NEW_WARDEN(Warden).ToAllChat().ToAllCenter();
+ notifications.NewWarden(Warden).ToAllChat().ToAllCenter();
Warden.PlayerName = "[WARDEN] " + Warden.PlayerName;
@@ -175,7 +175,7 @@ private void processWardenDeath() {
logger.LogWarning("[Warden] BUG: Problem removing current warden :^(");
// Warden died!
- notifications.WARDEN_DIED.ToAllChat().ToAllCenter();
+ notifications.WardenDied.ToAllChat().ToAllCenter();
foreach (var player in Utilities.GetPlayers()) {
if (!player.IsReal()) continue;
@@ -183,7 +183,7 @@ private void processWardenDeath() {
$"play sounds/{config.WardenKilledSoundName}");
}
- notifications.BECOME_NEXT_WARDEN.ToAllChat();
+ notifications.BecomeNextWarden.ToAllChat();
unblueTimer
?.Kill(); // If the warden dies withing 3 seconds of becoming warden, we need to cancel the unblue timer
@@ -331,7 +331,7 @@ public HookResult OnPlayerDisconnect(EventPlayerDisconnect ev,
logger.LogWarning("[Warden] BUG: Problem removing current warden :^(");
- notifications.WARDEN_LEFT.ToAllChat().ToAllCenter();
+ notifications.WardenLeft.ToAllChat().ToAllCenter();
foreach (var player in Utilities.GetPlayers()) {
if (!player.IsReal()) continue;
@@ -339,7 +339,7 @@ public HookResult OnPlayerDisconnect(EventPlayerDisconnect ev,
$"play sounds/{config.WardenPassedSoundName}");
}
- notifications.BECOME_NEXT_WARDEN.ToAllChat();
+ notifications.BecomeNextWarden.ToAllChat();
return HookResult.Continue;
}
diff --git a/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs b/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs
index 9a53d367..44322422 100644
--- a/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs
+++ b/mod/Jailbreak.Warden/Markers/WardenMarkerBehavior.cs
@@ -9,9 +9,8 @@
namespace Jailbreak.Warden.Markers;
-public class WardenMarkerBehavior : IPluginBehavior {
+public class WardenMarkerBehavior(IWardenService warden) : IPluginBehavior {
private const float MIN_RADIUS = 60f, MAX_RADIUS = 360f;
- private readonly IWardenService warden;
private Vector? currentPos;
@@ -19,8 +18,6 @@ public class WardenMarkerBehavior : IPluginBehavior {
private long placementTime;
private float radius = MIN_RADIUS;
- public WardenMarkerBehavior(IWardenService warden) { this.warden = warden; }
-
public void Start(BasePlugin basePlugin) {
marker = new BeamCircle(basePlugin, new Vector(), 60f, (int)Math.PI * 15);
basePlugin.AddCommandListener("player_ping", CommandListener_PlayerPing);
diff --git a/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs b/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs
index aaa6dae3..a6cc2805 100644
--- a/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs
+++ b/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs
@@ -8,13 +8,11 @@
namespace Jailbreak.Warden.Paint;
-public class WardenPaintBehavior : IPluginBehavior {
- private readonly IWardenService wardenService;
+public class WardenPaintBehavior(IWardenService wardenService)
+ : IPluginBehavior {
private Vector? lastPosition;
private BasePlugin? parent;
- public WardenPaintBehavior(IWardenService warden) { wardenService = warden; }
-
public void Start(BasePlugin basePlugin) {
parent = basePlugin;
basePlugin.RegisterListener(paint);
diff --git a/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs b/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs
index 49d4295a..4046965a 100644
--- a/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs
+++ b/mod/Jailbreak.Warden/Selection/WardenSelectionBehavior.cs
@@ -82,7 +82,7 @@ public HookResult OnRoundStart(EventRoundStart ev, GameEventInfo info) {
// Enable the warden queue
queueInactive = false;
- notifications.PICKING_SHORTLY.ToAllChat();
+ notifications.PickingShortly.ToAllChat();
// Start a timer to pick the warden in 7 seconds
ScheduleChooseWarden();
@@ -109,7 +109,7 @@ protected void OnChooseWarden() {
eligible);
if (eligible.Count == 0) {
- notifications.NO_WARDENS.ToAllChat();
+ notifications.NoWardens.ToAllChat();
queueInactive = true;
return;
diff --git a/mod/Jailbreak.Warden/SpecialTreatment/SpecialTreatmentBehavior.cs b/mod/Jailbreak.Warden/SpecialTreatment/SpecialTreatmentBehavior.cs
index 01ab46e7..04719a47 100644
--- a/mod/Jailbreak.Warden/SpecialTreatment/SpecialTreatmentBehavior.cs
+++ b/mod/Jailbreak.Warden/SpecialTreatment/SpecialTreatmentBehavior.cs
@@ -27,7 +27,7 @@ public void Grant(CCSPlayerController player) {
sts.Get(player).HasSpecialTreatment = true;
if (rebel.IsRebel(player)) rebel.UnmarkRebel(player);
- setSpecialColor(player, /* hasSt */ true);
+ setSpecialColor(player, true);
notifications.Granted.ToPlayerChat(player).ToPlayerCenter(player);
diff --git a/public/Jailbreak.Formatting/Views/ILastGuardNotifications.cs b/public/Jailbreak.Formatting/Views/ILastGuardNotifications.cs
index 421f4bc8..a4e09405 100644
--- a/public/Jailbreak.Formatting/Views/ILastGuardNotifications.cs
+++ b/public/Jailbreak.Formatting/Views/ILastGuardNotifications.cs
@@ -3,5 +3,5 @@
namespace Jailbreak.Formatting.Views;
public interface ILastGuardNotifications {
- public IView LG_STARTED(int ctHealth, int tHealth);
+ public IView LGStarted(int ctHealth, int tHealth);
}
\ No newline at end of file
diff --git a/public/Jailbreak.Formatting/Views/ILastRequestMessages.cs b/public/Jailbreak.Formatting/Views/ILastRequestMessages.cs
index da40c182..0006e376 100644
--- a/public/Jailbreak.Formatting/Views/ILastRequestMessages.cs
+++ b/public/Jailbreak.Formatting/Views/ILastRequestMessages.cs
@@ -16,4 +16,6 @@ public interface ILastRequestMessages {
public IView InformLastRequest(AbstractLastRequest lr);
public IView AnnounceLastRequest(AbstractLastRequest lr);
public IView LastRequestDecided(AbstractLastRequest lr, LRResult result);
+ public IView CannotLR(string reason);
+ public IView CannotLR(CCSPlayerController player, string reason);
}
\ No newline at end of file
diff --git a/public/Jailbreak.Formatting/Views/ILogMessages.cs b/public/Jailbreak.Formatting/Views/ILogMessages.cs
index be462cde..e9c72fdd 100644
--- a/public/Jailbreak.Formatting/Views/ILogMessages.cs
+++ b/public/Jailbreak.Formatting/Views/ILogMessages.cs
@@ -24,7 +24,7 @@ public FormatObject Time() {
return new StringFormatObject($"[{minutes}:{seconds}]", ChatColors.Gold);
}
- public IView CREATE_LOG(params FormatObject[] objects) {
+ public IView CreateLog(params FormatObject[] objects) {
return new SimpleView { Time(), objects };
}
}
\ No newline at end of file
diff --git a/public/Jailbreak.Formatting/Views/IRaceLRMessages.cs b/public/Jailbreak.Formatting/Views/IRaceLRMessages.cs
index ecdaf4c3..a909abd5 100644
--- a/public/Jailbreak.Formatting/Views/IRaceLRMessages.cs
+++ b/public/Jailbreak.Formatting/Views/IRaceLRMessages.cs
@@ -7,4 +7,8 @@ public interface IRaceLRMessages {
public IView EndRaceInstruction { get; }
public IView RaceStartingMessage(CCSPlayerController prisoner);
+
+ public IView NotInRaceLR();
+
+ public IView NotInPendingState();
}
\ No newline at end of file
diff --git a/public/Jailbreak.Formatting/Views/IWardenNotifications.cs b/public/Jailbreak.Formatting/Views/IWardenNotifications.cs
index bb23b6ed..ae5e0815 100644
--- a/public/Jailbreak.Formatting/Views/IWardenNotifications.cs
+++ b/public/Jailbreak.Formatting/Views/IWardenNotifications.cs
@@ -6,29 +6,29 @@
namespace Jailbreak.Formatting.Views;
public interface IWardenNotifications {
- public IView PICKING_SHORTLY { get; }
- public IView NO_WARDENS { get; }
- public IView WARDEN_LEFT { get; }
- public IView WARDEN_DIED { get; }
- public IView BECOME_NEXT_WARDEN { get; }
- public IView JOIN_RAFFLE { get; }
- public IView LEAVE_RAFFLE { get; }
- public IView NOT_WARDEN { get; }
- public IView FIRE_COMMAND_FAILED { get; }
+ public IView PickingShortly { get; }
+ public IView NoWardens { get; }
+ public IView WardenLeft { get; }
+ public IView WardenDied { get; }
+ public IView BecomeNextWarden { get; }
+ public IView JoinRaffle { get; }
+ public IView LeaveRaffle { get; }
+ public IView NotWarden { get; }
+ public IView FireCommandFailed { get; }
///
/// Create a view for when the specified player passes warden
///
///
///
- public IView PASS_WARDEN(CCSPlayerController player);
+ public IView PassWarden(CCSPlayerController player);
///
/// Create a view for when this player becomes a new warden
///
///
///
- public IView NEW_WARDEN(CCSPlayerController player);
+ public IView NewWarden(CCSPlayerController player);
///
/// Format a response to a request about the current warden.
@@ -36,12 +36,12 @@ public interface IWardenNotifications {
///
///
///
- public IView CURRENT_WARDEN(CCSPlayerController? player);
+ public IView CurrentWarden(CCSPlayerController? player);
- public IView FIRE_COMMAND_SUCCESS(CCSPlayerController player);
+ public IView FireCommandSuccess(CCSPlayerController player);
- public IView FIRE_WARDEN(CCSPlayerController player);
+ public IView FireWarden(CCSPlayerController player);
- public IView FIRE_WARDEN(CCSPlayerController player,
+ public IView FireWarden(CCSPlayerController player,
CCSPlayerController admin);
}
\ No newline at end of file
diff --git a/public/Jailbreak.Public/Extensions/WeaponExtensions.cs b/public/Jailbreak.Public/Extensions/WeaponExtensions.cs
index ae478adc..ad6ee3b9 100644
--- a/public/Jailbreak.Public/Extensions/WeaponExtensions.cs
+++ b/public/Jailbreak.Public/Extensions/WeaponExtensions.cs
@@ -2,50 +2,84 @@
namespace Jailbreak.Public.Extensions;
-public static class WeaponExtensions
-{
- public static string ToFriendlyString(this CCSWeaponBase weaponEntity)
- {
- var designerName = weaponEntity.DesignerName;
- switch (designerName)
- {
- case "weapon_ak47": return "AK47";
- case "weapon_aug": return "AUG";
- case "weapon_awp": return "AWP";
- case "weapon_bizon": return "Bizon";
- case "weapon_cz75a": return "CZ75";
- case "weapon_deagle": return "Desert Eagle";
- case "weapon_famas": return "Famas";
- case "weapon_fiveseven": return "Five Seven";
- case "weapon_g3sg1": return "G3SG1";
- case "weapon_galilar": return "Galil";
- case "weapon_glock": return "Glock 18";
- case "weapon_hkp2000": return "HPK2000";
- case "weapon_m249": return "M249";
- case "weapon_m4a1": return "M4A1";
- case "weapon_m4a1_silencer": return "M4A1S";
- case "weapon_m4a4": return "M4A4";
- case "weapon_mac10": return "MAC10";
- case "weapon_mag7": return "MAG7";
- case "weapon_mp5sd": return "MP5SD";
- case "weapon_mp7": return "MP7";
- case "weapon_mp9": return "MP9";
- case "weapon_negev": return "Negev";
- case "weapon_nova": return "Nova";
- case "weapon_p250": return "P250";
- case "weapon_p90": return "P90";
- case "weapon_revolver": return "Revolver";
- case "weapon_sawedoff": return "Sawed Off";
- case "weapon_scar20": return "Scar20";
- case "weapon_sg553": return "SG553";
- case "weapon_sg556": return "SG556";
- case "weapon_ssg08": return "SSG08";
- case "weapon_taser": return "Zeus";
- case "weapon_tec9": return "Tec9";
- case "weapon_ump45": return "UMP45";
- case "weapon_usp_silencer": return "USPS";
- case "weapon_xm1014": return "XM1014";
- default: return "UNKNOWN: Pleace Contact Tech";
- }
+public static class WeaponExtensions {
+ public static string ToFriendlyString(this CCSWeaponBase weaponEntity) {
+ var designerName = weaponEntity.DesignerName;
+ switch (designerName) {
+ case "weapon_ak47":
+ return "AK47";
+ case "weapon_aug":
+ return "AUG";
+ case "weapon_awp":
+ return "AWP";
+ case "weapon_bizon":
+ return "Bizon";
+ case "weapon_cz75a":
+ return "CZ75";
+ case "weapon_deagle":
+ return "Desert Eagle";
+ case "weapon_famas":
+ return "Famas";
+ case "weapon_fiveseven":
+ return "Five Seven";
+ case "weapon_g3sg1":
+ return "G3SG1";
+ case "weapon_galilar":
+ return "Galil";
+ case "weapon_glock":
+ return "Glock 18";
+ case "weapon_hkp2000":
+ return "HPK2000";
+ case "weapon_m249":
+ return "M249";
+ case "weapon_m4a1":
+ return "M4A1";
+ case "weapon_m4a1_silencer":
+ return "M4A1S";
+ case "weapon_m4a4":
+ return "M4A4";
+ case "weapon_mac10":
+ return "MAC10";
+ case "weapon_mag7":
+ return "MAG7";
+ case "weapon_mp5sd":
+ return "MP5SD";
+ case "weapon_mp7":
+ return "MP7";
+ case "weapon_mp9":
+ return "MP9";
+ case "weapon_negev":
+ return "Negev";
+ case "weapon_nova":
+ return "Nova";
+ case "weapon_p250":
+ return "P250";
+ case "weapon_p90":
+ return "P90";
+ case "weapon_revolver":
+ return "Revolver";
+ case "weapon_sawedoff":
+ return "Sawed Off";
+ case "weapon_scar20":
+ return "Scar20";
+ case "weapon_sg553":
+ return "SG553";
+ case "weapon_sg556":
+ return "SG556";
+ case "weapon_ssg08":
+ return "SSG08";
+ case "weapon_taser":
+ return "Zeus";
+ case "weapon_tec9":
+ return "Tec9";
+ case "weapon_ump45":
+ return "UMP45";
+ case "weapon_usp_silencer":
+ return "USPS";
+ case "weapon_xm1014":
+ return "XM1014";
+ default:
+ return "UNKNOWN: Pleace Contact Tech";
}
+ }
}
\ No newline at end of file
diff --git a/public/Jailbreak.Public/Jailbreak.Public.csproj b/public/Jailbreak.Public/Jailbreak.Public.csproj
index 49a1c520..7a3174f6 100644
--- a/public/Jailbreak.Public/Jailbreak.Public.csproj
+++ b/public/Jailbreak.Public/Jailbreak.Public.csproj
@@ -7,8 +7,8 @@
-
-
+
+