Currency Component¶
Overview¶
UMIPCurrencyComponent holds and replicates currency entries (tag + amount per storage tag) via a fast array. It provides add, consume, and query (owned amount, has enough, can add/can consume) and integrates with the fee struct FMIPCurrencyFeeStruct. Currency is loaded/saved with the player; replication notifies clients of changes.
Key traits:
- Attachment: PlayerController.
- Replication: Currency list replicates; ReplicateSubobjects for currency instances. MarkCurrencyForReplication when mutating.
- Storage tag: Currencies can be scoped by storage (e.g. character vs family) via InCurrencyStorageTag.
All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.
Key Classes & Files¶
| Class | File |
|---|---|
UMIPCurrencyComponent |
Public/Currency/MIPCurrencyComponent.h |
UMIPCurrencyComponent¶
- Base: UMIPBasePlayerControllerComponent.
- Delegate:
CurrencyEntryChangedDelegate(FMIPCurrencyEntry, Index). - API:
AddCurrency(InCurrencyTag, InAmount, InCurrencyStorageTag, bLoaded),AddCurrencyByFee(InFee),ConsumeCurrency(InFee).GetOwnedCurrencyAmount(InCurrencyTag, InCurrencyStorageTag),GetOwnedCurrencyAmountByFee(InFee),HasEnoughWithStorageTag(InFee, InCurrencyStorageTag),HasEnough(InFee),CanAddCurrency(InFee),CanConsumeCurrency(InFee).MarkCurrencyForReplication(InCurrencyInstance). - Flow: BeginPlay/ClientBeginPlay; OnCurrencyListReplicatedListChanged for replication callback.
Integration¶
- UMIPBaseInventoryManagerComponent – HasEnoughCurrency, RemoveCurrency use this component.
- UMIPBasePlayerLevelBasedFeatureComponent / IMIPCurrencyFeeInterface – fee checks for enhance, repair, reforge, etc.
- Save/load – server load component loads currencies; save marks dirty via MarkCurrencyForReplication.