Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Helpers/Exceptions/KrzysiuFuckedUpException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace SER.Helpers.Exceptions;
public class KrzysiuFuckedUpException : SystemException
{
public KrzysiuFuckedUpException()
{
}

public KrzysiuFuckedUpException(string msg) : base(msg)
{
}
}
39 changes: 39 additions & 0 deletions MethodSystem/Methods/ItemMethods/FirearmItemInfoMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using LabApi.Features.Wrappers;
using SER.ArgumentSystem.Arguments;
using SER.ArgumentSystem.BaseArguments;
using SER.Helpers.Exceptions;
using SER.MethodSystem.BaseMethods;
using SER.ValueSystem;
using System;

namespace SER.MethodSystem.Methods.ItemMethods;
internal class FirearmItemInfoMethod : ReturningMethod
{
public override string Description => "Returns info about provided firearm";

public override Type[] ReturnTypes => [typeof(BoolValue), typeof(NumberValue)];

public override Argument[] ExpectedArguments =>
[
new ReferenceArgument<FirearmItem>("firearm"),
new OptionsArgument("property",
"ammo",
"maxAmmo",
"isCocked",
"isMagazineInserted"
)
];

public override void Execute()
{
FirearmItem f = Args.GetReference<FirearmItem>("firearm");
ReturnValue = Args.GetOption("property") switch
{
"ammo" => new NumberValue(f.StoredAmmo),
"maxammo" => new NumberValue(f.MaxAmmo),
"iscocked" => new BoolValue(f.Cocked),
"ismagazineinserted" => new BoolValue(f.MagazineInserted),
_ => throw new KrzysiuFuckedUpException("out of range")
};
}
}
37 changes: 37 additions & 0 deletions MethodSystem/Methods/ItemMethods/UsableItemInfoMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using LabApi.Features.Wrappers;
using SER.ArgumentSystem.Arguments;
using SER.ArgumentSystem.BaseArguments;
using SER.Helpers.Exceptions;
using SER.MethodSystem.BaseMethods;
using SER.ValueSystem;
using System;

namespace SER.MethodSystem.Methods.ItemMethods;
internal class UsableItemInfoMethod : ReturningMethod
{
public override string Description => "Returns information about provided usable item, like Painkillers, Medkit, etc.";

public override Type[] ReturnTypes => [typeof(NumberValue), typeof(BoolValue)];

public override Argument[] ExpectedArguments =>
[
new ReferenceArgument<UsableItem>("usable"),
new OptionsArgument("property",
"useTime",
"canUse",
"isUsing"
)
];

public override void Execute()
{
UsableItem u = Args.GetReference<UsableItem>("usable");
ReturnValue = Args.GetOption("property") switch
{
"usetime" => new NumberValue((decimal)u.UseDuration),
"canuse" => new BoolValue(u.CanClientStartUsing),
"isusing" => new BoolValue(u.IsUsing),
_ => throw new KrzysiuFuckedUpException("out of range")
};
}
}
4 changes: 0 additions & 4 deletions MethodSystem/Methods/RoleMethods/RoleInfoMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public class RoleInfoMethod : ReturningMethod<TextValue>, IReferenceResolvingMet
new OptionsArgument("property",
Option.Enum<RoleTypeId>("type"),
Option.Enum<Team>("team"),
Option.Enum<RoleSpawnFlags>("spawnFlags"),
Option.Enum<RoleChangeReason>("spawnReason"),
"name"
)
];
Expand All @@ -35,8 +33,6 @@ public override void Execute()
{
"type" => new TextValue(role.RoleTypeId.ToString()),
"team" => new TextValue(role.Team.ToString()),
"spawnflags" => new TextValue(role.ServerSpawnFlags.ToString()),
"spawnreason" => new TextValue(role.ServerSpawnReason.ToString()),
"name" => new TextValue(role.RoleName),
_ => throw new AndrzejFuckedUpException("out of range")
};
Expand Down
34 changes: 34 additions & 0 deletions MethodSystem/Methods/RoleMethods/Set079AuxPowerMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using LabApi.Features.Wrappers;
using PlayerRoles.PlayableScps.Scp079;
using SER.ArgumentSystem.Arguments;
using SER.ArgumentSystem.BaseArguments;
using SER.MethodSystem.BaseMethods;
using System.Collections.Generic;

