Fix streak grace period, UNO earnings, hospital UX, wordle/lottery atomicity

- Streak grace now checks LastDeathDate instead of LastActionDate (was
  suppressing streak updates for all active players)
- UNO single-player earnings use net payout (minus wager) not gross
- Hospital sends error message on save failure instead of silent no-op
- Wordle total_earned update moved into stats transaction
- Lottery ticket inserts + community pot add wrapped in single transaction
  with euro refund on failure
- Lottery fixed-tier ticket prize updated with actual prorated amount
- Added last_death_date column to adventure_characters

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-04-08 00:54:58 -07:00
parent 26d2846481
commit f57dcd93a5
9 changed files with 63 additions and 32 deletions

View File

@@ -118,7 +118,11 @@ func (p *LotteryPlugin) handleLotteryBuy(ctx MessageContext, args string) error
tickets[i] = generateLotteryNumbers()
}
lotteryInsertTickets(ctx.Sender, weekStart, tickets)
if err := lotteryInsertTickets(ctx.Sender, weekStart, tickets); err != nil {
// Refund — tickets didn't persist.
p.euro.Credit(ctx.Sender, cost, "lottery_refund")
return p.SendReply(ctx.RoomID, ctx.EventID, "Something went wrong buying tickets. You've been refunded.")
}
// Build confirmation.
var sb strings.Builder