Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respawn.cs API improvements #229

Open
wants to merge 2 commits into
base: 13.1
Choose a base branch
from
Open
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
48 changes: 43 additions & 5 deletions NwPluginAPI/Core/Respawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,70 @@ namespace PluginAPI.Core
using static Respawning.RespawnEffectsController;

/// <summary>
/// Handles respawning
/// Handles respawning.
/// </summary>
public static class Respawn
{
/// <summary>
/// Gets the amount of NTF tickets left.
/// Gets or sets the amount of NTF tickets left.
/// </summary>
public static float NtfTickets => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.NineTailedFox);
public static float NtfTickets
{
get => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.NineTailedFox);
set
{
RespawnTokensManager.RemoveTokens(SpawnableTeamType.NineTailedFox, NtfTickets);
AddTickets(SpawnableTeamType.NineTailedFox, value);
}
}

/// <summary>
/// Gets the amount of chaos tickets left.
/// Gets or sets the amount of chaos tickets left.
/// </summary>
public static float ChaosTickets => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.ChaosInsurgency);
public static float ChaosTickets
{
get => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.ChaosInsurgency);
set
{
RespawnTokensManager.RemoveTokens(SpawnableTeamType.ChaosInsurgency, ChaosTickets);
AddTickets(SpawnableTeamType.ChaosInsurgency, value);
}
}

/// <summary>
/// Gets the next team which will be spawned.
/// </summary>
public static SpawnableTeamType NextKnownTeam => RespawnManager.Singleton.NextKnownTeam;

/// <summary>
/// Gets the total time, in seconds, until the next respawn wave.
/// </summary>
public static int SecondsToNextRepawn => RespawnManager.Singleton.TimeTillRespawn;

/// <summary>
/// Gets the current <see cref="RespawnManager.RespawnSequencePhase"/>.
/// </summary>
public static RespawnManager.RespawnSequencePhase CurrentRespawnSequence() => RespawnManager.CurrentSequence();

/// <summary>
/// Adds tickets to a specific team.
/// </summary>
/// <param name="team">The team to add tickets to.</param>
/// <param name="amount">The amount of tickets to add.</param>
public static void AddTickets(SpawnableTeamType team, float amount) => RespawnTokensManager.GrantTokens(team, amount);

/// <summary>
/// Resets the tokens manager ticket values to the starting value.
/// </summary>
public static void ResetTickets() => RespawnTokensManager.ResetTokens();

/// <summary>
/// Forces a <see cref="SpawnableTeamType"/> to become the dominant team.
/// </summary>
/// <param name="teamType">The <see cref="SpawnableTeamType"/> to force to dominance.</param>
/// <param name="tokens">The amount of tokens the team will have.</param>
public static void ForceTeamLead(SpawnableTeamType teamType, float tokens) => RespawnTokensManager.ForceTeamDominance(teamType, tokens);

/// <summary>
/// Spawns a specific team.
/// </summary>
Expand Down