Skip to content

Commit fe9ff0e

Browse files
Merge pull request #9 from KrzychuWarrior/main
2 methods and fixes
2 parents f064974 + 656913e commit fe9ff0e

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

MethodSystem/Methods/RoleMethods/Set079AuxPowerMethod.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
namespace SER.MethodSystem.Methods.RoleMethods;
88
public class Set079AuxPowerMethod : SynchronousMethod
99
{
10-
public override string Description => "Sets players EXP if he is SCP-079";
10+
public override string Description => "Sets players Aux power if he is SCP-079";
1111

1212
public override Argument[] ExpectedArguments =>
1313
[
1414
new PlayersArgument("players"),
15-
new IntArgument("exp")
15+
new IntArgument("power")
1616
];
1717

1818
public override void Execute()
1919
{
2020
var pls = Args.GetPlayers("players");
21-
int exp = Args.GetInt("exp");
21+
int pow = Args.GetInt("power");
2222
foreach(Player p in pls)
2323
{
2424
if(p.RoleBase is Scp079Role scp)
2525
{
26-
if(scp.SubroutineModule.TryGetSubroutine<Scp079TierManager>(out Scp079TierManager tier))
26+
if(scp.SubroutineModule.TryGetSubroutine<Scp079AuxManager>(out Scp079AuxManager aux))
2727
{
28-
tier.TotalExp = exp;
28+
aux.CurrentAux = pow;
2929
}
3030
}
3131
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using LabApi.Features.Wrappers;
2+
using PlayerRoles.PlayableScps.Scp079;
3+
using SER.ArgumentSystem.Arguments;
4+
using SER.ArgumentSystem.BaseArguments;
5+
using SER.MethodSystem.BaseMethods;
6+
7+
namespace SER.MethodSystem.Methods.RoleMethods;
8+
public class Set079ExpMethod : SynchronousMethod
9+
{
10+
public override string Description => "Sets players EXP if he is SCP-079";
11+
12+
public override Argument[] ExpectedArguments =>
13+
[
14+
new PlayersArgument("players"),
15+
new IntArgument("exp")
16+
];
17+
18+
public override void Execute()
19+
{
20+
var pls = Args.GetPlayers("players");
21+
int exp = Args.GetInt("exp");
22+
foreach (Player p in pls)
23+
{
24+
if (p.RoleBase is Scp079Role scp)
25+
{
26+
if (scp.SubroutineModule.TryGetSubroutine<Scp079TierManager>(out Scp079TierManager tier))
27+
{
28+
tier.TotalExp = exp;
29+
}
30+
}
31+
}
32+
}
33+
}

MethodSystem/Methods/WarheadMethods/WarheadInfoMethod.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class WarheadInfoMethod : ReturningMethod
1717
[
1818
new OptionsArgument("property",
1919
"isLocked",
20+
"isOpen",
2021
"isArmed",
2122
"hasStarted",
2223
"isDetonated",
@@ -29,7 +30,8 @@ public override void Execute()
2930
ReturnValue = Args.GetOption("property") switch
3031
{
3132
"islocked" => new BoolValue(Warhead.IsLocked),
32-
"isarmed" => new BoolValue(Warhead.IsAuthorized),
33+
"isopen" => new BoolValue(Warhead.IsAuthorized),
34+
"isarmed" => new BoolValue(Warhead.LeverStatus),
3335
"hasstarted" => new BoolValue(Warhead.IsDetonationInProgress),
3436
"isdetonated" => new BoolValue(Warhead.IsDetonated),
3537
"duration" => new DurationValue(TimeSpan.FromSeconds(AlphaWarheadController.TimeUntilDetonation)),

TokenSystem/Tokens/ExpressionTokens/PlayerExpressionToken.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public enum PlayerProperty
5555
RoleSpawnFlags,
5656
AuxiliaryPower,
5757
Emotion,
58+
Experience
5859
}
5960

6061
public abstract class Info
@@ -110,6 +111,18 @@ public class Info<T>(Func<Player, T> handler, string? description) : Info
110111
[PlayerProperty.RoleChangeReason] = new Info<TextValue>(plr => plr.RoleBase._spawnReason.ToString(), null),
111112
[PlayerProperty.RoleSpawnFlags] = new Info<TextValue>(plr => plr.RoleBase._spawnFlags.ToString(), null),
112113
[PlayerProperty.AuxiliaryPower] = new Info<NumberValue>(plr =>
114+
{
115+
if (plr.RoleBase is Scp079Role scp)
116+
{
117+
if (scp.SubroutineModule.TryGetSubroutine<Scp079AuxManager>(out Scp079AuxManager man))
118+
{
119+
return (decimal)man.CurrentAux;
120+
}
121+
else return -1;
122+
}
123+
else return -1;
124+
}, "Returns player Aux power if he is SCP-079, otherwise returns -1"),
125+
[PlayerProperty.Experience] = new Info<NumberValue>(plr =>
113126
{
114127
if (plr.RoleBase is Scp079Role scp)
115128
{

0 commit comments

Comments
 (0)