ModdedPurchaseKeeper
Fixes REPOLib-registered (modded) shop items being bought but not appearing in the level. Preserves modded purchase counts across REPOLib's per-level item re-registration.
模組介紹 作者原文
ModdedPurchaseKeeper
Fixes REPOLib-registered (modded) shop items being bought and charged but never appearing
in the level — e.g. EMLGunPlus coil guns, and any other modded purchasable item.
If you've ever bought a modded weapon in the shop, watched it take your money, then loaded
into the level to find it missing — this fixes that.
The bug
When you buy an item, the game records it in StatsManager.itemsPurchased, and at the start
of the next level ItemManager.GetPurchasedItems reads that list so the truck can respawn
what you own. But REPOLib re-registers its modded items on level transitions, and
StatsManager.AddItem resets itemsPurchased[name] = 0 for each one it registers — wiping
the purchase count of a modded item you just bought, before it can respawn. Vanilla items
never go through REPOLib's registration path, which is why only modded items disappear.
(Verified against EMLGunPlus coil guns on R.E.P.O. 0.4.4 / REPOLib 4.2.0.)
The fix
Instead of fighting REPOLib's re-registration, ModdedPurchaseKeeper keeps its own ledger of
what you actually bought (hooking StatsManager.ItemPurchase / SetItemPurchase) and
re-asserts the correct count in a prefix on ItemManager.GetPurchasedItems — the exact moment
the truck reads it. Whatever zeroed the value in between, it's correct when it matters. The
ledger is cleared on a genuine new-run reset (ResetAllStats), so purchases never leak
between runs, and it only ever raises a count back to what you paid for — it can't duplicate
items or interfere with consumables being used up.
No configuration. Load order is handled via a soft dependency on REPOLib.
Scope
Covers purchasable items (weapons, tools, carts, etc. — anything tracked by
itemsPurchased). Modded single-use upgrades use separate dictionaries and are out of scope.
Compatibility
- R.E.P.O. 0.4.x
- Requires REPOLib and BepInEx.
- Safe alongside other shop mods (MoreShopItems, etc.) — it only reads/writes purchase counts.
Building
GAME_DIR=/path/to/REPO./package.sh
Produces builds/ModdedPurchaseKeeper-.zip and deploys the DLL to a local r2modman
profile for testing.
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: