2022-05-23 18:41:30 +00:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
#include "InventoryFragment_SetStats.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
|
|
|
|
#include "GameplayTagContainer.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
#include "Inventory/LyraInventoryItemInstance.h"
|
2022-09-13 07:18:28 +00:00
|
|
|
#include "Templates/Tuple.h"
|
2022-05-23 18:41:30 +00:00
|
|
|
|
|
|
|
void UInventoryFragment_SetStats::OnInstanceCreated(ULyraInventoryItemInstance* Instance) const
|
|
|
|
{
|
|
|
|
for (const auto& KVP : InitialItemStats)
|
|
|
|
{
|
|
|
|
Instance->AddStatTagStack(KVP.Key, KVP.Value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int32 UInventoryFragment_SetStats::GetItemStatByTag(FGameplayTag Tag) const
|
|
|
|
{
|
|
|
|
if (const int32* StatPtr = InitialItemStats.Find(Tag))
|
|
|
|
{
|
|
|
|
return *StatPtr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|