11using JetBrains . Annotations ;
22using LabApi . Features . Wrappers ;
33using PlayerRoles ;
4+ using Respawning ;
5+ using Respawning . Waves ;
6+ using Respawning . Waves . Generic ;
47using SER . Code . ArgumentSystem . Arguments ;
58using SER . Code . ArgumentSystem . BaseArguments ;
69using SER . Code . ArgumentSystem . Structures ;
@@ -14,36 +17,39 @@ namespace SER.Code.MethodSystem.Methods.RespawnMethods;
1417[ UsedImplicitly ]
1518public 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