Skip to content

Commit

Permalink
Added Player class (In-Game Name, Wielded Item, Health, Max Health)
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinPtrl committed Jan 10, 2022
1 parent ca1792e commit 54180bd
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SotCore core = new SotCore();
//if u are in steam version replace by true
if (core.Prepare(false))
{
UE4Actor localPlayer = core.GetLocalPlayer();
Player localPlayer = new Player(core.GetLocalPlayer());
//Do your things here
}
else
Expand Down
6 changes: 5 additions & 1 deletion SotCoreTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace SotEspCoreTest
{
class Program
{

static void Main(string[] args)
{
SotCore core = new SotCore();
Expand All @@ -15,12 +16,15 @@ static void Main(string[] args)
{
Console.WriteLine("Name : {0} | Actual Name : {1} Pos : {2} Rot : {3}", actor.BaseName, actor.getName(), actor.getPos().ToString(), actor.getRot().ToString());
}
UE4Actor localPlayer = core.GetLocalPlayer();
Player localPlayer = new Player(core.GetLocalPlayer());

Console.WriteLine("LocalPlayer Name : {0} | LocalPlayer Actual Name : {1} LocalPlayer Pos : {2} LocalPlayer Rot : {3}", localPlayer.BaseName, localPlayer.getName(), localPlayer.getPos().ToString(), localPlayer.getRot().ToString());

CameraManager cameraManager = core.GetCameraManager();
Console.WriteLine("Camera Manager | Pos : {0} Rot : {1} FOV {2}", cameraManager.getPos().ToString(), cameraManager.getRot().ToString(), cameraManager.getFOV());

Console.WriteLine("LocalPlayer in-game Name : {0} | Health : {1} | Max Health : {2} | Wielded Item Name {3} ", localPlayer.getPlayerName(), localPlayer.getHealth(), localPlayer.getMaxHealth(), localPlayer.getWieldedItem());

}
}
}
Expand Down
1 change: 1 addition & 0 deletions SotCoreWrapper/Core.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#include "SotCore.h"
#include "Player.h"
#include "SOTStuff.h"
30 changes: 30 additions & 0 deletions SotCoreWrapper/Player.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "pch.h"
#include "Player.h"
namespace SoT
{
Player::Player(UE4Actor^ actor) : UE4Actor(actor)
{

}

System::String^ Player::getPlayerName()
{
return gcnew System::String(getActor().GetPlayerState().GetName().c_str());
}

System::String^ Player::getWieldedItem()
{
return gcnew System::String(getActor().GetWieldedItemComponent().GetWieldedItem().GetItemInfo().GetItemDesc().GetName().c_str());
}

int Player::getHealth()
{
return getActor().GetHealthComponent().GetHealth();
}

int Player::getMaxHealth()
{
return getActor().GetHealthComponent().GetMaxHealth();
}

}
17 changes: 17 additions & 0 deletions SotCoreWrapper/Player.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include "Core.h"
#include "UE4ActorWrapper.h"
namespace SoT
{
public ref class Player : public UE4Actor
{
public:
Player::Player(UE4Actor^ actor);
System::String^ getPlayerName();
System::String^ getWieldedItem();
int getHealth();
int getMaxHealth();

};
}

2 changes: 1 addition & 1 deletion SotCoreWrapper/SOTStuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace Core

TArray<struct FIsland> AActor::GetIslandarray()
{
return MemoryManager->Read< TArray<struct FIsland>>(*(uintptr_t*)(__pad0x0 + 0x523A));
return MemoryManager->Read< TArray<struct FIsland>>(*(uintptr_t*)(__pad0x0 + 0x0470));
}

UDrowningComponent ACharacter::GetDrowningComponent()
Expand Down
30 changes: 30 additions & 0 deletions SotCoreWrapper/SOTStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,36 @@ namespace Core
char __pad0x0[0x1000];
};

struct FIsland
{
int IslandNameId;
char __pad0x4[0x4];
byte IslandType;
unsigned char UnknownData00[0x7];
char __pad0x10[0x8];
Vector3 IslandBoundsCentre;
float IslandBoundsRadius;
float IslandTriggerRadius;
float IslandSafeZoneRadius;
char __pad0x30[0x38];
};

