Skip to content

Commit

Permalink
Added Water Level and Water Amount in Ship Class
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinPtrl committed Jan 12, 2022
1 parent 6e78870 commit 26003e7
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions SotCoreTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static void Main(string[] args)
if (actor.getName().Equals("BP_SmallShipTemplate_C") || actor.getName().Equals("BP_SmallShipNetProxy") || actor.getName().Equals("BP_MediumShipTemplate_C") || actor.getName().Equals("BP_MediumShipNetProxy") || actor.getName().Equals("BP_LargeShipTemplate_C") || actor.getName().Equals("BP_LargeShipNetProxy") || actor.getName().Equals("BP_Rowboat_C") || actor.getName().Equals("BP_RowboatRowingSeat_C") || actor.getName().Equals("BP_RowboatRowingSeat_C") || actor.getName().Equals("BP_Rowboat_WithFrontHarpoon_C"))
{
Ship ship = new Ship(actor);
float CurrentWaterLevel = ship.getCurrentWaterLevel();
Console.WriteLine("Ship");
}
/*else if(actor.getName().Contains("Proxy") && !actor.getName().Contains("NetProxy"))
Expand Down
12 changes: 12 additions & 0 deletions SotCoreWrapper/SOTStuff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ namespace Core
return MemoryManager->Read<UCrewOwnershipComponent>(*(uintptr_t*)(__pad0x0 + Offsets.AShip.CrewOwnershipComponent));
}

UChildActorComponent AShip::getChildActorComponent()
{
return MemoryManager->Read<UChildActorComponent>(*(uintptr_t*)(__pad0x0 + Offsets.AShip.ShipInternalWaterComponent));
}

AActor UChildActorComponent::getChildActor()
{
return MemoryManager->Read<AActor>(*(uintptr_t*)(__pad0x0 + Offsets.UChildActorComponent.ChildActor));
}



uintptr_t AShip::GetOwningActor()
{
return *(uintptr_t*)(__pad0x0 + Offsets.AShip.ShipOwningActor);
Expand Down
19 changes: 19 additions & 0 deletions SotCoreWrapper/SOTStuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ namespace Core
char __pad0x0[0x100];
};

class UChildActorComponent
{
public:
AActor getChildActor();
private:
char __pad0x0[0x1000];
};

struct FSinkingShipParams
{
float DragWhenGrindingToHalt;
Expand Down Expand Up @@ -413,6 +421,8 @@ namespace Core
UCrewOwnershipComponent GetCrewOwnershipComponent();
USinkingComponent GetSinkingComponent();
uintptr_t GetOwningActor();
UChildActorComponent getChildActorComponent();

private:
char __pad0x0[0x1000];
};
Expand All @@ -426,6 +436,15 @@ namespace Core
TArray<Chunk*> m_Actors;
};


class AShipInternalWater
{
public:
unsigned char UnknownData00[0x0418];
float CurrentVisualWaterLevel;
float WaterAmount;
};

class AFauna
{
public:
Expand Down
15 changes: 15 additions & 0 deletions SotCoreWrapper/Ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ namespace SoT
return gcnew SoT::Guid(getActor().GetCrewOwnershipComponent().GetCrewId());
}

float Ship::getCurrentWaterLevel()
{
UChildActorComponent component = getActor().getChildActorComponent();
AShipInternalWater internalWater = *reinterpret_cast<AShipInternalWater*>(&component.getChildActor());
return internalWater.CurrentVisualWaterLevel;
}

float Ship::getCurrentWaterAmount()
{
UChildActorComponent component = getActor().getChildActorComponent();
AShipInternalWater internalWater = *reinterpret_cast<AShipInternalWater*>(&component.getChildActor());
return internalWater.WaterAmount;
}


float Ship::getDragWhenGrindingToHalt()
{
return getActor().GetSinkingComponent().SinkingParams.DragWhenGrindingToHalt;
Expand Down
5 changes: 5 additions & 0 deletions SotCoreWrapper/Ship.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ namespace SoT
public:
Ship(UE4Actor^ actor);
Guid^ getGuid();

float getCurrentWaterLevel();
float getCurrentWaterAmount();

float getDragWhenGrindingToHalt();
float getMinSpdToStopToBeforeLowering();
float getLowerIntoWaterTime();
Expand All @@ -28,6 +32,7 @@ namespace SoT
float getTimeIntoKeelingOverToTeleportPlayer();
float getMinSampleSubmersionToConsiderInWater();
float getMinPctSamplesRequiredSubmergedToBeAbleToSink();

};
}

7 changes: 6 additions & 1 deletion SotCoreWrapper/offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ namespace Core
struct AShip
{
int CrewOwnershipComponent = 1888;
int ShipInternalWaterComponent = 0x05E0;
int SinkingComponent = 0x05F0;
int ShipOwningActor = 0x3E0;
int ShipInternalWaterComponent = 0x05E8;
}AShip;

struct UChildActorComponent
{
int ChildActor = 0x02B8;
}UChildActorComponent;

struct ACannon
{
int TimePerFire = 0x5A0;
Expand Down

0 comments on commit 26003e7

Please sign in to comment.