Track the gold Membership Card actually saved #318
No reviewers
Labels
No labels
4-29
bug
documentation
duplicate
enhancement
flow improvement
good first issue
help wanted
invalid
investigating
issue-agent
issue-agent-blocked
issue-agent-complete
issue-agent-pr-open
issue-agent-runner-nelsonlaptop
issue-agent-runner-nelsonpc
issue-agent-runner-nelsonpc-user
issue-agent-running
needs-verification
next to do
question
queue
recon
relics-stats-onboarding
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/spirelens!318
Loading…
Reference in a new issue
No description provided.
Delete branch "claude/membership-card-gold-stats-f120ab"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Membership Card had no stats. It also has no activation callback — it only
overrides
ModifyMerchantPrice, andMerchantEntry.Costre-runs that wholechain on every read, including the reads the shop UI makes just to draw price
labels. Counting hook calls would be meaningless, so the observed unit is a
completed purchase.
Gold saved
Measured marginally. Inside the purchase prefix the entry's
Costis readtwice, the second time with only this relic's own override short-circuited to
return
originalPrice. Both reads run the rest of the chain, so The Courier'soverlapping 20% stays credited to The Courier and the game's own final
(int)truncation applies to both sides. The suppression flag is thread-static, armed
for exactly one nested read, released in a
finally.The snapshot is taken before the purchase runs, not at
Hook.AfterItemPurchased:OnTryPurchaseWrapperrestocks or clears the entry— recalculating
_costfor a different item — between charging the playerand announcing the sale.
MerchantCardRemovalEntrydeclares its own cancelablewrapper instead of calling the shared one, so both get the prefix.
Hook.AfterItemPurchasedthen supplies the authoritativegoldSpentand firesonly on success; a free (
ignoreCost) purchase reports zero and records nosaving.
Gold held / earned after purchase
Neither needed a new observation point. The shop pays through
PlayerCmd.LoseGoldbeforeRelicCmd.Obtain, so the balance at the existingobtain hook is already the gold held after buying the relic — stamped once,
never overwritten. Gold earned afterwards is every gain at the established
RunTracker.RecordRunGoldGainboundary while the relic is held; ownership onlybegins at the purchase, so that needs no stored cutoff floor and survives
Continue and Core hot reload for free.
Melted wax relics drop out of
IterateHookListeners, which makes both thediscount measurement and the held-period gain stop on their own.
Notes
Fixtures/RunSchemafixture andmatching
SchemaLoadingTestsassertions.docs/sts2-runtime-primer.md.[CUS-diag]after hotreload (432 classes patched, 0 failed). Because the merchant purchase path
had already JIT-compiled in that process, behavioral checking needs one full
game restart first — see the primer's newly-added-target rule.
verification rule. Both projects compile clean.