Skip to content

Vendor Repurchasing

Overview

Vendor repurchasing stores items the player sold to a vendor in a per-vendor dynamic storage backed by UMIPDynamicStorageIMC (often UMIPVendorRepurchaseStorageIMC). Items carry UItemPiece_SoldToVendorItem for ordering and expiry; UMIPStoragesManagerComponent resolves the correct IMC using a purpose gameplay tag and UMIPSettings::DynamicStorageIMCClassByPurposeTag. The vendor UI uses GetCurrentActiveVendorRepurchaseIMC() while the player is interacting with a vendor implementing IMIPVendorInterface.

All paths below are relative to Plugins/ModularInventoryPlus/Source/ModularInventoryPlus/.


Key Classes & Files

Class File
UMIPStoragesManagerComponent Public/Inventory/Storage/MIPStoragesManagerComponent.h
UMIPDynamicStorageIMC Public/Inventory/Storage/MIPDynamicStorageIMC.h
UMIPVendorRepurchaseStorageIMC Public/Inventory/Storage/MIPVendorRepurchaseStorageIMC.h
UItemPiece_SoldToVendorItem Public/Inventory/Pieces/TempDuration/ItemPiece_SoldToVendorItem.h
UMIPVendorExpiringItemDurationDecorator Public/Cooldown/Decorator/MIPVendorExpiringItemDurationDecorator.h
UMIPSettings (purpose map) Public/Setting/MIPSettings.h
MIPGameplayTags (purpose tags) Public/GameplayTag/MIPGameplayTags.h

Flow (high level)

Player sells to vendor
Item stored in dynamic IMC keyed by GetVendorUniqueInventoryTag()
Repurchase list / timers use same IMC (purpose: VendorRepurchase)
Player buys back via UMIPPlayerVendorManager / UMIPPlayerServerIMC

Purpose tags & settings

Native tags (under Storage.DynamicPurpose):

Tag Typical class
Storage.DynamicPurpose.Default UMIPDynamicStorageIMC
Storage.DynamicPurpose.VendorRepurchase UMIPVendorRepurchaseStorageIMC

UMIPSettings

Property Role
DynamicStorageIMCClassByPurposeTag TMap<FGameplayTag, TSubclassOf<UMIPDynamicStorageIMC>> — which concrete IMC class to spawn on first access for that purpose. Constructor seeds Default / VendorRepurchase entries.
DefaultDynamicStorageIMCClass Fallback if the purpose tag is missing from the map or the mapped class is invalid.

UMIPStoragesManagerComponent

API Role
GetDynamicStorageIMCByTag(InUniqueInventoryTag, PurposeTag) Finds or creates the IMC for that storage tag; PurposeTag empty uses Storage.DynamicPurpose.Default for the map lookup.
GetCurrentActiveVendorRepurchaseIMC() Requires active vendor interaction; uses Tag_Storage_DynamicPurpose_VendorRepurchase when creating.

Same tag, one IMC

DynamicStorageIMCs is keyed only by unique inventory tag. Do not mix unrelated purpose tags for the same tag: the first creation wins.


UMIPVendorRepurchaseStorageIMC

Subclass of UMIPDynamicStorageIMC with default grid sizing (e.g. slot count / rows) suitable for repurchase UI. Project can point Storage.DynamicPurpose.VendorRepurchase at this class or a custom subclass via DynamicStorageIMCClassByPurposeTag.


Widgets

UMIPVendorContainerWidget — On the repurchase tab, binds RepurchaseStorageIMC from GetCurrentActiveVendorRepurchaseIMC(), sorts sold items (newest first), and builds UMIPVendorRepurchaseItemWidget rows. UpdateRepurchaseSlotCountTexts() updates optional RepurchaseAvailableInventorySlotsWidget via UpdateAvailableInventorySlotsWidget (used / max from GetUsedItemSlotsCount() / GetTotalUnlockedSlotsCount() on the storage IMC).


Integration