This commit is contained in:
Ji Yoon Rhee
2024-09-10 10:46:13 +09:00
parent eeaf691a1a
commit cf526110b3
13 changed files with 54 additions and 24 deletions

View File

@ -39,13 +39,18 @@ bool AHYPlayerCharacController::AddItemToInventoryByID(FName ID)
return false;
}
void AHYPlayerCharacController::CraftItem(FInventoryItem ItemA, FInventoryItem ItemB)
void AHYPlayerCharacController::CraftItem(FInventoryItem ItemA, FInventoryItem ItemB, FInventoryItem ItemC, FInventoryItem ItemD)
{
for (auto Pair : ItemB.CraftCombinations) {
if (Pair.ComponentID == ItemA.ItemID) {
if (Pair.bDestroyItemA) Inventory.RemoveSingle(ItemA);
if (Pair.bDestroyItemB) Inventory.RemoveSingle(ItemB);
AddItemToInventoryByID(Pair.ProductID);
for (auto Combination : ItemB.CraftCombinations) {
if (Combination.ItemAID == ItemA.ItemID
&& Combination.ItemBID == ItemB.ItemID
&& Combination.ItemCID == ItemC.ItemID
&& Combination.ItemDID == ItemD.ItemID) {
if (Combination.bDestroyItemA) Inventory.RemoveSingle(ItemA);
if (Combination.bDestroyItemB) Inventory.RemoveSingle(ItemB);
if (Combination.bDestroyItemC) Inventory.RemoveSingle(ItemC);
if (Combination.bDestroyItemD) Inventory.RemoveSingle(ItemD);
AddItemToInventoryByID(Combination.ProductID);
ReloadCraftUI();
}
}