部分数据包修正 移动数据包

This commit is contained in:
Sancaros 2024-12-06 00:31:51 +08:00
parent 5f1b15e009
commit 7373d98228
13 changed files with 97 additions and 18 deletions

View File

@ -48,7 +48,7 @@ namespace PSO2SERVER.Models
/// Set for all (?) of (0x04) packets. 0x40
OBJECT_RELATED = 1 << 6,
/// 0x44
unk0x44 = 0x44
PACKED_OBJECT_RELATED = PACKED | OBJECT_RELATED
}
}

View File

@ -19,8 +19,8 @@ namespace PSO2SERVER.Protocol.Handlers
return;
// Dunno what these are yet.
context.SendPacket(0x11, 0xA, 0x0, BitConverter.GetBytes(context._account.AccountId));
context.SendPacket(0x1E, 0xC, 0x0, BitConverter.GetBytes(101));
context.SendPacket(0x11, 0x0A, 0x0, BitConverter.GetBytes(context._account.AccountId));
context.SendPacket(new Unk1E0CPacket(101));
Map casinoMap = ZoneManager.Instance.MapFromInstance("casino", "lobby");
casinoMap.SpawnClient(context, casinoMap.GetDefaultLocation());

View File

@ -19,8 +19,8 @@ namespace PSO2SERVER.Protocol.Handlers
return;
// Dunno what these are yet.
context.SendPacket(0x11, 0xA, 0x0, BitConverter.GetBytes(context._account.AccountId));
context.SendPacket(0x1E, 0xC, 0x0, BitConverter.GetBytes(101));
context.SendPacket(0x11, 0x0A, 0x0, BitConverter.GetBytes(context._account.AccountId));
context.SendPacket(new Unk1E0CPacket(101));
Map bridgeMap = ZoneManager.Instance.MapFromInstance("bridge", "lobby");
bridgeMap.SpawnClient(context, bridgeMap.GetDefaultLocation());

View File

@ -19,8 +19,8 @@ namespace PSO2SERVER.Protocol.Handlers
return;
// Dunno what these are yet.
context.SendPacket(0x11, 0xA, 0x0, BitConverter.GetBytes(context._account.AccountId));
context.SendPacket(0x1E, 0xC, 0x0, BitConverter.GetBytes(101));
context.SendPacket(0x11, 0x0A, 0x0, BitConverter.GetBytes(context._account.AccountId));
context.SendPacket(new Unk1E0CPacket(101));
Map dstMap = ZoneManager.Instance.MapFromInstance("cafe", "lobby");
if(dstMap != null)

View File

@ -137,8 +137,8 @@ namespace PSO2SERVER.Protocol.Handlers
if (c.Character == null || c == context || c.CurrentZone != context.CurrentZone)
continue;
c.SendPacket(0x04, 0x07, flags, data);
//c.SendPacket(new MovementPacket(dstData));
//c.SendPacket(0x04, 0x07, flags, data);
c.SendPacket(new MovementPacket(dstData));
}
}

View File

@ -23,9 +23,6 @@ namespace PSO2SERVER.Protocol.Handlers
movData.timestamp = 0;
// This could be simplified
PacketWriter writer = new PacketWriter();
writer.WriteStruct(movData);
//Logger.WriteInternal("[移动] 玩家 {0} 停止移动 (坐标:{1}, {2}, {3})", context.Character.Name,
// Helper.FloatFromHalfPrecision(movData.currentPos.x), Helper.FloatFromHalfPrecision(movData.currentPos.y),
@ -36,7 +33,7 @@ namespace PSO2SERVER.Protocol.Handlers
if (c == context || c.Character == null || c.CurrentZone != context.CurrentZone)
continue;
c.SendPacket(0x04, 0x71, 0x40, writer.ToArray());
c.SendPacket(new MovementEndPacket(movData));
}
}

View File

@ -199,6 +199,8 @@ namespace PSO2SERVER.Protocol.Handlers
// 提交更改到数据库
db.SaveChanges();
SaveNetInterfacesToDatabase(user.AccountId, Username, Interfaces);
}
//TODO 方便GM测试
@ -216,8 +218,6 @@ namespace PSO2SERVER.Protocol.Handlers
user = null;
}
}
SaveNetInterfacesToDatabase(user.AccountId, Username, Interfaces);
}
context.SendPacket(new LoginDataPacket("夢幻之星2", error, (user == null) ? (uint)0 : (uint)user.AccountId));

