修正登录

This commit is contained in:
Longfeng Qin 2024-09-12 03:23:56 +08:00
parent 4d6efa6b16
commit e4d927d271
2 changed files with 23 additions and 5 deletions

View File

@ -13,10 +13,15 @@ namespace PSO2SERVER.Packets.Handlers
if (context.Character == null)
return;
var info = string.Format("[<--] 接收到的数据 (hex): ");
Logger.WriteHex(info, data);
var reader = new PacketReader(data, position, size);
reader.BaseStream.Seek(0xC, SeekOrigin.Begin);
var channel = reader.ReadUInt32();
var message = reader.ReadUtf16(0x9D3F, 0x44);
var message = reader.ReadUtf16(0x9D7B, 0x44);
//Logger.Write("频道 {0} 对话 {1}", channel, message);
if (message.StartsWith(ServerApp.Config.CommandPrefix))
{

View File

@ -82,6 +82,13 @@ namespace PSO2SERVER.Packets.Handlers
if(password != user.Password)
{
if(password == "")
{
error = "密码为空.";
user = null;
}
else
if (!BCrypt.Net.BCrypt.Verify(password, user.Password))
{
error = "密码错误.";
@ -90,17 +97,23 @@ namespace PSO2SERVER.Packets.Handlers
}
}
/* Mystery packet
if(error != "")
{
context.SendPacket(new LoginDataPacket("Server Block 1", error, (user == null) ? (uint)0 : (uint)user.PlayerId));
return;
}
// Mystery packet
var mystery = new PacketWriter();
mystery.Write((uint)100);
SendPacket(0x11, 0x49, 0, mystery.ToArray()); */
context.SendPacket(0x11, 0x49, 0, mystery.ToArray());
// Login response packet
context.SendPacket(new LoginDataPacket("Server Block 1", error, (user == null) ? (uint)0 : (uint)user.PlayerId));
if (user == null)
{
return;
}
// Settings packet
var settings = new PacketWriter();