functionality finished now gussy up

This commit is contained in:
2024-10-26 14:42:16 -05:00
parent b9dd120a90
commit 83972cdd97
322 changed files with 89281 additions and 36763 deletions

View File

@@ -141,3 +141,29 @@ EInventoryCapType UAC_PlayerInventory::GetInventoryCapType()
return this->InventoryCapType;
}
int32 UAC_PlayerInventory::CountNumberOfSameItemsInInventory(const FBaseItemInfo& ItemToCheck)
{
int32 ItemCount = 0;
for (const FBaseItemInfo& Item : PlayerInventory)
{
if (Item == ItemToCheck)
{
ItemCount++;
}
}
return ItemCount;
}
void UAC_PlayerInventory::RequestDropItem(const FBaseItemInfo& ItemToDrop, const int32& ItemCount)
{
for (int32 i = 0; i < ItemCount; i++)
{
PlayerInventory.RemoveSingle(ItemToDrop);
}
}

View File

@@ -195,3 +195,15 @@ UAC_PlayerStats* UBPFL_EpicInventory::GetPlayerStatsComponent(UObject* WorldCont
}
}
bool UBPFL_EpicInventory::AreItemsEqual(const FBaseItemInfo& ItemA, const FBaseItemInfo& ItemB)
{
bool ItemsEqual = false;
if (ItemA == ItemB)
{
ItemsEqual = true;
}
return ItemsEqual;
}

View File

@@ -27,6 +27,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory Configuration")
bool bUseRequiredLevel;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory Configuration")
bool bStackSameItemsInInventoryUI;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Inventory Configuration")
bool bUseInventoryCap;
@@ -61,6 +64,12 @@ public:
UFUNCTION(BlueprintCallable)
EInventoryCapType GetInventoryCapType();
UFUNCTION(BlueprintCallable)
int32 CountNumberOfSameItemsInInventory(const FBaseItemInfo& ItemToCheck);
UFUNCTION(BlueprintCallable)
void RequestDropItem(const FBaseItemInfo& ItemToDrop, const int32& ItemCount);
protected:

View File

@@ -31,5 +31,8 @@ public:
UFUNCTION(BlueprintCallable, Category = "Player Stat Getters")
static UAC_PlayerStats* GetPlayerStatsComponent(UObject* WorldContextObject);
UFUNCTION(BlueprintCallable, Category = "Player Inventory Getters")
static bool AreItemsEqual(const FBaseItemInfo& ItemA, const FBaseItemInfo& ItemB);
};

View File

@@ -154,6 +154,18 @@ struct FBaseItemInfo : public FTableRowBase
{
GENERATED_BODY()
bool operator==(const FBaseItemInfo& Other) const
{
return Name.EqualTo(Other.Name) &&
Description.EqualTo(Other.Description) &&
(ItemType == Other.ItemType) &&
(Price == Other.Price) &&
(Rarity == Other.Rarity) &&
(ItemWeight == Other.ItemWeight);
}
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Base Item Info")