Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS authored Feb 6, 2024
2 parents 9579c32 + c90f1ef commit 28c81f1
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 12 deletions.
1 change: 1 addition & 0 deletions mod/Jailbreak.Debug/DebugCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public DebugCommand(IServiceProvider 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)
Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.Debug/Subcommands/MarkRebel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Mod.Rebel;
using Microsoft.Extensions.DependencyInjection;

Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.Debug/Subcommands/Pardon.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Mod.Rebel;
using Microsoft.Extensions.DependencyInjection;

Expand Down
42 changes: 41 additions & 1 deletion mod/Jailbreak.Rebel/RebelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,23 @@ public void Start(BasePlugin parent)
}, TimerFlags.REPEAT);
}


private void OnTick()
{
foreach (var player in GetActiveRebels())
{
if (!player.IsReal())
continue;

if (GetRebelTimeLeft(player) <= 0)
{
continue;
}

SendTimeLeft(player);
}
}

public ISet<CCSPlayerController> GetActiveRebels()
{
return _rebelTimes.Keys.ToHashSet();
Expand All @@ -70,6 +87,16 @@ public bool MarkRebel(CCSPlayerController player, long time = 120)
return true;
}


HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info)
{
var player = @event.Userid;
if (!player.IsReal())
return HookResult.Continue;
rebelTimes.Remove(player);
return HookResult.Continue;
}

public void UnmarkRebel(CCSPlayerController player)
{
_notifs.NoLongerRebel.ToPlayerChat(player);
Expand All @@ -92,7 +119,7 @@ private void OnTick()
}
}

private HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)
HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info)
{
_rebelTimes.Clear();
foreach (var player in Utilities.GetPlayers())
Expand Down Expand Up @@ -142,6 +169,19 @@ private Color GetRebelColor(CCSPlayerController player)
return color;
}

private Color GetRebelColor(CCSPlayerController player)
{
var percent = GetRebelTimePercentage(player);
var percentRGB = 255 - (int)Math.Round(percent * 255.0);
var color = Color.FromArgb(254, 255, percentRGB, percentRGB);
if (percent <= 0)
{
color = Color.FromArgb(254, 255, 255, 255);
}

return color;
}

private void ApplyRebelColor(CCSPlayerController player)
{
if (!player.IsReal() || player.Pawn.Value == null)
Expand Down
6 changes: 6 additions & 0 deletions public/Jailbreak.Formatting/Logistics/LanguageConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public void WithWarden<TWarden>()
_collection.AddSingleton<IWardenNotifications, TWarden>();
}

public void WithGenericCommand<TGenericCommand>()

Check failure on line 34 in public/Jailbreak.Formatting/Logistics/LanguageConfig.cs

View workflow job for this annotation

GitHub Actions / build

Type 'LanguageConfig<TDialect>' already defines a member called 'WithGenericCommand' with the same parameter types

Check failure on line 34 in public/Jailbreak.Formatting/Logistics/LanguageConfig.cs

View workflow job for this annotation

GitHub Actions / build

Type 'LanguageConfig<TDialect>' already defines a member called 'WithGenericCommand' with the same parameter types

Check failure on line 34 in public/Jailbreak.Formatting/Logistics/LanguageConfig.cs

View workflow job for this annotation

GitHub Actions / build

Type 'LanguageConfig<TDialect>' already defines a member called 'WithGenericCommand' with the same parameter types

Check failure on line 34 in public/Jailbreak.Formatting/Logistics/LanguageConfig.cs

View workflow job for this annotation

GitHub Actions / build

Type 'LanguageConfig<TDialect>' already defines a member called 'WithGenericCommand' with the same parameter types
where TGenericCommand : class, ILanguage<TDialect>, IGenericCommandNotifications
{
_collection.AddSingleton<IGenericCommandNotifications, TGenericCommand>();
}

public void WithRebel<TRebel>()
where TRebel : class, ILanguage<TDialect>, IRebelNotifications
{
Expand Down
16 changes: 8 additions & 8 deletions src/Jailbreak/Jailbreak.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\lang\Jailbreak.English\Jailbreak.English.csproj"/>
<ProjectReference Include="..\..\mod\Jailbreak.Debug\Jailbreak.Debug.csproj"/>
<ProjectReference Include="..\..\mod\Jailbreak.Teams\Jailbreak.Teams.csproj"/>
<ProjectReference Include="..\..\mod\Jailbreak.Warden\Jailbreak.Warden.csproj"/>
<ProjectReference Include="..\..\mod\Jailbreak.Rebel\Jailbreak.Rebel.csproj"/>
<ProjectReference Include="..\..\mod\Jailbreak.Logs\Jailbreak.Logs.csproj"/>
<ProjectReference Include="..\..\public\Jailbreak.Public\Jailbreak.Public.csproj"/>
<ProjectReference Include="..\Jailbreak.Generic\Jailbreak.Generic.csproj"/>
<ProjectReference Include="..\..\lang\Jailbreak.English\Jailbreak.English.csproj" />
<ProjectReference Include="..\..\mod\Jailbreak.Debug\Jailbreak.Debug.csproj" />
<ProjectReference Include="..\..\mod\Jailbreak.Teams\Jailbreak.Teams.csproj" />
<ProjectReference Include="..\..\mod\Jailbreak.Warden\Jailbreak.Warden.csproj" />
<ProjectReference Include="..\..\mod\Jailbreak.Rebel\Jailbreak.Rebel.csproj" />
<ProjectReference Include="..\..\mod\Jailbreak.Logs\Jailbreak.Logs.csproj" />
<ProjectReference Include="..\..\public\Jailbreak.Public\Jailbreak.Public.csproj" />
<ProjectReference Include="..\Jailbreak.Generic\Jailbreak.Generic.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Jailbreak/JailbreakServiceCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ public void ConfigureServices(IServiceCollection serviceCollection)
config.WithRebel<RebelNotifications>();
});
}
}
}

0 comments on commit 28c81f1

Please sign in to comment.