Bugfix Quest System Not Item Matching Correctly
This commit is contained in:
parent
fea2ccface
commit
814c2d6aaa
@ -33,7 +33,7 @@ bool UQuest::WorldStateMatch(UWorldState* A, UWorldState* B)
|
|||||||
if (A->Items.IsEmpty() && !B->Items.IsEmpty()) return false;
|
if (A->Items.IsEmpty() && !B->Items.IsEmpty()) return false;
|
||||||
for (UBaseItem* Item : B->Items)
|
for (UBaseItem* Item : B->Items)
|
||||||
{
|
{
|
||||||
if (!A->Items.Contains(Item) && Item->StackCount > A->Items[A->Items.Find(Item)]->StackCount)
|
if (!A->Items.Contains(Item) && Item->StackCount > A->Items[A->Items.IndexOfByPredicate([Item](const UBaseItem* AItem) { return AItem->ItemID == Item->ItemID; })]->StackCount)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -60,9 +60,9 @@ bool UQuest::FlagTrueMatch(const UWorldState* WorldState, const FString& FlagNam
|
|||||||
FString UQuest::GetItemCountAndGoalAmount(const UWorldState* WorldState, UBaseItem* Item) const
|
FString UQuest::GetItemCountAndGoalAmount(const UWorldState* WorldState, UBaseItem* Item) const
|
||||||
{
|
{
|
||||||
FString Result;
|
FString Result;
|
||||||
if (WorldState->Items.Contains(Item))
|
if (WorldState->Items.ContainsByPredicate([Item](const UBaseItem* AItem) { return AItem->ItemID == Item->ItemID; }))
|
||||||
{
|
{
|
||||||
Result += FString::FromInt(WorldState->Items[WorldState->Items.Find(Item)]->StackCount);
|
Result += FString::FromInt(WorldState->Items[WorldState->Items.IndexOfByPredicate([Item](const UBaseItem* AItem) { return AItem->ItemID == Item->ItemID; })]->StackCount);
|
||||||
Result += "/";
|
Result += "/";
|
||||||
Result += FString::FromInt(Goals->Items[Goals->Items.Find(Item)]->StackCount);
|
Result += FString::FromInt(Goals->Items[Goals->Items.Find(Item)]->StackCount);
|
||||||
return Result;
|
return Result;
|
||||||
|
@ -51,6 +51,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
void CheckActiveQuestConditions();
|
void CheckActiveQuestConditions();
|
||||||
UWorldState* GetWorldState() const;
|
UWorldState* GetWorldState() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user