Vendor¶
Overview¶
Vendor extends the Exchange system: the player interacts with an NPC that implements IMIPVendorInterface, UMIPPlayerVendorManager loads offers from MIPVendorDataAsset, and the UI can switch between purchase (exchange list) and repurchase (recently sold items). Purchase and repurchase share the same requirement/currency plumbing as exchange; repurchase storage is described in Vendor Repurchasing.
All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.
Key Classes & Files¶
| Class | File |
|---|---|
IMIPVendorInterface |
Public/Interfaces/MIPVendorInterface.h |
UMIPPlayerVendorManager |
Public/Vendor/MIPPlayerVendorManager.h |
MIPVendorDataAsset |
Public/DataAsset/MIPVendorDataAsset.h |
UMIPVendorSettings |
Public/Setting/MIPVendorSettings.h |
UMIPVendorContainerWidget |
Public/Widget/Vendor/MIPVendorContainerWidget.h |
UMIPVendorItemWidget |
Public/Widget/Vendor/MIPVendorItemWidget.h |
IMIPVendorInterface¶
Implemented by the vendor NPC (or actor) the player is interacting with.
| Method | Role |
|---|---|
GetVendorTag() |
Gameplay tag identifying this vendor’s data (lookup in UMIPVendorSettings::DefaultVendorDataAssets). |
GetVendorUniqueInventoryTag() |
Unique tag for that vendor’s dynamic repurchase storage (one UMIPDynamicStorageIMC instance per tag). |
UMIPPlayerVendorManager¶
- Base:
UMIPBaseInteractableExchangeManager→UMIPBaseExchangeManager. - Role: Same interaction lifecycle as exchange;
GenerateExchangeItemsresolvesMIPVendorDataAssetfromInteractingVendorTag(set while interacting). - API:
RepurchaseVendorItem(InItemEntry, InAmount)— client entry for buying back a sold item; server RPCsServer_RepurchaseItem/Server_RepurchaseItemByUniqueId. - Delegates (client):
OnVendorPurchaseRequestSent(item tag, amount, scope);OnVendorRepurchaseRequestSent(item tag, amount) — e.g. UI sounds. - Storage: Repurchase state (sequences, etc.) lives on
UMIPStoragesManagerComponent; see Vendor Repurchasing.
UMIPVendorSettings (config)¶
| Property | Role |
|---|---|
DefaultVendorDataAssets |
TMap<FGameplayTag, FMIPVendorAssetInfo> — vendor tag → vendor data asset. |
DefaultVendorItemWidgetClass |
Row widget for the purchase list. |
VendorRepurchaseItemWidgetClass |
Row widget for repurchase slots. |
DefaultVendorExpiringDuration |
Default window (seconds) for sold-item timers where applicable. |
UI¶
UMIPVendorContainerWidget—WidgetSwitcherbetween purchase grid (GenerateVendorItems) and repurchase grid (GenerateRepurchaseItems*). Binds toUMIPStoragesManagerComponentand currentGetCurrentActiveVendorRepurchaseIMC()for the repurchase tab. OptionalRepurchaseAvailableInventorySlotsWidget(UMIPAvailableInventorySlotsWidget) for used/max slot counts (same widget as player bag slot display).- Widget toggles are driven by project interaction / widget tag setup (see Interaction, Widget).
Integration¶
- Exchange base: Exchange —
UMIPBaseExchangeManager, requirements. - Repurchase storage & purpose tags: Vendor Repurchasing.
- Currency / action limits: Currency, Action limits.
- NPCs: NPC.