Merge pull request #14 from EntenKoeniq/main

Small changes
This commit is contained in:
Nick-I. A
2021-08-04 14:30:19 +02:00
committed by GitHub
6 changed files with 35 additions and 50 deletions

View File

@ -350,7 +350,8 @@ namespace CoopClient
if ((CurrentVehicleSpeed > 0.2f || VehIsInBurnout) && MainVehicle.IsInRange(VehiclePosition, 7.0f)) if ((CurrentVehicleSpeed > 0.2f || VehIsInBurnout) && MainVehicle.IsInRange(VehiclePosition, 7.0f))
{ {
MainVehicle.Velocity = VehicleVelocity + (VehiclePosition - MainVehicle.Position); MainVehicle.Velocity = VehicleVelocity + (VehiclePosition - MainVehicle.Position);
MainVehicle.Quaternion = Quaternion.Slerp(MainVehicle.Quaternion, VehicleRotation, 0.25f);
MainVehicle.Quaternion = Quaternion.Slerp(MainVehicle.Quaternion, VehicleRotation, 0.5f);
VehicleStopTime = Environment.TickCount; VehicleStopTime = Environment.TickCount;
} }

View File

@ -161,7 +161,6 @@ namespace CoopClient
KeyDown += OnKeyDown; KeyDown += OnKeyDown;
Util.NativeMemory(); Util.NativeMemory();
Util.DisableSlowMo();
} }
private int LastDataSend; private int LastDataSend;

View File

