PSO2SERVER/Server/Protocol/Packets/0B-QuestPacket/0B-13-MinimapRevealPacket.cs
2024-11-27 18:05:53 +08:00

59 lines
1.6 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 PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Protocol.Packets
{
public class MinimapRevealPacket : Packet
{
private ObjectHeader unk1 { get; set; }
private ObjectHeader party { get; set; }
private uint zone_id { get; set; }
private byte[] unk2 { get; set; } = new byte[10];
// 构造函数,允许在创建时初始化字段
public MinimapRevealPacket(ObjectHeader unk1, ObjectHeader party, uint zone_id, byte[] unk2)
{
this.unk1 = unk1;
this.party = party;
this.zone_id = zone_id;
// 如果传入的 unk2 长度小于 10则填充剩余部分为 0
if (unk2.Length <= 10)
{
this.unk2 = unk2.Concat(new byte[10 - unk2.Length]).ToArray();
}
else
{
// 如果传入的 unk2 长度大于 10则截取前 10 字节
this.unk2 = unk2.Take(10).ToArray();
}
}
public MinimapRevealPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.WriteStruct(unk1);
pkt.WriteStruct(party);
pkt.Write(zone_id);
for (var i = 0; i < 10; i++)
pkt.Write(unk2[i]);
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x0B, 0x13, PacketFlags.None);
}
#endregion
}
}