PSO2SERVER/Server/Protocol/Packets/0B-QuestPacket/0B-1A-QuestDifficultyPacket.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2024-09-10 00:31:40 +08:00
using System;
using System.Collections.Generic;
2024-09-10 00:31:40 +08:00
using System.Runtime.InteropServices;
using PSO2SERVER.Json;
2024-09-10 01:13:20 +08:00
using PSO2SERVER.Models;
2024-09-10 00:31:40 +08:00
namespace PSO2SERVER.Protocol.Packets
2024-09-10 00:31:40 +08:00
{
class QuestDifficultyPacket : Packet
{
private List<QuestData> questdefs;
2024-09-10 00:31:40 +08:00
public QuestDifficultyPacket(List<QuestData> questdefs)
2024-09-10 00:31:40 +08:00
{
this.questdefs = questdefs;
2024-09-10 00:31:40 +08:00
}
public override byte[] Build()
{
PacketWriter pkt = new PacketWriter();
2024-09-10 00:31:40 +08:00
pkt.WriteMagic((uint)questdefs.Count, 0x292C, 0x5B);
foreach (var d in questdefs)
2024-09-10 00:31:40 +08:00
{
var qd = d.Difficulty;
pkt.WriteFixedLengthASCII(qd.Date, 0x20);
pkt.WriteObjectHeader(qd.QuestObj);
pkt.Write(qd.NameId);
pkt.Write(qd.Planet);
pkt.Write(qd.Area);
pkt.Write(qd.Unk1);
pkt.Write(qd.Unk2);
pkt.WriteStructArray(qd.Diffs);
2024-09-10 00:31:40 +08:00
}
return pkt.ToArray();
2024-09-10 00:31:40 +08:00
}
public override PacketHeader GetHeader()
{
2024-10-23 20:44:09 +08:00
return new PacketHeader(0x0B, 0x1A, PacketFlags.PACKED);
2024-09-10 00:31:40 +08:00
}
}
}