class AIslandService
{
public:
unsigned char UnknownData00[0x88]; // 0x03D0(0x0088) MISSED OFFSET
unsigned char UnknownData01[0x0008]; // 0x0458(0x0008) (ZeroConstructor, Transient, IsPlainOldData)
unsigned char UnknownData02[0x0008]; // 0x0458(0x0008) (ZeroConstructor, Transient, IsPlainOldData)
unsigned char UnknownData03[0x0008]; // 0x0458(0x0008) (ZeroConstructor, Transient, IsPlainOldData)
unsigned char UnknownData04[0x18]; // 0x0470(0x0018) MISSED OFFSET
TArray<FIsland> IslandArray; // 0x0488(0x0010) (Net, ZeroConstructor)
unsigned char UnknownData05[0x120]; // 0x0498(0x0120) MISSED OFFSET
unsigned char UnknownData06[0x0010]; // 0x0458(0x0008) (ZeroConstructor, Transient, IsPlainOldData)
unsigned char UnknownData07[0x0010]; // 0x0458(0x0008) (ZeroConstructor, Transient, IsPlainOldData)
unsigned char UnknownData08[0x0010]; // 0x0458(0x0008) (ZeroConstructor, Transient, IsPlainOldData)
unsigned char UnknownData09[0x8]; // 0x05E8(0x0008) MISSED OFFSET
};

class AActor
{
public:
Expand Down
1 change: 0 additions & 1 deletion SotCoreWrapper/SotCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ namespace Core
auto objectActor = *reinterpret_cast<AActor*>(&worldActors[i]);
auto objectID = objectActor.GetID();
auto objectName = getNameFromIDmem(objectID);
;
actors.push_back(objectActor);
}
TempActors = actors;
Expand Down
1 change: 1 addition & 0 deletions SotCoreWrapper/SotCoreWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "UE4ActorWrapper.h"
#include "VectorUE4.h"
#include "CameraManager.h"
#include "Player.h"
#include "process_manager.h"

using namespace System;
Expand Down
2 changes: 2 additions & 0 deletions SotCoreWrapper/SotCoreWrapper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
<ItemGroup>
<ClInclude Include="CameraManager.h" />
<ClInclude Include="Core.h" />
<ClInclude Include="Player.h" />
<ClInclude Include="SotCore.h" />
<ClInclude Include="globals.h" />
<ClInclude Include="ManagedObject.h" />
Expand All @@ -140,6 +141,7 @@
<ItemGroup>
<ClCompile Include="CameraManager.cpp" />
<ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="Player.cpp" />
<ClCompile Include="SotCore.cpp" />
<ClCompile Include="globals.cpp" />
<ClCompile Include="MemoryManager.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions SotCoreWrapper/SotCoreWrapper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
<ClInclude Include="CameraManager.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Player.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SotCoreWrapper.cpp">
Expand Down Expand Up @@ -95,6 +98,9 @@
<ClCompile Include="CameraManager.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Player.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="app.ico">
Expand Down
8 changes: 6 additions & 2 deletions SotCoreWrapper/UE4ActorWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#include "pch.h"
#include "Core.h"
#include "UE4ActorWrapper.h"
#include <msclr\marshal_cppstd.h>
using namespace msclr::interop;

namespace SoT
{

UE4Actor::UE4Actor(UE4Actor^ actor)
{
this->BaseName = actor->BaseName;
this->IDActors = actor->IDActors;
}

UE4Actor::UE4Actor(std::string BaseName, int IDActors)
{
this->BaseName = gcnew System::String(BaseName.c_str());
Expand Down
7 changes: 7 additions & 0 deletions SotCoreWrapper/UE4ActorWrapper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#pragma once
#include <string>
#include "VectorUE4.h"
#include <msclr\marshal_cppstd.h>
using namespace msclr::interop;

using namespace System;
using namespace Core;


namespace SoT
{
public ref class UE4Actor
Expand All @@ -11,8 +16,10 @@ namespace SoT
VectorUE4^ pos;
VectorUE4^ rot;
bool isValid();
internal:
AActor UE4Actor::getActor();
public:
UE4Actor(UE4Actor^ actor);
UE4Actor(std::string BaseName, int IDActors);
System::String^ getName();
VectorUE4^ UE4Actor::getPos();
Expand Down
2 changes: 1 addition & 1 deletion SotCoreWrapper/offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace Core

struct UWieldedItemComponent
{
int WieldedItem = 1192;
int WieldedItem = 696;
}UWieldedItemComponent;

struct AWieldableItem
Expand Down

0 comments on commit 54180bd

Please sign in to comment.