25 lines
600 B
C++
25 lines
600 B
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "InventoryFragment_SetStats.h"
|
|
|
|
#include "GameplayTagContainer.h"
|
|
#include "Inventory/LyraInventoryItemInstance.h"
|
|
#include "Templates/Tuple.h"
|
|
|
|
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;
|
|
} |