新增数据包 移除错误数据处理

This commit is contained in:
Longfeng Qin 2024-09-18 02:05:22 +08:00
parent 41b941fb7b
commit 4e527d3fab
7 changed files with 53 additions and 68 deletions

View File

@ -35,7 +35,7 @@ namespace PSO2SERVER
InputArc4 = null;
OutputArc4 = null;
SendPacket(new ServerHelloPacket());
SendPacket(new ServerHelloPacket(0x03, 201, 0));
}
public bool IsClosed { get; private set; }

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSO2SERVER.Packets.Handlers
{
//[PacketHandlerAttr(0x03, 0x00)]
//class MapTransfer : PacketHandler
//{
// /// (0x03, 0x00) Map Transfer.
// public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
// {
// //var info = string.Format("[<--] 接收到的数据 (hex): ");
// //Logger.WriteHex(info, data);
// }
//}
}

View File

@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSO2SERVER.Packets.Handlers
{
//[PacketHandlerAttr(0x03, 0x06)]
//class _0B_06_UNK : PacketHandler
//{
// public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
// {
// //var info = string.Format("[<--] 接收到的数据 (hex): ");
// //Logger.WriteHex(info, data);
// }
//}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class Unk0306Packet : Packet
{
public Unk0306Packet()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x03, 0x06, PacketFlags.None);
}
#endregion
}
}

View File

@ -6,38 +6,24 @@ namespace PSO2SERVER.Packets.PSOPackets
{
class ServerHelloPacket : Packet
{
private readonly ushort _Unk1;
private readonly ushort _BlockId;
private readonly uint _Unk2;
/// <summary>
/// Unknown. Seems to be always 0x03.
/// </summary>
public ushort Unk1 { get; set; }
/// <summary>
/// Block Id.
/// </summary>
public ushort BlockId { get; set; }
public uint Unk2 { get; set; }
public ServerHelloPacket()
public ServerHelloPacket(ushort Unk1, ushort BlockId, uint Unk2)
{
Unk1 = 0x03; // Initialize Unk1 with default value
_Unk1 = Unk1;
_BlockId = BlockId;
_Unk2 = Unk2;
}
public override byte[] Build()
{
//var welcome = new PacketWriter();
//welcome.Write((ushort)3);
//welcome.Write((ushort)201);
//welcome.Write((ushort)0);
//welcome.Write((ushort)0);
PacketWriter writer = new PacketWriter();
writer.Write(Unk1);
writer.Write(_Unk1);
writer.Seek(4, SeekOrigin.Current); // Skip 4 bytes
writer.Write(BlockId);
writer.Write(Unk2);
writer.Write(_BlockId);
writer.Write(_Unk2);
return writer.ToArray();
}

View File

@ -2,21 +2,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class DespawnObjectPacket : Packet
{
public DespawnObjectPacket()
private readonly PSOObject _player;
private readonly PSOObject _item;
public DespawnObjectPacket(PSOObject player, PSOObject item)
{
_player = player;
_item = item;
}
#region implemented abstract members of Packet
public override byte[] Build()
{
return new byte[0];
PacketWriter writer = new PacketWriter();
writer.WriteStruct(_player.Header);
writer.WriteStruct(_item.Header);
return writer.ToArray();
}
public override PacketHeader GetHeader()

View File

@ -170,8 +170,6 @@
<Compile Include="Models\Quest.cs" />
<Compile Include="Network\PortChecker.cs" />
<Compile Include="Object\ObjectManager.cs" />
<Compile Include="Packets\Handlers\03-ServerHandler\03-06-UNK.cs" />
<Compile Include="Packets\Handlers\03-ServerHandler\03-00-MapTransfer.cs" />
<Compile Include="Packets\Handlers\03-ServerHandler\03-03-InitialLoad.cs" />
<Compile Include="Packets\Handlers\03-ServerHandler\03-0C-PingResponse.cs" />
<Compile Include="Packets\Handlers\03-ServerHandler\03-10-DoItMaybe.cs" />
@ -203,6 +201,7 @@
<Compile Include="Packets\Handlers\03-ServerHandler\03-34-TeleportCasinoToLobby.cs" />
<Compile Include="Packets\Handlers\11-ClientHandler\11-41-CreateCharacterOne.cs" />
<Compile Include="Packets\Handlers\2F-SymbolHandler\2F-06-SymbolArtHandler.cs" />
<Compile Include="Packets\PSOPackets\03-ServerPacket\03-06-Unk0306Packet.cs" />
<Compile Include="Packets\PSOPackets\03-ServerPacket\03-00-MapTransferPacket.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-80-MovementActionServerPacket.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-81-ActionUpdateServerPacket.cs" />