Add new plugins, refactor exp, introduce stat forge to replace GAS

This commit is contained in:
2026-07-15 22:48:04 +02:00
parent 3c084d9669
commit da0a0b643f
267 changed files with 33330 additions and 48 deletions

View File

@@ -3,7 +3,7 @@
#include "MoveActorsComponent.h"
#include "../System/Subsystem/ObjectPersistenceSubsystem.h"
#include "../System/MainlBlueprintFunctionLibrary.h"
#include "../System/MainBlueprintFunctionLibrary.h"
#include "Kismet/KismetMathLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "EnhancedInputSubsystems.h"

View File

@@ -0,0 +1,25 @@
#pragma once
#include "StatDefinitions.h"
STATFORGE_MAKE_STAT(Health)
STATFORGE_MAKE_STAT(MaxHealth)
STATFORGE_MAKE_STAT(MovementSpeedMultiplier)
STATFORGE_MAKE_STAT(Energy)
STATFORGE_MAKE_STAT(MaxEnergy)
STATFORGE_MAKE_STAT(HungerSatiation)
STATFORGE_MAKE_STAT(GatherDoubleDropChance)
STATFORGE_MAKE_STAT(GatherHqDropChance)
STATFORGE_MAKE_STAT(FriendPointsMultiplier)
STATFORGE_MAKE_STAT(AlchemyMultiplier)
STATFORGE_MAKE_STAT(BazarCustomerSpawnRate)
STATFORGE_MAKE_STAT(BazarCustomerWill)
STATFORGE_MAKE_STAT(AlchemyXp)
STATFORGE_MAKE_STAT(BotanyXp)
STATFORGE_MAKE_STAT(GatheringXp)
STATFORGE_MAKE_STAT(FlyingXp)
STATFORGE_MAKE_STAT(BargainingXp)
// MAKE_STAT_NS(Combat, AttackSpeed)

View File

@@ -0,0 +1,29 @@
#pragma once
#include "Data/StatForgeRegistry.h"
// -Flat Stats-
// MAKE_STAT(Health)
STATFORGE_DECLARE_STAT(Health)
STATFORGE_DECLARE_STAT(MaxHealth)
STATFORGE_DECLARE_STAT(MovementSpeedMultiplier)
STATFORGE_DECLARE_STAT(Energy)
STATFORGE_DECLARE_STAT(MaxEnergy)
STATFORGE_DECLARE_STAT(HungerSatiation)
STATFORGE_DECLARE_STAT(GatherDoubleDropChance)
STATFORGE_DECLARE_STAT(GatherHqDropChance)
STATFORGE_DECLARE_STAT(FriendPointsMultiplier)
STATFORGE_DECLARE_STAT(AlchemyMultiplier)
STATFORGE_DECLARE_STAT(BazarCustomerSpawnRate)
STATFORGE_DECLARE_STAT(BazarCustomerWill)
STATFORGE_DECLARE_STAT(AlchemyXp)
STATFORGE_DECLARE_STAT(BotanyXp)
STATFORGE_DECLARE_STAT(GatheringXp)
STATFORGE_DECLARE_STAT(FlyingXp)
STATFORGE_DECLARE_STAT(BargainingXp)
// -Grouped Stats-
// STATFORGE_DECLARE_STAT_NS(Combat, AttackSpeed)
// STATFORGE_DECLARE_STAT_NS(Locomotion, MovementSpeed)

View File

@@ -7,7 +7,7 @@
#include "../Public/MyCharacter.h"
#include "Engine/StaticMeshActor.h"
#include "../System/Subsystem/ObjectPersistenceSubsystem.h"
#include "../System/MainlBlueprintFunctionLibrary.h"
#include "../System/MainBlueprintFunctionLibrary.h"
#include "../Components/MoveActorsComponent.h"
ARemovableStaticMeshActor::ARemovableStaticMeshActor()

View File

