Skip to content

Commit

Permalink
New Warden Commands, Gameplay Enhancements, and Customizable Features…
Browse files Browse the repository at this point in the history
… in Jailbreak (#294)

This pull request resolves a series of issues in the Jailbreak project,
focusing on new commands, gameplay tweaks, and customizable features:

- **[Issue JB-4](https://bug.msws.xyz/issue/JB-4)**: Implements the
"Roll the Dice" (RTD) feature with various rewards and punishments.
- **[Issue JB-46](https://bug.msws.xyz/issue/JB-46)**: Adds anti-cheat
measures to OITC mode to prevent the `/wp` command from refreshing
bullets.
- **[Issue JB-72](https://bug.msws.xyz/issue/JB-72)**: Reduces the
speedrun time limit to 30 seconds.
- **[Issue JB-79](https://bug.msws.xyz/issue/JB-79)**: Adjusts OITC mode
so that only player-dealt damage results in instant kills.
- **[Issue JB-77](https://bug.msws.xyz/issue/JB-77)**: Modifies Gun Game
mode to ignore suicides.
- **[Issue JB-66](https://bug.msws.xyz/issue/JB-66), [Issue
JB-64](https://bug.msws.xyz/issue/JB-64), [Issue
JB-60](https://bug.msws.xyz/issue/JB-60)**: Introduces customizable
options for OITC, NoScope, and HNS modes.
- **[Issue JB-75](https://bug.msws.xyz/issue/JB-75) & [Issue
JB-74](https://bug.msws.xyz/issue/JB-74)**: Adds new commands for the
Warden to spawn a chicken or soccer ball at their location.
- **[Issue JB-56](https://bug.msws.xyz/issue/JB-56)**: Increases the
Last Request (LR) start delay for noscope mode from 3 seconds to 7
seconds.
- **[Issue JB-82](https://bug.msws.xyz/issue/JB-82) & [Issue
JB-81](https://bug.msws.xyz/issue/JB-81)**: Introduces new overlays: a
green overlay for Special Team (ST) members and a red overlay for
rebels.
- **[Issue JB-80](https://bug.msws.xyz/issue/JB-80)**: Optimizes weapon
pickup prevention by removing the costly ontick checks.
- **[Issue JB-51](https://bug.msws.xyz/issue/JB-51)**: Adjusts the
message for auto-opened cells by graying it out.
- **[Issue JB-70](https://bug.msws.xyz/issue/JB-70)**: Tidies up in-game
messages.
- **[Issue JB-69](https://bug.msws.xyz/issue/JB-69)**: Updates the `!sd`
command to display the currently active Special Day.
  • Loading branch information
MSWS authored Aug 28, 2024
2 parents 17ec8eb + 4cff50e commit e5734b2
Show file tree
Hide file tree
Showing 101 changed files with 2,092 additions and 715 deletions.
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Contributing

The jail plugin is currently in heavy development and all contributions are welcome!
Please make sure all contributions use the dependency injection system, or ask to have your contribution
ported if you don't know how.

> [!TIP]
> Microsoft has some good documentation on dependency injection here:
> [Overview](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection),
> [Using Dependency Injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-usage),
> [Dependency Injection Guidelines](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines).
All event handlers should derive from `IPluginBehavior` and be registered using
`IServiceCollection.AddPluginBehavior<T>`. If your behavior also acts as a service,
make sure to use `IServiceCollection.AddPluginBehavior<TInterface, T>`. All `IPluginBehavior` objects
have their event handlers automatically registered.

Code style should follow .NET conventions and use the formatting settings specified
in [Jailbreak.sln.DotSettings](./Jailbreak.sln.DotSettings)
(if you need help, make sure to check "enable edits from maintainers" and ask for a format)
7 changes: 7 additions & 0 deletions Jailbreak.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.Zones", "mod\Jail
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.Trail", "mod\Jailbreak.Trail\Jailbreak.Trail.csproj", "{91F4EC7A-993A-4CA0-84C3-9F1100124A9C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.RTD", "mod\Jailbreak.RTD\Jailbreak.RTD.csproj", "{C68D4760-7E1E-4633-995A-5EC1EF40E63B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -116,6 +118,10 @@ Global
{91F4EC7A-993A-4CA0-84C3-9F1100124A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91F4EC7A-993A-4CA0-84C3-9F1100124A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91F4EC7A-993A-4CA0-84C3-9F1100124A9C}.Release|Any CPU.Build.0 = Release|Any CPU
{C68D4760-7E1E-4633-995A-5EC1EF40E63B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C68D4760-7E1E-4633-995A-5EC1EF40E63B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C68D4760-7E1E-4633-995A-5EC1EF40E63B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C68D4760-7E1E-4633-995A-5EC1EF40E63B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9135CCC9-66C5-4A9C-AE3C-91475B5F0437} = {177DA48D-8306-4102-918D-992569878581}
Expand All @@ -135,5 +141,6 @@ Global
{A6249693-5B7E-4E14-A675-C292914F10F3} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
{C93A626A-BB44-4309-8DAD-4B28B2941870} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
{91F4EC7A-993A-4CA0-84C3-9F1100124A9C} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
{C68D4760-7E1E-4633-995A-5EC1EF40E63B} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
EndGlobalSection
EndGlobal
45 changes: 16 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,50 @@ The classic Jail gamemode, ported to Counter-Strike 2.

[![Release](https://img.shields.io/badge/Release-mediumseagreen?style=for-the-badge&logo=onlyoffice
)](https://github.com/edgegamers/Jailbreak/releases/)⠀⠀
[![Stable](https://img.shields.io/badge/Stable-orangered?style=for-the-badge&logo=onlyoffice)](https://nightly.link/edgegamers/Jailbreak/workflows/nightly/main/jailbreak-nightly)⠀⠀
[![Stable](https://img.shields.io/badge/Stable-orangered?style=for-the-badge&logo=onlyoffice)](https://nightly.link/edgegamers/Jailbreak/workflows/nightly/main/jailbreak-nightly)
⠀⠀
[![Dev](https://img.shields.io/badge/Nightly-slateblue?style=for-the-badge&logo=onlyoffice
)](https://nightly.link/edgegamers/Jailbreak/workflows/nightly/dev/jailbreak-nightly)

**Release** builds are our full releases. We try to keep these high-quality and bug-free, when we can.
Our **Stable** builds run on EdgeGamers' own Jailbreak servers.
Our **Stable** builds run on EdgeGamers' own Jailbreak servers.
Our **Nightly** builds are used exclusively for development and staging, and are likely to have problems.

## Versioning

Our release tags starting from 'v2.0.0' follow the [Semantic Versioning 2.0.0](https://semver.org/) standard,
where `MAJOR.MINOR.PATCH` are incremented based on the following:

- `MAJOR` when we make incompatible API changes,
- `MINOR` when we add functionality in a backwards-compatible manner.
- `PATCH` when we make backwards-compatible bug fixes.

## Status

- **⚙️ Server**
- [ ] Stats/Analytics Sinks
- [ ] Error reporting
- [x] Configuration system
- Note: Passable, but in a terrible state. Needs TLC.
- [x] Stats/Analytics Sinks
- [x] Error reporting
- [x] Logging
- [x] Zones
- **👮 Guards**
- [x] Warden Selection
- [x] Warden Laser and Paint
- [ ] Special Days
- [x] Ratio Enforcement
- [ ] Bans/Punishments
- [x] Special Days
- **🎃 Prisoners**
- [x] Last Request
- [x] Rebel System
- **🛕 Maps**
- [x] Automagic Cell Opening
- [ ] Custom Entities
- [ ] Custom I/O
- [ ] Warden/Guard/Prisoner Filters

## Contributing

The jail plugin is currently in heavy development and all contributions are welcome!
Please make sure all contributions use the dependency injection system, or ask to have your contribution
ported if you don't know how.

Ports to DI containers that have more verbose scoping systems for round-based or game-based scoping are welcome.

> [!TIP]
> Microsoft has some good documentation on dependency injection here:
> [Overview](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection),
> [Using Dependency Injection](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-usage),
> [Dependency Injection Guidelines](https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines).
## Configuration

All event handlers should derive from `IPluginBehavior` and be registered using
`IServiceCollection.AddPluginBehavior<T>`. If your behavior also acts as a service,
make sure to use `IServiceCollection.AddPluginBehavior<TInterface, T>`. All `IPluginBehavior` objects
have their event handlers automatically registered.
Configuration is done through CS#'s [FakeConVars](https://docs.cssharp.dev/examples/WithFakeConvars.html?q=fakeconvar).

Code style should follow .NET conventions
(if you need help, make sure to check "enable edits from maintainers" and ask for a format)
You can search for the list of configurable
convars [like so](https://github.com/search?q=repo%3Aedgegamers%2FJailbreak%20fakeconvar&type=code).

## Modding

Expand Down Expand Up @@ -97,7 +83,8 @@ foreach (IPluginBehavior extension in _extensions)

## Building

The jailbreak plugin automatically builds to `build/Jailbreak` when using `dotnet publish src/Jailbreak/Jailbreak.csproj`.
The jailbreak plugin automatically builds to `build/Jailbreak` when
using `dotnet publish src/Jailbreak/Jailbreak.csproj`.
Please use [SDK 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or higher.

Note that only the `src/Jailbreak` project is intended to be built directly.
Expand Down
9 changes: 6 additions & 3 deletions lang/Jailbreak.English/Generic/GenericCmdLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Jailbreak.Formatting.Logistics;
using Jailbreak.Formatting.Objects;
using Jailbreak.Formatting.Views;
using Jailbreak.Public.Extensions;

namespace Jailbreak.English.Generic;

Expand Down Expand Up @@ -36,21 +37,23 @@ public IView CommandOnCooldown(DateTime cooldownEndsAt) {
PREFIX,
$"{ChatColors.Grey}Command is on cooldown for",
seconds,
$"{ChatColors.Grey}seconds!"
$"{ChatColors.Grey}second" + (seconds == 1 ? "" : "s") + "."
};
}

public IView InvalidParameter(string parameter, string expected) {
return new SimpleView {
PREFIX,
$"{ChatColors.Red}Invalid parameter '{ChatColors.LightBlue}{parameter}{ChatColors.Red}', expected a(n) {ChatColors.White}{expected}{ChatColors.Red}."
$"{ChatColors.Red}Invalid parameter '{ChatColors.LightBlue}{parameter}{ChatColors.Red}',",
"expected a" + (expected[0].IsVowel() ? "n" : ""),
$"{ChatColors.White}{expected}{ChatColors.Red}."
};
}

public IView NoPermissionMessage(string permission) {
return new SimpleView {
PREFIX,
$"{ChatColors.Red}This command requires the {ChatColors.White}{permission}{ChatColors.Red} permission."
$"{ChatColors.DarkRed}This requires the {ChatColors.White}{permission}{ChatColors.Red} permission."
};
}

Expand Down
4 changes: 3 additions & 1 deletion lang/Jailbreak.English/LastRequest/CoinflipLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ 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"
PREFIX,
"The coin landed on" + ChatColors.Green,
heads ? "Heads" : "Tails" + ChatColors.White + "."
};
}
}
55 changes: 19 additions & 36 deletions lang/Jailbreak.English/LastRequest/LastRequestLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class LastRequestLocale : ILRLocale,
ILanguage<Formatting.Languages.English> {
public static readonly FormatObject PREFIX =
new HiddenFormatObject(
$" {ChatColors.DarkRed}[{ChatColors.LightRed}LR{ChatColors.DarkRed}]") {
$" {ChatColors.Green}[{ChatColors.Lime}LR{ChatColors.Green}]") {
// Hide in panorama and center text
Plain = false, Panorama = false, Chat = true
};
Expand All @@ -24,7 +24,7 @@ public IView LastRequestEnabled() {
return new SimpleView {
{
PREFIX,
$"Last Request has been enabled. {ChatColors.Grey}Type {ChatColors.LightBlue}!lr{ChatColors.Grey} to start a last request."
$"Last Request activated. {ChatColors.Grey}Type {ChatColors.LightBlue}!lr{ChatColors.Grey} to start a last request."
}
};
}
Expand All @@ -33,7 +33,7 @@ public IView LastRequestDisabled() {
return new SimpleView {
{
PREFIX,
$"{ChatColors.Grey}Last Request has been {ChatColors.Red}disabled{ChatColors.Grey}."
$"{ChatColors.Grey}Last Request {ChatColors.Red}disabled{ChatColors.Grey}."
}
};
}
Expand All @@ -52,9 +52,9 @@ public IView InformLastRequest(AbstractLastRequest lr) {
return new SimpleView {
PREFIX,
lr.Prisoner,
ChatColors.Grey + "is preparing a",
ChatColors.Grey + "is starting a",
ChatColors.White + lr.Type.ToFriendlyString(),
ChatColors.Grey + "Last Request against",
ChatColors.Grey + "LR against",
lr.Guard
};
}
Expand All @@ -74,36 +74,29 @@ public IView LastRequestDecided(AbstractLastRequest lr, LRResult result) {
var tNull = !lr.Prisoner.IsReal();
var gNull = !lr.Guard.IsReal();
if (tNull && gNull)
return new SimpleView { PREFIX, "Last Request has been decided." };
return new SimpleView { PREFIX, "Last Request decided." };

if (tNull && result == LRResult.PRISONER_WIN)
return new SimpleView {
PREFIX, lr.Guard, "lost the LR, but the prisoner left the game."
PREFIX, lr.Guard, "lost the LR, but the prisoner left the game?"
};

if (gNull && result == LRResult.GUARD_WIN)
return new SimpleView {
PREFIX, lr.Prisoner, "lost the LR, but the guard left the game."
PREFIX, lr.Prisoner, "lost the LR, but the guard left the game?"
};

switch (result) {
case LRResult.TIMED_OUT:
return new SimpleView {
PREFIX, ChatColors.Grey.ToString(), "Last Request has timed out."
};
case LRResult.INTERRUPTED:
return new SimpleView {
PREFIX,
ChatColors.Grey.ToString(),
"Last Request has been interrupted."
};
default:
return new SimpleView {
PREFIX,
result == LRResult.PRISONER_WIN ? lr.Prisoner : lr.Guard,
"won the LR."
};
}
return result switch {
LRResult.TIMED_OUT => new SimpleView {
PREFIX, ChatColors.Grey.ToString(), "Last Request timed out."
},
LRResult.INTERRUPTED => new SimpleView {
PREFIX, ChatColors.Grey.ToString(), "Last Request interrupted."
},
_ => new SimpleView {
PREFIX, result == LRResult.PRISONER_WIN ? lr.Prisoner : lr.Guard, "won."
}
};
}

public IView CannotLR(string reason) {
Expand Down Expand Up @@ -149,14 +142,4 @@ public IView DamageBlockedNotInSameLR
=> new SimpleView {
PREFIX, "You are not in the same LR as them, damage blocked."
};

public IView InvalidPlayerChoice(CCSPlayerController player, string reason) {
return new SimpleView {
PREFIX,
"Invalid player choice: ",
player,
" Reason: ",
reason
};
}
}
10 changes: 5 additions & 5 deletions lang/Jailbreak.English/LastRequest/RPSLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public IView PlayerMadeChoice(CCSPlayerController player) {

public IView BothPlayersMadeChoice() {
return new SimpleView {
PREFIX, "Both players have rocked, papered, and scissored! (ew)"
PREFIX, "Both players rocked, papered, and scissored! (ew)"
};
}

Expand All @@ -23,13 +23,13 @@ public IView Results(CCSPlayerController guard, CCSPlayerController prisoner,
int guardPick, int prisonerPick) {
return new SimpleView {
PREFIX,
"Results: ",
"Results:",
guard,
" picked ",
"picked",
toRPS(guardPick),
" and ",
"and",
prisoner,
" picked ",
"picked",
toRPS(prisonerPick)
};
}
Expand Down
12 changes: 7 additions & 5 deletions lang/Jailbreak.English/LastRequest/RaceLocale.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ public IView EndRaceInstruction
SimpleView.NEWLINE, {
PREFIX,
$"Type {ChatColors.Blue}!endrace{ChatColors.White} to set the end point!"
},
SimpleView.NEWLINE
}
};

public IView RaceStartingMessage(CCSPlayerController prisoner) {
return new SimpleView {
{
PREFIX, prisoner,
" is starting a race. Pay attention to where they set the end point!"
"is racing you. Pay attention to where they set the end point!"
}
};
}
Expand All @@ -37,14 +36,17 @@ public IView NotInRaceLR() {
return new SimpleView {
{
PREFIX,
$"You must be in a race {ChatColors.Blue + "!lr" + ChatColors.White} to use this command"
$"{ChatColors.Red}You must be in a race {ChatColors.Blue + "!lr" + ChatColors.Red} to use this."
}
};
}

public IView NotInPendingState() {
return new SimpleView {
{ PREFIX, "You must be in the pending state to use this command." }
{
PREFIX,
ChatColors.Red + "You must be in the pending state to use this command."
}
};
}
}
Loading

0 comments on commit e5734b2

Please sign in to comment.