Skip to content

Crafting — Currency Adapters

This folder contains Crafting adapters that integrate with the RevFramework Currency and Economy systems.

All adapters here implement: - ICraftingCurrencyAdapter - optionally ICraftingCurrencyHoldAdapter

They forward Crafting currency operations to an underlying ICurrencyService when available.

Adapters are conditionally compiled and fail safely when required services are missing.

These adapters are built for RevFramework Currency / Economy systems only.
They are not intended for use with third-party currency solutions.


Currency adapter

CurrencyCraftingAdapter

  • Compiled when REV_CURRENCY_PRESENT is defined.
  • Forwards balance queries, debits, and credits to ICurrencyService.
  • Attempts to resolve the service automatically if not explicitly assigned.

Current behaviour

  • GetBalance returns 0 if no valid currency service is resolved
  • TryDebit returns false if the request cannot be processed
  • Credit performs no action when inputs or service resolution are invalid
  • Hold, capture, and release operations are not supported
  • All escrow-related calls fail safely

👉 This adapter provides direct debit/credit only.


Economy adapter (no hold support yet)

CurrencyHoldCraftingAdapter

  • Compiled when REV_ECONOMY_PRESENT is defined.
  • Uses the same direct currency operations as the standard adapter.
  • Intended as the future integration point for Economy-based hold/escrow flows.

Current behaviour

  • Balance, debit, and credit forward to ICurrencyService
  • TryHold, TryCapture and ReleaseHold are implemented, backed by the Currency escrow

This section used to say the opposite

It stated that hold, capture and release were "not implemented", that all escrow-related calls "fail safely", and that crafting flows requiring currency holds "will not run when using this adapter". The adapter implements all three.

What it does require is an escrow-composed currency service. Without one, TryHold refuses — which is a configuration answer, not a missing feature, and the refusal is reported rather than silent.


Design intent

These adapters are intentionally:

  • Thin bridges — no business logic lives here
  • Safe-failing — missing services never cause runtime errors
  • Explicit — all cross-system behaviour is visible and replaceable
  • Optional — removing this folder does not affect Crafting core

Safe to remove

This folder is optional.

Removing it will:

  • Not affect the Crafting system
  • Disable currency-based crafting behaviour
  • Remove all built-in currency integration paths

Summary

This folder answers:

“How does Crafting talk to Currency?”

It provides:

  • A direct currency adapter (debit/credit)
  • A future-facing economy adapter (no escrow yet)
  • A clean, replaceable integration seam

If you need different behaviour, implement your own adapter using the public interfaces.