@@ -4,30 +4,13 @@
#include "EleriAbilitySystemComponent.h"
#include "GameplayEffect.h"
#include "Attributes/PrimaryAttributeSet.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/Settings/EleriGameSettings.h"
void UEleriAbilitySystemComponent::AddExp(UObject* WorldContextObject, FGameplayAttribute GameplayAttribute, float Amount) {
if (!UPrimaryAttributeSet::IsExpAttribute(GameplayAttribute)) {
return;
}
if (UEleriAbilitySystemComponent* ASC = UMainBlueprintFunctionLibrary::GetAbilitySystemComponentFromPlayer(WorldContextObject)) {
if (const UEleriGameSettings* GameSettings = GetDefault<UEleriGameSettings>()) {
TSubclassOf<UGameplayEffect> ExpEffect = GameSettings->ExpIncreaseEffect;
UGameplayEffect* NewExpEffect = NewObject<UGameplayEffect>(WorldContextObject, GameSettings->ExpIncreaseEffect);
if (NewExpEffect->Modifiers.Num() >= 1) {
FGameplayModifierInfo& Mod = NewExpEffect->Modifiers[0];
Mod.Attribute = GameplayAttribute;
FScalableFloat ScalFloat;
ScalFloat.SetValue(Amount);
Mod.ModifierMagnitude = FGameplayEffectModifierMagnitude(ScalFloat);
ASC->ApplyGameplayEffectToSelf(NewExpEffect, 1.f, ASC->MakeEffectContext());
}
}
}
}
void UEleriAbilitySystemComponent::AddProfessionExp(UObject* WorldContextObject, EProfessionType Profession, float Amount) {

View File

@@ -5,7 +5,7 @@
#include "ItemDatabase.h"
#include "Kismet/GameplayStatics.h"
#include "MyCharacter.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/EleriGameplayTags.h"

View File

@@ -8,7 +8,7 @@
#include "EnhancedInputSubsystems.h"
#include "ProjectEleri/Public/InventoryComponent.h"
#include "ProjectEleri/Items/DataAssets/ItemDataAsset.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
AAlchemyManager::AAlchemyManager()
{

View File

@@ -6,7 +6,7 @@
#include "MyCharacter.h"
#include "../System/Subsystem/ObjectPersistenceSubsystem.h"
#include "EngineUtils.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/Public/EleriGameState.h"
DEFINE_LOG_CATEGORY(LogEleriGameInstance);

View File

@@ -6,7 +6,7 @@
#include "MyCharacter.h"
#include "../System/Subsystem/ObjectPersistenceSubsystem.h"
#include "EngineUtils.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/GameObjects/EleriBaseActor.h"
AEleriGameState* AEleriGameState::Get(const UObject* WorldContext) {

View File

@@ -7,7 +7,7 @@
#include "EnhancedInputSubsystems.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Interface/ZoneInteractableInterface.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/Components/MoveActorsComponent.h"
#include "../GameObjects/RemovableStaticMeshActor.h"
#include "Components/WidgetComponent.h"

View File

@@ -5,7 +5,7 @@
#include "Kismet/GameplayStatics.h"
#include "EngineUtils.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/GameplayAbilities/EleriAbilitySystemComponent.h"
#include "ProjectEleri/GameObjects/EleriBaseActor.h"

View File

@@ -17,12 +17,13 @@
#include "Engine/TextureRenderTarget2D.h"
#include "GameFramework/PawnMovementComponent.h"
#include "ProjectEleri/GameObjects/BenchmarkActor.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
#include "ProjectEleri/UI/InteractionWidget.h"
#include "ProjectEleri/GameObjects/BookActor.h"
#include "ProjectEleri/GameObjects/BroomActor.h"
#include "Components/CapsuleComponent.h"
#include "DisplayDebugHelpers.h"
#include "Components/StatForgeComponent.h"
#include "Engine/Canvas.h"
#include "RTSCameraPlugin/Public/UniversalCamera.h"
#include "RTSCameraPlugin/Public/AsyncNode.h"
@@ -50,6 +51,7 @@ AMyCharacter::AMyCharacter()
EleriAbilitySystemComponent = CreateDefaultSubobject<UEleriAbilitySystemComponent>(TEXT("EleriAbilitySystemComponent"));
PrimaryAttributeSet = CreateDefaultSubobject<UPrimaryAttributeSet>(TEXT("PrimaryAttributeSet"));
StatForgeComponent = CreateDefaultSubobject<UStatForgeComponent>(TEXT("StatForgeComponent"));
}
bool AMyCharacter::IsEditor() const {

View File

@@ -18,7 +18,7 @@
#include "Materials/MaterialParameterCollection.h"
#include "ProjectEleri/Data/WeatherPresetDataAsset.h"
#include "ProjectEleri/GameEventSystem/GameEventSubsystem.h"
#include "ProjectEleri/System/MainlBlueprintFunctionLibrary.h"
#include "ProjectEleri/System/MainBlueprintFunctionLibrary.h"
// Sets default values

View File

@@ -30,7 +30,9 @@ public class ProjectEleri : ModuleRules
"UniversalCameraPlugin",
"StateTreeModule",
"GameplayStateTreeModule",
"DirectiveUtilitiesRuntime"
"DirectiveUtilitiesRuntime",
"StatForge",
"InteractionSystem"
});
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "OnlineSubsystemUtils" });

