Skip to content

Economy — Internal Utilities

Purpose

These are shared low-level helpers used internally by Economy services and adapters. They exist to help keep behaviour consistent across the subsystem.

Namespace: RevGaming.RevFramework.Economy.Internal.Utilities

These types are internal implementation details and may change over time.


Not for Production Use

These utilities are not extension points

They should not be referenced from gameplay code or integrations.


What Lives Here

PriceBundleUtil

Validation and normalization for PriceBundle.

Responsibilities:

  • Validates money and item lines (returns InvalidArgs with clear messages)
  • Normalises money lines:

  • Merges duplicate currency ids

  • Detects numeric overflow when summing amounts
  • Produces deterministic ordering (ordinal by id)
  • Convenience checks:

  • HasMoney() / HasItems()

  • Validate()
  • TryNormalize()

Used internally by:

  • Shop flows
  • Crafting flows
  • Reward flows
  • Currency-backed ledger adapters

This helps ensure built-in economy operations use a consistent bundle shape.


EcoReasonUtil

Telemetry hygiene helper.

Responsibilities:

  • Normalises caller-supplied reason strings (trim, default)
  • Editor-only warnings when reasons are non-canonical (helps reduce analytics drift)
  • Player builds avoid canonical checks (no runtime overhead from these checks)

Used throughout services and teachable or demo tooling to keep reason strings consistent.


EcoEditorBridge

Editor-only diagnostics bridge.

Responsibilities:

  • WarnOnce — logs a warning once per unique key per editor session
  • WarnThrottle — rate-limits warnings per key over a time window
  • Player builds are no-op

Used by adapters and internal helpers to surface warnings without excessive log noise.


EconomyOwnerUtil

Readable owner labels for diagnostics.

Responsibilities:

  • OwnerKey(GameObject) provides a null-safe owner label (primarily for editor logs)

Important Notes

  • Internal utilities are not extension points
  • They support consistent behaviour across Economy flows
  • Custom behaviour should be implemented via supported interfaces and facade composition rather than depending on these helpers

  • Economy — Abstractions
  • Economy — Facade
  • Economy — Diagnostics