Init enter game

This commit is contained in:
Naruse
2025-06-14 11:15:32 +08:00
commit 6a03b39f07
568 changed files with 92872 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
using KianaBH.GameServer.Server.Packet.Send.Client;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.ClientReportReq)]
public class HandlerClientReportReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
await connection.SendPacket(new PacketClientReportRsp());
}
}

View File

@@ -0,0 +1,15 @@
using KianaBH.GameServer.Server.Packet.Send.Client;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.GetClientDataReq)]
public class HandlerGetClientDataReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = GetClientDataReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketGetClientDataRsp(req.Id,req.Type, connection.Player!));
}
}

View File

@@ -0,0 +1,13 @@
using KianaBH.GameServer.Server.Packet.Send.Client;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.GetClientMailDataReq)]
public class HandlerGetClientMailDataReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
await connection.SendPacket(new PacketGetClientMailDataRsp());
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Client;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.GetClientSettingReq)]
public class HandlerGetClientSettingReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = GetClientSettingReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketGetClientSettingRsp(req.ClientSettingType));
}
}

View File

@@ -0,0 +1,13 @@
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.KeepAliveNotify)]
public class HandlerKeepAliveNotify : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
await connection.Player!.OnHeartBeat();
await connection.SendPacket(CmdIds.KeepAliveNotify);
}
}

View File

@@ -0,0 +1,14 @@
using KianaBH.GameServer.Server.Packet.Send.Client;
using KianaBH.Proto;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.ReportClientDataVersionReq)]
public class HandlerReportClientDataVersionReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = ReportClientDataVersionReq.Parser.ParseFrom(data);
await connection.SendPacket(new PacketReportClientDataVersionRsp(req.Version));
}
}

View File

@@ -0,0 +1,27 @@
using KianaBH.GameServer.Game.Player;
using KianaBH.GameServer.Server.Packet.Send.Client;
using KianaBH.Proto;
using KianaBH.Database.Client;
namespace KianaBH.GameServer.Server.Packet.Recv.Client;
[Opcode(CmdIds.SetClientDataReq)]
public class HandlerSetClientDataReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = SetClientDataReq.Parser.ParseFrom(data);
PlayerInstance player = connection.Player!;
var clientData = player.ClientData!.Clients.FirstOrDefault(c => c.Id == req.ClientData.Id && c.Type == req.ClientData.Type);
if (clientData == null)
{
player.ClientData.Clients.Add(new ClientDBData
{
Id = req.ClientData.Id,
Type = req.ClientData.Type,
Data = req.ClientData.Data.ToByteArray(),
});
}
await connection.SendPacket(new PacketSetClientDataRsp(req.ClientData.Id,req.ClientData.Type));
}
}