diff --git a/Exiled.CustomModules/API/Commands/CustomTeams/Spawn.cs b/Exiled.CustomModules/API/Commands/CustomTeams/Spawn.cs index 88cf7fd832..eeb4fc3f5b 100644 --- a/Exiled.CustomModules/API/Commands/CustomTeams/Spawn.cs +++ b/Exiled.CustomModules/API/Commands/CustomTeams/Spawn.cs @@ -56,7 +56,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - if (!CustomTeam.TryGet(arguments.At(0), out CustomTeam team) && (!uint.TryParse(arguments.At(0), out uint id) || !CustomTeam.TryGet(id, out team)) && team is null) + if (!uint.TryParse(arguments.At(0), out uint id) || (!CustomTeam.TryGet(id, out CustomTeam team) && team is null)) { response = $"Custom team {arguments.At(0)} not found!"; return false; diff --git a/Exiled.CustomModules/API/Commands/Gamemodes/Start.cs b/Exiled.CustomModules/API/Commands/Gamemodes/Start.cs index 849acef55b..4d3459b3a9 100644 --- a/Exiled.CustomModules/API/Commands/Gamemodes/Start.cs +++ b/Exiled.CustomModules/API/Commands/Gamemodes/Start.cs @@ -55,7 +55,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return false; } - if (CustomGameMode.TryGet(arguments.At(0), out CustomGameMode gameMode) && (!uint.TryParse(arguments.At(0), out uint id) || !CustomGameMode.TryGet(id, out gameMode)) && gameMode is null) + if (!uint.TryParse(arguments.At(0), out uint id) || (!CustomGameMode.TryGet(id, out CustomGameMode gameMode) && gameMode is null)) { response = $"Custom gamemode {arguments.At(0)} not found!"; return false; diff --git a/Exiled.Example/TestEscape/CustomEscapeScenarioType.cs b/Exiled.Example/TestEscape/CustomEscapeScenarioType.cs new file mode 100644 index 0000000000..68ebceb774 --- /dev/null +++ b/Exiled.Example/TestEscape/CustomEscapeScenarioType.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestEscape +{ + using Exiled.CustomModules.API.Enums; + + /// + /// The custom escape scenario type. + /// + public class CustomEscapeScenarioType : UUEscapeScenarioType + { + /// + /// Initializes a new custom escape scenario id. + /// + public static readonly CustomEscapeScenarioType CustomScenario = new(); + } +} \ No newline at end of file diff --git a/Exiled.Example/TestEscape/CustomEscapeType.cs b/Exiled.Example/TestEscape/CustomEscapeType.cs new file mode 100644 index 0000000000..c88b0e8499 --- /dev/null +++ b/Exiled.Example/TestEscape/CustomEscapeType.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestEscape +{ + using Exiled.CustomModules.API.Enums; + + /// + /// The custom escape type. + /// + public class CustomEscapeType : UUCustomEscapeType + { + /// + /// Initializes a new custom escape id. + /// + public static readonly CustomEscapeType TestEscape = new(); + } +} \ No newline at end of file diff --git a/Exiled.Example/TestEscape/TestEscape.cs b/Exiled.Example/TestEscape/TestEscape.cs new file mode 100644 index 0000000000..30407cbf27 --- /dev/null +++ b/Exiled.Example/TestEscape/TestEscape.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestEscape +{ + using System.Collections.Generic; + + using Exiled.API.Features; + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomEscapes; + using PlayerRoles; + + /// + [ModuleIdentifier] + public class TestEscape : CustomEscape + { + /// + public override uint Id { get; set; } = CustomEscapeType.TestEscape; + + /// + public override string Name { get; set; } = "Test Escape"; + + /// + public override bool IsEnabled { get; set; } = true; + + /// + public override Dictionary Scenarios { get; set; } = new() + { + [1] = new Hint("Test Scenario"), + }; + + /// + public override List Settings { get; set; } = new() + { + new EscapeSettings(true, RoleTypeId.FacilityGuard), + }; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestEscape/TestEscapeBehaviour.cs b/Exiled.Example/TestEscape/TestEscapeBehaviour.cs new file mode 100644 index 0000000000..31114b847e --- /dev/null +++ b/Exiled.Example/TestEscape/TestEscapeBehaviour.cs @@ -0,0 +1,32 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestEscape +{ + using Exiled.API.Features; + using Exiled.CustomModules.API.Enums; + using Exiled.CustomModules.API.Features.CustomEscapes; + using Exiled.CustomModules.Events.EventArgs.CustomEscapes; + + /// + public class TestEscapeBehaviour : EscapeBehaviour + { + /// + protected override UUEscapeScenarioType CalculateEscapeScenario() + { + return CustomEscapeScenarioType.CustomScenario; + } + + /// + protected override void OnEscaping(EscapingEventArgs ev) + { + base.OnEscaping(ev); + + Log.ErrorWithContext($"Player {ev.Player.Nickname} is escaping"); + } + } +} \ No newline at end of file diff --git a/Exiled.Example/TestEscape/TestEscapeConfig.cs b/Exiled.Example/TestEscape/TestEscapeConfig.cs new file mode 100644 index 0000000000..4db30536a5 --- /dev/null +++ b/Exiled.Example/TestEscape/TestEscapeConfig.cs @@ -0,0 +1,26 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestEscape +{ + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomEscapes; + using Exiled.CustomModules.API.Features.Generic; + + /// + [ModuleIdentifier] + public class TestEscapeConfig : ModulePointer + { + /// + public override uint Id { get; set; } = CustomEscapeType.TestEscape; + + /// + /// Gets or sets a integer value. + /// + public int Value { get; set; } = 10; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestGamemode/CustomGamemodeType.cs b/Exiled.Example/TestGamemode/CustomGamemodeType.cs new file mode 100644 index 0000000000..5a2b6321a1 --- /dev/null +++ b/Exiled.Example/TestGamemode/CustomGamemodeType.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestGamemode +{ + using Exiled.CustomModules.API.Enums; + + /// + /// The custom gamemode type. + /// + public class CustomGamemodeType : UUGameModeType + { + /// + /// Initializes a new custom gamemode id. + /// + public static readonly CustomGamemodeType TestGamemode = new(); + } +} \ No newline at end of file diff --git a/Exiled.Example/TestGamemode/TestGamemode.cs b/Exiled.Example/TestGamemode/TestGamemode.cs new file mode 100644 index 0000000000..95ba536b24 --- /dev/null +++ b/Exiled.Example/TestGamemode/TestGamemode.cs @@ -0,0 +1,48 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestGamemode +{ + using System; + + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomGameModes; + using PlayerRoles; + + /// + [ModuleIdentifier] + public class TestGamemode : CustomGameMode + { + /// + public override uint Id { get; set; } = CustomGamemodeType.TestGamemode; + + /// + public override string Name { get; set; } = "Test Gamemode"; + + /// + public override bool IsEnabled { get; set; } = true; + + /// + public override Type[] BehaviourComponents { get; } = { typeof(TestGamemodeGameState), typeof(TestGamemodePlayerState) }; + + /// + public override GameModeSettings Settings { get; set; } = new() + { + Automatic = false, + MinimumPlayers = 1, + MaximumPlayers = 5, + RejectExceedingPlayers = false, + IsRespawnEnabled = false, + IsTeamRespawnEnabled = false, + RestartRoundOnEnd = true, + IsDecontaminationEnabled = false, + IsWarheadEnabled = false, + IsWarheadInteractable = false, + SpawnableRoles = new[] { RoleTypeId.ClassD, RoleTypeId.Scientist }, + }; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestGamemode/TestGamemodeConfig.cs b/Exiled.Example/TestGamemode/TestGamemodeConfig.cs new file mode 100644 index 0000000000..fd9d02778c --- /dev/null +++ b/Exiled.Example/TestGamemode/TestGamemodeConfig.cs @@ -0,0 +1,26 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestGamemode +{ + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomGameModes; + using Exiled.CustomModules.API.Features.Generic; + + /// + [ModuleIdentifier] + public class TestGamemodeConfig : ModulePointer + { + /// + public override uint Id { get; set; } = CustomGamemodeType.TestGamemode; + + /// + /// Gets or sets a integer value. + /// + public int Value { get; set; } = 10; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestGamemode/TestGamemodeGameState.cs b/Exiled.Example/TestGamemode/TestGamemodeGameState.cs new file mode 100644 index 0000000000..5ade00b0c9 --- /dev/null +++ b/Exiled.Example/TestGamemode/TestGamemodeGameState.cs @@ -0,0 +1,36 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestGamemode +{ + using Exiled.API.Features; + using Exiled.CustomModules.API.Features.CustomGameModes; + + /// + public class TestGamemodeGameState : GameState + { + /// + public override void Start(bool isForced = false) + { + Map.Broadcast(5, "Test Gamemode Started"); + base.Start(isForced); + } + + /// + public override void End(bool isForced = false) + { + Map.Broadcast(5, "Test Gamemode Ended"); + base.End(isForced); + } + + /// + protected override bool EvaluateEndingConditions() + { + return false; + } + } +} \ No newline at end of file diff --git a/Exiled.Example/TestGamemode/TestGamemodePlayerState.cs b/Exiled.Example/TestGamemode/TestGamemodePlayerState.cs new file mode 100644 index 0000000000..72d40ca452 --- /dev/null +++ b/Exiled.Example/TestGamemode/TestGamemodePlayerState.cs @@ -0,0 +1,16 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestGamemode +{ + using Exiled.CustomModules.API.Features.CustomGameModes; + + /// + public class TestGamemodePlayerState : PlayerState + { + } +} \ No newline at end of file diff --git a/Exiled.Example/TestRole/CustomRoleType.cs b/Exiled.Example/TestRole/CustomRoleType.cs index f7c6a6503f..4a6ab52ed4 100644 --- a/Exiled.Example/TestRole/CustomRoleType.cs +++ b/Exiled.Example/TestRole/CustomRoleType.cs @@ -18,5 +18,10 @@ public class CustomRoleType : UUCustomRoleType /// Initializes a new custom role id. /// public static readonly CustomRoleType TestRole = new(); + + /// + /// Initializes a new custom role id. + /// + public static readonly CustomRoleType TestRole2 = new(); } } \ No newline at end of file diff --git a/Exiled.Example/TestRole/TestRole.cs b/Exiled.Example/TestRole/TestRole.cs index 8b42da381d..624f0b49ff 100644 --- a/Exiled.Example/TestRole/TestRole.cs +++ b/Exiled.Example/TestRole/TestRole.cs @@ -38,7 +38,7 @@ public class TestRole : CustomRole public override int MaxInstances { get; set; } = 1; /// - public override Team[] TeamsOwnership { get; set; } = { Team.SCPs }; + public override Team[] TeamsOwnership { get; set; } = { Team.ClassD }; /// public override RoleTypeId AssignFromRole { get; set; } = RoleTypeId.ClassD; diff --git a/Exiled.Example/TestRole/TestRole2.cs b/Exiled.Example/TestRole/TestRole2.cs new file mode 100644 index 0000000000..f170b099ae --- /dev/null +++ b/Exiled.Example/TestRole/TestRole2.cs @@ -0,0 +1,79 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestRole +{ + using Exiled.API.Enums; + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomRoles; + using PlayerRoles; + + /// + [ModuleIdentifier] + public class TestRole2 : CustomRole + { + /// + public override string Name { get; set; } = "TestRole2"; + + /// + public override uint Id { get; set; } = CustomRoleType.TestRole2; + + /// + public override bool IsEnabled { get; set; } = true; + + /// + public override string Description { get; set; } = "Custom role for testing purposes."; + + /// + public override RoleTypeId Role { get; set; } = RoleTypeId.Scientist; + + /// + public override int Probability { get; set; } = 100; + + /// + public override int MaxInstances { get; set; } = 1; + + /// + public override Team[] TeamsOwnership { get; set; } = { Team.Scientists }; + + /// + public override RoleTypeId AssignFromRole { get; set; } = RoleTypeId.Scientist; + + /// + public override bool IsScp { get; set; } = true; + + /// + public override RoleSettings Settings { get; set; } = new() + { + UseDefaultRoleOnly = true, + UniqueRole = RoleTypeId.ClassD, + + Health = 300, + MaxHealth = 400, + Scale = 0.90f, + CustomInfo = "Test Role", + + SpawnedText = new("You've been spawned as Test Role", 10, channel: TextChannelType.Broadcast), + + PreservePosition = true, + + PreserveInventory = true, + + CanActivateWarhead = true, + + CanBypassCheckpoints = true, + CanActivateGenerators = false, + CanPlaceBlood = false, + CanBeHurtByScps = false, + CanHurtScps = false, + CanBeHandcuffed = false, + + DoesLookingAffectScp096 = false, + DoesLookingAffectScp173 = false, + }; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestRole/TestRole2Behaviour.cs b/Exiled.Example/TestRole/TestRole2Behaviour.cs new file mode 100644 index 0000000000..f24624dfe4 --- /dev/null +++ b/Exiled.Example/TestRole/TestRole2Behaviour.cs @@ -0,0 +1,16 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestRole +{ + using Exiled.CustomModules.API.Features.CustomRoles; + + /// + public class TestRole2Behaviour : RoleBehaviour + { + } +} \ No newline at end of file diff --git a/Exiled.Example/TestRole/TestRole2Config.cs b/Exiled.Example/TestRole/TestRole2Config.cs new file mode 100644 index 0000000000..e78181ba6c --- /dev/null +++ b/Exiled.Example/TestRole/TestRole2Config.cs @@ -0,0 +1,26 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestRole +{ + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.CustomModules.API.Features.Generic; + + /// + [ModuleIdentifier] + public class TestRole2Config : ModulePointer + { + /// + public override uint Id { get; set; } = CustomRoleType.TestRole2; + + /// + /// Gets or sets a integer value. + /// + public int Value { get; set; } = 10; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestTeam/CustomTeamType.cs b/Exiled.Example/TestTeam/CustomTeamType.cs new file mode 100644 index 0000000000..2423258f24 --- /dev/null +++ b/Exiled.Example/TestTeam/CustomTeamType.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestTeam +{ + using Exiled.CustomModules.API.Enums; + + /// + /// The custom team type. + /// + public class CustomTeamType : UUCustomTeamType + { + /// + /// Initializes a new custom team id. + /// + public static readonly CustomTeamType TestTeam = new(); + } +} \ No newline at end of file diff --git a/Exiled.Example/TestTeam/TestTeam.cs b/Exiled.Example/TestTeam/TestTeam.cs new file mode 100644 index 0000000000..97697489f2 --- /dev/null +++ b/Exiled.Example/TestTeam/TestTeam.cs @@ -0,0 +1,47 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestTeam +{ + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomRoles; + using PlayerRoles; + using Respawning; + using UnityEngine; + + /// + [ModuleIdentifier] + public class TestTeam : CustomTeam + { + /// + public override uint Id { get; set; } = CustomTeamType.TestTeam; + + /// + public override string Name { get; set; } = "TestTeam"; + + /// + public override bool IsEnabled { get; set; } = true; + + /// + public override string DisplayName { get; set; } = "ECustomTeam"; + + /// + public override int Probability { get; set; } = 100; + + /// + public override string DisplayColor { get; set; } = Color.cyan.ToHex(); + + /// + public override SpawnableTeamType[] SpawnableFromTeams { get; set; } = { SpawnableTeamType.ChaosInsurgency }; + + /// + public override Team[] TeamsOwnership { get; set; } = { Team.FoundationForces }; + + /// + public override bool UseTickets { get; set; } = false; + } +} \ No newline at end of file diff --git a/Exiled.Example/TestTeam/TestTeamConfig.cs b/Exiled.Example/TestTeam/TestTeamConfig.cs new file mode 100644 index 0000000000..a99f974b3d --- /dev/null +++ b/Exiled.Example/TestTeam/TestTeamConfig.cs @@ -0,0 +1,26 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Example.TestTeam +{ + using Exiled.CustomModules.API.Features.Attributes; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.CustomModules.API.Features.Generic; + + /// + [ModuleIdentifier] + public class TestTeamConfig : ModulePointer + { + /// + public override uint Id { get; set; } = CustomTeamType.TestTeam; + + /// + /// Gets or sets a integer value. + /// + public int Value { get; set; } = 10; + } +} \ No newline at end of file