namespace Pokerfreak.Cockpit.Kern; /// /// Wie viel das Cockpit zeigt. Vorgabe: nur Cash Game NLH und /// Turniere stehen (Owner 15.11.: "alle modi disablen außer cash und turniere, nur noch NLH"): /// weg sind PLO, die Sonderformate (All-In or Fold, Bomb Pot, K-Poker), /// Lehrer & Stimme, Streamer (samt Maus-Schalter) und das Klon-Abzeichen. Ausgeblendete Formate fliegen /// auch aus der Wahl, damit der Laeufer sie nicht mehr spielt. Der Zuschauer bleibt (16.11.: er spielt /// nicht, er liest nur mit). Übung bleibt, damit ein Start nicht nur /// noch mit Echtgeld geht. (Spiegel: mac/Sources/Cockpit/Umfang.swift, cockpit/src/umfang.rs.) /// Seit 15.11. 23:30 IMMER so (Owner, mehrfach: das Cockpit lief einmal ohne `--nur-spiel` aus der /// Taskleiste und zeigte alles wieder). Nur `--alles` oder POKERFREAK_NUR_SPIEL=0 zeigt alles. /// public static class Umfang { public static bool NurSpiel { get; } = Bestimmen(Environment.GetCommandLineArgs(), Environment.GetEnvironmentVariable("POKERFREAK_NUR_SPIEL")); /// An, ausser `--alles` oder POKERFREAK_NUR_SPIEL=0/nein/false (`--nur-spiel` bleibt erlaubt). public static bool Bestimmen(IEnumerable args, string? env) => !args.Contains("--alles") && env?.Trim().ToLowerInvariant() is not ("0" or "nein" or "false"); /// Ob ein Format gezeigt und gespielt wird. Freeroll und VIP sind Turnier-Typen. public static bool Erlaubt(SpielFormat f) => !NurSpiel || f is SpielFormat.Cash or SpielFormat.Turnier or SpielFormat.Vip or SpielFormat.Freeroll; /// Nicht erlaubte Formate aus der Wahl nehmen; true, wenn sich etwas aenderte. public static bool Bereinigen(Spielplan w) { var weg = Formate.Alle.Where(f => !Erlaubt(f) && w.Anzahl(f) > 0).ToList(); foreach (var f in weg) w.Setzen(f, 0); return weg.Count > 0; } }