PSO2SERVER/Server/Packets/PSOPackets/0E-PartyPacket/0E-02-PartyInitPacket.cs

86 lines
3.2 KiB
C#
Raw Normal View History

2024-09-10 00:31:40 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
2024-09-10 01:13:20 +08:00
using PSO2SERVER.Models;
2024-09-10 00:31:40 +08:00
2024-09-10 01:13:20 +08:00
namespace PSO2SERVER.Packets.PSOPackets
2024-09-10 00:31:40 +08:00
{
class PartyInitPacket : Packet
{
private Character[] members;
public PartyInitPacket(Character[] members)
{
this.members = members;
}
public override byte[] Build()
{
if (members.Length < 1)
return new byte[0];
// xor: 0xD863, sub: 0xA9
PacketWriter writer = new PacketWriter();
writer.WriteBytes(0, 12); // Unknown 12 bytes, not obj header
2024-09-20 21:58:37 +08:00
writer.WriteStruct(new ObjectHeader((uint)members[0].Account.AccountId, EntityType.Player)); // Account receiving the thing
2024-09-10 00:31:40 +08:00
writer.WriteStruct(members.Length); // Likely partymembercount
for(int i = 0; i < members.Length; i++)
{
2024-09-20 21:58:37 +08:00
writer.WriteStruct(new ObjectHeader((uint)members[i].Account.AccountId, EntityType.Player)); // Header of player
2024-09-10 00:31:40 +08:00
writer.WriteUtf16(members[i].Name, 0xD863, 0xA9);
2024-09-20 21:58:37 +08:00
writer.WriteUtf16(members[i].Account.Nickname, 0xD863, 0xA9);
2024-09-10 00:31:40 +08:00
writer.Write((byte)members[i].Jobs.entries.hunter.level); // Active class level
writer.Write((byte)0); // idk
writer.Write((byte)4); // idk
writer.Write((byte)0xFF); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0xFF); // idk
writer.Write((byte)0xFF); // idk
writer.Write((byte)0); // idk
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.WriteBytes(0, 12);
writer.Write(0);
writer.Write(0);
}
for(int i = 0; i < 4 - members.Length; i++) // Empty entries
{
writer.WriteStruct(new ObjectHeader(0, 0)); // Header of player
writer.WriteMagic(0, 0xD863, 0xA9);
writer.WriteMagic(0, 0xD863, 0xA9);
writer.Write((byte)0); // Active class level
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((byte)0); // idk
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.Write((ushort)0);
writer.WriteBytes(0, 12);
writer.Write(0);
}
return writer.ToArray();
}
public override PacketHeader GetHeader()
{
2024-09-16 02:56:02 +08:00
return new PacketHeader(0x0E, 0x02, PacketFlags.PACKED);
2024-09-10 00:31:40 +08:00
}
}
}