diff --git a/internal/plugin/achievements.go b/internal/plugin/achievements.go index 59f6770..4c15656 100644 --- a/internal/plugin/achievements.go +++ b/internal/plugin/achievements.go @@ -1050,7 +1050,7 @@ func (p *AchievementsPlugin) buildAchievements() []achievementDef { Emoji: "🍼", Check: func(d *sql.DB, u id.UserID) bool { var count int - _ = d.QueryRow(`SELECT COUNT(*) FROM babysit_log WHERE user_id = ?`, string(u)).Scan(&count) + _ = d.QueryRow(`SELECT COUNT(*) FROM adventure_babysit_log WHERE user_id = ?`, string(u)).Scan(&count) return count > 0 }, }, diff --git a/internal/plugin/adventure_babysit.go b/internal/plugin/adventure_babysit.go index a3e17d8..d28c6dd 100644 --- a/internal/plugin/adventure_babysit.go +++ b/internal/plugin/adventure_babysit.go @@ -137,6 +137,9 @@ func (p *AdventurePlugin) handleBabysitPurchase(ctx MessageContext, days int) er return p.SendDM(ctx.Sender, "Payment failed. The babysitter looked at your wallet and walked away.") } + // Clear any leftover logs from prior service so this period's summary is clean + clearBabysitLogs(char.UserID) + // Set babysit fields skill := babysitWeakestSkill(char) expires := time.Now().UTC().Add(time.Duration(days) * 24 * time.Hour) @@ -243,9 +246,6 @@ func (p *AdventurePlugin) handleBabysitCancel(ctx MessageContext) error { slog.Error("babysit: failed to save character on cancel", "user", char.UserID, "err", err) } - // Clear logs - clearBabysitLogs(char.UserID) - return p.SendDM(ctx.Sender, "🍼 Service cancelled. No refund. The babysitter was already there.\n\n"+summary) } @@ -367,13 +367,26 @@ func (p *AdventurePlugin) runAutoBabysitDay(char *AdventureCharacter) { skill := babysitWeakestSkill(char) activity := skillToActivity(skill) + var totalGold int + var totalXP int + var allItems []string for char.HarvestActionsUsed < harvestMax { - p.runBabysitAction(char, equip, activity, bonuses) + gold, xp, items := p.runBabysitAction(char, equip, activity, bonuses) + totalGold += gold + totalXP += xp + allItems = append(allItems, items...) char.HarvestActionsUsed++ } char.ActionTakenToday = true char.LastActionDate = time.Now().UTC().Format("2006-01-02") + + itemsJSON := "" + if len(allItems) > 0 { + itemsJSON = strings.Join(allItems, ", ") + } + logBabysitActivity(char.UserID, string(activity), "auto_babysit_daily", + totalGold, totalXP, itemsJSON) } // ── Expiry Check ──────────────────────────────────────────────────────────── @@ -403,8 +416,6 @@ func (p *AdventurePlugin) checkBabysitExpiry(chars []AdventureCharacter) { continue } - clearBabysitLogs(char.UserID) - if err := p.SendDM(char.UserID, summary); err != nil { slog.Error("babysit: failed to send expiry summary DM", "user", char.UserID, "err", err) } diff --git a/internal/plugin/adventure_blacksmith.go b/internal/plugin/adventure_blacksmith.go index 6dd16f0..41140ca 100644 --- a/internal/plugin/adventure_blacksmith.go +++ b/internal/plugin/adventure_blacksmith.go @@ -12,7 +12,7 @@ import ( // ── Pricing ───────────────────────────────────────────────────────────────── -var blacksmithBaseRates = [6]int{1, 3, 8, 20, 55, 150} +var blacksmithBaseRates = [6]int{1, 2, 5, 12, 30, 80} func blacksmithRepairCost(eq *AdvEquipment) int { if eq == nil || eq.Condition >= 100 { @@ -34,7 +34,7 @@ func blacksmithRepairCost(eq *AdvEquipment) int { } baseRate := float64(blacksmithBaseRates[tier]) damage := float64(100 - eq.Condition) - condMult := 1.0 + damage/100.0 + condMult := 1.0 + damage/200.0 costPerPoint := baseRate * condMult return int(math.Ceil(costPerPoint * damage)) }