- Echtgeld bankroll = conservative N-buy-in reserve per table (configurable,
default 20), replacing the aggressive 1/5 rule; threaded through table
selection (auswahl) and the sit gate (sitzen) end to end.
- Table shape selectable (Multiway/Heads-Up/Both); heads-up detected from the
seat count AND the room name ('NL HU'); an opened wrong-shape table is closed.
- Bomb Pot playable in both modes (PLO5, engine capable); only K-Poker stays
off (bet menu unmeasured). Drop the 'gambling' framing for an honest
capability gate (nicht_bespielbar / NICHT_BESPIELBAR).
- Stakes band (min/max BB) added to the money model; 'Echtgeld' mode rename;
native Preferences window; budget tile shows the reserve, not a percent.
- Fix runner import path so the client auto-config thread finds lobby_adapter.
66 lines
3.1 KiB
Swift
66 lines
3.1 KiB
Swift
import Foundation
|
|
|
|
// Stimme & KI: was das Cockpit fuer das Formular braucht (betrieb/anbieter.fuer_ansicht):
|
|
// {katalog: {art: [{id, name}]}, feldnamen: {feld: Beschriftung}, gespeichert: {art: {id: {werte,
|
|
// schluessel}}}}. Der Schluessel kommt nur verdeckt - nie im Klartext. Nachsichtig gelesen.
|
|
|
|
public struct Anbieter: Decodable, Equatable, Sendable {
|
|
public var feldnamen: [String: String] = [:]
|
|
public var katalog: [String: [Eintrag]] = [:]
|
|
public var gespeichert: [String: [String: Wahl]] = [:]
|
|
|
|
/// Eine reine Ansichtsmeldung (kein Knopf) - wie `Sendung.lesen`, nach derselben Namensregel.
|
|
public static let lesen = "anbieter_lesen"
|
|
|
|
enum CodingKeys: String, CodingKey { case feldnamen, katalog, gespeichert }
|
|
public init() {}
|
|
public init(from d: Decoder) throws {
|
|
let c = try d.container(keyedBy: CodingKeys.self)
|
|
feldnamen = c.woerter(.feldnamen)
|
|
katalog = ((try? c.decodeIfPresent([String: [Eintrag]].self, forKey: .katalog)) ?? nil) ?? [:]
|
|
gespeichert = ((try? c.decodeIfPresent([String: [String: Wahl]].self, forKey: .gespeichert)) ?? nil) ?? [:]
|
|
}
|
|
|
|
/// Aus dem `anbieter`-Feld einer Rueckmeldung (JSONSerialization-Objekt).
|
|
public static func aus(_ roh: Any?) -> Anbieter? {
|
|
guard let roh, JSONSerialization.isValidJSONObject(roh), // kein Objekt -> nil, nie ein Wurf
|
|
let data = try? JSONSerialization.data(withJSONObject: roh) else { return nil }
|
|
return try? JSONDecoder().decode(Anbieter.self, from: data)
|
|
}
|
|
|
|
/// Ein Katalogeintrag: die waehlbare Stimme/der KI-Anbieter, mit allem fuers Formular - welche
|
|
/// Felder (schluessel, stimmname, modell, adresse), welche Pflicht, Vorgaben und ein Hinweis.
|
|
public struct Eintrag: Decodable, Equatable, Sendable, Identifiable {
|
|
public var id = ""
|
|
public var name: String?
|
|
public var felder: [String] = []
|
|
public var pflicht: [String] = []
|
|
public var vorgaben: [String: String] = [:]
|
|
public var hinweis: String?
|
|
|
|
enum CodingKeys: String, CodingKey { case id, name, felder, pflicht, vorgaben, hinweis }
|
|
public init(from d: Decoder) throws {
|
|
let c = try d.container(keyedBy: CodingKeys.self)
|
|
id = c.text(.id) ?? ""
|
|
name = c.text(.name)
|
|
felder = ((try? c.decodeIfPresent([String].self, forKey: .felder)) ?? nil) ?? []
|
|
pflicht = ((try? c.decodeIfPresent([String].self, forKey: .pflicht)) ?? nil) ?? []
|
|
vorgaben = c.woerter(.vorgaben)
|
|
hinweis = c.text(.hinweis)
|
|
}
|
|
}
|
|
|
|
/// Ein gespeicherter Anbieter: seine Werte (Adresse, Stimme, Modell), der Schluessel nur verdeckt.
|
|
public struct Wahl: Decodable, Equatable, Sendable {
|
|
public var werte: [String: String] = [:]
|
|
public var schluessel: String?
|
|
|
|
enum CodingKeys: String, CodingKey { case werte, schluessel }
|
|
public init(from d: Decoder) throws {
|
|
let c = try d.container(keyedBy: CodingKeys.self)
|
|
werte = c.woerter(.werte)
|
|
schluessel = c.text(.schluessel)
|
|
}
|
|
}
|
|
}
|