Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
ShopDuplicateFix
Buying two of the same shop item now delivers two instead of charging for both and delivering one.
By zoltan
| Last updated | 9 hours ago |
| Total downloads | 59 |
| Total rating | 0 |
| Categories | Mods |
| Dependency string | zoltan-ShopDuplicateFix-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
ShopDuplicateFix
Buy two of the same item, get two of the same item.
Built and compiled against game build v0.4.4 (runs on v0.4.4.x).
The bug
Put two copies of the same shop item in the cart and check out: you're charged for both, but only one exists afterwards.
The purchase ledger is StatsManager.itemsPurchased, a dictionary keyed by
item name. A name-keyed dictionary can't represent "two of these" unless
something counts — and evidently something doesn't. The money side charges
per physical object; the delivery side collapses to one per name.
The fix
Each purchased physical item produces one ItemPurchase(itemName) call.
This mod tallies those calls per item name per shop visit, and after the
game's own bookkeeping runs, raises the ledger to the tally if it's short.
Two properties worth knowing:
- It's a no-op where the bug isn't. If the game counted correctly, the ledger already matches or exceeds the tally and nothing is written. So it can't over-deliver, and it coexists with shop mods (More Shop Items etc.) regardless of which layer loses the count.
- The tally resets on level change, so one visit's purchases can never inflate the next visit's.
Host only
Purchases and the stats ledger are authoritative on the master client. Only the host needs this.
First run
Verbose is ON by default for this release. Buy two of the same item, then
check BepInEx/LogOutput.log:
paid for 2, game recorded 1 - corrected to 2→ the bug existed, now fixedvanilla counted correctly, no fix needed→ the game (or one of your other shop mods) already handles it; the fix stood down
Either way the log tells you exactly what happened underneath. Turn Verbose off afterwards.
If instead you see only ONE ItemPurchase line after buying two, the loss
happens before the ledger (the second item is never charged as a purchase at
all) — report that log and the fix needs to move a layer up.