implement more handler

This commit is contained in:
ArkanDash
2025-03-03 23:21:28 +07:00
parent 54bb351e5b
commit e1b4dd45e5
6 changed files with 91 additions and 5 deletions

View File

@@ -18,16 +18,16 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
[ProtocolHandler(NetMsgId.player_login_req)] // req id goes here [ProtocolHandler(NetMsgId.player_login_req)] // req id goes here
public Packet PlayerLoginHandler(LoginReq req) public Packet PlayerLoginHandler(LoginReq req)
{ {
Log.Information("login_req received, contents: " + JsonSerializer.Serialize(req)); //Log.Information("login_req received, contents: " + JsonSerializer.Serialize(req));
Log.Information("Building login resp..."); //Log.Information("Building login resp...");
LoginResp loginResp = new LoginResp() LoginResp loginResp = new LoginResp()
{ {
Token = "seggstoken", Token = "seggstoken",
}; };
Log.Information("Sending login_resp packet: " + JsonSerializer.Serialize(loginResp)); //Log.Information("Sending login_resp packet: " + JsonSerializer.Serialize(loginResp));
return Packet.Create(NetMsgId.player_login_succeed_ack, loginResp); return Packet.Create(NetMsgId.player_login_succeed_ack, loginResp);
} }
@@ -621,7 +621,7 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
{ {
return Packet.Create(NetMsgId.player_ping_succeed_ack, new Pong() return Packet.Create(NetMsgId.player_ping_succeed_ack, new Pong()
{ {
ServerTs = DateTime.Now.Ticks, ServerTs = 1736745112,
}); });
} }

View File

@@ -0,0 +1,19 @@
using Google.Protobuf;
using Novaria.Common.Core;
using Proto;
namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
{
public class Phone : ProtocolHandlerBase
{
public Phone(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory)
{
}
[ProtocolHandler(NetMsgId.phone_contacts_info_req)]
public Packet PhoneContactsInfoHandler(Nil req)
{
return Packet.Create(NetMsgId.phone_contacts_info_succeed_ack, PcapParser.PcapParser.Instance.GetPcapPacket(NetMsgId.phone_contacts_info_succeed_ack));
}
}
}

View File

@@ -0,0 +1,21 @@
using Google.Protobuf;
using Novaria.Common.Core;
using Proto;
namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
{
public class Player : ProtocolHandlerBase
{
public Player(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory)
{
}
[ProtocolHandler(NetMsgId.player_board_set_req)]
public Packet PlayerBoardSetHandler(PlayerBoardSetReq req)
{
ChangeInfo changeInfo = new();
return Packet.Create(NetMsgId.player_board_set_succeed_ack, changeInfo);
}
}
}

View File

@@ -0,0 +1,21 @@
using Google.Protobuf;
using Novaria.Common.Core;
using Proto;
namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
{
public class Plot : ProtocolHandlerBase
{
public Plot(IProtocolHandlerFactory protocolHandlerFactory) : base(protocolHandlerFactory)
{
}
[ProtocolHandler(NetMsgId.plot_reward_receive_req)]
public Packet PlotRewardReceiveHandler(UI32 req)
{
ChangeInfo resp = new ChangeInfo();
return Packet.Create(NetMsgId.plot_reward_receive_succeed_ack, resp);
}
}
}

View File

@@ -1,3 +1,4 @@
using Google.Protobuf;
using Novaria.Common.Core; using Novaria.Common.Core;
using Proto; using Proto;
using Serilog; using Serilog;
@@ -18,5 +19,29 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
return Packet.Create(NetMsgId.region_boss_level_apply_succeed_ack, regionBossChangeInfo); return Packet.Create(NetMsgId.region_boss_level_apply_succeed_ack, regionBossChangeInfo);
} }
[ProtocolHandler(NetMsgId.region_boss_level_settle_req)]
public Packet RegionBossLevelSettleHandler(RegionBossLevelSettleReq req)
{
RegionBossLevelSettleResp regionBossLevelSettleResp = new RegionBossLevelSettleResp()
{
First = true,
ThreeStar = true,
Change = new(),
//AwardItems = [],
//FirstItems = [],
//ThreeStarItems = [],
Exp = 0,
//SurpriseItems = [],
NextPackage = ByteString.Empty
};
regionBossLevelSettleResp.AwardItems.Add([]);
regionBossLevelSettleResp.FirstItems.Add([]);
regionBossLevelSettleResp.ThreeStarItems.Add([]);
regionBossLevelSettleResp.SurpriseItems.Add([]);
return Packet.Create(NetMsgId.region_boss_level_settle_succeed_ack, regionBossLevelSettleResp);
}
} }
} }

View File

@@ -11,7 +11,7 @@ namespace Novaria.GameServer.Controllers.Api.ProtocolHandlers
} }
[ProtocolHandler(NetMsgId.star_tower_info_req)] // req id goes here [ProtocolHandler(NetMsgId.star_tower_info_req)] // req id goes here
public Packet PlayerLoginHandler(Nil req) public Packet StarTowerInfoHandler(Nil req)
{ {
StarTowerInfo towerResp = new(); StarTowerInfo towerResp = new();