Skip to content

Commit

Permalink
Updated UE5 Plugin for 5.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreDartStudios committed Apr 28, 2024
1 parent 4aca515 commit 14a9122
Show file tree
Hide file tree
Showing 18 changed files with 256 additions and 447 deletions.
Binary file modified plugins/OWSPluginUE5/Content/OWSTravelToMapBP.uasset
Binary file not shown.
4 changes: 2 additions & 2 deletions plugins/OWSPluginUE5/OWSPlugin.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 5,
"VersionName": "5.3",
"VersionName": "5.4",
"FriendlyName": "OWSPlugin",
"Description": "Open World Server",
"Category": "Other",
Expand All @@ -10,7 +10,7 @@
"DocsURL": "https://www.openworldserver.com",
"MarketplaceURL": "",
"SupportURL": "",
"EngineVersion": "5.3.0",
"EngineVersion": "5.4.0",
"CanContainContent": true,
"IsBetaVersion": false,
"Installed": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ void UOWSAPISubsystem::Initialize(FSubsystemCollectionBase& Collection)
OWS2GlobalDataAPIPath,
GGameIni
);

OWS2APIRequestTimeout = 30.f;
}

void UOWSAPISubsystem::Deinitialize()
Expand Down Expand Up @@ -76,7 +74,6 @@ void UOWSAPISubsystem::GetJsonObjectFromResponse(FHttpRequestPtr Request, FHttpR
void UOWSAPISubsystem::ProcessOWS2POSTRequest(FString ApiModuleToCall, FString ApiToCall, FString PostParameters, void (UOWSAPISubsystem::* InMethodPtr)(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful))
{
Http = &FHttpModule::Get();
Http->SetHttpTimeout(OWS2APIRequestTimeout); //Set timeout
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, InMethodPtr);

Expand Down Expand Up @@ -115,7 +112,6 @@ void UOWSAPISubsystem::ProcessOWS2POSTRequest(FString ApiModuleToCall, FString A
void UOWSAPISubsystem::ProcessOWS2GETRequest(FString ApiModuleToCall, FString ApiToCall, void (UOWSAPISubsystem::* InMethodPtr)(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful))
{
Http = &FHttpModule::Get();
Http->SetHttpTimeout(OWS2APIRequestTimeout); //Set timeout
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, InMethodPtr);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Runtime/Engine/Classes/Components/AudioComponent.h"
#include "Runtime/Engine/Public/Audio.h"
#include "Runtime/Engine/Classes/Sound/SoundBase.h"
#include "Runtime/Engine/Classes/Engine/OverlapResult.h"
#include "Abilities/GameplayAbilityTargetTypes.h"
#include "AbilitySystemBlueprintLibrary.h"

Expand Down Expand Up @@ -358,7 +359,7 @@ void AOWSAdvancedProjectile::BeginFakeProjectileSynch(AOWSAdvancedProjectile* In
}
else
{
UE_LOG(OWS, Verbose, TEXT("%S: BeginFakeProjectileSynch: Move Replicated To Fake Pos: %s"), *ServerOrClient, *GetNameSafe(this));
UE_LOG(OWS, Verbose, TEXT("%s: BeginFakeProjectileSynch: Move Replicated To Fake Pos: %s"), *ServerOrClient, *GetNameSafe(this));

FRepMovement RepMovement;
RepMovement.Location = MyFakeProjectile->GetActorLocation();
Expand Down Expand Up @@ -938,10 +939,10 @@ void AOWSAdvancedProjectile::DamageImpactedActor_Implementation(AActor* OtherAct


//We use the InstigatorCharacter because if we use the Hit Character we won't have an owning connecto RPC up the prediction key.
AOWSCharacterWithAbilities* InstigatorCharacter = CastChecked<AOWSCharacterWithAbilities>(GetInstigator());
//AOWSCharacterWithAbilities* InstigatorCharacter = CastChecked<AOWSCharacterWithAbilities>(GetInstigator());

if (!IsValid(InstigatorCharacter))
{
//if (!IsValid(InstigatorCharacter))
//{
// InstigatorCharacter->HandleProjectileEffectApplicationPrediction(this, OtherActor);

/*IAbilitySystemInterface* AbilitySystemInterface = Cast<IAbilitySystemInterface>(CharacterWhoWasHit);
Expand All @@ -966,11 +967,11 @@ void AOWSAdvancedProjectile::DamageImpactedActor_Implementation(AActor* OtherAct
UE_LOG(OWS, Error, TEXT("Send GameplayEvent.AdvancedProjectile.DirectDamageEvent"));
}
}*/
}
/* }
else //Hit something other than an AOWSCharacterWithAbilities
{
}
}*/


/*
Expand Down
270 changes: 134 additions & 136 deletions plugins/OWSPluginUE5/Source/OWSPlugin/Private/OWSCharacter.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -471,71 +471,71 @@ void AOWSCharacterWithAbilities::OnGetCharacterStatsResponseReceived(FHttpReques

void AOWSCharacterWithAbilities::LoadAttributesFromJSON(TSharedPtr<FJsonObject> JsonObject)
{
OWSAttributes->SetThirst(JsonObject->GetNumberField("Thirst"));
OWSAttributes->SetHunger(JsonObject->GetNumberField("Hunger"));

OWSAttributes->SetMaxHealth(JsonObject->GetNumberField("MaxHealth"));
OWSAttributes->SetHealth(JsonObject->GetNumberField("Health"));
OWSAttributes->SetHealthRegenRate(JsonObject->GetNumberField("HealthRegenRate"));

OWSAttributes->SetMaxMana(JsonObject->GetNumberField("MaxMana"));
OWSAttributes->SetMana(JsonObject->GetNumberField("Mana"));
OWSAttributes->SetManaRegenRate(JsonObject->GetNumberField("ManaRegenRate"));

OWSAttributes->SetMaxEnergy(JsonObject->GetNumberField("MaxEnergy"));
OWSAttributes->SetEnergy(JsonObject->GetNumberField("Energy"));
OWSAttributes->SetEnergyRegenRate(JsonObject->GetNumberField("EnergyRegenRate"));

OWSAttributes->SetMaxFatigue(JsonObject->GetNumberField("MaxFatigue"));
OWSAttributes->SetFatigue(JsonObject->GetNumberField("Fatigue"));
OWSAttributes->SetFatigueRegenRate(JsonObject->GetNumberField("FatigueRegenRate"));

OWSAttributes->SetMaxStamina(JsonObject->GetNumberField("MaxStamina"));
OWSAttributes->SetStamina(JsonObject->GetNumberField("Stamina"));
OWSAttributes->SetStaminaRegenRate(JsonObject->GetNumberField("StaminaRegenRate"));

OWSAttributes->SetMaxEndurance(JsonObject->GetNumberField("MaxEndurance"));
OWSAttributes->SetEndurance(JsonObject->GetNumberField("Endurance"));
OWSAttributes->SetEnduranceRegenRate(JsonObject->GetNumberField("EnduranceRegenRate"));

OWSAttributes->SetStrength(JsonObject->GetNumberField("Strength"));
OWSAttributes->SetDexterity(JsonObject->GetNumberField("Dexterity"));
OWSAttributes->SetConstitution(JsonObject->GetNumberField("Constitution"));
OWSAttributes->SetIntellect(JsonObject->GetNumberField("Intellect"));
OWSAttributes->SetWisdom(JsonObject->GetNumberField("Wisdom"));
OWSAttributes->SetCharisma(JsonObject->GetNumberField("Charisma"));
OWSAttributes->SetAgility(JsonObject->GetNumberField("Agility"));
OWSAttributes->SetSpirit(JsonObject->GetNumberField("Spirit"));
OWSAttributes->SetMagic(JsonObject->GetNumberField("Magic"));
OWSAttributes->SetFortitude(JsonObject->GetNumberField("Fortitude"));
OWSAttributes->SetReflex(JsonObject->GetNumberField("Reflex"));
OWSAttributes->SetWillpower(JsonObject->GetNumberField("Willpower"));

OWSAttributes->SetBaseAttack(JsonObject->GetNumberField("BaseAttack"));
OWSAttributes->SetBaseAttackBonus(JsonObject->GetNumberField("BaseAttackBonus"));
OWSAttributes->SetAttackPower(JsonObject->GetNumberField("AttackPower"));
OWSAttributes->SetAttackSpeed(JsonObject->GetNumberField("AttackSpeed"));
OWSAttributes->SetCritChance(JsonObject->GetNumberField("CritChance"));
OWSAttributes->SetCritMultiplier(JsonObject->GetNumberField("CritMultiplier"));
OWSAttributes->SetHaste(JsonObject->GetNumberField("Haste"));
OWSAttributes->SetSpellPower(JsonObject->GetNumberField("SpellPower"));
OWSAttributes->SetSpellPenetration(JsonObject->GetNumberField("SpellPenetration"));
OWSAttributes->SetDefense(JsonObject->GetNumberField("Defense"));
OWSAttributes->SetDodge(JsonObject->GetNumberField("Dodge"));
OWSAttributes->SetParry(JsonObject->GetNumberField("Parry"));
OWSAttributes->SetAvoidance(JsonObject->GetNumberField("Avoidance"));
OWSAttributes->SetVersatility(JsonObject->GetNumberField("Versatility"));
OWSAttributes->SetMultishot(JsonObject->GetNumberField("Multishot"));
OWSAttributes->SetInitiative(JsonObject->GetNumberField("Initiative"));
OWSAttributes->SetNaturalArmor(JsonObject->GetNumberField("NaturalArmor"));
OWSAttributes->SetPhysicalArmor(JsonObject->GetNumberField("PhysicalArmor"));
OWSAttributes->SetBonusArmor(JsonObject->GetNumberField("BonusArmor"));
OWSAttributes->SetForceArmor(JsonObject->GetNumberField("ForceArmor"));
OWSAttributes->SetMagicArmor(JsonObject->GetNumberField("MagicArmor"));
OWSAttributes->SetResistance(JsonObject->GetNumberField("Resistance"));
OWSAttributes->SetReloadSpeed(JsonObject->GetNumberField("ReloadSpeed"));
OWSAttributes->SetRange(JsonObject->GetNumberField("Range"));
OWSAttributes->SetSpeed(JsonObject->GetNumberField("Speed"));
OWSAttributes->SetThirst(JsonObject->GetNumberField(TEXT("Thirst")));
OWSAttributes->SetHunger(JsonObject->GetNumberField(TEXT("Hunger")));

OWSAttributes->SetMaxHealth(JsonObject->GetNumberField(TEXT("MaxHealth")));
OWSAttributes->SetHealth(JsonObject->GetNumberField(TEXT("Health")));
OWSAttributes->SetHealthRegenRate(JsonObject->GetNumberField(TEXT("HealthRegenRate")));

OWSAttributes->SetMaxMana(JsonObject->GetNumberField(TEXT("MaxMana")));
OWSAttributes->SetMana(JsonObject->GetNumberField(TEXT("Mana")));
OWSAttributes->SetManaRegenRate(JsonObject->GetNumberField(TEXT("ManaRegenRate")));

OWSAttributes->SetMaxEnergy(JsonObject->GetNumberField(TEXT("MaxEnergy")));
OWSAttributes->SetEnergy(JsonObject->GetNumberField(TEXT("Energy")));
OWSAttributes->SetEnergyRegenRate(JsonObject->GetNumberField(TEXT("EnergyRegenRate")));

OWSAttributes->SetMaxFatigue(JsonObject->GetNumberField(TEXT("MaxFatigue")));
OWSAttributes->SetFatigue(JsonObject->GetNumberField(TEXT("Fatigue")));
OWSAttributes->SetFatigueRegenRate(JsonObject->GetNumberField(TEXT("FatigueRegenRate")));

OWSAttributes->SetMaxStamina(JsonObject->GetNumberField(TEXT("MaxStamina")));
OWSAttributes->SetStamina(JsonObject->GetNumberField(TEXT("Stamina")));
OWSAttributes->SetStaminaRegenRate(JsonObject->GetNumberField(TEXT("StaminaRegenRate")));

OWSAttributes->SetMaxEndurance(JsonObject->GetNumberField(TEXT("MaxEndurance")));
OWSAttributes->SetEndurance(JsonObject->GetNumberField(TEXT("Endurance")));
OWSAttributes->SetEnduranceRegenRate(JsonObject->GetNumberField(TEXT("EnduranceRegenRate")));

OWSAttributes->SetStrength(JsonObject->GetNumberField(TEXT("Strength")));
OWSAttributes->SetDexterity(JsonObject->GetNumberField(TEXT("Dexterity")));
OWSAttributes->SetConstitution(JsonObject->GetNumberField(TEXT("Constitution")));
OWSAttributes->SetIntellect(JsonObject->GetNumberField(TEXT("Intellect")));
OWSAttributes->SetWisdom(JsonObject->GetNumberField(TEXT("Wisdom")));
OWSAttributes->SetCharisma(JsonObject->GetNumberField(TEXT("Charisma")));
OWSAttributes->SetAgility(JsonObject->GetNumberField(TEXT("Agility")));
OWSAttributes->SetSpirit(JsonObject->GetNumberField(TEXT("Spirit")));
OWSAttributes->SetMagic(JsonObject->GetNumberField(TEXT("Magic")));
OWSAttributes->SetFortitude(JsonObject->GetNumberField(TEXT("Fortitude")));
OWSAttributes->SetReflex(JsonObject->GetNumberField(TEXT("Reflex")));
OWSAttributes->SetWillpower(JsonObject->GetNumberField(TEXT("Willpower")));

OWSAttributes->SetBaseAttack(JsonObject->GetNumberField(TEXT("BaseAttack")));
OWSAttributes->SetBaseAttackBonus(JsonObject->GetNumberField(TEXT("BaseAttackBonus")));
OWSAttributes->SetAttackPower(JsonObject->GetNumberField(TEXT("AttackPower")));
OWSAttributes->SetAttackSpeed(JsonObject->GetNumberField(TEXT("AttackSpeed")));
OWSAttributes->SetCritChance(JsonObject->GetNumberField(TEXT("CritChance")));
OWSAttributes->SetCritMultiplier(JsonObject->GetNumberField(TEXT("CritMultiplier")));
OWSAttributes->SetHaste(JsonObject->GetNumberField(TEXT("Haste")));
OWSAttributes->SetSpellPower(JsonObject->GetNumberField(TEXT("SpellPower")));
OWSAttributes->SetSpellPenetration(JsonObject->GetNumberField(TEXT("SpellPenetration")));
OWSAttributes->SetDefense(JsonObject->GetNumberField(TEXT("Defense")));
OWSAttributes->SetDodge(JsonObject->GetNumberField(TEXT("Dodge")));
OWSAttributes->SetParry(JsonObject->GetNumberField(TEXT("Parry")));
OWSAttributes->SetAvoidance(JsonObject->GetNumberField(TEXT("Avoidance")));
OWSAttributes->SetVersatility(JsonObject->GetNumberField(TEXT("Versatility")));
OWSAttributes->SetMultishot(JsonObject->GetNumberField(TEXT("Multishot")));
OWSAttributes->SetInitiative(JsonObject->GetNumberField(TEXT("Initiative")));
OWSAttributes->SetNaturalArmor(JsonObject->GetNumberField(TEXT("NaturalArmor")));
OWSAttributes->SetPhysicalArmor(JsonObject->GetNumberField(TEXT("PhysicalArmor")));
OWSAttributes->SetBonusArmor(JsonObject->GetNumberField(TEXT("BonusArmor")));
OWSAttributes->SetForceArmor(JsonObject->GetNumberField(TEXT("ForceArmor")));
OWSAttributes->SetMagicArmor(JsonObject->GetNumberField(TEXT("MagicArmor")));
OWSAttributes->SetResistance(JsonObject->GetNumberField(TEXT("Resistance")));
OWSAttributes->SetReloadSpeed(JsonObject->GetNumberField(TEXT("ReloadSpeed")));
OWSAttributes->SetRange(JsonObject->GetNumberField(TEXT("Range")));
OWSAttributes->SetSpeed(JsonObject->GetNumberField(TEXT("Speed")));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ FString UOWSGameInstance::EncryptWithAES(FString StringToEncrypt, FString Key)

if (StringToBytes(StringToEncrypt, ByteString, Size)) {

FAES::EncryptData(ByteString, Size, TCHAR_TO_ANSI(KeyTChar));
FAES::EncryptData(ByteString, Size, StringCast<ANSICHAR>((KeyTChar)).Get());
StringToEncrypt = FString::FromHexBlob(ByteString, Size);

delete[] ByteString;
Expand Down Expand Up @@ -169,7 +169,7 @@ FString UOWSGameInstance::DecryptWithAES(FString StringToDecrypt, FString Key)

if (FString::ToHexBlob(StringToDecrypt, ByteString, Size)) {

FAES::DecryptData(ByteString, Size, TCHAR_TO_ANSI(KeyTChar));
FAES::DecryptData(ByteString, Size, StringCast<ANSICHAR>((KeyTChar)).Get());
StringToDecrypt = BytesToString(ByteString, Size);

FString LeftPart;
Expand Down
13 changes: 9 additions & 4 deletions plugins/OWSPluginUE5/Source/OWSPlugin/Private/OWSGameMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ void AOWSGameMode::AddOrUpdateGlobalDataItemError(const FString& ErrorMsg)
void AOWSGameMode::ProcessOWS2POSTRequest(FString ApiModuleToCall, FString ApiToCall, FString PostParameters, void (AOWSGameMode::* InMethodPtr)(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful))
{
Http = &FHttpModule::Get();
Http->SetHttpTimeout(30); //Set timeout
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, InMethodPtr);

Expand Down Expand Up @@ -230,6 +229,12 @@ FString AOWSGameMode::InitNewPlayer(APlayerController* NewPlayerController, cons
TArray<FString> SplitArray;
DecodedIDData.ParseIntoArray(SplitArray, TEXT("|"), false);

if (SplitArray.Num() < 8)
{
UE_LOG(OWS, Error, TEXT("OWSGameMode::InitNewPlayer - Not enough parameters in IDData! - %s"), *DecodedIDData);
return retString;
}

PLX = SplitArray[0];
PLY = SplitArray[1];
PLZ = SplitArray[2];
Expand All @@ -239,8 +244,8 @@ FString AOWSGameMode::InitNewPlayer(APlayerController* NewPlayerController, cons
PlayerName1 = SplitArray[6];
UserSessionGUID = SplitArray[7];

UE_LOG(OWS, Warning, TEXT("PlayerName: %s"), *PlayerName1);
UE_LOG(OWS, Warning, TEXT("UserSessionGUID: %s"), *UserSessionGUID);
UE_LOG(OWS, Verbose, TEXT("PlayerName: %s"), *PlayerName1);
UE_LOG(OWS, Verbose, TEXT("UserSessionGUID: %s"), *UserSessionGUID);

//FString OWSDefaultPawnClass = UGameplayStatics::ParseOption(DecodedOptions, TEXT("DPC"));
}
Expand Down Expand Up @@ -757,7 +762,7 @@ void AOWSGameMode::OnGetCurrentWorldTimeResponseReceived(FHttpRequestPtr Request
{
float fCurrentWorldTime;

fCurrentWorldTime = JsonObject->GetNumberField("CurrentWorldTime");
fCurrentWorldTime = JsonObject->GetNumberField(TEXT("CurrentWorldTime"));

NotifyGetCurrentWorldTime(fCurrentWorldTime);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "GameFramework/Pawn.h"
#include "WorldCollision.h"
#include "Abilities/GameplayAbility.h"
#include "Runtime/Engine/Classes/Engine/OverlapResult.h"


AOWSGameplayAbilityTargetAct_Cone::AOWSGameplayAbilityTargetAct_Cone(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ UOWSLoginWidget::UOWSLoginWidget(const class FObjectInitializer& ObjectInitializ
void UOWSLoginWidget::ProcessOWS2POSTRequest(FString ApiToCall, FString PostParameters, void (UOWSLoginWidget::* InMethodPtr)(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful))
{
Http = &FHttpModule::Get();
Http->SetHttpTimeout(LoginTimeout); //Set timeout
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, InMethodPtr);

Expand Down
Loading

0 comments on commit 14a9122

Please sign in to comment.