View File

@@ -19,6 +19,7 @@
#include "MyCharacter.generated.h"
class UStatForgeComponent;
class AEleriPlayerController;
class AWaterBall;
class UChildActorComponent;
@@ -75,6 +76,9 @@ protected:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UEleriAbilitySystemComponent* EleriAbilitySystemComponent;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UStatForgeComponent* StatForgeComponent;
UPROPERTY()
UPrimaryAttributeSet* PrimaryAttributeSet;
@@ -108,6 +112,9 @@ public:
virtual class UAbilitySystemComponent* GetAbilitySystemComponent() const override { return EleriAbilitySystemComponent; }
UFUNCTION(BlueprintCallable, BlueprintPure)
UPrimaryAttributeSet* GetPrimaryAttributeSet() { return PrimaryAttributeSet; }
UFUNCTION(BlueprintCallable, BlueprintPure)
UStatForgeComponent* GetStatForgeComponent() const { return StatForgeComponent; }
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
float CameraPitchMin;

View File

@@ -5,6 +5,7 @@
#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "GameplayTagContainer.h"
#include "Data/GameplayStatEffect.h"
#include "EleriGameSettings.generated.h"
@@ -27,9 +28,9 @@ public:
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Camera")
TMap<FGameplayTag, FVector> CameraZoomLevels;
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Ability System|Effects")
TSubclassOf<UGameplayEffect> ExpIncreaseEffect;
TSubclassOf<UGameplayStatEffect> ExpIncreaseEffectClass;
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly, Category = "Ability System|Professions")
TArray<float> ProfessionExpArray;
@@ -55,5 +56,5 @@ public:
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Ability System|Professions")
static int32 GetProfessionLevelForExp(float Exp);
};

View File

@@ -4,14 +4,26 @@
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MainlBlueprintFunctionLibrary.generated.h"
#include "MainBlueprintFunctionLibrary.generated.h"
class UStatForgeComponent;
class URetainerBox;
class UMainGameWidget;
class UInventoryComponent;
class ARemovableStaticMeshActor;
class UEleriAbilitySystemComponent;
UENUM(BlueprintType)
enum class EExpType : uint8
{
None,
Alchemy,
Botany,
Gathering,
Flying,
Bargaining
};
/**
*
*/
@@ -23,22 +35,22 @@ class PROJECTELERI_API UMainBlueprintFunctionLibrary : public UBlueprintFunction
public:
//HTTP REQ
UFUNCTION(BlueprintCallable, Category = "Eleri HTTP")
UFUNCTION(BlueprintCallable, Category = "Eleri|HTTP")
static void PostFeedback(const FString& Message);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri main", meta = (WorldContext = "WorldContextObject"))
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri", meta = (WorldContext = "WorldContextObject"))
static UInventoryComponent* GetPlayerInventory(const UObject* WorldContextObject);
UFUNCTION(BlueprintCallable, Category = "Eleri main", meta=(WorldContext="WorldContextObject"))
UFUNCTION(BlueprintCallable, Category = "Eleri", meta=(WorldContext="WorldContextObject"))
static UMainGameWidget* GetMainGameWidget(UObject* WorldContextObject);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri main", meta = (WorldContext = "WorldContextObject"))
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri", meta = (WorldContext = "WorldContextObject"))
static UEleriAbilitySystemComponent* GetAbilitySystemComponentFromActor(const AActor* Actor);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri main", meta = (WorldContext = "WorldContextObject"))
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri", meta = (WorldContext = "WorldContextObject"))
static UEleriAbilitySystemComponent* GetAbilitySystemComponentFromPlayer(const UObject* WorldContextObject);
UFUNCTION(BlueprintCallable, Category = "Eleri main")
UFUNCTION(BlueprintCallable, Category = "Eleri")
static ARemovableStaticMeshActor* SpawnPlaceable(UWorld* World, UClass* Class, FTransform Transform, FVector ScaleOverride);
UFUNCTION(BlueprintCallable, Category = "Dialogue System")
@@ -47,21 +59,28 @@ public:
UFUNCTION(BlueprintCallable, Category = "Math helpers")
static FVector2D GetDirectionalityVector(FVector PawnLoc, FVector PawnForwardVector, FVector CameraLoc);
UFUNCTION(BlueprintCallable, Category = "Eleri Event System", meta = (WorldContext = "WorldContext"))
UFUNCTION(BlueprintCallable, Category = "Eleri|Events", meta = (WorldContext = "WorldContext"))
static void StartEvent(const UObject* WorldContext, FSoftObjectPath EventPath);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Inventory", meta = (WorldContext = "WorldContext"))
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri|Inventory", meta = (WorldContext = "WorldContext"))
static int32 GetPlayerGold(const UObject* WorldContext);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Inventory", meta = (WorldContext = "WorldContext"))
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri|Inventory", meta = (WorldContext = "WorldContext"))
static bool CanSpendGold(const UObject* WorldContext, int32 Amount);
UFUNCTION(BlueprintCallable, Category = "Inventory", meta = (WorldContext = "WorldContext"))
UFUNCTION(BlueprintCallable, Category = "Eleri|Inventory", meta = (WorldContext = "WorldContext"))
static void SpendGold(const UObject* WorldContext, int32 Amount);
UFUNCTION(BlueprintCallable, Category = "Inventory", meta = (WorldContext = "WorldContext"))
UFUNCTION(BlueprintCallable, Category = "Eleri|Inventory", meta = (WorldContext = "WorldContext"))
static void AddGold(const UObject* WorldContext, int32 Amount);
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri Helpers", meta = (WorldContext = "WorldContext"))
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri|Helpers", meta = (WorldContext = "WorldContext"))
static float GetCharacterHeight(const UObject* WorldContext, const UClass* Class, bool bScaled = true);
// STATS
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Eleri|Stats")
static UStatForgeComponent* GetStatForgeComponentFromActor(AActor* Actor);
UFUNCTION(BlueprintCallable, Category = "Eleri|Stats", meta = (WorldContext = "WorldContext"))
static void ModifyExp(const UObject* WorldContext, const EExpType ExpType, const float Amount);
};

