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

44 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using PSO2SERVER.Json;
using PSO2SERVER.Models;
namespace PSO2SERVER.Protocol.Packets
{
class QuestDifficultyPacket : Packet
{
private List<QuestData> questdefs;
public QuestDifficultyPacket(List<QuestData> questdefs)
{
this.questdefs = questdefs;
}
public override byte[] Build()
{
PacketWriter pkt = new PacketWriter();
pkt.WriteMagic((uint)questdefs.Count, 0x292C, 0x5B);
foreach (var d in questdefs)
{
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);
}
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x0B, 0x1A, PacketFlags.PACKED);
}
}
}