增加部分数据包

This commit is contained in:
Longfeng Qin 2024-09-18 01:50:29 +08:00
parent 67486fdb68
commit 41b941fb7b
21 changed files with 594 additions and 27 deletions

View File

@ -46,7 +46,9 @@ namespace PSO2SERVER.Models
/// Set when the [`Packet::Movement`] has all fields set. 0x20
FULL_MOVEMENT = 1 << 5,
/// Set for all (?) of (0x04) packets. 0x40
OBJECT_RELATED = 1 << 6
OBJECT_RELATED = 1 << 6,
/// 0x44
unk0x44 = 0x44
}
}

View File

@ -1,4 +1,5 @@
using PSO2SERVER.Models;
using PSO2SERVER.Packets.PSOPackets;
using System;
using System.Collections.Generic;
using System.Linq;
@ -35,19 +36,20 @@ namespace PSO2SERVER.Packets.Handlers
{
if (c == context || c.Character == null || c.CurrentZone != context.CurrentZone)
continue;
PacketWriter output = new PacketWriter();
output.WriteStruct(new ObjectHeader((uint)context.User.PlayerId, EntityType.Player));
output.WriteStruct(preformer);
output.Write(preData);
output.WriteAscii(command, 0x4315, 0x7A);
output.Write(rest);
output.WriteMagic(thingCount, 0x4315, 0x7A);
output.Write(things);
output.Write(final);
c.SendPacket(0x4, 0x80, 0x44, output.ToArray());
//PacketWriter output = new PacketWriter();
//output.WriteStruct(new ObjectHeader((uint)context.User.PlayerId, EntityType.Player));
//output.WriteStruct(preformer);
//output.Write(preData);
//output.WriteAscii(command, 0x4315, 0x7A);
//output.Write(rest);
//output.WriteMagic(thingCount, 0x4315, 0x7A);
//output.Write(things);
//output.Write(final);
//c.SendPacket(0x4, 0x80, 0x44, output.ToArray());
c.SendPacket(new MovementActionServerPacket(context.User.PlayerId, preformer, preData
, command, rest, thingCount, things, final));
}
}
}

View File

@ -1,4 +1,5 @@
using PSO2SERVER.Models;
using PSO2SERVER.Packets.PSOPackets;
using System;
using System.Collections.Generic;
using System.Linq;
@ -21,12 +22,13 @@ namespace PSO2SERVER.Packets.Handlers
{
if (c == context || c.Character == null || c.CurrentZone != context.CurrentZone)
continue;
PacketWriter writer = new PacketWriter();
writer.WriteStruct(new ObjectHeader((uint)c.User.PlayerId, EntityType.Player));
writer.WriteStruct(actor);
writer.Write(rest);
//PacketWriter writer = new PacketWriter();
//writer.WriteStruct(new ObjectHeader((uint)c.User.PlayerId, EntityType.Player));
//writer.WriteStruct(actor);
//writer.Write(rest);
c.SendPacket(0x4, 0x81, 0x40, writer.ToArray());
//c.SendPacket(0x4, 0x81, 0x40, writer.ToArray());
c.SendPacket(new ActionUpdateServerPacket(c.User.PlayerId, actor, rest));
}
}

View File

@ -1,4 +1,5 @@
using System;
using PSO2SERVER.Packets.PSOPackets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -13,13 +14,14 @@ namespace PSO2SERVER.Packets.Handlers
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
var writer = new PacketWriter();
writer.Write((uint)0);
writer.Write((uint)0);
writer.Write((uint)0);
writer.Write((uint)0);
//var writer = new PacketWriter();
//writer.Write((uint)0);
//writer.Write((uint)0);
//writer.Write((uint)0);
//writer.Write((uint)0);
context.SendPacket(0x11, 0x42, 0x0, writer.ToArray());
//context.SendPacket(0x11, 0x42, 0x0, writer.ToArray());
context.SendPacket(new CreateCharacterOneResponsePacket());
}
#endregion

