Skip to content

Exposed Helpers

Tien edited this page Aug 16, 2024 · 2 revisions

Exposed Helpers

This page should contain all the public helpers modders can use.

BossRushAPI Namespace

BossRushAPI Class

The mod itself.

static BossRushAPI I { get; }

Simply returns the instance of the mod (the Mod class of the API itself) for simplicity's sake.

static BossRushAPI Instance { get; }

Same as I. Just a different flavor.

BossRushSystem Class

Controls the internal workings of the Boss Rush Event.

static BossRushSystem I { get; }

Returns the instance of the BossRushSystem class. This is the main class that handles the Boss Rush Event.

static BossRushSystem Instance { get; }

Same as I. Just a different flavor.

bool IsBossRushActive { get; }

Returns true if the Boss Rush Event is active. Otherwise, returns false.

bool IsBossRushOff { get; }

Returns true if the Boss Rush Event is off. Otherwise, returns false.

States State { get; }

Returns the current state of the Boss Rush Event.

List<NPC> CurrentBoss

Returns the cloned list of bosses that are currently active in the Boss Rush Event. This also treated as a Boss Rush Stage at play. The list should contain the bosses that need to be defeated in order to progress to the next Boss Rush Stage. The bosses are not removed from the list if they die. This list will only be cleared when the next stage starts, then repopulated with the next stage's bosses. Modifying the returned list here will do nothing as it is just a clone of the real one.

NPC ReferenceBoss

This is just a helper property that returns the first boss in the CurrentBoss list. Great for scenarios when you only need to quickly fetch the first active (alive) boss in the list. One such scenario is if the CurrentBoss list only contains one boss, this will make fetching the boss easier. Other than that, if there is a need to fetch a specific boss, querying from the CurrentBoss manually is the way to do it.

BossData? CurrentBossData

This property contains the details of the Boss Rush Stage that is currently active. This is exposed for referencing and debugging purposes; fields and properties here cannot be modified. The BossRushSystem mostly uses this struct for internal purposes.

void AddBoss(float, BossData)

Adds a Boss Rush Stage through BossData struct as details for the Boss Rush Event. Please refer to this page for more information about the method.

void ToggleBossRush()

Toggles the Boss Rush Event on and off. Refer to this page for more information about the method.

enum States : byte

The possible values for State property. Controls the behavior of the BossRushSystem.

static Util Class

Contains utility methods. Mostly for internal use, but exposed for usefulness. Adding using BossRushAPI; will allow you to use these extension methods.

static int RoundOff(this float)

Rounds off a float to the nearest integer.

static Vector2 RoundOff(this Vector2)

Rounds off the coordinates of a Vector2.

static int ToWorldCoordinate(this int)

Assumes the int parameter to be in tile coordinates and converts it to world coordinates.

static int RandomSign(int = 1)

Picks a random sign for the given int parameter. If the int parameter is 3, then the method will either return 3 or -3 randomly.

static int ToFrames(this float)

Assume the float parameter to be in seconds. This method converts the parameter to frames. Frames are based on ticks in-game. Useful for timers. 5f.ToFrames() means 5 seconds in-game and in the real world.

static int ToFrames(this int)

Similar to static int ToFrames(this float), except this accepts an int parameter.

static void NewText(string, Color? = null, bool = false)

Wrapper around Main.NewText and ChatHelper.BroadcastChatMessage. It will automatically properly send the messages using the correct methods and net codes. The Color parameter is optional and defaults to Color.White. The bool parameter determines if the string parameter is a string literal or a localization key.

static bool TryAdd<T>(this List<T>, T)

The method tries to add an item T into the List<T>. If the item is added, the method returns true. Otherwise, it returns false.

BossRushAPI.NPCs Namespace

BossAndMinions Class

GlobalNPC class that modifies the bosses and their minions when in Boss Rush Event through ModifiedAttributes struct.

static event Action<NPC, ModifiedAttributes> PreSetDefaults

Hook before the ModifiedAttributes struct is computed on the stats of the NPC.

static event Action<NPC, ModifiedAttributes> PostSetDefaults

Hook after the ModifiedAttributes struct is computed on the stats of the NPC.

BossRushAPI.Types Namespace

BossData Struct

Refer to this page for a detailed explanation of the struct and its fields and properties. The constructor parameters specified have a public property counterpart in the struct.

Message Struct

Refer to this section of the page for a detailed explanation of the struct. The specified parameters have a public property counterpart in the struct.

ModifiedAttributes Struct

Refer to this section for a detailed explanation of the struct and its fields and properties. The specified parameters have a public property counterpart in the struct.

PlaceContext Struct

Refer to this section for a detailed explanation of the struct and its fields and properties. The specified parameters have a public property counterpart in the struct.

SpawnAttributes Struct

Refer to this section for a detailed explanation of the struct and its fields and properties. The specified parameters have a public property counterpart in the struct.

TimeContext Struct

Refer to this section for a detailed explanation of the struct and its fields and properties. The specified parameters have a public property counterpart in the struct.

Clone this wiki locally