buehnenrahmen: Rahmen je Sonderform, Straddle als echtes Geld
buehnenrahmen setzt je Form die echten Merkmalsfelder (_merkmale) und sendet den eigenen Rahmen (game.splash_the_pot/game.mega_splash, game.auto_post_bb + Sitz- Caption Straddle, game.show_cards, game.rabbit_run_new, game.bounty_winner, game.hand_for_hand, bombpot_info mit Handzahl). selbstspiel legt den Straddle als live Blind (2xBB) wirklich vor und laesst die Runde dahinter starten.
This commit is contained in:
+120
-2
@@ -12,6 +12,7 @@ zweites Brett).
|
||||
Abschnitte da, nur null. So findet der Tisch sein `TableInit` und wirft nicht.
|
||||
"""
|
||||
import json
|
||||
import time
|
||||
|
||||
import bewerter
|
||||
import selbstspiel
|
||||
@@ -77,6 +78,56 @@ def _sitzbild(sitz, caption, betrag, chips, letzte="Check"):
|
||||
"selfBounty": None, "gameHandId": None}
|
||||
|
||||
|
||||
def _merkmale(b, stueck):
|
||||
"""Die Merkmalsfelder der Sonderformen setzen - Feldnamen woertlich aus dem Client
|
||||
(Fundort je Feld in archiv/mitschrieb/SPECIALFAELLE.md, aus DLL und app.asar gelesen).
|
||||
|
||||
Kein Feld ist erfunden; was nur eine Namenform aus dem Client ist (bounty/hand_for_hand
|
||||
ohne Log-Beleg), ist in SPECIALFAELLE.md als Annahme gekennzeichnet."""
|
||||
rp = b["roomProperties"]
|
||||
if stueck.get("splash"):
|
||||
rp["splashSharedBonusPercentage"] = 1.0 # roomProperties (Splash-Anteil)
|
||||
b["gameDynamicPropertiesResponseData"]["isSplashThePotEnabled"] = True
|
||||
b["gameDynamicPropertiesResponseData"]["maxBbCount"] = 100
|
||||
if stueck.get("straddle"):
|
||||
rp["isStraddle"] = True # roomProperties.isStraddle
|
||||
b["straddleResponseData"] = {"straddle": True} # straddleResponseData.straddle
|
||||
b["autoPostBBResponseData"] = {**(b.get("autoPostBBResponseData") or {}),
|
||||
"showAutoPostBB": True}
|
||||
if stueck.get("must_show"):
|
||||
rp["isMustShowEnabled"] = True # roomProperties.isMustShowEnabled
|
||||
if stueck.get("hands_in_bombpot"):
|
||||
rp["isFixedHandBombpot"] = True # roomProperties.isFixedHandBombpot
|
||||
rp["isBombpot"] = True
|
||||
rp["handsInBombpot"] = int(stueck["hands_in_bombpot"]) # roomProperties.handsInBombpot
|
||||
if stueck.get("rabbit"):
|
||||
rp["isRabbitRunAllowed"] = True # roomProperties.isRabbitRunAllowed
|
||||
# Big Ante: der Client zeigt die Marke, wenn ante >= bigAnteBBRatioThreshold * bigBlind
|
||||
# (Schwelle 0.2 aus AppStaticConfig.AnteConfig.BigAnteBbRatioThreshold). Merkmal: minAnte/maxAnte.
|
||||
if (not stueck.get("bombpot") and rp["ante"] > 0
|
||||
and rp["ante"] >= 0.2 * rp["bigBlind"]):
|
||||
rp["minAnte"] = rp["maxAnte"] = rp["ante"]
|
||||
if stueck.get("multi_day"):
|
||||
rp["isMultiDayTournament"] = True # roomProperties.isMultiDayTournament
|
||||
rp["multiDayStackType"] = "FREEZE"
|
||||
rp["multiDayFinishLevel"] = 12
|
||||
if stueck.get("arena") or stueck.get("cgwc"):
|
||||
rt = {**(rp.get("restrictedTableData") or {})}
|
||||
rt["isArena"] = bool(stueck.get("arena")) # restrictedTableData.isArena
|
||||
rt["isCgwc"] = bool(stueck.get("cgwc")) # restrictedTableData.isCgwc
|
||||
rp["restrictedTableData"] = rt
|
||||
if stueck.get("battle"):
|
||||
rp["dynamicRakeConfig"] = 1 # roomProperties.dynamicRakeConfig (Battle Cap)
|
||||
if stueck.get("hand_for_hand"):
|
||||
b["handForHandTournamentResponseData"] = {"notification": "Hand For Hand",
|
||||
"handForHandStatus": True,
|
||||
"isHandForHandFinalTable": False}
|
||||
if stueck.get("bounty"):
|
||||
b["tourneyTableProperties"] = {**(b.get("tourneyTableProperties") or {}),
|
||||
"isBountyTournament": True}
|
||||
return b
|
||||
|
||||
|
||||
def _alldata(stueck):
|
||||
b = json.loads(VORLAGE)
|
||||
held = stueck["sitze"][stueck["held"]]
|
||||
@@ -105,10 +156,24 @@ def _alldata(stueck):
|
||||
rp["gameType"] = "Allinfold"
|
||||
if stueck.get("kurz"):
|
||||
rp["isRit"] = True # kurzes Deck: RIT ist dort ueblich
|
||||
if stueck.get("turnier") or stueck.get("pause"):
|
||||
# Turniermerkmale - der Client behandelt den Tisch dann als Turnier (Stufen, kein
|
||||
# Nachkaufen, Pausenfenster). Feldnamen woertlich aus dem Client-Code geholt.
|
||||
b["tourneyTableProperties"] = {**(b.get("tourneyTableProperties") or {}),
|
||||
"tournamentId": 4242, "tourneyName": "Buehne Turnier",
|
||||
"tournamentCurrentStage": 1, "isRebuyAllowed": True}
|
||||
if stueck.get("pause"):
|
||||
# Die PAUSE: echtes Pausenfeld, der Client zeigt sein Pausenfenster mit Uhr
|
||||
# (BreakTimerPopup / TournamentBreak im Client).
|
||||
jetzt = int(time.time() * 1000)
|
||||
b["breakData"] = {"isPokerBreakActive": True, "pokerBreakEndDate": str(jetzt + 180000),
|
||||
"breakTime": 180, "breakDuration": 180,
|
||||
"title": "Pause", "message": "Turnierpause"}
|
||||
b["seatInfoRsponseData"] = {"isGameStarted": True, "initTimeStamp": str(TS_BASIS),
|
||||
"seatResponseDataList": [_sitzbild(s, "Inuse", 0, s["chips"])
|
||||
for s in stueck["sitze"]],
|
||||
"gameHandId": None}
|
||||
_merkmale(b, stueck)
|
||||
return b
|
||||
|
||||
|
||||
@@ -193,7 +258,9 @@ def rahmen(stueck):
|
||||
neu("game.hole_cards", {"holeCards": [karte(k) for k in stueck["karten"][stueck["held"]]],
|
||||
"gameHandId": stueck["hand"]})
|
||||
if stueck.get("bombpot"):
|
||||
gesamt = int(stueck.get("hands_in_bombpot") or 0) or None
|
||||
neu("game.bombpot_info", {"ante": ante, "isBombpotHand": True,
|
||||
"totalHandCount": gesamt, "currentHandNumber": 1 if gesamt else None,
|
||||
"bombpotInducesDoubleBoard": bool(stueck.get("doppelbrett")),
|
||||
"gameHandId": stueck["hand"]})
|
||||
|
||||
@@ -208,6 +275,15 @@ def rahmen(stueck):
|
||||
for sitz, caption, posten in ((sitz_sb, "SB", blinds[0]), (sitz_bb, "BB", blinds[1])):
|
||||
neu("game.seat", _sitzbild(stueck["sitze"][sitz - 1], caption, posten,
|
||||
stueck["stapel"] - investiert[sitz - 1]))
|
||||
straddel = next((z for z in stueck["ablauf"]
|
||||
if z["strasse"] == "PREFLOP" and z["art"] == "straddle"), None)
|
||||
if straddel: # der Straddle ist ein Sitz mit Caption
|
||||
s = straddel["sitz"]
|
||||
investiert[s] += straddel["betrag"]
|
||||
neu("game.seat", _sitzbild(stueck["sitze"][s], "Straddle", straddel["betrag"],
|
||||
stueck["stapel"] - investiert[s], "Straddle"))
|
||||
neu("game.auto_post_bb", {"autoPostBB": True, "showAutoPostBB": True,
|
||||
"gameHandId": stueck["hand"]})
|
||||
|
||||
pot = sum(investiert.values())
|
||||
|
||||
@@ -227,9 +303,9 @@ def rahmen(stueck):
|
||||
stueck["stapel"] - investiert[s], zug["art"]))
|
||||
|
||||
def strassenzuege(name):
|
||||
"""Nur die Spielerzuege einer Strasse - Antes und Blinds sind schon gesetzt."""
|
||||
"""Nur die Spielerzuege einer Strasse - Antes, Blinds und Straddle sind schon gesetzt."""
|
||||
return [z for z in stueck["ablauf"]
|
||||
if z["strasse"] == name and z["art"] not in ("fold", "ante", "sb", "bb")]
|
||||
if z["strasse"] == name and z["art"] not in ("fold", "ante", "sb", "bb", "straddle")]
|
||||
|
||||
for zug in strassenzuege("PREFLOP"):
|
||||
sitzzug(zug)
|
||||
@@ -256,14 +332,56 @@ def rahmen(stueck):
|
||||
potinfo(bis, runde_ende=True)
|
||||
|
||||
gewinn = max(pot - stueck["ergebnis"]["rake"], 0.0)
|
||||
if stueck.get("must_show"): # Must-Show: die Sieger zeigen ihre Karten
|
||||
for s in stueck["ergebnis"]["gewinner"]:
|
||||
neu("game.show_cards", {"seatId": stueck["sitze"][s]["seatId"], "showCardsList": [0, 1],
|
||||
"showCardIndexMap": [{"index": i, "card": karte(k)}
|
||||
for i, k in enumerate(stueck["karten"][s])],
|
||||
"gameHandId": stueck["hand"]})
|
||||
folge.append(_winnerbean(raum, stueck, naechste(), pot, gewinn))
|
||||
if stueck.get("rit"):
|
||||
neu("game.rit_info", {"isRit": True, "options": stueck.get("rit_optionen") or "0,1,2",
|
||||
"gameHandId": stueck["hand"]})
|
||||
_formenschluss(neu, stueck, pot)
|
||||
neu("game.reset_data", {"timestamp": None, "gameHandId": stueck["hand"]})
|
||||
return folge
|
||||
|
||||
|
||||
def _formenschluss(neu, stueck, pot):
|
||||
"""Die Rahmen, die eine Sonderform NACH dem Gewinner erwartet - je Form woertlich aus dem
|
||||
Client (Rahmen-Namen und Felder in archiv/mitschrieb/SPECIALFAELLE.md belegt)."""
|
||||
hand = stueck["hand"]
|
||||
if stueck.get("splash"):
|
||||
neu("game.splash_the_pot", {"isIllusion": bool(stueck.get("mega_splash")),
|
||||
"dropAmount": round(pot * 0.02, 6),
|
||||
"megaSplash": bool(stueck.get("mega_splash")),
|
||||
"megaDrop": None, "initTimestamp": None, "gameHandId": hand})
|
||||
if stueck.get("mega_splash"):
|
||||
neu("game.mega_splash", {"amount": round(pot * 0.1, 6),
|
||||
"serverAddress": stueck.get("adresse") or "",
|
||||
"roomName": stueck["raum"], "message": "MEGA SPLASH OCCUR ",
|
||||
"miniGameTypeId": stueck.get("mini_id", 1), "tableId": 1664030,
|
||||
"configId": 202096, "lobbyId": 1, "maxPlayerPerTable": stueck["spieler"],
|
||||
"smallBlind": stueck["blinds"][0], "bigBlind": stueck["blinds"][1],
|
||||
"coinType": 1, "gameHandId": hand})
|
||||
if stueck.get("rabbit"):
|
||||
neu("game.rabbit_run_new", {"rabbitRunCards": [karte(k) for k in stueck["brett"][3:]],
|
||||
"rabbitRunCardsDoubleBoard": [], "username": None,
|
||||
"gameHandId": hand})
|
||||
if stueck.get("bounty"):
|
||||
sieger = stueck["ergebnis"]["gewinner"][:1]
|
||||
neu("game.bounty_winner", {
|
||||
"bountyWinnerData": [{"seatId": stueck["sitze"][s]["seatId"], "bountyAmount": 100.0,
|
||||
"bountyType": "MYSTERY"} for s in sieger],
|
||||
"mysteryBountyWinnerData": [{"seatId": stueck["sitze"][s]["seatId"],
|
||||
"bountyAmount": 100.0, "bountyType": "MYSTERY"}
|
||||
for s in sieger], "gameHandId": hand})
|
||||
if stueck.get("hand_for_hand"):
|
||||
neu("game.hand_for_hand", {"notification": "Hand For Hand", "handForHandStatus": True,
|
||||
"isHandForHandFinalTable": False, "toPauseTable": False,
|
||||
"gameHandId": hand})
|
||||
|
||||
|
||||
def rahmenbytes(stueck):
|
||||
"""Dieselbe Folge, gross gerahmt (4 Byte Laenge, dann JSON) - so geht sie roh raus."""
|
||||
import pipe
|
||||
|
||||
+18
-3
@@ -78,7 +78,11 @@ class _Hand:
|
||||
return betrag
|
||||
|
||||
def vorspiel(self):
|
||||
"""Ante (alle) und Blinds - ein Bomb Pot kennt keine Blinds, nur Antes."""
|
||||
"""Ante (alle) und Blinds - ein Bomb Pot kennt keine Blinds, nur Antes.
|
||||
|
||||
Ein Straddle ist ein LIVE-Blind: der Sitz direkt hinter dem BB legt das Doppelte blind
|
||||
vor, der hoechste Einsatz steigt damit. So ist der Straddle echtes Geld, kein Aufkleber
|
||||
(der Client nennt ihn `game.seat` mit caption "Straddle")."""
|
||||
ante = float(self.stueck.get("ante") or 0.0)
|
||||
if ante > 0:
|
||||
for s in range(self.n):
|
||||
@@ -90,6 +94,13 @@ class _Hand:
|
||||
self.setze(sb, self.blinds[0], PREFLOP, "sb")
|
||||
self.setze(bb, self.blinds[1], PREFLOP, "bb")
|
||||
self.hoechster = self.blinds[1]
|
||||
if self.stueck.get("straddle") and self.n >= 3:
|
||||
sitz = self.stueck.get("straddle_sitz")
|
||||
sitz = (bb + 1) % self.n if sitz is None else int(sitz) % self.n
|
||||
betrag = round(self.blinds[1] * 2, 6)
|
||||
self.setze(sitz, betrag, PREFLOP, "straddle")
|
||||
self.hoechster = betrag
|
||||
self.letzte_erhoehung = self.blinds[1]
|
||||
|
||||
def _grenzen(self, sitz, to_call):
|
||||
"""(legal, minRaiseTo, maxRaiseTo) fuer den Sitz - CHECK nur ohne offenen Einsatz."""
|
||||
@@ -175,9 +186,13 @@ class _Hand:
|
||||
def lauf(self):
|
||||
self.vorspiel()
|
||||
strassen = ([] if self.stueck.get("bombpot") else [PREFLOP]) + list(STRASSEN)
|
||||
sb, bb = _sb_bb(self.n, self.stueck.get("dealer", 1))
|
||||
preflop_start = (bb + 1) % self.n
|
||||
if self.stueck.get("straddle") and self.n >= 3: # hinter dem Straddler geht es los
|
||||
sitz = self.stueck.get("straddle_sitz")
|
||||
preflop_start = ((preflop_start if sitz is None else int(sitz) % self.n) + 1) % self.n
|
||||
for strasse in strassen:
|
||||
start = (_sb_bb(self.n, self.stueck.get("dealer", 1))[0] if strasse != PREFLOP
|
||||
else (_sb_bb(self.n, self.stueck.get("dealer", 1))[1] + 1) % self.n)
|
||||
start = preflop_start if strasse == PREFLOP else sb
|
||||
if strasse != PREFLOP:
|
||||
self.strasse_einsatz = [0.0] * self.n
|
||||
self.hoechster = 0.0
|
||||
|
||||
Reference in New Issue
Block a user