diff --git a/hwanyoung2/Content/Hwanyoung/BP_ShopNPC.uasset b/hwanyoung2/Content/Hwanyoung/BP_ShopNPC.uasset new file mode 100644 index 00000000..d4e82df7 --- /dev/null +++ b/hwanyoung2/Content/Hwanyoung/BP_ShopNPC.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4a8c86a2570fc1fbdbb6ff1b364063d1786d1f82b3045f626dd053d036a17261 +size 33246 diff --git a/hwanyoung2/Content/Hwanyoung/Illusions/GeneralizedBlueprints/AOEBP/BP_ShopAOE.uasset b/hwanyoung2/Content/Hwanyoung/Illusions/GeneralizedBlueprints/AOEBP/BP_ShopAOE.uasset new file mode 100644 index 00000000..f093cac3 --- /dev/null +++ b/hwanyoung2/Content/Hwanyoung/Illusions/GeneralizedBlueprints/AOEBP/BP_ShopAOE.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afcdd07406d027fbf41155e3dc37e53579251281becf10ef6fd584a06cfe4713 +size 145464 diff --git a/hwanyoung2/Content/Hwanyoung/Levels/Sprink_TEST.umap b/hwanyoung2/Content/Hwanyoung/Levels/Sprink_TEST.umap index 55936151..7ac79562 100644 --- a/hwanyoung2/Content/Hwanyoung/Levels/Sprink_TEST.umap +++ b/hwanyoung2/Content/Hwanyoung/Levels/Sprink_TEST.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52b2f30159e2925f021575a2d7b0be8dd0a22fdd29c4ddd09ded70c570cd6147 -size 21812414 +oid sha256:5ae1110cb70738ceecf2981820c2cee426e72c426ec04c205dd47ade128637fd +size 21818428 diff --git a/hwanyoung2/Source/hwanyoung2/HYShopAOE.cpp b/hwanyoung2/Source/hwanyoung2/HYShopAOE.cpp index e6618736..f386c539 100644 --- a/hwanyoung2/Source/hwanyoung2/HYShopAOE.cpp +++ b/hwanyoung2/Source/hwanyoung2/HYShopAOE.cpp @@ -50,9 +50,10 @@ bool AHYShopAOE::RandomizeTradableItemSets(int CurrentHonbaekAmount) return false; } + // Filtering match the case.(ItemValue is less and equal than honbaek amount and over than 0) TArray FilteredItemData = ItemData.FilterByPredicate([CurrentHonbaekAmount](const FInventoryItem* ItemDataRow) { - return ItemDataRow->ItemValue <= CurrentHonbaekAmount; + return ItemDataRow->ItemValue > 0 && ItemDataRow->ItemValue <= CurrentHonbaekAmount; }); int maxLoopNum = FMath::Min(5, FilteredItemData.Num()); @@ -73,16 +74,18 @@ bool AHYShopAOE::RandomizeTradableItemSets(int CurrentHonbaekAmount) return false; } -void AHYShopAOE::GetTradableItemSets(TMap& Item) +TMap AHYShopAOE::GetTradableItemSets(int CurrentHonbaekAmount) { + TMap Item; TArray TempItems = FinalItemSets.Array(); for (FInventoryItem TempItem : TempItems) { - int Amount = FMath::RandRange(0, 100); + int MaxAmount = CurrentHonbaekAmount / TempItem.ItemValue; + int Amount = FMath::Clamp(FMath::RandRange(0, MaxAmount), 1, MaxAmount); Item.Add({ TempItem, Amount }); } - return; + return Item; } \ No newline at end of file diff --git a/hwanyoung2/Source/hwanyoung2/HYShopAOE.h b/hwanyoung2/Source/hwanyoung2/HYShopAOE.h index f7a76f86..3fc0050d 100644 --- a/hwanyoung2/Source/hwanyoung2/HYShopAOE.h +++ b/hwanyoung2/Source/hwanyoung2/HYShopAOE.h @@ -31,7 +31,7 @@ public: // @param Item is NPC Actor's Array. // Make random amount of the tradable items set. UFUNCTION(BlueprintCallable) - void GetTradableItemSets(TMap& Item); + TMap GetTradableItemSets(int CurrentHonbaekAmount); public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Data") diff --git a/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.cpp b/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.cpp index afe1da76..5b814744 100644 --- a/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.cpp +++ b/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.cpp @@ -1,8 +1,20 @@ // Fill out your copyright notice in the Description page of Project Settings. #include "HYShopNPCActor.h" +#include "Blueprint/UserWidget.h" void AHYShopNPCActor::Interact_Implementation(APlayerController* Controller) { + Super::Interact_Implementation(Controller); + //if (ShopWidget) + //{ + // ShopWidget->RemoveFromParent(); + // ShopWidget = nullptr; + //} + //else + //{ + // ShopWidget = CreateWidget(Controller, ShopWidgetClass); + // ShopWidget->AddToViewport(); + //} } \ No newline at end of file diff --git a/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.h b/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.h index 2865b006..809e16e1 100644 --- a/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.h +++ b/hwanyoung2/Source/hwanyoung2/HYShopNPCActor.h @@ -21,4 +21,9 @@ public: UPROPERTY(EditDefaultsOnly, BlueprintReadWrite) TMap TradableItems; + /*UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widget") + TSubclassOf ShopWidgetClass; + + UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Widget") + TObjectPtr ShopWidget;*/ };