mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-16 08:52:42 +00:00
Adv 2.0 post-L5 audit cleanup: drop redundant dual-writes + refresh stale comments
Audit confirmed saveAdvCharacter's fan-out (upsertAllPlayerMetaFromAdvChar) covers all 13 migrated subsystems, so the per-call-site upsertPlayerMetaXxx calls retained "as defense" through the L4-L5 migration are redundant post-L5h. Removed 16 such call sites across arena (2), scheduler (4), hospital (1), consumables (2), rival (1), housing (11), and reordered masterwork to drop a now-pointless explicit upsert before the load+save. Refreshed nine stale doc comments referencing the legacy adventure_characters table or "soak window / fallback" language that no longer applies after the L5 close-out (commit 596b2b7). No behavior change; go vet + go test ./... pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -253,7 +253,6 @@ func (p *AdventurePlugin) handleThomCmd(ctx MessageContext) error {
|
||||
userMu.Lock()
|
||||
char.ThomAnimalLineFired = true
|
||||
_ = saveAdvCharacter(char)
|
||||
_ = upsertPlayerMetaNPCState(char.UserID, npcStateFromAdvChar(char))
|
||||
userMu.Unlock()
|
||||
}
|
||||
return p.SendDM(ctx.Sender, text)
|
||||
@@ -331,8 +330,6 @@ func (p *AdventurePlugin) handleThomBuy(ctx MessageContext, char *AdventureChara
|
||||
p.euro.Credit(ctx.Sender, float64(totalCost), "house_purchase_refund")
|
||||
return p.SendDM(ctx.Sender, "Failed to save. You've been refunded.")
|
||||
}
|
||||
// L4e dual-write: mirror house state into player_meta.
|
||||
_ = upsertPlayerMetaHouseState(char.UserID, houseStateFromAdvChar(char))
|
||||
return p.SendDM(ctx.Sender, fmt.Sprintf("🏠 **%s** purchased outright for €%d.\n\nNo loan. No weekly payments. Thom is visibly disappointed.", def.Name, totalCost))
|
||||
}
|
||||
|
||||
@@ -364,8 +361,6 @@ func (p *AdventurePlugin) handleThomBuy(ctx MessageContext, char *AdventureChara
|
||||
}
|
||||
return p.SendDM(ctx.Sender, "Failed to save. You've been refunded.")
|
||||
}
|
||||
// L4e dual-write: mirror house state into player_meta.
|
||||
_ = upsertPlayerMetaHouseState(char.UserID, houseStateFromAdvChar(char))
|
||||
|
||||
weekly := houseWeeklyPayment(loanAmount, rate)
|
||||
var sb strings.Builder
|
||||
@@ -414,8 +409,6 @@ func (p *AdventurePlugin) handleThomPayoff(ctx MessageContext, char *AdventureCh
|
||||
p.euro.Credit(ctx.Sender, payoffAmount, "house_payoff_refund")
|
||||
return p.SendDM(ctx.Sender, "Failed to save. Your money has been refunded.")
|
||||
}
|
||||
// L4e dual-write: mirror house state into player_meta.
|
||||
_ = upsertPlayerMetaHouseState(char.UserID, houseStateFromAdvChar(char))
|
||||
|
||||
if char.HasPet() {
|
||||
return p.SendDM(ctx.Sender, fmt.Sprintf("🏠 %s", fmt.Sprintf(thomPaidOffPet, char.PetName)))
|
||||
@@ -469,8 +462,6 @@ func (p *AdventurePlugin) handleThomPay(ctx MessageContext, char *AdventureChara
|
||||
p.euro.Credit(ctx.Sender, float64(amount), "house_extra_payment_refund")
|
||||
return p.SendDM(ctx.Sender, "Failed to save. Your money has been refunded.")
|
||||
}
|
||||
// L4e dual-write: mirror house state into player_meta.
|
||||
_ = upsertPlayerMetaHouseState(char.UserID, houseStateFromAdvChar(char))
|
||||
|
||||
if char.HouseLoanBalance == 0 {
|
||||
if char.HasPet() {
|
||||
@@ -502,8 +493,6 @@ func (p *AdventurePlugin) handleThomAutopay(ctx MessageContext, char *AdventureC
|
||||
if err := saveAdvCharacter(char); err != nil {
|
||||
return p.SendDM(ctx.Sender, "Failed to save.")
|
||||
}
|
||||
// L4e dual-write: mirror house state into player_meta.
|
||||
_ = upsertPlayerMetaHouseState(char.UserID, houseStateFromAdvChar(char))
|
||||
|
||||
if char.HouseAutopay {
|
||||
return p.SendDM(ctx.Sender, "✅ Autopay enabled. 2% discount on weekly payments. Thom calls this a favour. It is not.")
|
||||
@@ -549,7 +538,6 @@ func (p *AdventurePlugin) processMortgagePayments() {
|
||||
freshChar.HouseLoanBalance = 0
|
||||
freshChar.HouseMissedPayments = 0
|
||||
_ = saveAdvCharacter(freshChar)
|
||||
_ = upsertPlayerMetaHouseState(freshChar.UserID, houseStateFromAdvChar(freshChar))
|
||||
userMu.Unlock()
|
||||
// Paid off!
|
||||
if freshChar.HasPet() {
|
||||
@@ -561,7 +549,6 @@ func (p *AdventurePlugin) processMortgagePayments() {
|
||||
}
|
||||
freshChar.HouseMissedPayments = 0
|
||||
_ = saveAdvCharacter(freshChar)
|
||||
_ = upsertPlayerMetaHouseState(freshChar.UserID, houseStateFromAdvChar(freshChar))
|
||||
userMu.Unlock()
|
||||
} else {
|
||||
// Missed payment
|
||||
@@ -572,7 +559,6 @@ func (p *AdventurePlugin) processMortgagePayments() {
|
||||
if freshChar.HouseMissedPayments >= 10 {
|
||||
freshChar.HouseLoanFrozen = true
|
||||
_ = saveAdvCharacter(freshChar)
|
||||
_ = upsertPlayerMetaHouseState(freshChar.UserID, houseStateFromAdvChar(freshChar))
|
||||
userMu.Unlock()
|
||||
if freshChar.HasPet() {
|
||||
_ = p.SendDM(freshChar.UserID, fmt.Sprintf("🏠 %s", fmt.Sprintf(thomFreezePet, freshChar.PetName)))
|
||||
@@ -581,7 +567,6 @@ func (p *AdventurePlugin) processMortgagePayments() {
|
||||
}
|
||||
} else {
|
||||
_ = saveAdvCharacter(freshChar)
|
||||
_ = upsertPlayerMetaHouseState(freshChar.UserID, houseStateFromAdvChar(freshChar))
|
||||
userMu.Unlock()
|
||||
if freshChar.HasPet() {
|
||||
_ = p.SendDM(freshChar.UserID, fmt.Sprintf("🏠 %s", fmt.Sprintf(thomMissedPaymentPet, freshChar.HouseLoanBalance, freshChar.PetName)))
|
||||
@@ -623,7 +608,6 @@ func (p *AdventurePlugin) sendMortgageRateChangeDMs(oldRate, newRate float64) {
|
||||
}
|
||||
freshChar.HouseCurrentRate = newRate
|
||||
_ = saveAdvCharacter(freshChar)
|
||||
_ = upsertPlayerMetaHouseState(freshChar.UserID, houseStateFromAdvChar(freshChar))
|
||||
userMu.Unlock()
|
||||
|
||||
newWeekly := houseWeeklyPayment(freshChar.HouseLoanBalance, newRate)
|
||||
|
||||
Reference in New Issue
Block a user