修正数据包
This commit is contained in:
parent
3e74d13348
commit
89465c789c
@ -9,10 +9,13 @@ using System.Linq;
|
||||
namespace PSO2SERVER.Packets.Handlers
|
||||
{
|
||||
[PacketHandlerAttr(0x11, 0x9B)]
|
||||
class CharacterNewNameRequestPacket : PacketHandler
|
||||
class CharacterNewNameRequest : PacketHandler
|
||||
{
|
||||
public uint player_id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public struct CharacterNewNameRequestPacket
|
||||
{
|
||||
public uint player_id;
|
||||
public string Name;
|
||||
}
|
||||
|
||||
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
|
||||
{
|
||||
@ -22,9 +25,13 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
if (context._account == null)
|
||||
return;
|
||||
|
||||
// 创建一个结构体实例
|
||||
var packet = new CharacterNewNameRequestPacket();
|
||||
|
||||
// 读取数据并填充到结构体中
|
||||
var reader = new PacketReader(data, position, size);
|
||||
player_id = reader.ReadUInt32();
|
||||
Name = reader.ReadFixedLengthUtf16(16);
|
||||
packet.player_id = reader.ReadUInt32();
|
||||
packet.Name = reader.ReadFixedLengthUtf16(16); // 读取16字节长度的名字
|
||||
|
||||
NewNameStatus isdone = NewNameStatus.Failure;
|
||||
|
||||
@ -40,7 +47,7 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
if (character != null)
|
||||
{
|
||||
// 确保名字不为空,并且是16字节长度
|
||||
character.Name = Name; // 用0填充至16字节
|
||||
character.Name = packet.Name.PadRight(16, '\0'); // 确保名字是16字节
|
||||
db.SaveChanges(); // 保存修改
|
||||
isdone = NewNameStatus.Success;
|
||||
}
|
||||
@ -48,7 +55,7 @@ namespace PSO2SERVER.Packets.Handlers
|
||||
|
||||
}
|
||||
|
||||
context.SendPacket(new CharacterNewNamePacket(isdone, player_id, Name));
|
||||
context.SendPacket(new CharacterNewNamePacket(isdone, packet.player_id, packet.Name));
|
||||
}
|
||||
}
|
||||
}
|
@ -8,13 +8,8 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
{
|
||||
public class LoadingScreenTransitionPacket : Packet
|
||||
{
|
||||
private readonly byte _subtype;
|
||||
private readonly byte _type;
|
||||
|
||||
public LoadingScreenTransitionPacket()
|
||||
{
|
||||
_type = 0x03;
|
||||
_subtype = 0x04;
|
||||
}
|
||||
|
||||
#region implemented abstract members of Packet
|
||||
@ -26,11 +21,7 @@ namespace PSO2SERVER.Packets.PSOPackets
|
||||
|
||||
public override PacketHeader GetHeader()
|
||||
{
|
||||
return new PacketHeader
|
||||
{
|
||||
Type = _type,
|
||||
Subtype = _subtype
|
||||
};
|
||||
return new PacketHeader(0x03, 0x04, PacketFlags.None);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -198,7 +198,7 @@
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-29-PlayerIsNotBusyState.cs" />
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-28-PlayerIsBusyState.cs" />
|
||||
<Compile Include="Packets\Handlers\0E-PartyHandler\0E-19-ChatStatusHandler.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-9B-CharacterNewNameRequestPacket.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-9B-CharacterNewNameRequest.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-97-CharacterRenameRequest.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-BC-CharacterShipTransferCanceldRequest.cs" />
|
||||
<Compile Include="Packets\Handlers\11-ClientHandler\11-B8-CharacterShipTransferRightsRequest.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user