PSO2SERVER/Server/Protocol/Handlers/0B-QuestHandler/0B-09-MinimapRevealRequest.cs

49 lines
1.8 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x0B, 0x09)]
public class MinimapRevealRequest : PacketHandler
{
// 定义 MinimapRevealRequestPacket 数据包结构
public struct MinimapRevealRequestPacket
{
// 未知字段32位无符号整数
public uint unk1;
// 玩家进入的区域块的ID
public uint chunk_id;
// 地图上区域块的列坐标
public uint map_column;
// 地图上区域块的行坐标
public uint map_row;
}
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
//var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length);
//Logger.WriteHex(info, data);
if (context.Character == null)
return;
var reader = new PacketReader(data, position, size);
// 从接收到的字节数组中解析数据到结构体
MinimapRevealRequestPacket packet = new MinimapRevealRequestPacket
{
unk1 = reader.ReadUInt32(), // 从数据包中解析unk1
chunk_id = reader.ReadUInt32(), // 从数据包中解析chunk_id
map_column = reader.ReadUInt32(), // 从数据包中解析map_column
map_row = reader.ReadUInt32() // 从数据包中解析map_row
};
// 打印解析后的数据
Logger.Write($"解析的地图数据包: unk1 = {packet.unk1}, Chunk ID = {packet.chunk_id}, Column = {packet.map_column}, Row = {packet.map_row}");
}
}
}