WK huoyan1231COMLib
Common library for huoyan1231's White Knuckle mods. Provides shared leaderboard management utilities — automatically disables leaderboards when any dependent mod exceeds the vanilla Trinket budget, an
模組介紹 作者原文
WK_huoyan1231COMLib
White Knuckle BepInEx Common Library — Shared utilities for huoyan1231's White Knuckle mods
White Knuckle BepInEx 公共組件庫 — huoyan1231 系列 White Knuckle Mod 的共享工具庫
English
What is this?
WK_huoyan1231COMLib is a shared BepInEx library (plugin) used by huoyan1231's White Knuckle mods.
It provides common utilities that multiple mods can share, avoiding code duplication.
Features
Leaderboard Management
Ported and extended from WKUnlimitedTrinkets:
- Automatic leaderboard disabling: When any dependent mod requests it (e.g. when the Trinket budget is exceeded), the library sets CL_Leaderboard.WK_Leaderboard_Core.disableLeaderboards = true
- Multi-mod coordination: Multiple mods can register/unregister disable requests independently. Leaderboards are only restored when all requesters have cleared their requests.
- Auto-reset on run end: Leaderboard state is fully reset after each run (M_Gamemode.Finish) to prevent state leaking into subsequent runs.
Achievement Management (Steam)
Intercepts the game's single Steam-achievement upload entry point — CL_AchievementManager.GameAchievement.GetSteamAchievement() (which calls new Achievement(id).Trigger(true)) — via a Harmony prefix:
- Disable Steam achievement uploads without losing progress: When disabled, the Steam Trigger call is skipped, so your real Steam achievement profile is never polluted. In-game flagged state and XP are kept intact.
- Multi-mod coordination: Multiple mods can register/unregister disable requests independently. Steam uploads stay blocked until all requesters have cleared.
- Global hard switch: A separate SetSteamAchievementsDisabled(bool) flag for an unconditional, run-independent block.
- Auto-reset on run end: Per-run disable requests are cleared after each run (M_Gamemode.Finish); the global hard switch persists.
Why intercept GetSteamAchievement instead of SetAchievementValue?
SetAchievementValue also drives in-game progression (flags, XP, unlock animations). Blocking there would break the game. GetSteamAchievement is the only method that touches Steam, so intercepting it disables uploads while leaving gameplay untouched.
Public API for Mod Developers
Other mods can use the LeaderboardManager and AchievementManager static classes:
// Leaderboards — disable for this run (call from your StartFreshGamemode patch)
LeaderboardManager.DisableForThisRun("your.mod.guid");
LeaderboardManager.TryRestore("your.mod.guid"); // re-enable your request
bool exceeded = LeaderboardManager.IsTrinketBudgetExceeded(trinketNamesList);
// Steam achievements — disable uploads for this run (keeps in-game progress)
AchievementManager.DisableForThisRun("your.mod.guid");
AchievementManager.TryRestore("your.mod.guid"); // clear your request
AchievementManager.SetSteamAchievementsDisabled(true); // unconditional global block
bool blocked = AchievementManager.IsSteamAchievementsDisabled(); // query current state
Installation
- Ensure BepInEx 5.x is installed (via Gale, R2MM, or manual)
- Place WK_huoyan1231COMLib.dll in:
/BepInEx/plugins/
- Install any dependent mods that require this library
Configuration
A config file will be generated in BepInEx/config/ after first run:
huoyan1231.whiteknuckle.comlib.cfg
| Setting | Default | Description |
|---------|---------|-------------|
| EnableLeaderboardManagement | true | Set to false to disable all leaderboard management patches |
| EnableAchievementManagement | true | Set to false to disable the Steam achievement interception patches |
Dependencies
| Mod | Purpose |
|-----|---------|
| WKUnlimitedTrinkets | Leaderboard logic was ported from here |
中文
這是什麼?
WK_huoyan1231COMLib 是一個 BepInEx 共享庫插件,供 huoyan1231 的 White Knuckle 系列 Mod 使用。
它提供多個 Mod 可複用的公共工具,避免重複實現相同邏輯。
功能
排行榜管理
從 WKUnlimitedTrinkets 移植並擴展:
- 自動禁用排行榜:當任意依賴本庫的 Mod 發起請求時(例如 Trinket 預算超限),庫會將 CL_Leaderboard.WK_Leaderboard_Core.disableLeaderboards 設爲 true
- 多 Mod 協調:多個 Mod 可獨立註冊/撤銷禁用請求;只有所有請求者都撤銷後,排行榜纔會恢復
- 局結束自動重置:每局結束(M_Gamemode.Finish)後完全重置排行榜狀態,
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: