From 4bf9308fa7b0dc8e2beb2eed8e7e811b0bade7dd Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Sun, 16 Nov 2025 02:03:02 -0600 Subject: [PATCH] Created initial models for kasino events --- .../Models/DbModels/MoneyDbModels.cs | 2 +- KfChatDotNetBot/Models/MoneyMetaModels.cs | 39 +++++++- KfChatDotNetBot/Models/MoneyModels.cs | 91 ++++++++++++++++++- 3 files changed, 129 insertions(+), 3 deletions(-) diff --git a/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs b/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs index ed503f6..ae26c81 100644 --- a/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs +++ b/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs @@ -289,7 +289,7 @@ public enum WagerGame /// Event, [Description("Guess what number I'm thinking of")] - GuessWhatNumber + GuessWhatNumber, } public enum GamblerState diff --git a/KfChatDotNetBot/Models/MoneyMetaModels.cs b/KfChatDotNetBot/Models/MoneyMetaModels.cs index c73fd18..43d6813 100644 --- a/KfChatDotNetBot/Models/MoneyMetaModels.cs +++ b/KfChatDotNetBot/Models/MoneyMetaModels.cs @@ -1,3 +1,40 @@ namespace KfChatDotNetBot.Models; -// Stash all the models used for perk or game metadata here \ No newline at end of file +// Stash all the models used for perk or game metadata here +public class KasinoWagerBaseEventMetaModel +{ + /// + /// Event type for this meta model for the purposes of figuring out which model to use when deserializing + /// + public required KasinoEventType EventType { get; set; } + /// + /// Unique reference tracking the shared event ID stored in the settings + /// + public required string SharedEventId { get; set; } + /// + /// How long it took the user to make a selection. This is based on the event announcement msg recv - sent timestamp + /// that SneedChat provided so the bot won't unfairly penalize users who were delayed by chat lag + /// + public required TimeSpan SelectionDelay { get; set; } +} +/// +/// Metadata model tracking a gambler's wager information related to win/lose games specifically +/// +public class KasinoWagerWinLoseEventMetaModel : KasinoWagerBaseEventMetaModel +{ + /// + /// Unique reference tracking the option the gambler selected. Tracked as a GUID in case the option text changes + /// + public required string OptionId { get; set; } +} + +/// +/// Metadata model tracking a gambler's wager information related to win/lose games specifically +/// +public class KasinoWagerPredictionEventMetaModel : KasinoWagerBaseEventMetaModel +{ + /// + /// The absolute time when the user predicted the thing was going to happen + /// + public required DateTimeOffset PredictedTime { get; set; } +} \ No newline at end of file diff --git a/KfChatDotNetBot/Models/MoneyModels.cs b/KfChatDotNetBot/Models/MoneyModels.cs index 485d766..97e7313 100644 --- a/KfChatDotNetBot/Models/MoneyModels.cs +++ b/KfChatDotNetBot/Models/MoneyModels.cs @@ -1,4 +1,4 @@ -using KfChatDotNetBot.Models.DbModels; +using System.ComponentModel; namespace KfChatDotNetBot.Models; @@ -54,4 +54,93 @@ public class NextVipLevelModel /// The wager requirement to reach this tier that factors in the tier /// public required decimal WagerRequirement { get; set; } +} + +public class KasinoEventModel +{ + /// + /// Text summary of the event itself such as: "How long until the chase ends?" or "Parole granted?" + /// + public required string EventText { get; set; } + /// + /// Unique reference used for tying this event to wagers gamblers are placing + /// + public required string EventId { get; set; } + /// + /// The set of options available for gamblers to select. This is only applicable to WinLose-type bets + /// It'll be an empty array for closest to finish + /// + public required List Options { get; set; } = []; + /// + /// The type of event this is, which is important for the purposes of calculating the payout correctly + /// + public required KasinoEventType EventType { get; set; } + /// + /// Timestamp of when the announcement message was received by the client for the purposes of calculating selection + /// delay. This value is null when the message hasn't been seen yet (either event not started or message lost. + /// Do not accept wagers where this is null. + /// + public DateTimeOffset? EventAnnouncementReceived { get; set; } = null; + /// + /// State of the kasino event + /// + public required KasinoEventState EventState { get; set; } = KasinoEventState.Incomplete; +} + +public class KasinoEventOptionModel +{ + /// + /// Unique reference used for tying a gambler's selection to a given option + /// + public required string OptionId { get; set; } + /// + /// Text to describe the option that users are picking + /// + public required string OptionText { get; set; } + /// + /// Whether this option won or not, null while incomplete + /// + public bool? Won { get; set; } = null; +} + +public enum KasinoEventType +{ + [Description("Win/Lose")] + WinLose, + [Description("Closest to prediction")] + Prediction, + [Description("Closest to prediction (payout weighted to favor early bets)")] + PredictionSelectionTimeWeighted, + [Description("Win/Lose (payout weighted to favor early bets)")] + WinLoseSelectionTimeWeighted +} + +public enum KasinoEventState +{ + /// + /// Event still under construction. This is the initial state when an admin creates an event but hasn't yet launched it + /// + Incomplete, + /// + /// Event has been launched but the announcement message hasn't yet been acknowledged by Sneedchat + /// No bets will be processed until the message is seen + /// If the message is ultimately lost, the event will never launch + /// + PendingAnnouncement, + /// + /// The event announcement message was seen, the event has started and wagers can now be placed + /// + Started, + /// + /// Closed to new wagers but the event is still ongoing + /// + Closed, + /// + /// Event has closed, it's so over. + /// + Over, + /// + /// Event was abandoned and all wagers canceled + /// + Abandoned } \ No newline at end of file