View File

@ -14,10 +14,12 @@ namespace PSO2SERVER.Packets.Handlers
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
var writer = new PacketWriter();
writer.Write((uint) 0);
//var writer = new PacketWriter();
//writer.Write((uint) 0);
context.SendPacket(0x11, 0x55, 0x0, writer.ToArray());
//context.SendPacket(0x11, 0x55, 0x0, writer.ToArray());
context.SendPacket(new CreateCharacterTwoResponsePacket(0));
}
#endregion

View File

@ -0,0 +1,62 @@
using Mysqlx.Crud;
using Mysqlx.Session;
using Org.BouncyCastle.Utilities;
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.Remoting.Contexts;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class MovementActionServerPacket : Packet
{
private readonly int _user_playerid;
private readonly ObjectHeader _preformer;
private readonly byte[] _preData;
private readonly string _command;
private readonly byte[] _rest;
private readonly uint _thingCount;
private readonly byte[] _things;
private readonly byte[] _final;
public MovementActionServerPacket(int user_playerid, ObjectHeader preformer, byte[] preData
, string command, byte[] rest, uint thingCount, byte[] things, byte[] final
)
{
_user_playerid = user_playerid;
_preformer = preformer;
_preData = preData;
_command = command;
_rest = rest;
_thingCount = thingCount;
_things = things;
_final = things;
}
#region implemented abstract members of Packet
public override byte[] Build()
{
PacketWriter output = new PacketWriter();
output.WriteStruct(new ObjectHeader((uint)_user_playerid, EntityType.Player));
output.WriteStruct(_preformer);
output.Write(_preData);
output.WriteAscii(_command, 0x4315, 0x7A);
output.Write(_rest);
output.WriteMagic(_thingCount, 0x4315, 0x7A);
output.Write(_things);
output.Write(_final);
return output.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x04, 0x80, PacketFlags.unk0x44);
}
#endregion
}
}

View File

@ -0,0 +1,43 @@
using Mysqlx.Crud;
using Mysqlx.Session;
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class ActionUpdateServerPacket : Packet
{
private readonly int _user_playerid;
private readonly ObjectHeader _actor;
private readonly byte[] _rest;
public ActionUpdateServerPacket(int user_playerid, ObjectHeader actor, byte[] rest)
{
_user_playerid = user_playerid;
_actor = actor;
_rest = rest;
}
#region implemented abstract members of Packet
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.WriteStruct(new ObjectHeader((uint)_user_playerid, EntityType.Player));
writer.WriteStruct(_actor);
writer.Write(_rest);
return writer.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x04, 0x81, PacketFlags.OBJECT_RELATED);
}
#endregion
}
}

View File

