aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/pai_gow.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/pai_gow.go')
-rw-r--r--internal/casino/pai_gow.go31
1 files changed, 26 insertions, 5 deletions
diff --git a/internal/casino/pai_gow.go b/internal/casino/pai_gow.go
index 44893c1..0de79e3 100644
--- a/internal/casino/pai_gow.go
+++ b/internal/casino/pai_gow.go
@@ -76,6 +76,7 @@ type pgPlayer struct {
payout int
result string
showdown *PaiGowShowdown
+ settlement []SettlementLine
}
type paiGowTable struct {
*tableBase
@@ -607,6 +608,11 @@ func (t *paiGowTable) prepareSettlementLocked() []Event {
result := pgMainResultRules(p.split, t.dealerSplit, t.dealer, t.Config.PaiGow.Variant, t.tie, t.a2345High())
p.payout = pgMainPay(p.main.Total, result, t.Config.PaiGow.Variant)
p.result = result
+ odds := "1:1"
+ if t.Config.PaiGow.Variant == PaiGowClassic {
+ odds = "19:20"
+ }
+ p.settlement = []SettlementLine{{Label: "Main", Odds: odds, Stake: p.main.Total, Returned: p.payout, Result: strings.Fields(result)[0]}}
highRank := pgEvaluateRules(p.split.high, t.a2345High())
lowRank := pgEvaluateRules(p.split.low, t.a2345High())
dealerHighRank := pgEvaluateRules(t.dealerSplit.high, t.a2345High())
@@ -623,22 +629,32 @@ func (t *paiGowTable) prepareSettlementLocked() []Event {
},
}
if t.Config.PaiGow.Variant == PaiGowFaceUp {
+ paid, odds := 0, "Varies"
rates, _ := t.Config.PaiGow.pushAceRates()
if class := pgPushAceClassRules(t.dealer, p.cards, rates, t.a2345High()); class.klass != "none" {
- p.payout += p.pushace.Total * (class.rate + 1)
+ paid = p.pushace.Total * (class.rate + 1)
+ odds = profitOdds(class.rate, 1)
+ p.payout += paid
sd.PushAce = fmt.Sprintf("%s (%d:1)", class.desc, class.rate)
sd.PushAceWin = true
} else if p.pushace.Total > 0 {
sd.PushAce = "dealer not ace-high"
}
+ if p.pushace.Total > 0 {
+ p.settlement = append(p.settlement, SettlementLine{Label: "Push Ace", Odds: odds, Stake: p.pushace.Total, Returned: paid, Result: returnResult(p.pushace.Total, paid)})
+ }
}
if p.fortune.Total > 0 {
row, win := pgFortuneRules(p.cards, t.Config.PaiGow.Envy, t.a2345High())
sd.Fortune = row.Hand
sd.FortuneWin = win
+ paid, odds := 0, "Varies"
if win {
- p.payout += p.fortune.Total * (row.Odds + 1)
+ paid = p.fortune.Total * (row.Odds + 1)
+ odds = profitOdds(row.Odds, 1)
+ p.payout += paid
}
+ p.settlement = append(p.settlement, SettlementLine{Label: "Fortune", Odds: odds, Stake: p.fortune.Total, Returned: paid, Result: returnResult(p.fortune.Total, paid)})
if t.Config.PaiGow.Envy && p.fortune.Total >= 5 {
envy, others := 0, 0
for _, other := range t.players {
@@ -653,6 +669,7 @@ func (t *paiGowTable) prepareSettlementLocked() []Event {
sd.ShowEnvy = true
sd.Envy = envy
p.payout += envy
+ p.settlement = append(p.settlement, SettlementLine{Label: "Envy bonus", Odds: "—", Returned: envy, Result: returnResult(0, envy)})
}
}
}
@@ -663,7 +680,7 @@ func (t *paiGowTable) prepareSettlementLocked() []Event {
return t.payLocked()
}
func (t *paiGowTable) payLocked() []Event {
- var events []Event
+ var events, receipts []Event
var newlyPaid []string
pending := false
for _, p := range t.players {
@@ -688,8 +705,12 @@ func (t *paiGowTable) payLocked() []Event {
continue
}
p.paid = true
+ receipt := t.private(p.name, settlementText(p.settlement))
+ receipt.Settlement = append([]SettlementLine(nil), p.settlement...)
+ receipts = append(receipts, receipt)
if p.showdown != nil {
p.showdown.Paid = true
+ p.showdown.Pending = false
}
newlyPaid = append(newlyPaid, p.name)
}
@@ -697,7 +718,7 @@ func (t *paiGowTable) payLocked() []Event {
for _, name := range newlyPaid {
events = append(events, t.statusLocked(name, false)...)
}
- return events
+ return withSettlementReceipts(events, receipts)
}
t.phase = "waiting"
kept := t.players[:0]
@@ -714,7 +735,7 @@ func (t *paiGowTable) payLocked() []Event {
for _, p := range t.players {
events = append(events, t.statusLocked(p.name, false)...)
}
- return events
+ return withSettlementReceipts(events, receipts)
}
func (t *paiGowTable) tick() []Event {
t.mu.Lock()