78 lines
2.5 KiB
C#
78 lines
2.5 KiB
C#
using System;
|
|
using PSO2SERVER.Json;
|
|
using System.Collections.Generic;
|
|
using PSO2SERVER.Models;
|
|
|
|
namespace PSO2SERVER.Protocol.Packets
|
|
{
|
|
public class QuestCategoryPacket : Packet
|
|
{
|
|
private List<QuestData> questdefs;
|
|
|
|
public QuestCategoryPacket(List<QuestData> questdefs)
|
|
{
|
|
this.questdefs = questdefs;
|
|
}
|
|
|
|
public override byte[] Build()
|
|
{
|
|
PacketWriter pkt = new PacketWriter();
|
|
pkt.WriteMagic((uint)questdefs.Count, 0x1DB0, 0xC5);
|
|
foreach (QuestData d in questdefs)
|
|
{
|
|
//pkt.WriteStruct(d.QuestDefiniton);
|
|
var qd = d.QuestDefiniton;
|
|
pkt.WriteFixedLengthASCII(qd.Date, 0x20);
|
|
pkt.WriteObjectHeader(qd.QuestObj);
|
|
pkt.Write(qd.NameId);
|
|
pkt.WriteUintArray(qd.Unk3);
|
|
pkt.Write(qd.Unk4);
|
|
pkt.Write(qd.Unk5);
|
|
pkt.Write(qd.Unk6);
|
|
pkt.WriteUintArray(qd.Unk7);
|
|
pkt.WriteUshortArray(qd.Unk8);
|
|
pkt.Write(qd.Length);
|
|
pkt.Write((byte)qd.PartyType);
|
|
pkt.Write((byte)qd.Difficulties);
|
|
pkt.Write((byte)qd.DifficultiesCompleted);
|
|
pkt.Write(qd.Unk9);
|
|
pkt.Write(qd.ReqLevel);
|
|
pkt.Write(qd.SubClassReqLevel);
|
|
pkt.Write(qd.EnemyLevel);
|
|
pkt.Write(qd.Unk10);
|
|
pkt.Write((byte)qd.QuestType);
|
|
pkt.Write(qd.Unk11);
|
|
pkt.Write(qd.Unk12);
|
|
pkt.WriteUintArray(qd.Unk13);
|
|
pkt.Write(qd.Unk14);
|
|
pkt.Write(qd.Unk15);
|
|
pkt.Write(qd.Unk16);
|
|
|
|
}
|
|
return pkt.ToArray();
|
|
}
|
|
|
|
public override PacketHeader GetHeader()
|
|
{
|
|
return new PacketHeader(0x0B, 0x18, PacketFlags.PACKED);
|
|
}
|
|
|
|
// Hoo boy, this is 468 bytes!
|
|
// TODO: Map out this struct.
|
|
// Most of this is WRONG!!! Needs serious investigation.
|
|
/*
|
|
[K873] What I've currently mapped out
|
|
24 -> Start
|
|
38 -> PartyQuest name/Type Index?
|
|
100 -> Bitfield 1
|
|
102 -> Estimated Play Time
|
|
103 -> Party Type
|
|
104 -> Difficulties Available
|
|
105 -> Difficulties Completed
|
|
108 -> Starting Level
|
|
120 -> Item Data 1?
|
|
12C -> Item Data 2?
|
|
*/
|
|
}
|
|
}
|