Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USTRUCT(BlueprintType)
- struct INVENTORYSYSTEM_API FInventoryItem : public FFastArraySerializerItem
- {
- GENERATED_USTRUCT_BODY()
- public:
- UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FInventoryItem")
- int32 Amount;
- UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FInventoryItem")
- int32 MaxAmount;
- UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FInventoryItem")
- bool bCanStack = false;
- UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "FInventoryItem")
- UInventoryItemAsset* ItemAsset = nullptr;
- // Item property key value pairs for dynamic properties
- UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Inventory System", DisplayName = "Dynamic Item Properties")
- FItemPropertyArray ItemProperties;
- void PreReplicatedRemove(const struct FInventoryArray& InArraySerializer);
- void PostReplicatedAdd(const struct FInventoryArray& InArraySerializer);
- void PostReplicatedChange(const struct FInventoryArray& InArraySerializer);
- FInventoryItem();
- FInventoryItem(int32 NewAmount, int32 NewMaxAmount, bool bNewCanStack, UInventoryItemAsset* NewItemAsset);
- friend bool operator== (const FInventoryItem& First, const FInventoryItem& Other)
- {
- return (First.ItemAsset == Other.ItemAsset && First.ItemProperties.Properties == Other.ItemProperties.Properties);
- }
- friend bool operator!= (const FInventoryItem& First, const FInventoryItem& Other)
- {
- return (First.ItemAsset != Other.ItemAsset || First.ItemProperties.Properties != Other.ItemProperties.Properties);
- }
- friend bool operator>= (const FInventoryItem& First, const FInventoryItem& Other)
- {
- return (First.Amount >= Other.Amount);
- }
- friend bool operator<= (const FInventoryItem& First, const FInventoryItem& Other)
- {
- return (First.Amount <= Other.Amount);
- }
- friend bool operator> (const FInventoryItem& First, const FInventoryItem& Other)
- {
- return (First.Amount > Other.Amount);
- }
- friend bool operator< (const FInventoryItem& First, const FInventoryItem& Other)
- {
- return (First.Amount < Other.Amount);
- }
- };
- USTRUCT(BlueprintType)
- struct FInventoryArray : public FFastArraySerializer
- {
- GENERATED_USTRUCT_BODY()
- UPROPERTY(BlueprintReadWrite, EditAnywhere)
- TArray< FInventoryItem > Items;
- bool NetDeltaSerialize(FNetDeltaSerializeInfo & DeltaParms);
- FInventoryArrayChangedDelegate InventoryArrayChangedDelegate;
- };
- template<>
- struct TStructOpsTypeTraits< FInventoryArray > : public TStructOpsTypeTraitsBase2< FInventoryArray >
- {
- enum
- {
- WithNetDeltaSerializer = true,
- };
- };
Add Comment
Please, Sign In to add comment