Skip to content

Commit 422390d

Browse files
committed
5 new player properties, Set079AccessTier
1 parent 4223fc6 commit 422390d

File tree

5 files changed

+93
-15
lines changed

5 files changed

+93
-15
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace SER.Helpers.Exceptions;
2+
3+
public class TosoksFuckedUpException : DeveloperFuckedUpException
4+
{
5+
public TosoksFuckedUpException() : base("tosoks")
6+
{
7+
}
8+
9+
public TosoksFuckedUpException(string msg) : base("tosoks", msg)
10+
{
11+
}
12+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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.SCP079Methods;
8+
public class Set079AccessTierMethod : SynchronousMethod
9+
{
10+
public override string Description => "Sets the Access Tier of the given player(s) if they are SCP-079";
11+
12+
public override Argument[] ExpectedArguments =>
13+
[
14+
new PlayersArgument("players"),
15+
new IntArgument("tier", 1, 5)
16+
];
17+
18+
public override void Execute()
19+
{
20+
var plrs = Args.GetPlayers("players");
21+
var value = Args.GetInt("tier");
22+
foreach(Player p in plrs)
23+
{
24+
if(p.RoleBase is Scp079Role scp)
25+
{
26+
var levelIndex = value - 1;
27+
if (scp.SubroutineModule.TryGetSubroutine<Scp079TierManager>(out Scp079TierManager tier))
28+
{
29+
tier.TotalExp = levelIndex != 0 ? tier.AbsoluteThresholds[levelIndex - 1] : 0;
30+
}
31+
}
32+
}
33+
}
34+
}

MethodSystem/Methods/RoleMethods/Set079AuxPowerMethod.cs renamed to MethodSystem/Methods/SCP-079Methods/Set079AuxPowerMethod.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44
using SER.ArgumentSystem.BaseArguments;
55
using SER.MethodSystem.BaseMethods;
66

7-
namespace SER.MethodSystem.Methods.RoleMethods;
7+
namespace SER.MethodSystem.Methods.SCP079Methods;
88
public class Set079AuxPowerMethod : SynchronousMethod
99
{
10-
public override string Description => "Sets players Aux power if he is SCP-079";
10+
public override string Description => "Sets the Auxiliary Power of the given player(s) if they are SCP-079";
1111

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

1818
public override void Execute()
1919
{
20-
var pls = Args.GetPlayers("players");
21-
int pow = Args.GetInt("power");
22-
foreach(Player p in pls)
20+
var plrs = Args.GetPlayers("players");
21+
var value = Args.GetInt("power");
22+
foreach(Player p in plrs)
2323
{
2424
if(p.RoleBase is Scp079Role scp)
2525
{
2626
if(scp.SubroutineModule.TryGetSubroutine<Scp079AuxManager>(out Scp079AuxManager aux))
2727
{
28-
aux.CurrentAux = pow;
28+
aux.CurrentAux = value;
2929
}
3030
}
3131
}

MethodSystem/Methods/RoleMethods/Set079ExpMethod.cs renamed to MethodSystem/Methods/SCP-079Methods/Set079ExpMethod.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44
using SER.ArgumentSystem.BaseArguments;
55
using SER.MethodSystem.BaseMethods;
66

7-
namespace SER.MethodSystem.Methods.RoleMethods;
7+
namespace SER.MethodSystem.Methods.SCP079Methods;
88
public class Set079ExpMethod : SynchronousMethod
99
{
10-
public override string Description => "Sets players EXP if he is SCP-079";
10+
public override string Description => "Sets the EXP of the given player(s) if they are SCP-079";
1111

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

1818
public override void Execute()
1919
{
20-
var pls = Args.GetPlayers("players");
21-
int exp = Args.GetInt("exp");
22-
foreach (Player p in pls)
20+
var plrs = Args.GetPlayers("players");
21+
var value = Args.GetInt("exp");
22+
foreach (Player p in plrs)
2323
{
2424
if (p.RoleBase is Scp079Role scp)
2525
{
2626
if (scp.SubroutineModule.TryGetSubroutine<Scp079TierManager>(out Scp079TierManager tier))
2727
{
28-
tier.TotalExp = exp;
28+
tier.TotalExp = value;
2929
}
3030
}
3131
}

TokenSystem/Tokens/ExpressionTokens/PlayerExpressionToken.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ public enum PlayerProperty
5555
RoleSpawnFlags,
5656
AuxiliaryPower,
5757
Emotion,
58-
Experience
58+
Experience,
59+
MaxAuxiliaryPower,
60+
SizeX,
61+
SizeY,
62+
SizeZ,
63+
AccessTier,
5964
}
6065

6166
public abstract class Info
@@ -135,6 +140,33 @@ public class Info<T>(Func<Player, T> handler, string? description) : Info
135140
else return -1;
136141
}, "Returns player EXP if he is SCP-079, otherwise returns -1"),
137142
[PlayerProperty.Emotion] = new Info<TextValue>(plr => plr.Emotion.ToString(), "Current emotion (e.g. Neutral, Chad)"),
143+
[PlayerProperty.MaxAuxiliaryPower] = new Info<NumberValue>(plr =>
144+
{
145+
if (plr.RoleBase is Scp079Role scp)
146+
{
147+
if (scp.SubroutineModule.TryGetSubroutine<Scp079AuxManager>(out Scp079AuxManager man))
148+
{
149+
return (decimal)man.MaxAux;
150+
}
151+
else return -1;
152+
}
153+
else return -1;
154+
}, "Returns the player's Maximum Auxiliary Power if they are SCP-079, otherwise returns -1"),
155+
[PlayerProperty.SizeX] = new Info<NumberValue>(plr => (decimal)plr.Scale.x, null),
156+
[PlayerProperty.SizeY] = new Info<NumberValue>(plr => (decimal)plr.Scale.y, null),
157+
[PlayerProperty.SizeZ] = new Info<NumberValue>(plr => (decimal)plr.Scale.z, null),
158+
[PlayerProperty.AccessTier] = new Info<NumberValue>(plr =>
159+
{
160+
if (plr.RoleBase is Scp079Role scp)
161+
{
162+
if (scp.SubroutineModule.TryGetSubroutine<Scp079TierManager>(out Scp079TierManager tier))
163+
{
164+
return tier.AccessTierLevel;
165+
}
166+
else return -1;
167+
}
168+
else return -1;
169+
}, "Returns the player's Access Tier Level if they are SCP-079, otherwise returns -1")
138170
};
139171

140172
protected override IParseResult InternalParse(BaseToken[] tokens)

0 commit comments

Comments
 (0)