This commit is contained in:
Longfeng Qin 2024-09-22 00:31:34 +08:00
parent 16806a40c8
commit d4528a6dcc
3 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ using PSO2SERVER.Packets.PSOPackets;
namespace PSO2SERVER.Packets.Handlers
{
[PacketHandlerAttr(0x11, 0x0D)]
public class PingTimestampResponse : PacketHandler
public class ClientPingHandler : PacketHandler
{
#region implemented abstract members of PacketHandler
@ -14,10 +14,7 @@ namespace PSO2SERVER.Packets.Handlers
var reader = new PacketReader(data, position, size);
var clientTime = reader.ReadUInt64();
var writer = new PacketWriter();
writer.Write(clientTime);
writer.Write(Helper.Timestamp(DateTime.UtcNow));
context.SendPacket(0x11, 0xE, 0, writer.ToArray());
context.SendPacket(new ClientPongPacket(clientTime));
}
#endregion

View File

@ -8,9 +8,10 @@ namespace PSO2SERVER.Packets.PSOPackets
{
public class ClientPongPacket : Packet
{
public ClientPongPacket()
private readonly ulong _clientTime;
public ClientPongPacket(ulong clientTime)
{
_clientTime = clientTime;
}
#region implemented abstract members of Packet
@ -18,6 +19,8 @@ namespace PSO2SERVER.Packets.PSOPackets
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.Write(_clientTime);
pkt.Write(Helper.Timestamp(DateTime.UtcNow));
return pkt.ToArray();
}

View File

@ -199,7 +199,7 @@
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-19-ChatStatusHandler.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-B8-CharacterShipTransferRightsRequest.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-06-DeleteCharacter.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-0D-PingTimestampResponse.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-0D-ClientPingHandler.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-1D-GuildInfoRequest.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-2B-LogOutRequest.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-3E-CharacterSpawn.cs" />