2024-12-06 19:47:18 +08:00
|
|
|
|
using PSO2SERVER.Models;
|
|
|
|
|
using System;
|
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
|
|
|
|
{
|
|
|
|
|
class LoginDataPacket : Packet
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public enum LoginStatus : uint
|
2024-09-22 11:14:48 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Login was successful.
|
|
|
|
|
/// </summary>
|
|
|
|
|
Success = 0,
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Login failed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
Failure = 1,
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Undefined status.
|
|
|
|
|
/// </summary>
|
|
|
|
|
Undefined = 0xFFFFFFFF
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public LoginStatus Status;
|
|
|
|
|
public string Error;
|
|
|
|
|
public ObjectHeader Player;
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public string BlockName = new string(' ', 0x20);
|
2024-12-06 21:49:29 +08:00
|
|
|
|
public float Unk1 = 0;
|
|
|
|
|
public uint Unk2 = 0;
|
|
|
|
|
public uint LevelCap = 0;
|
|
|
|
|
public uint LevelCap2 = 0;
|
|
|
|
|
public uint Unk5 = 0;
|
|
|
|
|
public float Unk6 = 0;
|
|
|
|
|
public float Unk7 = 0;
|
|
|
|
|
public uint Unk8 = 0;
|
|
|
|
|
public float Unk9 = 0;
|
|
|
|
|
public float Unk10 = 0;
|
|
|
|
|
public uint Unk11 = 0;
|
|
|
|
|
public float Unk12 = 0;
|
|
|
|
|
public uint Unk13 = 0;
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public float[] Unk14 = new float[10]; // Length: 10
|
|
|
|
|
public float[] Unk15 = new float[21]; // Length: 21
|
2024-12-06 21:49:29 +08:00
|
|
|
|
public float Unk16 = 0;
|
|
|
|
|
public float Unk17 = 0;
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public float[] Unk18 = new float[9]; // Length: 9
|
|
|
|
|
public uint[] Unk19 = new uint[2]; // Length: 2
|
2024-12-06 21:49:29 +08:00
|
|
|
|
public uint Unk20 = 0;
|
|
|
|
|
public uint Unk21 = 0;
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public float[] Unk22 = new float[3]; // Length: 3
|
2024-12-06 21:49:29 +08:00
|
|
|
|
public uint Unk23 = 0;
|
|
|
|
|
public float Unk24 = 0;
|
|
|
|
|
public float Unk25 = 0;
|
|
|
|
|
public uint Unk26 = 0;
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public byte[] Unk27 = new byte[12]; // Length: 12
|
|
|
|
|
public string Unk28 = new string(' ', 0x20);
|
2024-12-06 21:49:29 +08:00
|
|
|
|
public uint Unk29 = 0;
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public string Unk30 = new string(' ', 0x20);
|
2024-12-06 21:49:29 +08:00
|
|
|
|
public uint Unk31 = 0;
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public LoginDataPacket(string blockName, string error, uint userid)
|
2024-09-22 11:14:48 +08:00
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
Status = (userid == 0) ? LoginStatus.Failure : LoginStatus.Success;
|
|
|
|
|
Error = error;
|
|
|
|
|
Player = new ObjectHeader(userid, ObjectType.Player);
|
|
|
|
|
BlockName = blockName;
|
|
|
|
|
Unk1 = 0x42700000;
|
|
|
|
|
Unk2 = 7;
|
|
|
|
|
LevelCap = 0x0A;
|
|
|
|
|
LevelCap2 = 1;
|
|
|
|
|
Unk5 = 0x41200000;
|
|
|
|
|
Unk6 = 0x40A00000;
|
|
|
|
|
Unk7 = 11;
|
|
|
|
|
Unk8 = 0x3F800000;
|
|
|
|
|
Unk9 = 0x42960000;
|
|
|
|
|
Unk10 = 40;
|
|
|
|
|
Unk11 = 0x41200000;
|
|
|
|
|
Unk12 = 1;
|
|
|
|
|
Unk13 = 1120403456;
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
//WHAT
|
2024-09-22 11:14:48 +08:00
|
|
|
|
for (int i = 0; i < Unk14.Length; i++)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
Unk14[i] = 1065353216;
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
//ARE
|
2024-09-22 11:14:48 +08:00
|
|
|
|
for (int i = 0; i < Unk15.Length; i++)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
Unk15[i] = 1120403456;
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
public override byte[] Build()
|
2024-09-22 11:14:48 +08:00
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
var pkt = new PacketWriter();
|
|
|
|
|
pkt.Write((uint)Status);
|
|
|
|
|
pkt.WriteUtf16(Error, 0x8BA4, 0xB6);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
|
|
|
|
if (Player.ID == 0)
|
|
|
|
|
{
|
|
|
|
|
for (var i = 0; i < 0xEC; i++)
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write((byte)0);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
Player.WriteObjectHeaderToStream(pkt);
|
|
|
|
|
pkt.WriteFixedLengthUtf16(BlockName, 0x20);
|
|
|
|
|
pkt.Write(Unk1);
|
|
|
|
|
pkt.Write(Unk2);
|
|
|
|
|
pkt.Write(LevelCap);
|
|
|
|
|
pkt.Write(LevelCap2);
|
|
|
|
|
pkt.Write(Unk5);
|
|
|
|
|
pkt.Write(Unk6);
|
|
|
|
|
pkt.Write(Unk7);
|
|
|
|
|
pkt.Write(Unk8);
|
|
|
|
|
pkt.Write(Unk9);
|
|
|
|
|
pkt.Write(Unk10);
|
|
|
|
|
pkt.Write(Unk11);
|
|
|
|
|
pkt.Write(Unk12);
|
|
|
|
|
pkt.Write(Unk13);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
|
|
|
|
foreach (var val in Unk14)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(val);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var val in Unk15)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(val);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(Unk16);
|
|
|
|
|
pkt.Write(Unk17);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
|
|
|
|
foreach (var val in Unk18)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(val);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var val in Unk19)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(val);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(Unk20);
|
|
|
|
|
pkt.Write(Unk21);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
|
|
|
|
|
foreach (var val in Unk22)
|
|
|
|
|
{
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(val);
|
2024-09-22 11:14:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
pkt.Write(Unk23);
|
|
|
|
|
pkt.Write(Unk24);
|
|
|
|
|
pkt.Write(Unk25);
|
|
|
|
|
pkt.Write(Unk26);
|
|
|
|
|
pkt.Write(Unk27);
|
|
|
|
|
pkt.WriteFixedLengthUtf16(Unk28, 0x20);
|
|
|
|
|
pkt.Write(Unk29);
|
|
|
|
|
pkt.WriteFixedLengthUtf16(Unk30, 0x20);
|
|
|
|
|
pkt.Write(Unk31);
|
2024-09-10 00:31:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-06 19:47:18 +08:00
|
|
|
|
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(0x11, 0x01, PacketFlags.PACKED);
|
2024-09-10 00:31:40 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|