Skip to content

Commit

Permalink
New structure
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Feb 10, 2024
1 parent 06db963 commit 3c53366
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Jailbreak.sln
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.Logs", "mod\Jailb
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.Debug", "mod\Jailbreak.Debug\Jailbreak.Debug.csproj", "{4F10E2B5-E8BB-4253-9BE6-9187575ADB13}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jailbreak.LastRequest", "mod\Jailbreak.LastRequest\Jailbreak.LastRequest.csproj", "{D8952626-7B8D-4ABB-A3AE-FC81C688787B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -74,6 +76,10 @@ Global
{4F10E2B5-E8BB-4253-9BE6-9187575ADB13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F10E2B5-E8BB-4253-9BE6-9187575ADB13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F10E2B5-E8BB-4253-9BE6-9187575ADB13}.Release|Any CPU.Build.0 = Release|Any CPU
{D8952626-7B8D-4ABB-A3AE-FC81C688787B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8952626-7B8D-4ABB-A3AE-FC81C688787B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8952626-7B8D-4ABB-A3AE-FC81C688787B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8952626-7B8D-4ABB-A3AE-FC81C688787B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{9135CCC9-66C5-4A9C-AE3C-91475B5F0437} = {177DA48D-8306-4102-918D-992569878581}
Expand All @@ -86,5 +92,6 @@ Global
{CB2391A1-6CDD-496F-B8D6-674FD6268038} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
{CE6EC648-E7F9-4CE7-B28F-8C7995830F35} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
{4F10E2B5-E8BB-4253-9BE6-9187575ADB13} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
{D8952626-7B8D-4ABB-A3AE-FC81C688787B} = {36BA84C0-291C-4930-A7C6-97CDF8F7F0D7}
EndGlobalSection
EndGlobal
13 changes: 13 additions & 0 deletions mod/Jailbreak.LastRequest/Jailbreak.LastRequest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>
30 changes: 30 additions & 0 deletions mod/Jailbreak.LastRequest/LastRequestManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Behaviors;
using Jailbreak.Public.Mod.LastRequest;

namespace Jailbreak.LastRequest;

public class LastRequestManager : IPluginBehavior, ILastRequestManager
{
private BasePlugin _parent;

public void Start(BasePlugin parent)
{
_parent = parent;
_parent.RegisterEventHandler<EventPlayerDeath>(OnPlayerDeath);
}

public HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info)
{
return HookResult.Continue;
}

public bool IsLREnabled { get; set; }
public IList<AbstractLastRequest> ActiveLRs { get; } = new List<AbstractLastRequest>();

public void InitiateLastRequest(AbstractLastRequest lastRequest)
{
lastRequest.Setup();
ActiveLRs.Add(lastRequest);
}
}
17 changes: 17 additions & 0 deletions public/Jailbreak.Public/Mod/LastRequest/AbstractLastRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Mod.LastRequest.Enums;

namespace Jailbreak.Public.Mod.LastRequest;

public abstract class AbstractLastRequest
{
protected CCSPlayerController prisoner, guard;

Check warning on line 8 in public/Jailbreak.Public/Mod/LastRequest/AbstractLastRequest.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'prisoner' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 8 in public/Jailbreak.Public/Mod/LastRequest/AbstractLastRequest.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable field 'guard' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.
protected LRType type;
protected LRState state;

protected DateTimeOffset startTime;

public abstract void Setup();
public abstract void Execute();
public abstract void End(LRResult result);
}
9 changes: 9 additions & 0 deletions public/Jailbreak.Public/Mod/LastRequest/Enums/LRResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Jailbreak.Public.Mod.LastRequest.Enums;

public enum LRResult
{
PrisonerWin,
GuardWin,
TimedOut,
Interrupted
}
9 changes: 9 additions & 0 deletions public/Jailbreak.Public/Mod/LastRequest/Enums/LRState.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Jailbreak.Public.Mod.LastRequest.Enums;

public enum LRState
{
Pending,
Active,
Completed,
Cancelled
}
13 changes: 13 additions & 0 deletions public/Jailbreak.Public/Mod/LastRequest/Enums/LRType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Jailbreak.Public.Mod.LastRequest.Enums;

public enum LRType
{
GunToss,
RockPaperScissors,
KnifeFight,
NoScope,
FiftyFifty,
ShotForShot,
MagForMag,
Race
}
10 changes: 10 additions & 0 deletions public/Jailbreak.Public/Mod/LastRequest/ILastRequestFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Behaviors;
using Jailbreak.Public.Mod.LastRequest.Enums;

namespace Jailbreak.Public.Mod.LastRequest;

public interface ILastRequestFactory : IPluginBehavior
{
AbstractLastRequest CreateLastRequest(CCSPlayerController prisoner, CCSPlayerController guard, LRType type);
}
12 changes: 12 additions & 0 deletions public/Jailbreak.Public/Mod/LastRequest/ILastRequestManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Jailbreak.Public.Behaviors;

namespace Jailbreak.Public.Mod.LastRequest;

public interface ILastRequestManager : IPluginBehavior
{
public bool IsLREnabled { get; set; }
public IList<AbstractLastRequest> ActiveLRs { get; }

void InitiateLastRequest(AbstractLastRequest lastRequest);

}

0 comments on commit 3c53366

Please sign in to comment.