diff --git a/Source/ElementusInventory/Public/ElementusInventoryComponent.h b/Source/ElementusInventory/Public/ElementusInventoryComponent.h index e4b0043..beff560 100644 --- a/Source/ElementusInventory/Public/ElementusInventoryComponent.h +++ b/Source/ElementusInventory/Public/ElementusInventoryComponent.h @@ -58,9 +58,11 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone UFUNCTION(BlueprintPure, Category = "Elementus Inventory") int32 GetCurrentNumItems() const; + /* Called on every inventory update */ UPROPERTY(BlueprintAssignable, Category = "Elementus Inventory") FElementusInventoryUpdate OnInventoryUpdate; + /* Called when the inventory is empty */ UPROPERTY(BlueprintAssignable, Category = "Elementus Inventory") FElementusInventoryEmpty OnInventoryEmpty; @@ -68,9 +70,11 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone UFUNCTION(BlueprintPure, Category = "Elementus Inventory") TArray GetItemsArray() const; + /* Get a reference of the item at given index */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") FElementusItemInfo& GetItemReferenceAt(const int32 Index); + /* Get a copy of the item at given index */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") FElementusItemInfo GetItemCopyAt(const int32 Index) const; @@ -93,8 +97,7 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone /* Find the first elementus item that matches the specified id */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") bool FindFirstItemIndexWithId(const FPrimaryElementusItemId InId, int32& OutIndex, const FGameplayTagContainer IgnoreTags = FGameplayTagContainer(), const int32 Offset = 0) const; - - + /* Find the first elementus item that matches the specified info */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") bool FindAllItemIndexesWithInfo(const FElementusItemInfo InItemInfo, TArray& OutIndexes, const FGameplayTagContainer IgnoreTags = FGameplayTagContainer()) const; @@ -115,18 +118,23 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone UFUNCTION(BlueprintCallable, Category = "Elementus Inventory") virtual void DebugInventory(); + /* Remove all items from this inventory */ UFUNCTION(NetMulticast, Reliable, BlueprintCallable, Category = "Elementus Inventory") void ClearInventory(); + /* Update the current weight of this inventory */ UFUNCTION(Client, Unreliable, BlueprintCallable, Category = "Elementus Inventory") void UpdateWeight(); + /* Get items from another inventory */ UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Elementus Inventory") void GetItemsFrom(UElementusInventoryComponent* OtherInventory, const TArray& ItemIndexes); + /* Give items to another inventory */ UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Elementus Inventory") void GiveItemsTo(UElementusInventoryComponent* OtherInventory, const TArray& ItemIndexes); + /* Discard items from this inventory */ UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Elementus Inventory") void DiscardItems(const TArray& ItemIndexes); diff --git a/Source/ElementusInventory/Public/ElementusInventoryFunctions.h b/Source/ElementusInventory/Public/ElementusInventoryFunctions.h index bcbfaa9..a102f7c 100644 --- a/Source/ElementusInventory/Public/ElementusInventoryFunctions.h +++ b/Source/ElementusInventory/Public/ElementusInventoryFunctions.h @@ -65,12 +65,15 @@ class ELEMENTUSINVENTORY_API UElementusInventoryFunctions final : public UBluepr UFUNCTION(BlueprintCallable, Category = "Elementus Inventory") static void TradeElementusItem(TArray ItemsToTrade, UElementusInventoryComponent* FromInventory, UElementusInventoryComponent* ToInventory); + /* Check if the given item info have a valid id */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") static bool IsItemValid(const FElementusItemInfo InItemInfo); + /* Check if the given item info represents a stackable item */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") static bool IsItemStackable(const FElementusItemInfo InItemInfo); + /* Get item tags providing a parent tag */ UFUNCTION(BlueprintPure, Category = "Elementus Inventory") static FGameplayTagContainer GetItemTagsWithParentTag(const FElementusItemInfo InItemInfo, const FGameplayTag FromParentTag); diff --git a/Source/ElementusInventory/Public/ElementusInventoryPackage.h b/Source/ElementusInventory/Public/ElementusInventoryPackage.h index a8ddc75..e41b295 100644 --- a/Source/ElementusInventory/Public/ElementusInventoryPackage.h +++ b/Source/ElementusInventory/Public/ElementusInventoryPackage.h @@ -42,7 +42,7 @@ class ELEMENTUSINVENTORY_API AElementusInventoryPackage : public AActor virtual void BeginPlay() override; virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; - /* Will this package auto destroy when empty? */ + /* Should this package auto destroy when empty? */ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Elementus Inventory", meta = (Getter = "GetDestroyOnEmpty", Setter = "SetDestroyOnEmpty")) bool bDestroyWhenInventoryIsEmpty;