Events
Amounts are in OC. All events fire from your mod’s normal code, inside the game’s own call. If one of your handlers throws an error, the framework logs it and still runs the others.
Casino the casino events and their totals
Subscribe with += to Played, Won, CashedOut, Doubled or Scratched to hear about casino play. LastPayout holds the last win of this session.
public static class Casino
{
public static event Action<CasinoPlayedArgs> Played;
public static event Action<CasinoWonArgs> Won;
public static event Action<CasinoCashedOutArgs> CashedOut;
public static event Action<CasinoDoubledArgs> Doubled;
public static event Action<ScratchcardArgs> Scratched;
public static int LastPayout { get; }
public static bool IsAvailable { get; }
}
| Event | Gives you | When it fires |
|---|---|---|
Played | CasinoPlayedArgs | A paid round has started. |
Won | CasinoWonArgs | A win was credited inside a machine. |
CashedOut | CasinoCashedOutArgs | Winnings reached the player’s wallet. |
Doubled | CasinoDoubledArgs | The player’s double on a slot win was settled. |
Scratched | ScratchcardArgs | A scratchcard was used. |
| Property | Type | What it means |
|---|---|---|
LastPayout | int | The payout of the last Won event this session. 0 before the first win. Not saved. |
IsAvailable | bool | false when a needed event could not be set up. |
CasinoPlayedArgs what Played tells you
Played hands you this when a paid round starts. Machine says which machine, and Stake is the stake for the round in OC.
public sealed class CasinoPlayedArgs
{
public CasinoMachineInfo Machine { get; }
public int Stake { get; }
}
| Property | Type | What it means |
|---|---|---|
Machine | CasinoMachineInfo | The machine. |
Stake | int | The stake of this round, in OC. |
CasinoWonArgs what Won tells you
Won hands you this when a win is credited inside a machine. That is not money in the wallet yet, and CashedOut reports when it is. Payout is the win in OC.
public sealed class CasinoWonArgs
{
public CasinoMachineInfo Machine { get; }
public int Payout { get; }
}
| Property | Type | What it means |
|---|---|---|
Machine | CasinoMachineInfo | The machine. |
Payout | int | The win, in OC. |
CasinoCashedOutArgs what CashedOut tells you
CashedOut hands you this when winnings reach the player’s wallet. Amount is the OC that went into the wallet.
public sealed class CasinoCashedOutArgs
{
public CasinoMachineInfo Machine { get; }
public int Amount { get; }
}
| Property | Type | What it means |
|---|---|---|
Machine | CasinoMachineInfo | The machine. |
Amount | int | The OC that went into the wallet. |
CasinoDoubledArgs what Doubled tells you
Doubled hands you this when the player’s double on a slot win is settled. Before and After are the winnings either side of the double.
public sealed class CasinoDoubledArgs
{
public CasinoMachineInfo Machine { get; }
public int Before { get; }
public int After { get; }
public bool Won { get; }
}
| Property | Type | What it means |
|---|---|---|
Machine | CasinoMachineInfo | The slot machine. |
Before | int | The winnings of the round before the double. |
After | int | The winnings of the round after the double. |
Won | bool | true when After is more than Before. |
ScratchcardArgs what Scratched tells you
Scratched hands you this each time a scratchcard is used, win or not. Prize is what the game paid, and Won is true when it is above 0.
public sealed class ScratchcardArgs
{
public int CardItemId { get; }
public string CardTitle { get; }
public bool Won { get; }
public int Prize { get; }
public bool PrizeInRm { get; }
public int PrizeOc { get; }
public int Cost { get; }
public int ReceiptItemId { get; }
}
| Property | Type | What it means |
|---|---|---|
CardItemId | int | The item number of the card. |
CardTitle | string | The card’s name. |
Won | bool | true when the card paid a prize. |
Prize | int | The prize the game paid. It is in RM when PrizeInRm is true, and in OC otherwise. |
PrizeInRm | bool | true when the prize is in RM (Real Money). |
PrizeOc | int | The prize worth in OC. It is the same as Prize when PrizeInRm is false. |
Cost | int | The card’s value, in OC. |
ReceiptItemId | int | The item number of the card’s receipt. -1 when the card has none or it is not known. |
Things to know
Playedfires when a paid round starts. For a slot machine,Stakeis the stake taken from the machine’s pot for the round. For the coin pusher, one coin was launched andStakeis1. (For the slot machine,SlotMachineGameplay.ChargeMoneyreturnedtrue.)- If the round is refused, because the machine has too little money or it is busy, nothing fires.
Wonfires when a win is credited inside the machine. It is not money going to the player. The money reaches the wallet only atCashedOut. (For the slot machine, the round’s reward is handled inSlotMachineGameplay.HandleWinning. For the coin pusher, it isPajatsoGameplay.CoinGateHit.)- For a slot machine,
Payoutis the round’s win before any doubling. The player may double it, lose it or keep it. Doubling results are reported byDoubled, not as anotherWon. - For the coin pusher, a gate hit paid
Payoutcoins into the win pile. The pile reaches the wallet when the player collects it. A gate hit when the gutter has no coins does not fire. CashedOutfires when the winnings reach the wallet. Use it for what the player really received.- For a slot machine, the player pressed cash out.
Amountis the whole machine balance, including the money the player put in and any doubled winnings. (It is raised aroundSlotMachineGameplay.HandleQuittingProcedure.) - For the coin pusher, the player collected the win pile.
Amountis the pile. An empty pile does not fire. (It isPajatsoGameplay.OnCollectWins.) Doubledfires when the player’s double on a slot round is settled. The round’s winnings are still in the machine, so the wallet does not change here. (It is raised fromSlotMachineGameplay.HandleDoublingResult. The game logs “Trying to double without any winnings” whenBeforeis0.)- If the coin lands on its edge,
AfterequalsBefore. The winnings are kept andWonisfalse. A wrong guess givesAfterof0. - A double with nothing to double does not fire.
Scratchedfires every time a scratchcard is used, win or not. It fires while the card is still in the inventory. (It is raised aroundScratchcard.Use. A call toScratchcard.Usefrom another mod also fires it.)Scratched.Prizeis what the game paid. A card that pays RM setsPrizeInRmtotrue, andPrizeOcconverts it to OC.Wonistruewhen the prize is above 0. (PrizeOcusesMoney.RmToOcConvert.)Wonis not the same as the receipt’s “can be cashed out” flag, which can be on for a zero prize. (A receipt can havecanBeCashedOuttrue with a zero prize when the card’sval1is 0.)Scratched.Costis the card’s value. The game counts it as a gambling loss even when the card wins.ReceiptItemIdis a best guess. It is the number of the card’s receipt item. A receipt given by name may not match the item the game really uses. (It is theIDof the card’s receipt reference.)Scratched.Prizeis worked out from the gambling totals. The framework reads how much the game says the player has won before and after the card is used. Any other change made to that total during the use is counted as part of the prize. (The payout is read from the gambling tallyOCWonbefore and afterUse. Only another mod’s change can make that total move during the use.)LastPayoutis the payout of the lastWonevent since the game started. It is0before the first win and is not saved. It stays up to date even when nobody listens toWon.IsAvailableisfalsewhen a needed event could not be set up. A missing part stops only its own events, and the reads are not affected.LastPayoutonly changes for a win whose part is set up. If only the doubling change is missing, onlyDoubledstops. See “If something fails to set up” below.