namespace SER.MethodSystem.Methods.RoleMethods;
public class Set079AuxPowerMethod : SynchronousMethod
{
public override string Description => "Sets players EXP if he is SCP-079";

public override Argument[] ExpectedArguments =>
[
new PlayersArgument("players"),
new IntArgument("exp")
];

public override void Execute()
{
List<Player> pls = Args.GetPlayers("players");
int exp = Args.GetInt("exp");
foreach(Player p in pls)
{
if(p.RoleBase is Scp079Role scp)
{
if(scp.SubroutineModule.TryGetSubroutine<Scp079TierManager>(out Scp079TierManager tier))
{
tier.TotalExp = exp;
}
}
}
}
}
17 changes: 0 additions & 17 deletions MethodSystem/Methods/WarheadMethods/DetonateWarheadMethod.cs

This file was deleted.

39 changes: 39 additions & 0 deletions MethodSystem/Methods/WarheadMethods/WarheadInfoMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using LabApi.Features.Wrappers;
using SER.ArgumentSystem.Arguments;
using SER.ArgumentSystem.BaseArguments;
using SER.Helpers.Exceptions;
using SER.MethodSystem.BaseMethods;
using SER.ValueSystem;
using System;

namespace SER.MethodSystem.Methods.WarheadMethods;
public class WarheadInfoMethod : ReturningMethod
{
public override string Description => "returns information about alpha warhead";

public override Type[] ReturnTypes => [typeof(BoolValue), typeof(NumberValue)];

public override Argument[] ExpectedArguments =>
[
new OptionsArgument("property",
"isOpen",
"isArmed",
"isStarted",
"isDetonated",
"duration"
)
];

public override void Execute()
{
ReturnValue = Args.GetOption("property") switch
{
"isarmed" => new BoolValue(Warhead.IsAuthorized),
"isopen" => new BoolValue(Warhead.IsLocked),
"isstarted" => new BoolValue(Warhead.IsDetonationInProgress),
"isdetonated" => new BoolValue(Warhead.IsDetonated),
"duration" => new NumberValue((decimal)AlphaWarheadController.TimeUntilDetonation),
_ => throw new KrzysiuFuckedUpException()
};
}
}
76 changes: 76 additions & 0 deletions MethodSystem/Methods/WarheadMethods/WarheadMethod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using LabApi.Features.Wrappers;
using SER.ArgumentSystem.Arguments;
using SER.ArgumentSystem.BaseArguments;
using SER.MethodSystem.BaseMethods;
using SER.Helpers.Exceptions;

namespace SER.MethodSystem.Methods.WarheadMethods;

public class WarheadMethod : SynchronousMethod
{
public override string Description => "Manages alpha warhead.";

public override Argument[] ExpectedArguments =>
[
new OptionsArgument("action",
"Open",
"Close",
"Arm",
"Disarm",
"Lock",
"Unlock",
"Start",
"Stop",
"Detonate",
"Shake"
)
];

public override void Execute()
{
switch (Args.GetOption("action"))
{
case "open":
Warhead.IsAuthorized = true;
break;

case "close":
Warhead.IsAuthorized = false;
break;

case "lock":
Warhead.IsLocked = true;
break;

case "unlock":
Warhead.IsLocked = false;
break;

case "arm":
Warhead.BaseNukesitePanel.Networkenabled = true;
break;

case "disarm":
Warhead.BaseNukesitePanel.Networkenabled = false;
break;

case "start":
Warhead.Start();
break;

case "stop":
Warhead.Stop();
break;

case "detonate":
Warhead.Detonate();
break;

case "shake":
Warhead.Shake();
break;

default: throw new KrzysiuFuckedUpException("out of range");
}
}
}
Loading