56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System.Collections.Generic;
|
|
using HighRollerClassic.DataStructures;
|
|
|
|
namespace HighRollerClassic.SettingsStructure;
|
|
|
|
public class Settings(Configuration? configuration)
|
|
{
|
|
/// <summary>
|
|
/// Whether developer options should be visible in the settings
|
|
/// </summary>
|
|
public bool devOptions = false;
|
|
|
|
/// <summary>
|
|
/// Maximum bet that will be allowed to set
|
|
/// </summary>
|
|
public TrackedValue MaxBet { get; set; } = new(SettingValueType.MaxBet, null);
|
|
|
|
/// <summary>
|
|
/// How much the bet will change when user adjusts their bet via +/- keys
|
|
/// </summary>
|
|
public uint? Step { get; set; }
|
|
|
|
/// <summary>
|
|
/// Contains messages such as announcements etc.
|
|
/// </summary>
|
|
public List<MessageMacro> Macros { get; private set; } = new();
|
|
|
|
// todo we'll make this a new class because we have 3 roll methods already 'polluting' this class
|
|
|
|
public readonly RollsCollection RollsCollection = new();
|
|
|
|
// todo might get fucky wucky if maxbet is not yet defined
|
|
public bool IsValid => MaxBet.IsValid && StepValid() && RollsCollection.ValidateAll();
|
|
public bool Set => IsValid && RollsCollection.Size > 0 && Macros.Count > 0;
|
|
|
|
private bool StepValid()
|
|
{
|
|
uint maxBet;
|
|
|
|
if (configuration is { Settings.MaxBet.IsValid: true })
|
|
{
|
|
maxBet = configuration.Settings.MaxBet.Value!.Value; //IsValid guarantees validity
|
|
}
|
|
else if (MaxBet.IsValid)
|
|
{
|
|
maxBet = MaxBet.Value!.Value; // IsValid
|
|
}
|
|
else
|
|
{
|
|
maxBet = 0;
|
|
}
|
|
|
|
return Step <= maxBet;
|
|
}
|
|
}
|