mirror of
https://github.com/raphaeIl/Novaria.git
synced 2025-12-15 07:54:36 +01:00
pcap loader, first login packet
This commit is contained in:
@@ -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;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Novaria.Common.Core;
|
||||
using Proto;
|
||||
using Serilog;
|
||||
using System.Reflection;
|
||||
using Novaria.PcapParser;
|
||||
|
||||
namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user