pcap loader, first login packet

This commit is contained in:
raphaeIl
2025-01-13 04:29:00 -05:00
parent c331b9b89a
commit aae2dc6b55
9 changed files with 659 additions and 29 deletions

View File

@@ -3,6 +3,8 @@ using Novaria.Common.Core;
using Proto;
using Serilog;
using System.Text.Json;
using Novaria.PcapParser;
using Novaria.Common.Crypto;
namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
{
@@ -33,30 +35,48 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
public Packet PlayerDataHandler(Nil req)
{
// example: different netmsgid returned, if new player player_new_notify, other wise player_data_ack
PlayerInfo player_data_ack = new PlayerInfo()
AccInfo accountInfo = new AccInfo()
{
Acc = new AccInfo()
{
Id = 1,
NickName = "seggs",
Gender = true,
}
Id = 1,
Hashtag = 4562,
HeadIcon = 100101,
NickName = "夏萝莉是小楠梁",
Gender = false,
Signature = "",
TitlePrefix = 1,
TitleSuffix = 1,
SkinId = 10301,
CreateTime = DateTime.Now.Ticks,
};
Log.Information("Sending player_new_notify packet: " + JsonSerializer.Serialize(player_data_ack));
return Packet.Create(NetMsgId.player_new_notify, new Nil());
accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 101, StepId = -1 });
accountInfo.Newbies.Add(new NewbieInfo() { GroupId = 102, StepId = -1 });
byte[] real_key = AeadTool.key3;
// load from pcap
PcapParser.PcapParser.Instance.Parse("first_instant_join.json");
PlayerInfo pcapPlayerInfo = (PlayerInfo)PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.player_data_succeed_ack);
PlayerInfo playerInfoResponse = new PlayerInfo()
{
Acc = pcapPlayerInfo.Acc
};
AeadTool.key3 = real_key;
Log.Information("Sending player_new_notify packet: " + JsonSerializer.Serialize(pcapPlayerInfo));
return Packet.Create(NetMsgId.player_data_succeed_ack, pcapPlayerInfo);
}
[ProtocolHandler(NetMsgId.player_reg_req)]
public Packet PlayerRegHandler(PlayerReg req)
{
Log.Information("player_reg_req received, contents: " + JsonSerializer.Serialize(req));
//Log.Information("Sending PlayerInfo packet: " + JsonSerializer.Serialize(playerInfoResp));
return null;
}
//[ProtocolHandler(NetMsgId.player_reg_req)]
//public Packet PlayerRegHandler(PlayerReg req)
//{
// Log.Information("player_reg_req received, contents: " + JsonSerializer.Serialize(req));
// //Log.Information("Sending PlayerInfo packet: " + JsonSerializer.Serialize(playerInfoResp));
// return null;
//}
}
}

View File

@@ -3,6 +3,7 @@ using Novaria.Common.Core;
using Proto;
using Serilog;
using System.Reflection;
using Novaria.PcapParser;
namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
{