You are viewing a potentially older version of this package. View all versions.
ArceDev-UpgradeCore-0.2.0 icon

UpgradeCore

Developer API for upgrade catalogs, contexts, stacks, balance rules, and save-game state.

By ArceDev
Date uploaded 4 hours ago
Version 0.2.0
Download link ArceDev-UpgradeCore-0.2.0.zip
Downloads 15
Dependency string ArceDev-UpgradeCore-0.2.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

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

Preferred version: 5.4.2305

README

Upgrade Core

Upgrade Core is a developer library for registering upgrade definitions, querying a shared catalog, and resolving context-specific upgrade state. It does not add upgrades or acquisition mechanics by itself.

Developer API

Providers register what an upgrade is and implement its effect. Gameplay modes register a context that decides its lifetime, stack limit, balance, acquisition, scope, and activation rules.

UpgradeApi.Register(new UpgradeDefinition(
    id: "YourTeam.YourMod/double-jump",
    displayName: "Double Jump",
    supportedScopes: new[] { UpgradeScope.Player },
    iconPng: iconBytes,
    badgeColor: Color.cyan,
    abstractDescription: "Jump much higher",
    detailedDescription: values => $"+{values["height"]:0.##}m Jump Height",
    acquisitionTags: new[] { "shop", "achievement" },
    supportedTriggers: new[] { "YourTeam.YourMod/jump" },
    parameters: new[] {
        new UpgradeParameterDefinition("height", 2f, 0.5f, 10f)
    }));

const string contextId = "YourTeam.YourMode/normal";
UpgradeApi.Contexts.Register(new UpgradeContextDefinition(contextId, UpgradeLifetime.SaveGame));
UpgradeApi.Contexts.Configure(contextId, "YourTeam.YourMod/double-jump", new UpgradeRules(
    maxStacks: 3,
    parameters: new[] { KeyValuePair.Create("height", 1.5f) }));
UpgradeApi.Contexts.Activate(contextId);

// Runtime contexts live until explicitly cleared; reset them at a new session boundary.
// UpgradeApi.State.ClearRuntimeContext(contextId);

// Grant only from validated server-authoritative gameplay code.
UpgradeTarget target = UpgradeTarget.ForPlayer(player);
UpgradeApi.State.AddStacks(contextId, target, "YourTeam.YourMod/double-jump");

if (UpgradeApi.State.TryResolveActive(player, null, "YourTeam.YourMod/double-jump", out ResolvedUpgrade upgrade))
{
    ApplyJump(height: upgrade.GetFloat("height"), stacks: upgrade.Stacks);
}

Acquisition mods can discover compatible content without referencing its provider assembly:

IEnumerable<UpgradeDefinition> shopPool =
    UpgradeApi.Catalog.CompatibleWith(target, "shop");

Use globally unique, permanent IDs in Team.Mod/upgrade-name form. Catalog order is not a network identity; synchronize the string ID or maintain a deterministic provider-owned mapping.

Providers may register both an abstract, player-facing description and a detailed description formatter. The formatter receives the effective parameter values for the requested context through definition.GetDetailedDescription(contextId), so balance overrides and displayed numbers stay consistent.

The API supports player-wide and item-model contributions. Resolution combines compatible enabled stacks for the active context and clamps them to that context's limit. SaveGame state is authoritative on the host, saved beside the native world, and synchronized only to the owning player. Runtime contexts are suitable for alternate modes such as ROUNDS; activating one isolates it from saved ExoticUpgrades progress without deleting that progress. Runtime state lasts for the current game process, so session-based modes should call ClearRuntimeContext when a new match or lobby starts.

Save-game sidecars use the native save name and are removed with the native save. If a provider is temporarily absent, its records remain preserved. How to Fish does not use Steam Cloud, so moving a save between computers requires copying its Upgrade Core sidecar as well.

Installation

Upgrade Core is a library and adds nothing by itself. Install a mod that uses it with a Thunderstore-compatible mod manager such as r2modman; it installs Upgrade Core automatically. For a manual install, place ArceDev.UpgradeCore.dll in BepInEx/plugins together with BepInEx 5.

Multiplayer

The host decides which upgrades each player owns. Every player who uses a mod built on Upgrade Core must install Upgrade Core and that mod.

Support

Join DevArce Mods on Discord for questions, feedback, and bug reports.

AI Disclosure

This mod was developed with assistance from generative AI for programming, documentation, and promotional artwork. The author reviewed, tested, and approved the final implementation and assets.

CHANGELOG

Changelog

[0.2.0] - 2026-11-23

Added

  • Upgrade contexts with Global, SaveGame, and Runtime lifetimes.
  • Multiple supported scopes, trigger metadata, validated balance parameters, stack limits, and resolved upgrade profiles.
  • Server-authoritative save-game state synchronized to each owning player.
  • Versioned per-save sidecars with atomic writes, backups, deletion cleanup, and preservation of state whose provider is temporarily absent.
  • An idempotent path for importing legacy global ownership into existing saved games.
  • ClearRuntimeContext for resetting one mode's in-memory upgrade state without affecting saved, global, or unrelated runtime contexts.
  • Optional abstract and context-aware detailed descriptions for upgrade definitions.

Changed

  • The compatibility state API now resolves through the active context.

Fixed

  • Preserve host save-game state while FishNet tears down the local server and client, preventing a later native save from replacing the sidecar with an empty snapshot.
  • Determine legacy-migration eligibility from the players already stored when the save is selected, and retry the corrected migration for sidecars created by the earlier candidate.

[0.1.0] - 2026-09-04

Added

  • Public registration and catalog API for upgrade providers and acquisition mods.
  • Persistent ownership and enabled state for player-wide and item-model upgrades.