REPOUpgradeAPI

版本 v1.1.0·更新於 2026-05-11

Small-scale API for manipulating player upgrade stats.

模組介紹 作者原文

🇺🇸 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:

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

  • UpgradeNet handles RPC and dispatch
  • UpgradeManager applies 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

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack

檔案與校驗

檔案名稱
REPOUpgradeAPI-1.1.0.zip
檔案大小
119.9 KiB