AzureAbyss/Source/the_twilight_abyss/Quest/Quest.h

50 lines
1.6 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "WorldState.h"
#include "Quest.generated.h"
UENUM(BlueprintType)
enum class EQuestLine : uint8
{
Main UMETA(DisplayName="Main"),
Sub UMETA(DisplayName="Sub")
};
UCLASS(Abstract, BlueprintType, Blueprintable, EditInlineNew, DefaultToInstanced)
class THE_TWILIGHT_ABYSS_API UQuest : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
int QuestID;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FText Title;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FText Description;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
EQuestLine QuestLine;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, NoClear, Instanced)
UWorldState* Goals;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Instanced)
UWorldState* PreConditions;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Instanced)
TArray<UBaseItem*> Rewards;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TMap<FString, bool> QuestFlagsOnAdd;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TMap<FString, bool> QuestFlagsOnComplete;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
bool bShowQuestCompletedNotification = true;
bool CheckConditions(UWorldState* WorldState) const;
bool CheckPreConditions(UWorldState* WorldState) const;
void ApplyRewards(UInventoryComponent* Inventory);
static bool WorldStateMatch(UWorldState* A, UWorldState* B);
static bool FlagTrueMatch(const UWorldState* WorldState, const FString& FlagName);
FString GetItemCountAndGoalAmount(const UWorldState* WorldState, UBaseItem* Item) const;
};