Coop lockout fix, holidays full list, !fx convert, lottery cleanup

- Co-op: when a run wipes or completes, clear the 99-sentinel combat
  lock for participants and pin combat_actions_used to maxCombatActions.
  Previously the lock only released on the next midnight reset, so
  members were stuck unable to combat for the rest of the day after
  their run ended.
- Holidays: !holidays now prints the full list. Previously it called
  the same featured-only formatter as TwinBee's morning auto-post,
  so users saw the same truncated message twice with a misleading
  "Use !holidays for the full list" hint that pointed at itself.
- Forex: add currency conversion. Auto-detects when the first arg is
  numeric (`!fx 1500 USD EUR`) and also accepts an explicit `convert`
  subcommand. Tolerant parsing: "to"/"into"/"in"/"=" filters, comma
  and k/m suffix support, and any of `1500 USD EUR`, `1500 USD/EUR`,
  `USD/EUR 1500` orderings. Includes parser + comma-formatter tests.
- Lottery: drop 2-match prize tier. At 1/16 odds × €25 it was +EV per
  ticket on its own and bled the community pot (~€775/wk recently),
  preventing jackpot rollover from accumulating. Removed from scoring,
  payout loops, draw announcement, !lottery odds, and !lottery history.
  Match2Winners DB column kept (history rows preserved); always written
  as 0 going forward.
- Lottery: shift week boundary so Sat/Sun return next Monday. Friday's
  23:59 draw used to leave players locked at their 100-ticket cap until
  next Monday rolled in; now the cap resets immediately after the draw.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
prosolis
2026-05-01 16:11:01 -07:00
parent 4a4ef95d65
commit a00987e75c
10 changed files with 337 additions and 26 deletions

View File

@@ -239,7 +239,7 @@ func (p *HolidaysPlugin) PostHolidays(roomID id.RoomID) error {
return nil
}
msg := p.formatHolidays(today, data.Holidays)
msg := p.formatHolidays(today, data.Holidays, false)
if err := p.SendMessage(roomID, msg); err != nil {
return fmt.Errorf("holidays: send: %w", err)
}
@@ -291,7 +291,7 @@ func (p *HolidaysPlugin) handleHolidaysToday(ctx MessageContext) error {
return p.SendReply(ctx.RoomID, ctx.EventID, "No holidays today.")
}
msg := p.formatHolidays(today, data.Holidays)
msg := p.formatHolidays(today, data.Holidays, true)
return p.SendReply(ctx.RoomID, ctx.EventID, msg)
}
@@ -340,13 +340,16 @@ func (p *HolidaysPlugin) handleHolidaysRange(ctx MessageContext, days int) error
return p.SendReply(ctx.RoomID, ctx.EventID, sb.String())
}
func (p *HolidaysPlugin) formatHolidays(date string, holidays []Holiday) string {
func (p *HolidaysPlugin) formatHolidays(date string, holidays []Holiday, full bool) string {
var sb strings.Builder
t, _ := time.Parse("2006-01-02", date)
sb.WriteString(fmt.Sprintf("Today's Holidays — %s\n", t.Format("Monday, January 2, 2006")))
featured := p.selectFeatured(holidays)
for _, h := range featured {
shown := holidays
if !full {
shown = p.selectFeatured(holidays)
}
for _, h := range shown {
sb.WriteString(fmt.Sprintf("\n- %s", h.Name))
if h.Country != "" && h.Country != "International" {
sb.WriteString(fmt.Sprintf(" [%s]", h.Country))
@@ -356,9 +359,11 @@ func (p *HolidaysPlugin) formatHolidays(date string, holidays []Holiday) string
}
}
remaining := len(holidays) - len(featured)
if remaining > 0 {
sb.WriteString(fmt.Sprintf("\n\n...and %d more. Use !holidays for the full list.", remaining))
if !full {
remaining := len(holidays) - len(shown)
if remaining > 0 {
sb.WriteString(fmt.Sprintf("\n\n...and %d more. Use !holidays for the full list.", remaining))
}
}
return sb.String()