Table of Contents

Class SlotMachineHelper

Namespace
S1API.Casino
Assembly
S1API.dll

Provides a modder-facing API for interacting with slot machines without exposing game types. Handles finding slot machines, managing NPC cash, and triggering spins.

public static class SlotMachineHelper
Inheritance
SlotMachineHelper
Inherited Members

Methods

AddNPCCash(NPC, int)

Adds cash to an NPC's inventory. Tries to reuse existing cash stacks, otherwise ensures there's a spare slot (expanding the slot count if needed) and inserts a single cash item.

public static void AddNPCCash(NPC npc, int amount)

Parameters

npc NPC

The NPC to add cash to.

amount int

The amount of cash to add in dollars.

FindNearestSlotMachine(Vector3, float)

Finds the nearest slot machine to a given position.

public static SlotMachine FindNearestSlotMachine(Vector3 position, float maxDistance)

Parameters

position Vector3

The position to search from.

maxDistance float

Maximum distance to search.

Returns

SlotMachine

The nearest slot machine, or null if none found.

GetNPCCash(NPC)

Gets the total cash value from an NPC's inventory (cash items).

public static float GetNPCCash(NPC npc)

Parameters

npc NPC

The NPC whose cash to count.

Returns

float

Total cash amount in dollars.

RemoveNPCCash(NPC, int)

Removes a specified amount of cash from an NPC's inventory.

public static bool RemoveNPCCash(NPC npc, int amount)

Parameters

npc NPC

The NPC to remove cash from.

amount int

The amount of cash to remove in dollars.

Returns

bool

True if the full amount was successfully removed; false otherwise.

UseSlotMachine(NPC, Vector3, int, float)

Makes an NPC use a slot machine with the specified bet amount. This handles all cash transactions, animations, and outcome determination automatically.

public static bool UseSlotMachine(NPC npc, Vector3 machinePosition, int betAmount, float maxSearchDistance = 5)

Parameters

npc NPC

The NPC that will use the slot machine.

machinePosition Vector3

The world position of the slot machine.

betAmount int

The amount to bet in dollars.

maxSearchDistance float

Maximum distance to search for a slot machine from the specified position.

Returns

bool

True if the NPC successfully started using a slot machine; false otherwise.