View File

@ -9,7 +9,7 @@ using PSO2SERVER.Zone;
namespace PSO2SERVER.Protocol.Packets
{
class MovementPacket : Packet
public class MovementPacket : Packet
{
public struct PackedVec4
{

View File

@ -0,0 +1,34 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Protocol.Packets
{
public class MovementEndPacket : Packet
{
MovementPacket.FullMovementData movData = new MovementPacket.FullMovementData();
public MovementEndPacket(MovementPacket.FullMovementData movedata)
{
this.movData = movedata;
}
#region implemented abstract members of Packet
public override byte[] Build()
{
PacketWriter writer = new PacketWriter();
writer.WriteStruct(movData);
return writer.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x04, 0x71, PacketFlags.OBJECT_RELATED);
}
#endregion
}
}

View File

@ -54,7 +54,7 @@ namespace PSO2SERVER.Protocol.Packets
public override PacketHeader GetHeader()
{
return new PacketHeader(0x04, 0x80, PacketFlags.unk0x44);
return new PacketHeader(0x04, 0x80, PacketFlags.PACKED_OBJECT_RELATED);
}
#endregion

View File

@ -8,9 +8,17 @@ namespace PSO2SERVER.Protocol.Packets
{
public class Unk11AFPacket : Packet
{
public uint unk1 { get; set; }
public uint unk2 { get; set; }
public uint unk3 { get; set; }
public uint unk4 { get; set; }
public Unk11AFPacket()
public Unk11AFPacket(uint unk1, uint unk2, uint unk3, uint unk4)
{
this.unk1 = unk1;
this.unk2 = unk2;
this.unk3 = unk3;
this.unk4 = unk4;
}
#region implemented abstract members of Packet
@ -18,6 +26,10 @@ namespace PSO2SERVER.Protocol.Packets
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.Write(unk1);
pkt.Write(unk2);
pkt.Write(unk3);
pkt.Write(unk4);
return pkt.ToArray();
}

View File

@ -0,0 +1,34 @@
using PSO2SERVER.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PSO2SERVER.Protocol.Packets
{
public class Unk1E0CPacket : Packet
{
public uint unk { get; set; }
public Unk1E0CPacket(uint unk)
{
this.unk = unk;
}
#region implemented abstract members of Packet
public override byte[] Build()
{
var pkt = new PacketWriter();
pkt.Write(unk);
return pkt.ToArray();
}
public override PacketHeader GetHeader()
{
return new PacketHeader(0x1E, 0x0C, PacketFlags.None);
}
#endregion
}
}

View File

@ -241,10 +241,12 @@
<Compile Include="Protocol\Handlers\4A-ARKSMisionsHandler\4A-00-MissionListRequest.cs" />
<Compile Include="Protocol\Handlers\4D-ClassicMissionPassHandler\4D-02-MissionPassRequest.cs" />
<Compile Include="Protocol\Handlers\4D-ClassicMissionPassHandler\4D-00-MissionPassInfoRequest.cs" />
<Compile Include="Protocol\Packets\1E-UnkPacket\1E-0C-Unk1E0CPacket.cs" />
<Compile Include="Protocol\Packets\0B-QuestPacket\0B-1C-QuestDifficultySendFinishedPacket.cs" />
<Compile Include="Protocol\Packets\0F-ItemPacket\0F-0C-LoadEquipedPacket.cs" />
<Compile Include="Protocol\Packets\11-ClientPacket\11-42-CreateCharacterOneResponsePacket.cs" />
<Compile Include="Protocol\Packets\11-ClientPacket\11-BD-CharacterShipTransferCancelPacket.cs" />
<Compile Include="Protocol\Packets\04-ObjectRelatedPacket\04-71-MovementEndPacket.cs" />
<Compile Include="Protocol\Packets\4A-ARKSMissionPacket\4A-03-Unk4A03Packet.cs" />
<Compile Include="Protocol\Packets\4A-ARKSMissionPacket\4A-01-ARKSMissionListPacket.cs" />
<Compile Include="Protocol\Packets\07-ChatPacket\07-00-ChatPacket.cs" />