Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #24

Merged
merged 9 commits into from
Feb 6, 2024
Merged

Dev #24

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Insert Job Version
run: sed -i "s/{GIT_VERSION}/${{github.run_number}}/g" src/Jailbreak/Jailbreak.cs

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build src/Jailbreak/Jailbreak.csproj --no-restore
- name: Publish
run: dotnet publish src/Jailbreak/Jailbreak.csproj --no-build --no-restore
- run: |
dotnet restore
dotnet build src/Jailbreak/Jailbreak.csproj --no-restore
dotnet publish src/Jailbreak/Jailbreak.csproj --no-build --no-restore

- uses: actions/[email protected]
with:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ The classic Jail gamemode, ported to Counter-Strike 2.
- [ ] Error reporting
- [x] Configuration system
- Note: Passable, but in a terrible state. Needs TLC.
- [x] Logging
- **👮 Guards**
- [x] Warden Selection
- [x] Warden Laser and Paint
- [ ] Special Days
- [x] Ratio Enforcement
- [ ] Bans/Punishments
- **🎃 Prisoners**
- [ ] Last Request
- [x] Rebel System
- **🛕 Maps**
- [ ] Custom Entities
- [ ] Custom I/O
Expand Down
8 changes: 4 additions & 4 deletions lang/Jailbreak.English/Generic/GenericCommandNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ namespace Jailbreak.English.Generic;

public class GenericCommandNotifications : IGenericCommandNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX =
public static FormatObject Prefix =
new HiddenFormatObject($" {ChatColors.Darkred}[{ChatColors.LightRed}JB{ChatColors.Darkred}]")
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true,
Chat = true
};

public IView PlayerNotFound(string query)
{
return new SimpleView(writer =>
writer
.Line(PREFIX, $"Player '{query}' not found!"));
.Line(Prefix, $"Player '{query}' not found!"));
}

public IView PlayerFoundMultiple(string query)
{
return new SimpleView(writer =>
writer
.Line(PREFIX, $"Multiple players found for '{query}'!"));
.Line(Prefix, $"Multiple players found for '{query}'!"));
}
}
2 changes: 1 addition & 1 deletion lang/Jailbreak.English/Jailbreak.English.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\public\Jailbreak.Formatting\Jailbreak.Formatting.csproj" />
<ProjectReference Include="..\..\public\Jailbreak.Formatting\Jailbreak.Formatting.csproj"/>
</ItemGroup>

</Project>
20 changes: 11 additions & 9 deletions lang/Jailbreak.English/Rebel/RebelNotifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ namespace Jailbreak.English.Rebel;

public class RebelNotifications : IRebelNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX = new HiddenFormatObject( $" {ChatColors.Darkred}[{ChatColors.LightRed}Rebel{ChatColors.Darkred}]" )
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true,
};
public IView NO_LONGER_REBEL => new SimpleView(writer =>
public static FormatObject Prefix =
new HiddenFormatObject($" {ChatColors.Darkred}[{ChatColors.LightRed}Rebel{ChatColors.Darkred}]")
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true
};

public IView NoLongerRebel => new SimpleView(writer =>
writer
.Line(PREFIX, "You are no longer a rebel."));
.Line(Prefix, "You are no longer a rebel."));
}
86 changes: 43 additions & 43 deletions lang/Jailbreak.English/Teams/RatioNotifications.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CounterStrikeSharp.API.Modules.Utils;

using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Core;
using Jailbreak.Formatting.Logistics;
Expand All @@ -10,45 +9,46 @@ namespace Jailbreak.English.Teams;

public class RatioNotifications : IRatioNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX = new HiddenFormatObject( $" {ChatColors.LightRed}[{ChatColors.Red}JB{ChatColors.LightRed}]" )
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true,
};

public IView NOT_ENOUGH_GUARDS => new SimpleView(writer =>
writer
.Line(PREFIX, "There's not enough guards in the queue!"));

public IView PLEASE_JOIN_GUARD_QUEUE => new SimpleView(writer =>
writer
.Line(PREFIX, "Type !guard to become a guard!"));

public IView JOINED_GUARD_QUEUE => new SimpleView(writer =>
writer
.Line(PREFIX, "You've joined the guard queue!"));

