InventoryComponent:UltimateInventoryComponent
Inventory components need to be added to players, buildings, or monsters
The inventory is divided into backpacks, blueprints, shortcut bars, and equipment bars. The blueprints are fixed blueprints and cannot be moved. They can only be added through the system and used by players to create items
In the inventory component, only the inventory of the client control role can be operated, and the inventory of others cannot be operated,Please use UltimateControllerComponent for operation if necessary
Moving or using inventory items requires obtaining permission first. Each player can only operate one inventory at a time, and opening the inventory will synchronize the items
Variable | Explain |
---|---|
RemoteViewingInventoryPlayerControllers(Protect) | List of licensed player controllers |
UseColdDowns(Protect) | Use cooling list |
DroppedClass(Setting) | The entity type generated by discarding items from this inventory system,APrimalDropped |
DroppedBackpackClass(Setting) | One click discard all items and package entity types generated after death from the inventory system,APrimalDroppedBackpack |
MaxAllowViewDistance(Setting) | Maximum allowed distance to open inventory system |
InteractionColdDownTime(Setting) | Interactive cooling time to prevent cheating players from using the inventory system to occupy server resources |
DecayMultiplication(Setting) | Decay rate, a variable used to delay the decay time of refrigerators and other items |
bDisableDropAllItem(Setting) | It is prohibited to discard all items with one click. For items discarded with one click, the inventory component of the package will enable this option and bEnable Transfer Restriction will be enabled to prevent players from transferring items to the package |
bEnableTransferRestriction(Setting) | Enable item transfer restrictions, for example: weapon cabinets can only hold weapons items |
AllowItemType(Setting) | The types of items that are allowed to be transferred need to be opened,bEnableTransferRestriction |
InventoryItems | Backpack items |
BlueprintItems | Blueprint item, issued by the system as a basic blueprint, cannot be discarded or moved by players, can only be created |
QuickItems | Quick Bar Items |
EquippedItems | Equipment Bar Items |
MaxItemCount | Maximum number of items |
EquipSlotSetting(Setting) | Equipment Bar Slot Array Settings |
Table | Production platform, such as workbench, machine tool |
CraftQueueEntries | Create queue Item UID Quantity Is bIsRepair a repair |
CraftQueueMaxCount | Maximum number of production queues |
CraftEntiie | Current item information being created |
bCraftEntriesValid | Are items being made |
CraftQueueHande | Craft timer handle for the queue |
CraftStartTime | Craft start time |
CraftRequestTime | Time required for craft |
MaxCraftQuantity | Maximum production quantity, such as a maximum of 100 foundations made at once |
bAllowCrafFromOtherPlayer(Setting) | Allow other players to create items here, preventing them from using their blueprint to craft items on another player |
Function | Explain |
---|---|
GiveItemToInventory(UPrimalItemBasic* ItemClass, EInventorySite InventorySite, int32 Quantity, bool bIsBlueprint,bool bShowHUDNotification) | Give items, server only |
ClientStartReceivingItems/ClientEndReceivingItems | Client starts/stops synchronizing items |
FindItem(FItemUID ItemUID, EInventorySite InventorySite) | Searching for items |
FindItemDetail(FItemUID ItemUID, EInventorySite InventorySite, int32& ItemIndex, UPrimalItem*& ResultItem, EInventorySite& InSite) | Search for items and return detailed information |
FindItemsByClass(UPrimalItemBasic* ItemBasic, EInventorySite InventorySite) | Search for items by type |
GetIsInventoryHasEmpty | Is there enough space in the inventory |
GetStackableQuantity(UPrimalItemBasic* ItemClass, EInventorySite InventorySite) | Obtain the number of items in inventory that can be stacked for the specified item type |
GetItemQuantityByClass(UPrimalItemBasic* ItemClass, EInventorySite InventorySite, bool bIncludeBlurprint) | Obtain the total quantity of this item type in inventory |
IsEqualInventory(UPrimalItem* Item1, UPrimalItem* Item2) | Is the item in the same inventory component as the item |
GetQuickSlotItem(int32 Index) | Obtain shortcut bar items |
GetEquipSlotItem(EItemEquipSlot SlotType,int32 Number) | Obtain items from the equipment bar |
GetIsEquipSlotEmpty(EItemEquipSlot SlotType) | Check if there are empty slots in the equipment bar |
GetItemsFromEquip(EItemEquipSlot SlotType) | Obtain an array of items in the equipment bar |
GetItemsByPanel(EItemPanel Panel) | Obtain an item array for item pagination, used by the UI for classification |
GetUseColdDown(FName ColdDownGroup) | Obtain a cooling CD, UI usage, and display the cooling CD used by the item |
Server only functions | |
DropAllItem(bool bIncludeEquip, bool bShowHUDNotification) | Drop all item, server only BIncludeEquip includes equipment and shortcut bars, which are true when dead and false when actively discarded to prevent players from discarding their equipment with just one click |
RemoveItem(UPrimalItem* Item, bool bDropped = false, bool bShowHUDNotification) | Remove item,server only bDropped If it is a discarded item, true will generate an item entity for players to pick up when discarding it |
SetupItemQuantity(UPrimalItem* Item, int32 Quantity, bool bShowHUDNotification) | Set the number of items, which will be called by the server. Setting 0 will remove the item |
AddItemToInventoryItemStack(UPrimalItemBasic* ItemClass, int32 Quantity, EInventorySite InventorySite, bool bShowHUDNotification) | Add items to the inventory stack, return the number of unstacked items, server only |
AddItem(FItemBuildInfo BuildInfo, EInventorySite InventorySite, bool bShowHUDNotification, bool bUseStack) | Add items to inventory,server only |
UseItem(UPrimalItem* Item) | Use item,server only |
UseItemWithItem(UPrimalItem* Item1, UPrimalItem* Item2) | Use an item to another item, when dragging, to adjust the ammunition type or stack items for the weapon,,server only |
ApplyColdDown(FName ColdDownGroup, double ColdDown) | Apply Cold Down |
TransferToInventorySlot(UPrimalItem* Item, bool bUseStack) | Transfer to item backpack,server only |
TransferToQuickSlot(UPrimalItem* Item, int32 SlotIndex) | Transfer to quick bar,server only |
TransferToEquipSlot(UPrimalItem* Item, int32 Index) | Transfer to Equipment Bar,server only |
SwapInventorySlotItem(UPrimalItem* Item1, UPrimalItem* Item2) | Exchange item position,server only |
SwapQuickSlotItem(UPrimalItem* Item, int32 SlotIndex) | Swap quick bar position,server only |
SplitItemStack(UPrimalItem* Item, int32 AmountToSplit) | Split Stack,server only |
StackItemToItem(UPrimalItem* Item1, UPrimalItem* Item2) | Stacking Item,server only |
SplitItemStackToItem(UPrimalItem* Item1, UPrimalItem* Item2, int32 AmountToSplit, bool bShowHUDNotification) | Split and stack items onto another item,server only |
TransferItemFromDrop(UPrimalItem* Item) | Transferred from discarded items to backpacks for picking up ground item,server only |
TransferItemToInventory(UUltimateInventoryComponent* Inventory, UPrimalItem* Item) | Transferring items to another inventory component,server only |
TransferItemFromInventory(UUltimateInventoryComponent* Inventory, UPrimalItem* Item) | Moving items from another inventory component to this inventory component中,server only |
GetRemotePlayerControllers(bool bIncludeNetCullDistanceSquared) | Obtain the player controller used for synchronization, bIncludeNetCullDistanceSquared Does it include players within the exclusion distance for player equipment synchronization, but not for synchronizing backpack items |
RemoveQuantityFromItem(UPrimalItem* Item, int32 Quantity) | Remove quantity from item |
RemoveQuantityFromInventory(UPrimalItemBasic* ItemClass, int32 Quantity) | Remove items of the specified item type from the backpack |
SpawnDroppedItem(UPrimalItem* Item) | Generate dropped item actor |
SpawnDroppedItems(const TArray<UPrimalItem*>& Items) | Generate item package actor |
ResourceCheckFunction | Explain |
MeetResourcesRequirement(TArray<FItemResource> Resources, int32 Amount) | Have Resource In Inventory |
MeetEnhanceRequirements(UPrimalItem* Item) | Have Enhance resource in inventory |
MeetRepairRequirements(UPrimalItem* Item) | Have Repair resource in inventory |
MeetBlueprintCraftingRequirements(UPrimalItem* Item, int32 CraftAmount) | Have Craft resource in inventory |
GetBlueprintCanCraftQuantity(UPrimalItem* Item) | How many designated blueprints can be made by obtaining the item materials in the inventory |
NetworkSynchronization | Explain |
NotifyClientsItemCommand(UPrimalItem* Item1, UPrimalItem* Item2, bool bShowHUDNotification, EClientItemNotifyType NotifyType) | Notify the client of item commands, used to synchronize the client's item position, add items, and create queue updates |
NotifyClientsItemMutableAttribute(UPrimalItem* Item, UItemMutableAttribute* MutableAttribute) | Notify the client of variable attribute changes to the item, including serialization of variable attributes |
NotifyClientsColdDown(FName ColdDownGroup, double DeleteTime) | Notify client of changes in item usage cooling time |
Player interaction using function (whether connected or not) | Explain |
ServerDropItem(FItemUID ItemUID) | DropItem |
ServerDropAllItems() | Drop All Items in inventory |
ServerDropMultiItems(const TArray<FItemUID>& ItemUIDs) | Drop MultiItem items |
ServerSwapItem(FItemUID ItemUID, FItemUID TargetItemUID) | Swap Item position |
ServerUseItemWithItem(FItemUID ItemUID, FItemUID TargetItemUID) | Used after dragging items, for stacking onto another item or setting weapon and ammunition types |
ServerSplitItemStack(FItemUID ItemUID, FItemUID TargetItemUID,int32 AmountToSplit) | Split the item stack. If the TargetItemUID is blank, it will be split to the end of the backpack. If it is not blank, the item will be stacked |
ServerSplitItemAllStack(FItemUID ItemUID) | Split the item stack and divide it into items one by one. After splitting, the UID will change to a new item, and durability and other attributes will be inherited |
ServerAddToQuick(FItemUID ItemUID, int32 SlotIndex) | Equip items to the quick bar |
ServerRemoveToQuick(int32 SlotIndex) | Remove item from shortcut bar to backpack |
ServerSwapQuickItem(int32 SlotIndex, int32 TargetSlotIndex) | Exchange quick bar item location |
ServerUseItem(FItemUID ItemUID) | Use item |
ServerEquipItem(FItemUID ItemUID,int32 Index) | Equip Item |
ServerUnequipItem(FItemUID ItemUID) | Unequip Item |
ServerRepairItem(FItemUID ItemUID, APlayerController* PC) | Repair Item |
ServerCraftItem(FItemUID ItemUID, int32 AmountToCraft, APlayerController* PC) | Craft Item |
ServerRemoveCraftQueue(int32 QueueIndex, APlayerController* PC) | Remove Craft Queue |
ServerEnhanceItem(FItemUID ItemUID, int32 AppointIndex) | Enhance Item |
Functions that need to be override for playing sound effects and other operations
Override Function | Explain |
---|---|
OnItemAddedNotify | Item addition notification, used to display item acquisition notifications |
OnItemEquipNotify | Item equipment notification, replacing the character's equipment component grid here |
OnItemUseNotify | Item usage notification for playing sound effects and animations |
OnItemMutableAttributeUpdated | Item Variable Attribute Update Notification |
OnNotifyClientsItemStatus | Item change notification, including item movement, addition, etc., used for UI synchronization of backpack updates |
OnAddWeight | Weight increase notification, used to reduce player movement speed due to excessive weight, etc |