LEAP Documentation 40220
Documentation for the LEAP project
PlayerProgressionManager.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4#include "Runtime/Json/Public/Dom/JsonObject.h"
5#include "CoreMinimal.h"
6#include "UObject/NoExportTypes.h"
7#include "Engine/DataTable.h"
9#include "PlayerProgressionManager.generated.h"
10
11class UDataTable;
12class UTexture2D;
13class UCurveFloat;
14class UWeaponInstance;
15class ULoadOutAssetBase;
17
18USTRUCT(BlueprintType)
19struct FClassLevelTable: public FTableRowBase
20{
21 GENERATED_BODY()
22 UPROPERTY(EditAnywhere, BlueprintReadOnly)
23 UDataTable* LevelTable;
24};
25
26USTRUCT(BlueprintType)
27struct FLevelProgession: public FTableRowBase
28{
29 GENERATED_USTRUCT_BODY()
30public:
31 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item Struct")
33 UPROPERTY(EditAnywhere, BlueprintReadOnly)
34 UTexture2D* Badge;
35};
36
37USTRUCT(BlueprintType)
39{
40 GENERATED_USTRUCT_BODY()
41public:
42 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item Struct")
43 TMap<TSubclassOf<UWeaponInstance>, uint8> UnlockedWeapons;
44 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item Struct")
45 TMap<FString, uint8> UnlockedPerks;
46};
47
48USTRUCT(BlueprintType)
50{
51 GENERATED_BODY()
53 FPlayerLevelInfo(int ExperienceRequiredIn,int CurrencyRewardIn) : ExperienceForNextLevel(ExperienceRequiredIn), CurrencyReward(CurrencyRewardIn)
54 {}
55
56 int ExperienceForNextLevel = INDEX_NONE;
57 int CurrencyReward = INDEX_NONE;
58};
59
60USTRUCT(BlueprintType)
62{
63 GENERATED_BODY()
64 UPROPERTY(EditAnywhere, BlueprintReadWrite)
65 int Experience = 0;
66 UPROPERTY(EditAnywhere, BlueprintReadWrite)
67 int Currency = 0;
68 UPROPERTY(EditAnywhere, BlueprintReadWrite)
69 TArray<FString> ItemIDs;
70};
71
72DECLARE_DYNAMIC_MULTICAST_DELEGATE(FProgressionInfoLoadedSignature);
73
74UCLASS(Blueprintable)
75class PROJECTX_API UPlayerProgressionManager : public UObject
76{
77 GENERATED_UCLASS_BODY()
78
79public:
80 void Init(UProjectXGameInstance* GameInstance);
81
82 UFUNCTION()
83 void OnNakamaConnected();
84
85 void LoadFirstMatchRewards();
86 UFUNCTION(BlueprintPure, Category = PlayerProgressionManager)
87 bool GetProgresisonInfo(const FString& ClassID,int Level, FProgressionInfo& ProgressionInfo) const;
88 UFUNCTION(BlueprintPure, Category = PlayerProgressionManager)
89 int GetMaxLevel(const FString& ClassID);
90 UFUNCTION(BlueprintPure, Category = PlayerProgressionManager)
91 bool GetProgressionUnlocks(const FString& ClassID, int CurrentLevel, TArray<UCosmeticAssetBase*>& Unlocks, int& Currency);
92
93 void LoadProgressionTables(const FString& ProgressionTableID, std::string cursor = "");
94 void ProgressionTableLoadResponse(const FString& ProgressionTableID, std::vector<NAKAMA_NAMESPACE::NStorageObject> FoundProgressionTable);
95
96 void AwardLevelUpRewards(const FString& PlayerID, const FString& ClassID, int NewLevel);
97
98 UFUNCTION(BlueprintPure, Category = StatTracking, meta = (WorldContext = "WorldContextObject", CallableWithoutWorldContext))
99 static UPlayerProgressionManager* GetPlayerProgression(const UObject* WorldContextObject);
100 UFUNCTION(BlueprintPure, Category = PlayerProgressionManager)
101 static void SortWeaponsByUnlockLevel(UPARAM(ref)const TMap<TSubclassOf<UWeaponInstance>, uint8>& MapIn, TArray<TSubclassOf<UWeaponInstance>>& SortedWeaponList);
102 UFUNCTION(BlueprintPure)
103 int GetMatchBonusExperience() const {return MatchOfTheDayExperience;}
104
105 UPROPERTY(BlueprintAssignable)
106 FProgressionInfoLoadedSignature OnProgressionInfoLoaded;
107
108protected:
109 TMap<FString, TMap<int, FProgressionInfo>> ProgressionTable = TMap<FString, TMap<int, FProgressionInfo>>();
110 bool bProgressionTablesLoaded = false;;
111 int MatchOfTheDayExperience = 0;
112};
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FProgressionInfoLoadedSignature)
Definition: PlayerProgressionManager.h:76
Definition: ProjectXGameInstance.h:507
UPlayerProgressionManager * GetPlayerProgression() const
Definition: ProjectXGameInstance.h:613
virtual void OnNakamaConnected()
Definition: ProjectXGameInstance.cpp:556
virtual void Init() override
Definition: ProjectXGameInstance.cpp:219
Definition: WeaponInstance.h:220
Definition: PlayerProgressionManager.h:20
Definition: PlayerProgressionManager.h:39
Definition: PlayerProgressionManager.h:28
Definition: PlayerProgressionManager.h:50
FPlayerLevelInfo(int ExperienceRequiredIn, int CurrencyRewardIn)
Definition: PlayerProgressionManager.h:53
Definition: PlayerProgressionManager.h:62