mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
Expedition: skip idle reaper + legacy morning DM while on expedition
The midnight idle reaper inspected only the overworld CombatActionsUsed/ HarvestActionsUsed counters, so a player on an active expedition was flagged idle — streak halved and a nonsense overworld shame DM sent. The 08:00 morning DM had the same gap and stomped on the 06:00 expedition briefing. Both paths now early-out when getActiveExpedition is non-nil (advancing the streak in the midnight branch). Includes a one-shot bootstrap that doubles CurrentStreak (capped at BestStreak, +1 when room allows to recover the integer-divide odd half) for characters still flagged StreakDecayed with an active expedition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,6 +98,17 @@ func (p *AdventurePlugin) sendMorningDMs() {
|
||||
continue
|
||||
}
|
||||
|
||||
// Active expedition: the expedition cycle delivers its own morning
|
||||
// briefing at 06:00 UTC (deliverBriefing). The legacy overworld
|
||||
// morning DM is irrelevant — and confusing — while underground.
|
||||
if char.Alive {
|
||||
if exp, err := getActiveExpedition(char.UserID); err != nil {
|
||||
slog.Warn("adventure: failed to check active expedition for morning DM", "user", char.UserID, "err", err)
|
||||
} else if exp != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// If still dead, send death status
|
||||
if !char.Alive {
|
||||
text := renderAdvDeathStatusDM(char.UserID)
|
||||
@@ -375,6 +386,27 @@ func (p *AdventurePlugin) midnightReset() error {
|
||||
continue
|
||||
}
|
||||
|
||||
// Active expedition counts as activity. The expedition system tracks
|
||||
// its own action flow (zone/harvest/combat/transit/extract) and never
|
||||
// touches the legacy CombatActionsUsed/HarvestActionsUsed counters, so
|
||||
// HasActedToday() reports false for expeditioners. Treat them like the
|
||||
// acted-today branch below: advance the streak and bail out.
|
||||
if exp, err := getActiveExpedition(char.UserID); err != nil {
|
||||
slog.Warn("adventure: failed to check active expedition for idle reaper", "user", char.UserID, "err", err)
|
||||
} else if exp != nil {
|
||||
if char.LastActionDate == yesterday || char.LastActionDate == today {
|
||||
char.CurrentStreak++
|
||||
} else {
|
||||
char.CurrentStreak = 1
|
||||
}
|
||||
if char.CurrentStreak > char.BestStreak {
|
||||
char.BestStreak = char.CurrentStreak
|
||||
}
|
||||
char.LastActionDate = today
|
||||
_ = saveAdvCharacter(&char)
|
||||
continue
|
||||
}
|
||||
|
||||
// Jitter between DMs to avoid Matrix rate limits
|
||||
if dmsSent > 0 {
|
||||
time.Sleep(time.Duration(1000+rand.IntN(2000)) * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user