From 0a99ff646fd3a69ba2fa6da5cb3dc3ec0da36eab Mon Sep 17 00:00:00 2001 From: NotIntense Date: Sun, 1 Oct 2023 00:31:22 -0400 Subject: [PATCH 1/2] Respawn.cs API improvements --- NwPluginAPI/Core/Respawn.cs | 40 ++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/NwPluginAPI/Core/Respawn.cs b/NwPluginAPI/Core/Respawn.cs index 5d58de1..1d49061 100644 --- a/NwPluginAPI/Core/Respawn.cs +++ b/NwPluginAPI/Core/Respawn.cs @@ -4,25 +4,43 @@ namespace PluginAPI.Core using static Respawning.RespawnEffectsController; /// - /// Handles respawning + /// Handles respawning. /// public static class Respawn { /// - /// Gets the amount of NTF tickets left. + /// Gets or sets the amount of NTF tickets left. /// - public static float NtfTickets => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.NineTailedFox); + public static float NtfTickets + { + get => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.NineTailedFox); + set => AddTickets(SpawnableTeamType.NineTailedFox, value); + } /// - /// Gets the amount of chaos tickets left. + /// Gets or sets the amount of chaos tickets left. /// - public static float ChaosTickets => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.ChaosInsurgency); + public static float ChaosTickets + { + get => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.ChaosInsurgency); + set => AddTickets(SpawnableTeamType.ChaosInsurgency, value); + } /// /// Gets the next team which will be spawned. /// public static SpawnableTeamType NextKnownTeam => RespawnManager.Singleton.NextKnownTeam; + /// + /// Gets the total time, in seconds, until the next respawn wave. + /// + public static int SecondsToNextRepawn => RespawnManager.Singleton.TimeTillRespawn; + + /// + /// Gets the current . + /// + public static RespawnManager.RespawnSequencePhase CurrentRespawnSequence() => RespawnManager.CurrentSequence(); + /// /// Adds tickets to a specific team. /// @@ -30,6 +48,18 @@ public static class Respawn /// The amount of tickets to add. public static void AddTickets(SpawnableTeamType team, float amount) => RespawnTokensManager.GrantTokens(team, amount); + /// + /// Resets the tokens manager ticket values to the starting value. + /// + public static void ResetTickets() => RespawnTokensManager.ResetTokens(); + + /// + /// Forces a to become the dominant team. + /// + /// The to force to dominance. + /// The amount of tokens the team will have. + public static void ForceTeamLead(SpawnableTeamType teamType, float tokens) => RespawnTokensManager.ForceTeamDominance(teamType, tokens); + /// /// Spawns a specific team. /// From 9939b9845ff4e7d4daffb54bd540cf09d032f2dd Mon Sep 17 00:00:00 2001 From: NotIntense Date: Sun, 1 Oct 2023 17:32:14 -0400 Subject: [PATCH 2/2] Fix, oops :trollface: --- NwPluginAPI/Core/Respawn.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/NwPluginAPI/Core/Respawn.cs b/NwPluginAPI/Core/Respawn.cs index 1d49061..764acf0 100644 --- a/NwPluginAPI/Core/Respawn.cs +++ b/NwPluginAPI/Core/Respawn.cs @@ -14,7 +14,11 @@ public static class Respawn public static float NtfTickets { get => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.NineTailedFox); - set => AddTickets(SpawnableTeamType.NineTailedFox, value); + set + { + RespawnTokensManager.RemoveTokens(SpawnableTeamType.NineTailedFox, NtfTickets); + AddTickets(SpawnableTeamType.NineTailedFox, value); + } } /// @@ -23,7 +27,11 @@ public static float NtfTickets public static float ChaosTickets { get => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.ChaosInsurgency); - set => AddTickets(SpawnableTeamType.ChaosInsurgency, value); + set + { + RespawnTokensManager.RemoveTokens(SpawnableTeamType.ChaosInsurgency, ChaosTickets); + AddTickets(SpawnableTeamType.ChaosInsurgency, value); + } } ///