public IView ALREADY_A_GUARD => new SimpleView(writer =>
writer
.Line(PREFIX, "You're already a guard!"));

public IView YOU_WERE_AUTOBALANCED_PRISONER => new SimpleView(writer =>
writer
.Line(PREFIX, "You were autobalanced to the prisoner team!"));

public IView ATTEMPT_TO_JOIN_FROM_TEAM_MENU => new SimpleView(writer =>
writer
.Line(PREFIX, "You were swapped back to the prisoner team!")
.Line(PREFIX, "Please use !guard to join the guard team."));

public IView LEFT_GUARD => new SimpleView(writer =>
writer
.Line(PREFIX, "You are no longer a guard.")
.Line(PREFIX, "Please use !guard if you want to re-join the guard team."));

public IView YOU_WERE_AUTOBALANCED_GUARD => new SimpleView(writer =>
writer
.Line(PREFIX, "You are now a guard!"));
}
public static FormatObject Prefix =
new HiddenFormatObject($" {ChatColors.LightRed}[{ChatColors.Red}JB{ChatColors.LightRed}]")
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true
};

public IView NotEnoughGuards => new SimpleView(writer =>
writer
.Line(Prefix, "There's not enough guards in the queue!"));

public IView PleaseJoinGuardQueue => new SimpleView(writer =>
writer
.Line(Prefix, "Type !guard to become a guard!"));

public IView JoinedGuardQueue => new SimpleView(writer =>
writer
.Line(Prefix, "You've joined the guard queue!"));

public IView AlreadyAGuard => new SimpleView(writer =>
writer
.Line(Prefix, "You're already a guard!"));

public IView YouWereAutobalancedPrisoner => new SimpleView(writer =>
writer
.Line(Prefix, "You were autobalanced to the prisoner team!"));

public IView AttemptToJoinFromTeamMenu => new SimpleView(writer =>
writer
.Line(Prefix, "You were swapped back to the prisoner team!")
.Line(Prefix, "Please use !guard to join the guard team."));

public IView LeftGuard => new SimpleView(writer =>
writer
.Line(Prefix, "You are no longer a guard.")
.Line(Prefix, "Please use !guard if you want to re-join the guard team."));

public IView YouWereAutobalancedGuard => new SimpleView(writer =>
writer
.Line(Prefix, "You are now a guard!"));
}
89 changes: 44 additions & 45 deletions lang/Jailbreak.English/Warden/WardenNotifications.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Utils;

using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Core;
using Jailbreak.Formatting.Logistics;
Expand All @@ -11,57 +10,57 @@ namespace Jailbreak.English.Warden;

public class WardenNotifications : IWardenNotifications, ILanguage<Formatting.Languages.English>
{
public static FormatObject PREFIX = new HiddenFormatObject( $" {ChatColors.Lime}[{ChatColors.Green}WARDEN{ChatColors.Lime}]" )
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true,
};
public static FormatObject Prefix =
new HiddenFormatObject($" {ChatColors.Lime}[{ChatColors.Green}WARDEN{ChatColors.Lime}]")
{
// Hide in panorama and center text
Plain = false,
Panorama = false,
Chat = true
};

public IView PICKING_SHORTLY => new SimpleView(writer =>
writer
.Line(PREFIX, "Picking a warden shortly")
.Line(PREFIX, "To enter the warden queue, type !warden in chat."));
public IView PickingShortly => new SimpleView(writer =>
writer
.Line(Prefix, "Picking a warden shortly")
.Line(Prefix, "To enter the warden queue, type !warden in chat."));

public IView NO_WARDENS => new SimpleView(writer =>
writer
.Line(PREFIX, "No wardens in queue! The next player to run !warden will become a warden."));
public IView NoWardens => new SimpleView(writer =>
writer
.Line(Prefix, "No wardens in queue! The next player to run !warden will become a warden."));

public IView WARDEN_LEFT => new SimpleView(writer =>
writer.Line(PREFIX, "The warden has left the game!"));
public IView WardenLeft => new SimpleView(writer =>
writer.Line(Prefix, "The warden has left the game!"));

