diff --git a/Content/Levels/Build.umap b/Content/Levels/Build.umap index b8e51cb..e7c7969 100644 --- a/Content/Levels/Build.umap +++ b/Content/Levels/Build.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a5d06e03b062da9234d1031908a1fa3c338d3783545004c83604516663388532 -size 1198477 +oid sha256:a187839ef7cf7d89b3e08cef9cf0c55156de9bc59e743502f51ca39cd6610ce2 +size 3402514 diff --git a/Source/the_twilight_abyss/Quest/FWorldState.h b/Source/the_twilight_abyss/Quest/FWorldState.h new file mode 100644 index 0000000..a8bd535 Binary files /dev/null and b/Source/the_twilight_abyss/Quest/FWorldState.h differ diff --git a/Source/the_twilight_abyss/Quest/Quest.cpp b/Source/the_twilight_abyss/Quest/Quest.cpp new file mode 100644 index 0000000..ff166ae --- /dev/null +++ b/Source/the_twilight_abyss/Quest/Quest.cpp @@ -0,0 +1,20 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Quest.h" + +bool UQuest::CheckConditions(FJsonObject WorldState) +{ + if (Conditions.Values.IsEmpty()) return true; + return false; +} + +bool UQuest::CheckPreConditions(FJsonObject WorldState) +{ + if (PreConditions.Values.IsEmpty()) return true; + return false; +} + +void UQuest::ApplyRewards() +{ +} diff --git a/Source/the_twilight_abyss/Quest/Quest.h b/Source/the_twilight_abyss/Quest/Quest.h new file mode 100644 index 0000000..acfa2b4 --- /dev/null +++ b/Source/the_twilight_abyss/Quest/Quest.h @@ -0,0 +1,31 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/NoExportTypes.h" +#include "../PlayerTemp/TempCharacter.h" +#include "Quest.generated.h" + +/** + * + */ +UCLASS() +class THE_TWILIGHT_ABYSS_API UQuest : public UObject +{ + GENERATED_BODY() +public: + FText Title; + FText Description; + FString QuestLine; + UQuest* ParentQuest; + FJsonObject Conditions; + FJsonObject PreConditions; + + //TODO: Rewards + + bool CheckConditions(FJsonObject WorldState); + bool CheckPreConditions(FJsonObject WorldState); + void ApplyRewards(); + //TODO: CreateQuest +}; diff --git a/Source/the_twilight_abyss/Quest/QuestSystem.cpp b/Source/the_twilight_abyss/Quest/QuestSystem.cpp index bd1ebd6..828bce0 100644 --- a/Source/the_twilight_abyss/Quest/QuestSystem.cpp +++ b/Source/the_twilight_abyss/Quest/QuestSystem.cpp @@ -32,3 +32,21 @@ void UQuestSystem::TickComponent(float DeltaTime, ELevelTick TickType, FActorCom } +void UQuestSystem::CheckActiveQuestConditions() +{ + for (UQuest* Quest : ActiveQuests) + { + if (Quest->CheckConditions(GetWorldState())) + { + CompletedQuests.Add(Quest); + Quest->ApplyRewards(); + } + } +} + +FJsonObject UQuestSystem::GetWorldState() +{ + FJsonObject WorldState = FJsonObject(); + return WorldState; +} + diff --git a/Source/the_twilight_abyss/Quest/QuestSystem.h b/Source/the_twilight_abyss/Quest/QuestSystem.h index 52979f0..d105bf4 100644 --- a/Source/the_twilight_abyss/Quest/QuestSystem.h +++ b/Source/the_twilight_abyss/Quest/QuestSystem.h @@ -6,17 +6,9 @@ #include "Components/ActorComponent.h" #include "Components/TextBlock.h" #include "Blueprint/UserWidget.h" +#include "Quest.h" #include "QuestSystem.generated.h" -// UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) -// class UQuest : public UObject -// { -// GENERATED_BODY() -// -// public: -// -// }; - UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) class THE_TWILIGHT_ABYSS_API UQuestSystem : public UActorComponent { @@ -26,6 +18,11 @@ public: // Sets default values for this component's properties UQuestSystem(); + TArray ActiveQuests; + TArray CompletedQuests; + TArray CompletedQuestLines; + TMap QuestFlags; + protected: // Called when the game starts virtual void BeginPlay() override; @@ -33,7 +30,11 @@ protected: UPROPERTY() TSubclassOf QuestWidget; + FJsonObject WorldStateJsonTemplate; + public: // Called every frame virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + void CheckActiveQuestConditions(); + FJsonObject GetWorldState(); }; diff --git a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs index b8c5d17..53967db 100644 --- a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs +++ b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs @@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule", "Json" }); PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });