mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
Add version system, tax tracking, lottery winner DMs, fmtEuro, audit fixes
- Version system: per-plugin versions via Versioned interface, crash_log and version_history DB tables, !version command, crash stats in !botinfo - Tax tracking: tax_ledger table, trackTaxPaid across all communityTax and communityPotAdd sites, tax paid display in !stats and !superstatsexplusalpha - Lottery: DM winners with winning ticket details and matched numbers bolded - fmtEuro: generic currency formatter with thousand separators across all economy display paths - Audit fixes: streak_decayed column for Streak Survivor achievement, combat_narrative empty-phase guard, crafting success rate integer division, RecordCrash nil-DB guard Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package plugin
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -96,7 +97,7 @@ func (p *AdventurePlugin) handleHospitalCmd(ctx MessageContext) error {
|
||||
sb.WriteString("\n\n")
|
||||
|
||||
// Payment prompt
|
||||
sb.WriteString(fmt.Sprintf("**St. Guildmore's Memorial Hospital**\nAmount due: **€%d**\n\n", afterInsurance))
|
||||
sb.WriteString(fmt.Sprintf("**St. Guildmore's Memorial Hospital**\nAmount due: **%s**\n\n", fmtEuro(afterInsurance)))
|
||||
sb.WriteString("Pay now? (yes / no)\n\n")
|
||||
sb.WriteString("*Note: Declining payment will result in discharge to the natural respawn queue. " +
|
||||
"You'll be back tomorrow. The chair in the waiting room is available in the meantime.*")
|
||||
@@ -162,6 +163,12 @@ func (p *AdventurePlugin) resolveHospitalPay(ctx MessageContext, interaction *ad
|
||||
return p.SendDM(ctx.Sender, text)
|
||||
}
|
||||
|
||||
// Community health fund: 10% of revival cost.
|
||||
if potCut := int(math.Round(float64(cost) * 0.1)); potCut > 0 {
|
||||
communityPotAdd(potCut)
|
||||
trackTaxPaid(ctx.Sender, potCut)
|
||||
}
|
||||
|
||||
// Revive
|
||||
char.Alive = true
|
||||
char.DeadUntil = nil
|
||||
@@ -176,10 +183,10 @@ func (p *AdventurePlugin) resolveHospitalPay(ctx MessageContext, interaction *ad
|
||||
// Discharge DM
|
||||
p.SendDM(ctx.Sender, fmt.Sprintf(
|
||||
"✅ **Discharged — you're alive!**\n\n"+
|
||||
"€%d deducted. Nurse Joy wishes you the best. "+
|
||||
"%s deducted. Nurse Joy wishes you the best. "+
|
||||
"She means it. She always means it.\n\n"+
|
||||
"Go get 'em. Type `!adventure` when you're ready.",
|
||||
cost))
|
||||
fmtEuro(cost)))
|
||||
|
||||
// Room announcement
|
||||
gr := gamesRoom()
|
||||
@@ -220,9 +227,9 @@ func (p *AdventurePlugin) sendHospitalAd(userID id.UserID, char *AdventureCharac
|
||||
"🏥 **St. Guildmore's Memorial Hospital**\n\n"+
|
||||
"Nurse Joy has been notified. A bed is being prepared.\n\n"+
|
||||
"Type `!hospital` to check in for same-day revival.\n"+
|
||||
"Estimated bill: €%d (Guild insurance covers €%d → you pay €%d)\n\n"+
|
||||
"Estimated bill: %s (Guild insurance covers %s → you pay %s)\n\n"+
|
||||
"Or rest up — natural respawn at %s UTC.",
|
||||
beforeInsurance, beforeInsurance-afterInsurance, afterInsurance, respawnTime)
|
||||
fmtEuro(beforeInsurance), fmtEuro(beforeInsurance-afterInsurance), fmtEuro(afterInsurance), respawnTime)
|
||||
|
||||
time.AfterFunc(10*time.Second, func() {
|
||||
if err := p.SendDM(userID, text); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user