@ -258,7 +258,7 @@ namespace CoopClient
} }
} }
#region GET #region -- GET --
#region -- PLAYER -- #region -- PLAYER --
private void PlayerConnect(PlayerConnectPacket packet) private void PlayerConnect(PlayerConnectPacket packet)
{ {
@ -371,7 +371,6 @@ namespace CoopClient
if (Main.Players.ContainsKey(packet.Player)) if (Main.Players.ContainsKey(packet.Player))
{ {
EntitiesPlayer player = Main.Players[packet.Player]; EntitiesPlayer player = Main.Players[packet.Player];
player.ModelHash = packet.ModelHash;
player.Health = packet.Health; player.Health = packet.Health;
player.Position = packet.Position.ToVector(); player.Position = packet.Position.ToVector();
player.VehicleModelHash = packet.VehModelHash; player.VehicleModelHash = packet.VehModelHash;
@ -503,7 +502,7 @@ namespace CoopClient
#endregion // -- NPC -- #endregion // -- NPC --
#endregion #endregion
#region SEND #region -- SEND --
private bool FullPlayerSync = true; private bool FullPlayerSync = true;
public void SendPlayerData() public void SendPlayerData()
{ {
@ -572,7 +571,6 @@ namespace CoopClient
new LightSyncPlayerVehPacket() new LightSyncPlayerVehPacket()
{ {
Player = Main.LocalPlayerID, Player = Main.LocalPlayerID,
ModelHash = player.Model.Hash,
Health = player.Health, Health = player.Health,
Position = player.Position.ToLVector(), Position = player.Position.ToLVector(),
VehModelHash = player.CurrentVehicle.Model.Hash, VehModelHash = player.CurrentVehicle.Model.Hash,

View File

@ -452,36 +452,33 @@ namespace CoopClient
public string Player { get; set; } public string Player { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public int ModelHash { get; set; }
[ProtoMember(3)]
public int Health { get; set; } public int Health { get; set; }
[ProtoMember(4)] [ProtoMember(3)]
public LVector3 Position { get; set; } public LVector3 Position { get; set; }
[ProtoMember(5)] [ProtoMember(4)]
public int VehModelHash { get; set; } public int VehModelHash { get; set; }
[ProtoMember(6)] [ProtoMember(5)]
public int VehSeatIndex { get; set; } public int VehSeatIndex { get; set; }
[ProtoMember(7)] [ProtoMember(6)]
public LVector3 VehPosition { get; set; } public LVector3 VehPosition { get; set; }
[ProtoMember(8)] [ProtoMember(7)]
public LQuaternion VehRotation { get; set; } public LQuaternion VehRotation { get; set; }
[ProtoMember(9)] [ProtoMember(8)]
public LVector3 VehVelocity { get; set; } public LVector3 VehVelocity { get; set; }
[ProtoMember(10)] [ProtoMember(9)]
public float VehSpeed { get; set; } public float VehSpeed { get; set; }
[ProtoMember(11)] [ProtoMember(10)]
public float VehSteeringAngle { get; set; } public float VehSteeringAngle { get; set; }
[ProtoMember(12)] [ProtoMember(11)]
public byte? Flag { get; set; } = 0; public byte? Flag { get; set; } = 0;
public override void PacketToNetOutGoingMessage(NetOutgoingMessage message) public override void PacketToNetOutGoingMessage(NetOutgoingMessage message)
@ -501,7 +498,6 @@ namespace CoopClient
LightSyncPlayerVehPacket data = CoopSerializer.Deserialize<LightSyncPlayerVehPacket>(message.ReadBytes(len)); LightSyncPlayerVehPacket data = CoopSerializer.Deserialize<LightSyncPlayerVehPacket>(message.ReadBytes(len));
Player = data.Player; Player = data.Player;
ModelHash = data.ModelHash;
Health = data.Health; Health = data.Health;
Position = data.Position; Position = data.Position;
VehModelHash = data.VehModelHash; VehModelHash = data.VehModelHash;

View File

@ -53,7 +53,7 @@ namespace CoopClient
GetEntityAddressFunc = GetDelegateForFunctionPointer<GetHandleAddressFuncDelegate>(new IntPtr(*(int*)(address + 1) + address + 5)); GetEntityAddressFunc = GetDelegateForFunctionPointer<GetHandleAddressFuncDelegate>(new IntPtr(*(int*)(address + 1) + address + 5));
// use the former pattern if the version is 1.0.1604.0 or newer // use the former pattern if the version is 1.0.1604.0 or newer
var gameVersion = (int)Game.Version; int gameVersion = (int)Game.Version;
address = gameVersion >= 46 ? address = gameVersion >= 46 ?
FindPattern("\xF3\x0F\x10\x9F\xD4\x08\x00\x00\x0F\x2F\xDF\x73\x0A", "xxxx????xxxxx") : FindPattern("\xF3\x0F\x10\x9F\xD4\x08\x00\x00\x0F\x2F\xDF\x73\x0A", "xxxx????xxxxx") :
FindPattern("\xF3\x0F\x10\x8F\x68\x08\x00\x00\x88\x4D\x8C\x0F\x2F\xCF", "xxxx????xxx???"); FindPattern("\xF3\x0F\x10\x8F\x68\x08\x00\x00\x88\x4D\x8C\x0F\x2F\xCF", "xxxx????xxx???");
@ -63,6 +63,15 @@ namespace CoopClient
{ {
SteeringAngleOffset = *(int*)(address + 6) + 8; SteeringAngleOffset = *(int*)(address + 6) + 8;
} }
address = FindPattern("\x32\xc0\xf3\x0f\x11\x09", "xxxxxx"); // Weapon / Radio slowdown
if (address != null)
{
for (int i = 0; i < 6; i++)
{
*(byte*)((IntPtr)address + i).ToPointer() = 0x90;
}
}
} }
delegate ulong GetHandleAddressFuncDelegate(int handle); delegate ulong GetHandleAddressFuncDelegate(int handle);
@ -75,7 +84,7 @@ namespace CoopClient
public static unsafe void CustomSteeringAngle(int Handle, float value) public static unsafe void CustomSteeringAngle(int Handle, float value)
{ {
var address = GetEntityAddress(Handle); IntPtr address = GetEntityAddress(Handle);
if (address == IntPtr.Zero || SteeringAngleOffset == 0) if (address == IntPtr.Zero || SteeringAngleOffset == 0)
{ {
return; return;
@ -83,20 +92,6 @@ namespace CoopClient
*(float*)(address + SteeringAngleOffset).ToPointer() = value; *(float*)(address + SteeringAngleOffset).ToPointer() = value;
} }
public static unsafe void DisableSlowMo()
{
var address = FindPattern("\x32\xc0\xf3\x0f\x11\x09", "xxxxxx"); // Weapon / Radio slowdown
if (address == null)
{
return;
}
for (int i = 0; i < 6; i++)
{
*(byte*)((IntPtr)address + i).ToPointer() = 0x90;
}
}
#endregion #endregion
public static bool IsBetween<T>(this T item, T start, T end) public static bool IsBetween<T>(this T item, T start, T end)

View File

@ -415,36 +415,33 @@ namespace CoopServer
public string Player { get; set; } public string Player { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public int ModelHash { get; set; }
[ProtoMember(3)]
public int Health { get; set; } public int Health { get; set; }
[ProtoMember(4)] [ProtoMember(3)]
public LVector3 Position { get; set; } public LVector3 Position { get; set; }
[ProtoMember(5)] [ProtoMember(4)]
public int VehModelHash { get; set; } public int VehModelHash { get; set; }
[ProtoMember(6)] [ProtoMember(5)]
public int VehSeatIndex { get; set; } public int VehSeatIndex { get; set; }
[ProtoMember(7)] [ProtoMember(6)]
public LVector3 VehPosition { get; set; } public LVector3 VehPosition { get; set; }
[ProtoMember(8)] [ProtoMember(7)]
public LQuaternion VehRotation { get; set; } public LQuaternion VehRotation { get; set; }
[ProtoMember(9)] [ProtoMember(8)]
public LVector3 VehVelocity { get; set; } public LVector3 VehVelocity { get; set; }
[ProtoMember(10)] [ProtoMember(9)]
public float VehSpeed { get; set; } public float VehSpeed { get; set; }
[ProtoMember(11)] [ProtoMember(10)]
public float VehSteeringAngle { get; set; } public float VehSteeringAngle { get; set; }
[ProtoMember(12)] [ProtoMember(11)]
public byte? Flag { get; set; } = 0; public byte? Flag { get; set; } = 0;
public override void PacketToNetOutGoingMessage(NetOutgoingMessage message) public override void PacketToNetOutGoingMessage(NetOutgoingMessage message)
@ -464,7 +461,6 @@ namespace CoopServer
LightSyncPlayerVehPacket data = CoopSerializer.Deserialize<LightSyncPlayerVehPacket>(message.ReadBytes(len)); LightSyncPlayerVehPacket data = CoopSerializer.Deserialize<LightSyncPlayerVehPacket>(message.ReadBytes(len));
Player = data.Player; Player = data.Player;
ModelHash = data.ModelHash;
Health = data.Health; Health = data.Health;
Position = data.Position; Position = data.Position;
VehModelHash = data.VehModelHash; VehModelHash = data.VehModelHash;