2024-12-02 20:43:28 +08:00
|
|
|
|
using PSO2SERVER.Database;
|
2024-09-10 01:13:20 +08:00
|
|
|
|
using PSO2SERVER.Models;
|
2024-12-11 19:54:48 +08:00
|
|
|
|
using PSO2SERVER.Party;
|
|
|
|
|
using System.Collections.Generic;
|
2024-09-10 00:31:40 +08:00
|
|
|
|
|
2024-11-27 18:05:53 +08:00
|
|
|
|
namespace PSO2SERVER.Protocol.Packets
|
2024-09-10 00:31:40 +08:00
|
|
|
|
{
|
2024-12-11 19:54:48 +08:00
|
|
|
|
public class PartyInitPacket : Packet
|
2024-09-10 00:31:40 +08:00
|
|
|
|
{
|
2024-11-25 23:33:41 +08:00
|
|
|
|
/// 队伍实例.
|
|
|
|
|
private ObjectHeader party_object;
|
|
|
|
|
/// 队伍队长实例.
|
|
|
|
|
private ObjectHeader leader;
|
|
|
|
|
/// 队伍人数.
|
|
|
|
|
private uint people_amount;
|
|
|
|
|
/// 队伍成员.
|
|
|
|
|
private PartyEntry[] entries = new PartyEntry[4]; // 这个是一个包含 4 个 `PartyEntry` 结构的数组,表示队伍中的4个成员。
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 未知
|
|
|
|
|
/// </summary>
|
2024-12-11 19:54:48 +08:00
|
|
|
|
private string unk2 = string.Empty;
|
2024-11-25 23:33:41 +08:00
|
|
|
|
|
2024-12-11 19:54:48 +08:00
|
|
|
|
private List<Client> Clients = new List<Client>();
|
|
|
|
|
public PartyInitPacket(List<Client> clients)
|
2024-11-25 23:33:41 +08:00
|
|
|
|
{
|
2024-12-11 19:54:48 +08:00
|
|
|
|
this.Clients = clients;
|
|
|
|
|
|
|
|
|
|
party_object = new ObjectHeader((uint)clients[0]._account.AccountId, ObjectType.Party);
|
|
|
|
|
leader = new ObjectHeader((uint)clients[0]._account.AccountId, ObjectType.Player);
|
|
|
|
|
people_amount = (uint)Clients.Count;
|
2024-11-25 23:33:41 +08:00
|
|
|
|
|
|
|
|
|
// 队伍结构数据
|
2024-12-11 19:54:48 +08:00
|
|
|
|
for (int i = 0; i < Clients.Count; i++)
|
2024-11-25 23:33:41 +08:00
|
|
|
|
{
|
2024-12-11 19:54:48 +08:00
|
|
|
|
entries[i].id = new ObjectHeader((uint)Clients[i]._account.AccountId, ObjectType.Player); // player of player
|
|
|
|
|
entries[i].nickname = Clients[i]._account.Nickname;
|
|
|
|
|
var character = Clients[i].Character;
|
|
|
|
|
entries[i].char_name = character.Name;
|
|
|
|
|
entries[i].level = (byte)character.Jobs.entries.hunter.level;
|
|
|
|
|
entries[i].sublevel = (byte)character.Jobs.entries.hunter.level2;
|
|
|
|
|
entries[i].mainClass = character.Jobs.mainClass;
|
|
|
|
|
entries[i].subClass = character.Jobs.subClass;
|
2024-11-25 23:33:41 +08:00
|
|
|
|
entries[i].color = (PartyColor)i;
|
|
|
|
|
entries[i].unk2 = 0;
|
|
|
|
|
entries[i].mapid = 0;
|
|
|
|
|
entries[i].unk3 = 0;
|
2024-12-11 19:54:48 +08:00
|
|
|
|
entries[i].unk6 = character.Name;
|
2024-11-25 23:33:41 +08:00
|
|
|
|
}
|
2024-09-10 00:31:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override byte[] Build()
|
|
|
|
|
{
|
2024-12-11 19:54:48 +08:00
|
|
|
|
if (Clients.Count < 1)
|
2024-09-10 00:31:40 +08:00
|
|
|
|
return new byte[0];
|
|
|
|
|
|
|
|
|
|
// xor: 0xD863, sub: 0xA9
|
2024-12-10 01:23:49 +08:00
|
|
|
|
PacketWriter pkt = new PacketWriter();
|
2024-12-11 02:24:51 +08:00
|
|
|
|
pkt.WriteObjectHeader(party_object);
|
|
|
|
|
pkt.WriteObjectHeader(leader); // Accounts receiving the thing
|
2024-12-10 01:23:49 +08:00
|
|
|
|
pkt.Write(people_amount); // Likely partymembercount
|
2024-11-25 23:33:41 +08:00
|
|
|
|
for (int i = 0; i < 4; i++)
|
2024-09-10 00:31:40 +08:00
|
|
|
|
{
|
2024-12-11 03:39:12 +08:00
|
|
|
|
pkt.WriteObjectHeader(entries[i].id);
|
2024-12-10 01:23:49 +08:00
|
|
|
|
pkt.WriteUtf16(entries[i].nickname, 0xD863, 0xA9);
|
|
|
|
|
pkt.WriteUtf16(entries[i].char_name, 0xD863, 0xA9);
|
|
|
|
|
pkt.Write(entries[i].level); // Active class level
|
|
|
|
|
pkt.Write(entries[i].sublevel); // idk
|
|
|
|
|
pkt.Write((byte)entries[i].mainClass); // idk
|
|
|
|
|
pkt.Write((byte)entries[i].subClass); // idk
|
|
|
|
|
pkt.Write((byte)entries[i].color); // idk
|
|
|
|
|
pkt.WriteBytes(0, 7);
|
|
|
|
|
pkt.Write(entries[i].unk2); // idk
|
2024-11-25 23:33:41 +08:00
|
|
|
|
///hp
|
2024-12-10 01:23:49 +08:00
|
|
|
|
pkt.Write((uint)0);
|
|
|
|
|
pkt.Write((uint)0);
|
|
|
|
|
pkt.Write((uint)0);
|
2024-11-25 23:33:41 +08:00
|
|
|
|
/// 玩家所在的地图ID。
|
2024-12-10 01:23:49 +08:00
|
|
|
|
pkt.Write(entries[i].mapid);
|
|
|
|
|
pkt.Write(entries[i].unk3);
|
|
|
|
|
pkt.WriteBytes(0, 12);
|
|
|
|
|
pkt.Write((uint)0);
|
|
|
|
|
pkt.Write((uint)0);
|
|
|
|
|
pkt.WriteUtf16(entries[i].unk6, 0xD863, 0xA9);
|
2024-09-10 00:31:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-10 01:23:49 +08:00
|
|
|
|
pkt.WriteAscii(unk2, 0xD863, 0xA9);
|
|
|
|
|
return pkt.ToArray();
|
2024-09-10 00:31:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|