From 19bcb4e182c0e3b859e4ae2809ecddce2ade4b98 Mon Sep 17 00:00:00 2001 From: 15Slamyxx <140884344+15Slamyxx@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:28:28 +0100 Subject: [PATCH 1/3] Fix Respawn and RespawnEvent & TeamRespawnSelectedEvent --- NwPluginAPI.Docs/log.txt | 3 +++ NwPluginAPI/Core/Respawn.cs | 14 +++++++------- NwPluginAPI/Events/Args/Server/TeamRespawnEvent.cs | 8 ++++---- .../Events/Args/Server/TeamRespawnSelectedEvent.cs | 8 ++++---- NwPluginAPI/NwPluginAPI.csproj | 4 ++-- TemplatePlugin/EventHandlers.cs | 2 ++ TemplatePlugin/MainClass.cs | 2 +- TemplatePlugin/TemplatePlugin.csproj | 4 ++-- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/NwPluginAPI.Docs/log.txt b/NwPluginAPI.Docs/log.txt index 692f815..22773f6 100644 --- a/NwPluginAPI.Docs/log.txt +++ b/NwPluginAPI.Docs/log.txt @@ -1264,3 +1264,6 @@ {"message":"Invalid link: 'Event handlers'. The file articles/gettingstarted/codeprerequisites.md doesn't contain a bookmark named 'event-handlers'.","source":"BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors.Processing html.ValidateBookmark","file":"articles/toc.md","date_time":"2023-04-17T12:01:18.1694264Z","message_severity":"warning","code":"InvalidBookmark","correlation_id":"022C5718-6EA0-4F52-8713-8F5E77AF8928.2.198.1.3.1.21.2"} {"message":"Invalid link: '[The `Config` class](gettingstarted/codeprerequisites.md#the-config-class)'. The file articles/gettingstarted/codeprerequisites.md doesn't contain a bookmark named 'the-config-class'.","source":"BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors.Processing html.ValidateBookmark","file":"articles/intro.md","line":"11","date_time":"2023-04-17T12:01:18.1694264Z","message_severity":"warning","code":"InvalidBookmark","correlation_id":"022C5718-6EA0-4F52-8713-8F5E77AF8928.2.198.1.3.1.21.3"} {"message":"Invalid link: '[Event handlers](gettingstarted/codeprerequisites.md#event-handlers)'. The file articles/gettingstarted/codeprerequisites.md doesn't contain a bookmark named 'event-handlers'.","source":"BuildCommand.Postprocess.HandlePostProcessorsWithIncremental.HandlePostProcessors.Processing html.ValidateBookmark","file":"articles/intro.md","line":"12","date_time":"2023-04-17T12:01:18.1694264Z","message_severity":"warning","code":"InvalidBookmark","correlation_id":"022C5718-6EA0-4F52-8713-8F5E77AF8928.2.198.1.3.1.21.4"} +{"message":"Fail to find MSBuild >= 15.0 on machine. Please install Visual Studio 2017 or above with MSBuild >= 15.0: https://visualstudio.microsoft.com/vs/","source":"MetadataCommand.ExtractMetadata","date_time":"2024-12-14T19:25:18.6290761Z","message_severity":"warning","correlation_id":"993E186F-184C-4611-B874-6EDFB99E511A.1.1.1"} +{"message":"Error opening project W:/NwPluginAPI/NwPluginAPI/NwPluginAPI.csproj: Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.. Ignored.","source":"MetadataCommand.ExtractMetadata","file":"W:/NwPluginAPI/NwPluginAPI/NwPluginAPI.csproj","date_time":"2024-12-14T19:25:19.8252825Z","message_severity":"warning","correlation_id":"993E186F-184C-4611-B874-6EDFB99E511A.1.1.5"} +{"message":"Error extracting metadata for W:/NwPluginAPI/NwPluginAPI/NwPluginAPI.csproj: System.NullReferenceException: La référence d'objet n'est pas définie à une instance d'un objet.\r\n à Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.d__13.MoveNext()\r\n--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---\r\n à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n à Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.d__11.MoveNext()","date_time":"2024-12-14T19:25:19.841786Z","message_severity":"error","code":"FatalError","correlation_id":"993E186F-184C-4611-B874-6EDFB99E511A.2"} diff --git a/NwPluginAPI/Core/Respawn.cs b/NwPluginAPI/Core/Respawn.cs index cd7af31..c3e0a14 100644 --- a/NwPluginAPI/Core/Respawn.cs +++ b/NwPluginAPI/Core/Respawn.cs @@ -55,25 +55,25 @@ public static float ChaosTokens /// Gets the next team which will be spawned. /// [Obsolete] - public static SpawnableTeamType NextKnownTeam => SpawnableTeamType.None; + public static Faction NextKnownTeam => Faction.Unclassified; /// /// Adds tickets to a specific team. /// /// The team to add tickets to. /// The amount of tickets to add. - public static void AddTickets(SpawnableTeamType team, float amount) + public static void AddTickets(Faction team, float amount) { switch (team) { - case SpawnableTeamType.ChaosInsurgency: + case Faction.FoundationEnemy: if (!WaveManager.TryGet(Faction.FoundationEnemy, out SpawnableWaveBase chaosWave) || chaosWave is not NtfSpawnWave chaosSpawnWave) return; chaosSpawnWave.RespawnTokens += (int)amount; break; - case SpawnableTeamType.NineTailedFox: + case Faction.FoundationStaff: if (!WaveManager.TryGet(Faction.FoundationStaff, out SpawnableWaveBase ntfWave) || ntfWave is not NtfSpawnWave ntfSpawnWave) return; @@ -87,11 +87,11 @@ public static void AddTickets(SpawnableTeamType team, float amount) /// /// The team to spawn. /// Plays spawn effects. - public static void Spawn(SpawnableTeamType team, bool playEffects = false) + public static void Spawn(Faction team, bool playEffects = false) { switch (team) { - case SpawnableTeamType.ChaosInsurgency: + case Faction.FoundationEnemy: if (!WaveManager.TryGet(Faction.FoundationEnemy, out SpawnableWaveBase chaosWave)) return; @@ -100,7 +100,7 @@ public static void Spawn(SpawnableTeamType team, bool playEffects = false) WaveManager.InitiateRespawn(chaosWave); break; - case SpawnableTeamType.NineTailedFox: + case Faction.FoundationStaff: if (!WaveManager.TryGet(Faction.FoundationStaff, out SpawnableWaveBase ntfWave)) return; diff --git a/NwPluginAPI/Events/Args/Server/TeamRespawnEvent.cs b/NwPluginAPI/Events/Args/Server/TeamRespawnEvent.cs index 8043fc6..24a191c 100644 --- a/NwPluginAPI/Events/Args/Server/TeamRespawnEvent.cs +++ b/NwPluginAPI/Events/Args/Server/TeamRespawnEvent.cs @@ -1,22 +1,22 @@ using PluginAPI.Core; using PluginAPI.Enums; using PluginAPI.Core.Attributes; -using Respawning; using System.Collections.Generic; +using PlayerRoles; -namespace PluginAPI.Events +namespace PluginAPI.Events.Args.Server { public class TeamRespawnEvent : IEventArguments { public ServerEventType BaseType { get; } = ServerEventType.TeamRespawn; [EventArgument] - public SpawnableTeamType Team { get; set; } + public Faction Team { get; set; } [EventArgument] public List Players { get; set; } = new List(); [EventArgument] public int NextWaveMaxSize { get; set; } - public TeamRespawnEvent(SpawnableTeamType team, List spectators) + public TeamRespawnEvent(Faction team, List spectators) { Team = team; diff --git a/NwPluginAPI/Events/Args/Server/TeamRespawnSelectedEvent.cs b/NwPluginAPI/Events/Args/Server/TeamRespawnSelectedEvent.cs index dc9d610..4b11e1a 100644 --- a/NwPluginAPI/Events/Args/Server/TeamRespawnSelectedEvent.cs +++ b/NwPluginAPI/Events/Args/Server/TeamRespawnSelectedEvent.cs @@ -1,16 +1,16 @@ +using PlayerRoles; using PluginAPI.Enums; using PluginAPI.Core.Attributes; -using Respawning; -namespace PluginAPI.Events +namespace PluginAPI.Events.Args.Server { public class TeamRespawnSelectedEvent : IEventArguments { public ServerEventType BaseType { get; } = ServerEventType.TeamRespawnSelected; [EventArgument] - public SpawnableTeamType Team { get; } + public Faction Team { get; } - public TeamRespawnSelectedEvent(SpawnableTeamType team) + public TeamRespawnSelectedEvent(Faction team) { Team = team; } diff --git a/NwPluginAPI/NwPluginAPI.csproj b/NwPluginAPI/NwPluginAPI.csproj index b801063..aa91634 100644 --- a/NwPluginAPI/NwPluginAPI.csproj +++ b/NwPluginAPI/NwPluginAPI.csproj @@ -62,7 +62,7 @@ - - + + \ No newline at end of file diff --git a/TemplatePlugin/EventHandlers.cs b/TemplatePlugin/EventHandlers.cs index 6c22c83..5231652 100644 --- a/TemplatePlugin/EventHandlers.cs +++ b/TemplatePlugin/EventHandlers.cs @@ -1,3 +1,5 @@ +using PluginAPI.Events.Args.Server; + namespace TemplatePlugin { using PlayerRoles.PlayableScps.Scp173; diff --git a/TemplatePlugin/MainClass.cs b/TemplatePlugin/MainClass.cs index c2e9394..3c3a4f5 100644 --- a/TemplatePlugin/MainClass.cs +++ b/TemplatePlugin/MainClass.cs @@ -482,7 +482,7 @@ void OnInteractWithLocker(Player plr, Locker locker, LockerChamber chamber, bool [PluginEvent(ServerEventType.PlayerInteractElevator)] void OnInteractWithElevator(Player plr, ElevatorChamber elevator) { - Log.Info($"Player &6{plr.Nickname}&r (&6{plr.UserId}&r) interacted with elevator in position &6{elevator.transform.position}&r with the destination in &6{elevator.CurrentDestination.transform.position}&r"); + Log.Info($"Player &6{plr.Nickname}&r (&6{plr.UserId}&r) interacted with elevator in position &6{elevator.transform.position}&r with the destination in &6{elevator.CurSequence}&r"); } [PluginEvent(ServerEventType.PlayerInteractScp330)] diff --git a/TemplatePlugin/TemplatePlugin.csproj b/TemplatePlugin/TemplatePlugin.csproj index 165b943..e396892 100644 --- a/TemplatePlugin/TemplatePlugin.csproj +++ b/TemplatePlugin/TemplatePlugin.csproj @@ -34,7 +34,7 @@ - - + + \ No newline at end of file From 6f43e4c7b3e64616a7d9e1ccfd0438fc00419961 Mon Sep 17 00:00:00 2001 From: RomzyyTV <140884344+RomzyyTV@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:29:17 +0100 Subject: [PATCH 2/3] Update NwPluginAPI.csproj --- NwPluginAPI/NwPluginAPI.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NwPluginAPI/NwPluginAPI.csproj b/NwPluginAPI/NwPluginAPI.csproj index aa91634..35cc85c 100644 --- a/NwPluginAPI/NwPluginAPI.csproj +++ b/NwPluginAPI/NwPluginAPI.csproj @@ -62,7 +62,7 @@ - - + + - \ No newline at end of file + From cb009bca2107db8826a94cd84b149d92390ae7a3 Mon Sep 17 00:00:00 2001 From: RomzyyTV <140884344+RomzyyTV@users.noreply.github.com> Date: Sat, 14 Dec 2024 20:29:30 +0100 Subject: [PATCH 3/3] Update TemplatePlugin.csproj --- TemplatePlugin/TemplatePlugin.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TemplatePlugin/TemplatePlugin.csproj b/TemplatePlugin/TemplatePlugin.csproj index e396892..992186d 100644 --- a/TemplatePlugin/TemplatePlugin.csproj +++ b/TemplatePlugin/TemplatePlugin.csproj @@ -34,7 +34,7 @@ - - + + - \ No newline at end of file +