public IView WARDEN_DIED => new SimpleView(writer =>
writer.Line(PREFIX, "The warden has died!"));
public IView WardenDied => new SimpleView(writer =>
writer.Line(Prefix, "The warden has died!"));

public IView BECOME_NEXT_WARDEN => new SimpleView(writer =>
writer.Line(PREFIX, "Type !warden to become the next warden"));
public IView BecomeNextWarden => new SimpleView(writer =>
writer.Line(Prefix, "Type !warden to become the next warden"));

public IView JOIN_RAFFLE => new SimpleView(writer =>
writer.Line(PREFIX, "You've joined the warden raffle!"));
public IView JoinRaffle => new SimpleView(writer =>
writer.Line(Prefix, "You've joined the warden raffle!"));

public IView LEAVE_RAFFLE => new SimpleView(writer =>
writer.Line(PREFIX, "You've left the warden raffle!"));
public IView LeaveRaffle => new SimpleView(writer =>
writer.Line(Prefix, "You've left the warden raffle!"));

public IView PASS_WARDEN(CCSPlayerController player)
{
return new SimpleView(writer =>
writer.Line(PREFIX, player, "has resigned from being warden!"));
}
public IView PassWarden(CCSPlayerController player)
{
return new SimpleView(writer =>
writer.Line(Prefix, player, "has resigned from being warden!"));
}

public IView NEW_WARDEN(CCSPlayerController player)
{
return new SimpleView(writer =>
writer.Line(PREFIX, player, "is now the warden!"));
}
public IView NewWarden(CCSPlayerController player)
{
return new SimpleView(writer =>
writer.Line(Prefix, player, "is now the warden!"));
}

public IView CURRENT_WARDEN(CCSPlayerController? player)
{
if (player is not null)
return new SimpleView(writer =>
writer.Line(PREFIX, "The current warden is", player));
else
return new SimpleView(writer =>
writer.Line(PREFIX, "There is currently no warden!"));
}
}
public IView CurrentWarden(CCSPlayerController? player)
{
if (player is not null)
return new SimpleView(writer =>
writer.Line(Prefix, "The current warden is", player));
return new SimpleView(writer =>
writer.Line(Prefix, "There is currently no warden!"));
}
}
28 changes: 11 additions & 17 deletions mod/Jailbreak.Debug/DebugCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,41 @@
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
using Jailbreak.Debug.Subcommands;
using Jailbreak.Formatting.Views;
using Jailbreak.Public.Behaviors;

namespace Jailbreak.Debug;

// css_debug [subcommand] [args] -> subcommand [args]
public class DebugCommand : IPluginBehavior
{
private readonly Dictionary<string, Subcommands.AbstractCommand> commands = new();
private readonly Dictionary<string, AbstractCommand> _commands = new();

public DebugCommand(IServiceProvider serviceProvider)
{
commands.Add("markrebel", new MarkRebel(serviceProvider));
commands.Add("pardon", new Pardon(serviceProvider));
_commands.Add("markrebel", new MarkRebel(serviceProvider));
_commands.Add("pardon", new Pardon(serviceProvider));
}



[RequiresPermissions("@css/root")]
[ConsoleCommand("css_debug", "Debug command for Jailbreak.")]
public void Command_Debug(CCSPlayerController? executor, CommandInfo info)
{
if (executor == null)
{
return;
}
if (executor == null) return;

if (info.ArgCount == 1)
{
foreach (var command in commands)
{
info.ReplyToCommand(command.Key);
}
foreach (var command in _commands) info.ReplyToCommand(command.Key);

return;
}
if (!commands.TryGetValue(info.GetArg(1), out var subcommand))

if (!_commands.TryGetValue(info.GetArg(1), out var subcommand))
{
info.ReplyToCommand("Invalid subcommand");
return;
}

subcommand.OnCommand(executor, new WrappedInfo(info));
}
}
8 changes: 4 additions & 4 deletions mod/Jailbreak.Debug/DebugServiceExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace Jailbreak.Debug;

public static class DebugServiceExtension
{
public static void AddJailbreakDebug(this IServiceCollection services)
{
services.AddPluginBehavior<DebugCommand>();
}
public static void AddJailbreakDebug(this IServiceCollection services)
{
services.AddPluginBehavior<DebugCommand>();
}
}
Loading