PSO2SERVER/Server/Packets/PSOPackets/0B-QuestPacket/0B-13-MinimapRevealPacket.cs

59 lines
1.6 KiB
C#
Raw Normal View History

2024-09-16 17:09:36 +08:00
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
2024-09-18 04:21:17 +08:00
public class MinimapRevealPacket : Packet
2024-09-16 17:09:36 +08:00
{
2024-11-26 00:07:24 +08:00
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();
}
}
2024-09-16 17:09:36 +08:00
2024-09-18 04:21:17 +08:00
public MinimapRevealPacket()
2024-09-16 17:09:36 +08:00
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
2024-09-17 11:29:41 +08:00
var pkt = new PacketWriter();
2024-11-26 00:07:24 +08:00
pkt.WriteStruct(unk1);
pkt.WriteStruct(party);
pkt.Write(zone_id);
for (var i = 0; i < 10; i++)
pkt.Write(unk2[i]);
2024-09-17 11:29:41 +08:00
return pkt.ToArray();
2024-09-16 17:09:36 +08:00
}
public override PacketHeader GetHeader()
{
2024-09-18 04:21:17 +08:00
return new PacketHeader(0x0B, 0x13, PacketFlags.None);
2024-09-16 17:09:36 +08:00
}
#endregion
}
}