You are viewing a potentially older version of this package. View all versions.
darkharasho-ModdedPurchaseKeeper-0.1.0 icon

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.

Date uploaded 3 days ago
Version 0.1.0
Download link darkharasho-ModdedPurchaseKeeper-0.1.0.zip
Downloads 176
Dependency string darkharasho-ModdedPurchaseKeeper-0.1.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100
Zehs-REPOLib-2.1.0 icon
Zehs-REPOLib

Library for adding content to R.E.P.O.

Preferred version: 2.1.0

README

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-<version>.zip and deploys the DLL to a local r2modman profile for testing.