-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,931 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
using Jailbreak.Formatting.Base; | ||
using Jailbreak.Formatting.Core; | ||
using Jailbreak.Formatting.Logistics; | ||
using Jailbreak.Formatting.Objects; | ||
using Jailbreak.Formatting.Views; | ||
using Jailbreak.Public.Mod.LastRequest; | ||
using Jailbreak.Public.Mod.LastRequest.Enums; | ||
|
||
namespace Jailbreak.English.LastRequest; | ||
|
||
public class LastRequestMessages : ILastRequestMessages, ILanguage<Formatting.Languages.English> | ||
{ | ||
public static FormatObject PREFIX = | ||
new HiddenFormatObject($" {ChatColors.DarkRed}[{ChatColors.LightRed}LR{ChatColors.DarkRed}]") | ||
{ | ||
// Hide in panorama and center text | ||
Plain = false, | ||
Panorama = false, | ||
Chat = true | ||
}; | ||
|
||
public IView LastRequestEnabled() => new SimpleView() | ||
{ | ||
{ PREFIX, "Last Request has been enabled." } | ||
}; | ||
|
||
public IView LastRequestDisabled() => new SimpleView() | ||
{ | ||
{ PREFIX, "Last Request has been disabled." } | ||
}; | ||
|
||
public IView LastRequestNotEnabled() => new SimpleView() | ||
{ | ||
{ PREFIX, "Last Request is not enabled." } | ||
}; | ||
|
||
public IView InvalidLastRequest(string query) | ||
{ | ||
return new SimpleView() | ||
{ | ||
PREFIX, | ||
"Invalid Last Request: ", | ||
query | ||
}; | ||
} | ||
|
||
public IView InvalidPlayerChoice(CCSPlayerController player, string reason) | ||
{ | ||
return new SimpleView() | ||
{ | ||
PREFIX, | ||
"Invalid player choice: ", | ||
player, | ||
" Reason: ", | ||
reason | ||
}; | ||
} | ||
|
||
public IView InformLastRequest(AbstractLastRequest lr) | ||
{ | ||
return new SimpleView() | ||
{ | ||
PREFIX, | ||
lr.prisoner, "is preparing a", lr.type.ToFriendlyString(), | ||
"Last Request against", lr.guard | ||
}; | ||
} | ||
|
||
public IView AnnounceLastRequest(AbstractLastRequest lr) | ||
{ | ||
return new SimpleView() | ||
{ | ||
PREFIX, | ||
lr.prisoner, "is doing a", lr.type.ToFriendlyString(), | ||
"Last Request against", lr.guard | ||
}; | ||
} | ||
|
||
public IView LastRequestDecided(AbstractLastRequest lr, LRResult result) | ||
{ | ||
return new SimpleView() | ||
{ | ||
PREFIX, | ||
result == LRResult.PrisonerWin ? lr.prisoner : lr.guard, "won the LR." | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
lang/Jailbreak.English/Warden/SpecialTreatmentNotifications.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
|
||
using Jailbreak.Formatting.Base; | ||
using Jailbreak.Formatting.Core; | ||
using Jailbreak.Formatting.Logistics; | ||
using Jailbreak.Formatting.Objects; | ||
using Jailbreak.Formatting.Views; | ||
|
||
namespace Jailbreak.English.Warden; | ||
|
||
public class SpecialTreatmentNotifications : ISpecialTreatmentNotifications, ILanguage<Formatting.Languages.English> | ||
{ | ||
public static FormatObject PREFIX = new HiddenFormatObject( $" {ChatColors.Lime}[{ChatColors.Green}ST{ChatColors.Lime}]" ) | ||
{ | ||
// Hide in panorama and center text | ||
Plain = false, | ||
Panorama = false, | ||
Chat = true, | ||
}; | ||
|
||
public IView GRANTED => | ||
new SimpleView { PREFIX, "You now have special treatment!" }; | ||
|
||
public IView REVOKED => | ||
new SimpleView { PREFIX, "Your special treatment was removed" }; | ||
|
||
public IView GRANTED_TO(CCSPlayerController player) | ||
{ | ||
return new SimpleView { PREFIX, player, "now has Special Treatment!" }; | ||
} | ||
|
||
public IView REVOKED_FROM(CCSPlayerController player) | ||
{ | ||
return new SimpleView { PREFIX, player, "no longer has Special Treatment." }; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Modules.Menu; | ||
using CounterStrikeSharp.API.Modules.Utils; | ||
using Jailbreak.Formatting.Extensions; | ||
using Jailbreak.Formatting.Views; | ||
using Jailbreak.LastRequest; | ||
using Jailbreak.Public.Extensions; | ||
using Jailbreak.Public.Mod.LastRequest; | ||
using Jailbreak.Public.Mod.LastRequest.Enums; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Jailbreak.Debug.Subcommands; | ||
|
||
public class LastRequest : AbstractCommand | ||
{ | ||
private ILastRequestManager manager; | ||
private LastRequestPlayerSelector playerSelector; | ||
private LastRequestMenuSelector menuSelector; | ||
private ILastRequestMessages _messages; | ||
private IGenericCommandNotifications _generic; | ||
|
||
private BasePlugin plugin; | ||
|
||
public LastRequest(IServiceProvider services, BasePlugin plugin) : base(services) | ||
{ | ||
this.plugin = plugin; | ||
manager = services.GetRequiredService<ILastRequestManager>(); | ||
playerSelector = new LastRequestPlayerSelector(manager, true); | ||
menuSelector = new LastRequestMenuSelector(services.GetRequiredService<ILastRequestFactory>(), | ||
(type) => "css_debug lastrequest " + type); | ||
_messages = services.GetRequiredService<ILastRequestMessages>(); | ||
_generic = services.GetRequiredService<IGenericCommandNotifications>(); | ||
} | ||
|
||
// css_lastrequest [lr] [player] <target> | ||
public override void OnCommand(CCSPlayerController? executor, WrappedInfo info) | ||
{ | ||
if (executor != null && !executor.IsReal()) | ||
return; | ||
|
||
if (info.ArgCount == 1 && executor != null) | ||
{ | ||
MenuManager.OpenCenterHtmlMenu(plugin, executor, menuSelector.GetMenu()); | ||
} | ||
|
||
var type = LRTypeExtensions.FromString(info.GetArg(1)); | ||
if (type is null) | ||
{ | ||
_messages.InvalidLastRequest(info.GetArg(1)).ToPlayerChat(executor); | ||
return; | ||
} | ||
|
||
if (info.ArgCount == 2) | ||
{ | ||
MenuManager.OpenCenterHtmlMenu(plugin, executor, | ||
playerSelector.CreateMenu(executor, (str) => "css_debug lastrequest " + type + " #" + str)); | ||
return; | ||
} | ||
|
||
var fromPlayer = GetVulnerableTarget(info, 2); | ||
if (fromPlayer == null) | ||
return; | ||
|
||
if (info.ArgCount == 3 && executor != null) | ||
{ | ||
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 | ||
manager.InitiateLastRequest(fromPlayer.First(), executor, type.Value); | ||
return; | ||
} | ||
|
||
if (info.ArgCount == 4) | ||
{ | ||
var targetPlayer = GetVulnerableTarget(info, 3); | ||
if (targetPlayer == null) | ||
return; | ||
manager.InitiateLastRequest(fromPlayer.First(), targetPlayer.First(), type.Value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\public\Jailbreak.Formatting\Jailbreak.Formatting.csproj" /> | ||
<ProjectReference Include="..\..\public\Jailbreak.Public\Jailbreak.Public.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.