Skip to content

Commit

Permalink
More cleanup (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS authored Jul 12, 2024
2 parents 7eec75c + 8d991b7 commit 4070ee0
Show file tree
Hide file tree
Showing 37 changed files with 399 additions and 351 deletions.
5 changes: 5 additions & 0 deletions Jailbreak.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNotificationDisabled/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IO/@EntryIndexedValue">IO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LG/@EntryIndexedValue">LG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LR/@EntryIndexedValue">LR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ST/@EntryIndexedValue">ST</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=08582792_002Dd334_002D4f6d_002Db467_002Dfc7b9fd4557b/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Private, ProtectedInternal, Internal, PrivateProtected" Description="Non-Public Methods"&gt;&lt;ElementKinds&gt;&lt;Kind Name="METHOD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
Expand All @@ -83,6 +84,10 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=8a85b61a_002D1024_002D4f87_002Db9ef_002D1fdae19930a1/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Parameters"&gt;&lt;ElementKinds&gt;&lt;Kind Name="PARAMETER" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="_" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=8b8504e3_002Df0be_002D4c14_002D9103_002Dc732f2bddc15/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum members"&gt;&lt;ElementKinds&gt;&lt;Kind Name="ENUM_MEMBER" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=c873eafb_002Dd57f_002D481d_002D8c93_002D77f6863c2f88/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>



Expand Down
4 changes: 2 additions & 2 deletions lang/Jailbreak.English/LastGuard/LastGuardNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ namespace Jailbreak.English.LastGuard;

public class LastGuardNotifications : ILastGuardNotifications,
ILanguage<Formatting.Languages.English> {
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",
Expand Down
16 changes: 16 additions & 0 deletions lang/Jailbreak.English/LastRequest/LastRequestMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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." };

Expand Down
16 changes: 16 additions & 0 deletions lang/Jailbreak.English/LastRequest/RaceLRMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
};
}
4 changes: 2 additions & 2 deletions lang/Jailbreak.English/Mute/PeaceMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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."
};
}

Expand Down
8 changes: 0 additions & 8 deletions lang/Jailbreak.English/Rebel/JihadC4Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace Jailbreak.English.Rebel;

public class JihadC4Notifications : IJihadC4Notifications,
ILanguage<Formatting.Languages.English> {
// 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!"
Expand All @@ -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!" };
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}!"
};
}

Expand Down
38 changes: 19 additions & 19 deletions lang/Jailbreak.English/Warden/WardenNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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,
Expand All @@ -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."
};
Expand Down
15 changes: 6 additions & 9 deletions mod/Jailbreak.Debug/Subcommands/AbstractCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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";
}
}
Expand Down
35 changes: 19 additions & 16 deletions mod/Jailbreak.Debug/Subcommands/LastRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
Loading

0 comments on commit 4070ee0

Please sign in to comment.