@ -0,0 +1,55 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class CreateCharacterOneResponsePacket : Packet
{
public struct CreateCharacter1ResponsePacket
{
/// <summary>
/// Creation status.
/// </summary>
public uint Status;
public uint Unk2;
public uint UsedSmth;
/// <summary>
/// Required AC to buy a character creation pass.
/// </summary>
public uint ReqAc;
public CreateCharacter1ResponsePacket(uint status, uint unk2, uint usedSmth, uint reqAc) : this()
{
Status = status;
Unk2 = unk2;
UsedSmth = usedSmth;
ReqAc = reqAc;
}
}
public CreateCharacterOneResponsePacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.WriteStruct(new CreateCharacter1ResponsePacket(0, 0, 0, 0));
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x11, 0x42, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,41 @@
using PSO2SERVER.Models;
using System;
namespace PSO2SERVER.Packets.PSOPackets
{
public class CreateCharacterTwoResponsePacket : Packet
{
private readonly uint _referral_flag;
public struct CreateCharacter2ResponsePacket
{
public uint ReferralFlag { get; }
public CreateCharacter2ResponsePacket(uint referral_flag)
{
ReferralFlag = referral_flag;
}
}
public CreateCharacterTwoResponsePacket(uint referral_flag)
{
_referral_flag = referral_flag;
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.WriteStruct(new CreateCharacter2ResponsePacket(_referral_flag));
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x11, 0x55, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class SetFlagPacket : Packet
{
public SetFlagPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x02, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class ServerSetFlagPacket : Packet
{
public ServerSetFlagPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x04, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class ServerSetParamPacket : Packet
{
public ServerSetParamPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x05, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class AccountFlagsPacket : Packet
{
public AccountFlagsPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x06, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class CharacterFlagsPacket : Packet
{
public CharacterFlagsPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x07, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class CutsceneEndPacket : Packet
{
public CutsceneEndPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x0A, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class SkitItemAddRequestPacket : Packet
{
public SkitItemAddRequestPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x0B, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class SkitItemAddResponsePacket : Packet
{
public SkitItemAddResponsePacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x0C, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class Unk230DPacket : Packet
{
public Unk230DPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x0D, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class Unk230EPacket : Packet
{
public Unk230EPacket()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x0E, PacketFlags.None);
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Packets.PSOPackets
{
public class Unk2315Packet : Packet
{
public Unk2315Packet()
{
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x23, 0x15, PacketFlags.None);
}
#endregion
}
}

View File

@ -204,10 +204,14 @@
<Compile Include="Packets\Handlers\11-ClientHandler\11-41-CreateCharacterOne.cs" />
<Compile Include="Packets\Handlers\2F-SymbolHandler\2F-06-SymbolArtHandler.cs" />
<Compile Include="Packets\PSOPackets\03-ServerPacket\03-00-MapTransferPacket.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-80-MovementActionServerPacket.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-81-ActionUpdateServerPacket.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-3B-DespawnPlayerPacket.cs" />
<Compile Include="Packets\PSOPackets\06-PlayerStatusPackets\06-00-SetPlayerIDPacket.cs" />
<Compile Include="Packets\PSOPackets\08-SpawnPacket\08-0C-NPCSpawnPacket.cs" />
<Compile Include="Packets\PSOPackets\08-SpawnPacket\08-0B-ObjectSpawnPacket.cs" />
<Compile Include="Packets\PSOPackets\11-ClientPacket\11-55-CreateCharacterTwoResponsePacket.cs" />
<Compile Include="Packets\PSOPackets\11-ClientPacket\11-42-CreateCharacterOneResponsePacket.cs" />
<Compile Include="Packets\PSOPackets\11-ClientPacket\11-03-CharacterListPacket.cs" />
<Compile Include="Packets\PSOPackets\11-ClientPacket\11-07-CharacterCreateResponsePacket.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-06-DespawnObjectPacket.cs" />
@ -230,6 +234,17 @@
<Compile Include="Packets\PSOPackets\0F-ItemPacket\0F-14-SetMesetaPacket.cs" />
<Compile Include="Packets\PSOPackets\0E-PartyPacket\0E-25-SetQuestPacket.cs" />
<Compile Include="Packets\PSOPackets\03-ServerPacket\03-04-LoadingScreenTransitionPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-02-SetFlagPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-04-ServerSetFlagPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-05-ServerSetParamPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-06-AccountFlagsPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-0A-CutsceneEndPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-0C-SkitItemAddResponsePacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-0D-Unk230DPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-0E-Unk230EPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-15-Unk2315Packet.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-0B-SkitItemAddRequestPacket.cs" />
<Compile Include="Packets\PSOPackets\23-FlagPackets\23-07-CharacterFlagsPacket.cs" />
<Compile Include="Packets\PSOPackets\UN-UN-SetScenePacket.cs" />
<Compile Include="Packets\PSOPackets\2F-SymbolPacket\2F-07-SymbolArtList.cs" />
<Compile Include="Packets\PSOPackets\04-ObjectPacket\04-02-TeleportTransferPacket.cs" />