View File

@@ -1,7 +1,7 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "MainlBlueprintFunctionLibrary.h"
#include "MainBlueprintFunctionLibrary.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetStringLibrary.h"
#include "../Public/InventoryComponent.h"
@@ -10,6 +10,7 @@
#include <Kismet/KismetMathLibrary.h>
#include "EleriPlayerController.h"
#include "Components/CapsuleComponent.h"
#include "Components/StatForgeComponent.h"
#include "ProjectEleri/GameEventSystem/GameEventSubsystem.h"
#include "ProjectEleri/GameObjects/BaseCharacter.h"
#include "Runtime/Online/HTTP/Public/HttpModule.h"
@@ -167,4 +168,54 @@ float UMainBlueprintFunctionLibrary::GetCharacterHeight(const UObject* WorldCont
return 0.f;
}
UStatForgeComponent* UMainBlueprintFunctionLibrary::GetStatForgeComponentFromActor(AActor* Actor)
{
if (!Actor) return nullptr;
if (const AMyCharacter* MyCharacter = Cast<AMyCharacter>(Actor))
{
return MyCharacter->GetStatForgeComponent();
}
return nullptr;
}
void UMainBlueprintFunctionLibrary::ModifyExp(const UObject* WorldContext, const EExpType ExpType, const float Amount)
{
if (!WorldContext || !WorldContext->GetWorld()) return;
UStatForgeComponent* StatForgeComponent = GetStatForgeComponentFromActor(UGameplayStatics::GetPlayerCharacter(WorldContext, 0));
if (!StatForgeComponent) return;
const UEleriGameSettings* GameSettings = UEleriGameSettings::GetEleriGameSettings();
TSubclassOf<UGameplayStatEffect> ExpIncreaseEffect = GameSettings->ExpIncreaseEffectClass;
check(ExpIncreaseEffect);
TMap<FName, float> DataValueMap;
switch (ExpType)
{
case EExpType::None:
break;
case EExpType::Alchemy:
DataValueMap.Add("Alchemy", Amount);
break;
case EExpType::Botany:
DataValueMap.Add("Botany", Amount);
break;
case EExpType::Gathering:
DataValueMap.Add("Gathering", Amount);
break;
case EExpType::Flying:
DataValueMap.Add("Flying", Amount);
break;
case EExpType::Bargaining:
DataValueMap.Add("Bargaining", Amount);
break;
default:
break;
}
StatForgeComponent->ApplyGameplayStatEffect(ExpIncreaseEffect, DataValueMap);
}

View File

@@ -7,7 +7,7 @@
#include "Kismet/GameplayStatics.h"
#include "../../Public/EleriSaveGame.h"
#include "../GameObjects/RemovableStaticMeshActor.h"
#include "../System/MainlBlueprintFunctionLibrary.h"
#include "../System/MainBlueprintFunctionLibrary.h"
int32 UObjectPersistenceSubsystem::ActorExistsInList(AActor* ActorToRemove)
{