tested commit

This commit is contained in:
7heIVIaze
2025-06-04 18:23:40 +09:00
parent 1096753f5f
commit 36727688ac
8 changed files with 39 additions and 9 deletions

View File

@ -2,6 +2,7 @@
#include "HYShopNPCActor.h"
#include "Blueprint/UserWidget.h"
#include "HYPlayerCharacController.h"
void AHYShopNPCActor::Interact_Implementation(APlayerController* Controller)
{
@ -17,4 +18,23 @@ void AHYShopNPCActor::Interact_Implementation(APlayerController* Controller)
// ShopWidget = CreateWidget<UUserWidget>(Controller, ShopWidgetClass);
// ShopWidget->AddToViewport();
//}
}
void AHYShopNPCActor::BuyTradableItem_Implementation(APlayerController* Controller, const FInventoryItem ItemToBuy, const int Amount)
{
int CurrentAmount = *TradableItems.Find(ItemToBuy);
TradableItems[ItemToBuy] = CurrentAmount - Amount;
AHYPlayerCharacController* PlayerController = Cast<AHYPlayerCharacController>(Controller);
if (PlayerController)
{
for (int i = 0; i < Amount; ++i)
{
PlayerController->AddItemToInventoryByID(ItemToBuy.ItemID);
}
}
return;
}