File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed
Code/MethodSystem/Methods/RespawnMethods Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ using JetBrains . Annotations ;
2+ using LabApi . Features . Wrappers ;
3+ using SER . Code . ArgumentSystem . Arguments ;
4+ using SER . Code . ArgumentSystem . BaseArguments ;
5+ using SER . Code . Helpers . Exceptions ;
6+ using SER . Code . MethodSystem . BaseMethods . Synchronous ;
7+ using SER . Code . MethodSystem . Structures ;
8+ using SER . Code . ValueSystem ;
9+
10+ namespace SER . Code . MethodSystem . Methods . RespawnMethods ;
11+
12+ [ UsedImplicitly ]
13+ public class GetWaveTimerMethod : ReferenceReturningMethod < Result < DurationValue > >
14+ {
15+ public override string Description => "Returns the duration of a given spawn wave." ;
16+
17+ public override Argument [ ] ExpectedArguments { get ; } =
18+ [
19+ new OptionsArgument ( "wave type" ,
20+ "primaryMtfWave" ,
21+ "miniMtfWave" ,
22+ "primaryChaosWave" ,
23+ "miniChaosWave"
24+ )
25+ ] ;
26+
27+
28+ public override void Execute ( )
29+ {
30+ float duration = Args . GetOption ( "wave type" ) switch
31+ {
32+ "primarymtfwave" => RespawnWaves . PrimaryMtfWave ? . TimeLeft ?? - 1 ,
33+ "minimtfwave" => RespawnWaves . MiniMtfWave ? . TimeLeft ?? - 1 ,
34+ "primarychaoswave" => RespawnWaves . PrimaryChaosWave ? . TimeLeft ?? - 1 ,
35+ "minichaoswave" => RespawnWaves . MiniChaosWave ? . TimeLeft ?? - 1 ,
36+ _ => throw new AndrzejFuckedUpException ( )
37+ } ;
38+
39+ ReturnValue = new Result < DurationValue > (
40+ duration >= 0
41+ ? TimeSpan . FromSeconds ( duration )
42+ : null
43+ ) ;
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments