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.
REPOUpgradeAPI
Small-scale API for manipulating player upgrade stats.
| Date uploaded | a week ago |
| Version | 1.1.0 |
| Download link | Kai09TA-REPOUpgradeAPI-1.1.0.zip |
| Downloads | 7124 |
| Dependency string | Kai09TA-REPOUpgradeAPI-1.1.0 |
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
πΊπΈ REPOUpgradeAPI β Player Upgrade Sync API (Dependency Mod)
This API was originally created for my personal mod projects, but separating it as a standalone module made development easier, so I decided to publish it in case others find it useful.
If you need to reach me, I'm available in the R.E.P.O Modding Server on Discord: https://discord.gg/vPJtKhYAFe
REPOUpgradeAPI is a lightweight framework that provides a clean and safe way to synchronize player upgrades across host and clients. It handles RPC dispatching, synchronization logic, and UI refresh internally, so mods can focus only on calling simple API methods.
π§ Basic Usage
using REPOUpgradeAPI;
public class ExampleMod : BaseUnityPlugin
{
void Start()
{
// Increase Jump upgrade by +1
UpgradeAPI.Add(UpgradeType.Jump, 1);
// Set Sprint upgrade to level 3
UpgradeAPI.Set(UpgradeType.Sprint, 3);
}
}
Only UpgradeAPI.Add() and UpgradeAPI.Set() are needed.
All networking, syncing, and local UI updates are handled internally.
π API Summary
β Add
UpgradeAPI.Add(UpgradeType type, int delta);
UpgradeAPI.Add(string typeName, int delta);
UpgradeTypeβ¦ vanilla-like safe enum (Energy, Health, Jump, β¦)string typeNameβ¦ Stat dictionary name or internal key
β Set
UpgradeAPI.Set(UpgradeType type, int level);
UpgradeAPI.Set(string typeName, int level);
π§© Type Name / Dictionary Name Support
Besides the enum, REPOUpgradeAPI also supports direct dictionary names from StatsManager:
// Directly touch the underlying StatsManager dictionary:
UpgradeAPI.Add("playerUpgradeHealth", 1);
UpgradeAPI.Add("playerUpgradeStaminaRegen", 1);
UpgradeAPI.Add("playerUpgradeUnstableCore", 1);
Internally, the API:
- First tries to treat the string as a full dictionary name
(
StatsManager.dictionaryOfDictionaries[typeName]) - Then falls back to legacy short keys (e.g.
"energy","jump") - Finally, it tries to dynamically map to
playerUpgrade*dictionaries
This makes the API compatible with:
- Vanilla upgrades
- New upgrades added by game updates
- Custom upgrades added by other mods (as long as they expose a dictionary)
π§ͺ Debug / Introspection Helpers
For debugging or exploring new keys, the API can dump upgrade dictionaries:
// Log all playerUpgrade* dictionaries in StatsManager
UpgradeAPI.LogAllUpgradeDictionaries();
// Enumerate dictionary names (e.g. "playerUpgradeHealth", "playerUpgradeUnstableCore", ...)
foreach (var key in UpgradeAPI.ListUpgradeKeys())
Logger.LogInfo($"Key: {key}");
These names can then be passed directly into UpgradeAPI.Add/Set.
β Internal Features
UpgradeNethandles RPC and dispatchUpgradeManagerapplies local and networked changes- RPC registration is done automatically via Harmony (dependency mod)
- Works in both singleplayer (local-only) and multiplayer (via RPC)
- Internal architecture is hidden from mod developers β you only call
UpgradeAPI