2024-09-16 17:09:36 +08:00
|
|
|
|
using PSO2SERVER.Models;
|
2024-12-11 20:47:36 +08:00
|
|
|
|
using PSO2SERVER.Party;
|
2024-09-16 17:09:36 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2024-11-27 18:05:53 +08:00
|
|
|
|
namespace PSO2SERVER.Protocol.Packets
|
2024-09-16 17:09:36 +08:00
|
|
|
|
{
|
2024-09-18 04:21:17 +08:00
|
|
|
|
public class AddMemberPacket : Packet
|
2024-09-16 17:09:36 +08:00
|
|
|
|
{
|
2024-12-11 20:47:36 +08:00
|
|
|
|
// New player object.
|
|
|
|
|
public ObjectHeader NewMember { get; set; }
|
2024-09-16 17:09:36 +08:00
|
|
|
|
|
2024-12-11 20:47:36 +08:00
|
|
|
|
// Party color of the player.
|
|
|
|
|
public PartyColor Color { get; set; }
|
|
|
|
|
|
|
|
|
|
// Level of the main class.
|
|
|
|
|
public uint Level { get; set; }
|
|
|
|
|
|
|
|
|
|
// Level of the subclass.
|
|
|
|
|
public uint Sublevel { get; set; }
|
|
|
|
|
|
|
|
|
|
// Class of the player.
|
|
|
|
|
public ClassType PlayerClass { get; set; }
|
|
|
|
|
|
|
|
|
|
// Subclass of the player.
|
|
|
|
|
public ClassType SubClass { get; set; }
|
|
|
|
|
|
|
|
|
|
// Padding (3 bytes).
|
|
|
|
|
public byte[] Padding { get; set; } = new byte[3];
|
|
|
|
|
|
|
|
|
|
// Nickname of the player.
|
|
|
|
|
public string Nickname { get; set; }
|
|
|
|
|
|
|
|
|
|
// Name of the character.
|
|
|
|
|
public string CharName { get; set; }
|
|
|
|
|
|
|
|
|
|
// Unk5 (12 bytes).
|
|
|
|
|
public byte[] Unk5 { get; set; } = new byte[0xC];
|
|
|
|
|
|
|
|
|
|
// Unk6 (16-bit).
|
|
|
|
|
public ushort Unk6 { get; set; }
|
|
|
|
|
|
|
|
|
|
// Unk7 (2 bytes).
|
|
|
|
|
public byte[] Unk7 { get; set; } = new byte[2];
|
|
|
|
|
|
|
|
|
|
// HP of the player (3 values).
|
|
|
|
|
public uint[] Hp { get; set; } = new uint[3];
|
|
|
|
|
|
|
|
|
|
// Map ID where the player is located.
|
|
|
|
|
public ushort MapId { get; set; }
|
|
|
|
|
|
|
|
|
|
// Unk10 (4 bytes).
|
|
|
|
|
public byte[] Unk10 { get; set; } = new byte[4];
|
|
|
|
|
|
|
|
|
|
// Unk11 (16-bit).
|
|
|
|
|
public ushort Unk11 { get; set; }
|
|
|
|
|
|
|
|
|
|
// Unk12 (32-bit).
|
|
|
|
|
public uint Unk12 { get; set; }
|
|
|
|
|
|
|
|
|
|
// Unk13 (12 bytes).
|
|
|
|
|
public byte[] Unk13 { get; set; } = new byte[0xC];
|
|
|
|
|
|
|
|
|
|
// Unk14 (3 values of uint).
|
|
|
|
|
public uint[] Unk14 { get; set; } = new uint[3];
|
|
|
|
|
|
|
|
|
|
// Unk15 (string).
|
|
|
|
|
public string Unk15 { get; set; }
|
|
|
|
|
|
|
|
|
|
// Unk16 (AsciiString).
|
|
|
|
|
public string Unk16 { get; set; }
|
|
|
|
|
|
|
|
|
|
// NGS Packet Only (if applicable).
|
|
|
|
|
public string Unk17 { get; set; } // Only if feature is enabled
|
|
|
|
|
|
|
|
|
|
// Constructor
|
2024-09-18 04:21:17 +08:00
|
|
|
|
public AddMemberPacket()
|
2024-09-16 17:09:36 +08:00
|
|
|
|
{
|
2024-12-11 20:47:36 +08:00
|
|
|
|
Padding = new byte[3];
|
|
|
|
|
Unk5 = new byte[0xC];
|
|
|
|
|
Unk7 = new byte[2];
|
|
|
|
|
Hp = new uint[3];
|
|
|
|
|
Unk10 = new byte[4];
|
|
|
|
|
Unk13 = new byte[0xC];
|
|
|
|
|
Unk14 = new uint[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AddMemberPacket(Client client)
|
|
|
|
|
{
|
|
|
|
|
NewMember = new ObjectHeader((uint)client._account.AccountId, ObjectType.Player);
|
|
|
|
|
Color = client.currentParty.AddColor(0);
|
|
|
|
|
var character = client.Character;
|
|
|
|
|
Level = character.Jobs.entries.hunter.level;
|
|
|
|
|
Sublevel = character.Jobs.entries.ranger.level;
|
|
|
|
|
PlayerClass = character.Jobs.mainClass;
|
|
|
|
|
SubClass = character.Jobs.subClass;
|
|
|
|
|
Nickname = client._account.Nickname;
|
|
|
|
|
CharName = character.Name;
|
|
|
|
|
MapId = (ushort)client.CurrentMap.MapID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public AddMemberPacket(PartyInitPacket pkt)
|
|
|
|
|
{
|
|
|
|
|
NewMember = pkt.leader;
|
|
|
|
|
Color = PartyColor.Red;
|
2024-09-16 17:09:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region implemented abstract members of Packet
|
|
|
|
|
|
|
|
|
|
public override byte[] Build()
|
|
|
|
|
{
|
2024-09-17 11:29:41 +08:00
|
|
|
|
var pkt = new PacketWriter();
|
2024-12-11 20:47:36 +08:00
|
|
|
|
pkt.WriteObjectHeader(NewMember);
|
|
|
|
|
pkt.Write((byte)Color);
|
|
|
|
|
pkt.Write(Level);
|
|
|
|
|
pkt.Write(Sublevel);
|
|
|
|
|
pkt.WriteEnum(PlayerClass);
|
|
|
|
|
pkt.WriteEnum(SubClass);
|
|
|
|
|
pkt.Write(Padding);
|
|
|
|
|
pkt.WriteUtf16(Nickname, 0xCCE7, 0x13);
|
|
|
|
|
pkt.WriteUtf16(CharName, 0xCCE7, 0x13);
|
|
|
|
|
pkt.Write(Unk5);
|
|
|
|
|
pkt.Write(Unk6);
|
|
|
|
|
pkt.Write(Unk7);
|
|
|
|
|
pkt.WriteIntArray(Hp);
|
|
|
|
|
pkt.Write(MapId);
|
|
|
|
|
pkt.Write(Unk10);
|
|
|
|
|
pkt.Write(Unk11);
|
|
|
|
|
pkt.Write(Unk12);
|
|
|
|
|
pkt.Write(Unk13);
|
|
|
|
|
pkt.WriteIntArray(Unk14);
|
|
|
|
|
pkt.WriteUtf16(Unk15, 0xCCE7, 0x13);
|
|
|
|
|
pkt.WriteAscii(Unk16, 0xCCE7, 0x13);
|
|
|
|
|
//NGS
|
|
|
|
|
//pkt.WriteAscii(Unk17, 0xCCE7, 0x13);
|
|
|
|
|
|
2024-09-17 11:29:41 +08:00
|
|
|
|
return pkt.ToArray();
|
2024-09-16 17:09:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override PacketHeader GetHeader()
|
|
|
|
|
{
|
2024-12-11 20:47:36 +08:00
|
|
|
|
return new PacketHeader(0x0E, 0x00, PacketFlags.PACKED);
|
2024-09-16 17:09:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|