Skip to content

Commit 3e24956

Browse files
fix RespawnWaveInfoMethod
1 parent 6010af8 commit 3e24956

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Code/MethodSystem/Methods/RespawnMethods/RespawnWaveInfoMethod.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using JetBrains.Annotations;
22
using LabApi.Features.Wrappers;
33
using PlayerRoles;
4+
using Respawning;
5+
using Respawning.Waves;
6+
using Respawning.Waves.Generic;
47
using SER.Code.ArgumentSystem.Arguments;
58
using SER.Code.ArgumentSystem.BaseArguments;
69
using SER.Code.ArgumentSystem.Structures;
@@ -14,36 +17,39 @@ namespace SER.Code.MethodSystem.Methods.RespawnMethods;
1417
[UsedImplicitly]
1518
public class RespawnWaveInfoMethod : LiteralValueReturningMethod, IReferenceResolvingMethod
1619
{
17-
public Type ReferenceType => typeof(RespawnWave);
20+
public Type ReferenceType => typeof(TimeBasedWave);
1821

1922
public override TypeOfValue LiteralReturnTypes => new TypesOfValue([
2023
typeof(NumberValue),
21-
typeof(TextValue)
24+
typeof(TextValue),
25+
typeof(DurationValue)
2226
]);
2327

2428
public override string Description => IReferenceResolvingMethod.Desc.Get(this);
2529

2630
public override Argument[] ExpectedArguments { get; } =
2731
[
28-
new ReferenceArgument<RespawnWave>("respawnWave"),
32+
new ReferenceArgument<TimeBasedWave>("respawnWave"),
2933
new OptionsArgument("property",
3034
Option.Enum<Faction>(),
3135
"maxWaveSize",
3236
"respawnTokens",
3337
"influence",
34-
"secondsLeft")
38+
"secondsLeft"
39+
)
3540
];
3641

3742
public override void Execute()
3843
{
39-
var wave = Args.GetReference<RespawnWave>("respawnWave");
44+
var wave = Args.GetReference<TimeBasedWave>("respawnWave");
45+
4046
ReturnValue = Args.GetOption("property") switch
4147
{
42-
"faction" => new TextValue(wave.Faction.ToString()),
48+
"faction" => new TextValue(wave.TargetFaction.ToString()),
4349
"maxwavesize" => new NumberValue(wave.MaxWaveSize),
44-
"respawntokens" => new NumberValue(wave.RespawnTokens),
45-
"influence" => new NumberValue((decimal)wave.Influence),
46-
"secondsleft" => new NumberValue((decimal)wave.TimeLeft),
50+
"respawntokens" => new NumberValue(wave is ILimitedWave limitedWave ? limitedWave.RespawnTokens : 0),
51+
"influence" => new NumberValue((decimal)FactionInfluenceManager.Get(wave.TargetFaction)),
52+
"timeleft" => new DurationValue(TimeSpan.FromSeconds(wave.Timer.TimeLeft)),
4753
_ => throw new AndrzejFuckedUpException()
4854
};
4955
}

0 commit comments

Comments
 (0)