WutheringWaves/GameServer/Controllers/LoginController.cs

47 lines
1.4 KiB
C#
Raw Normal View History

2024-02-09 22:15:05 +00:00
using GameServer.Controllers.Attributes;
using GameServer.Network;
2024-02-10 16:04:03 +00:00
using GameServer.Systems.Event;
2024-02-09 22:15:05 +00:00
using Protocol;
namespace GameServer.Controllers;
internal class LoginController : Controller
{
public LoginController(PlayerSession session) : base(session)
{
// LoginController.
}
[NetEvent(MessageId.LoginRequest)]
public async Task<RpcResult> OnLoginRequest(EventSystem eventSystem)
2024-02-09 22:15:05 +00:00
{
await eventSystem.Emit(GameEventType.Login);
// Debug
await eventSystem.Emit(GameEventType.DebugUnlockAllRoles);
2024-02-22 19:32:57 +00:00
await eventSystem.Emit(GameEventType.DebugUnlockAllItems);
2024-02-09 22:15:05 +00:00
return Response(MessageId.LoginResponse, new LoginResponse
{
Code = 0,
Platform = "CBT3_EU",
2024-02-09 22:15:05 +00:00
Timestamp = DateTimeOffset.Now.ToUnixTimeSeconds()
});
}
[NetEvent(MessageId.EnterGameRequest)]
public RpcResult OnEnterGameRequest()
2024-02-09 22:15:05 +00:00
{
return Response(MessageId.EnterGameResponse, new EnterGameResponse())
.AddPostEvent(GameEventType.EnterGame)
.AddPostEvent(GameEventType.PushDataDone);
}
2024-02-09 22:15:05 +00:00
[GameEvent(GameEventType.PushDataDone)]
public async Task OnPushDataDone()
{
2024-02-09 22:15:05 +00:00
await Session.Push(MessageId.PushDataCompleteNotify, new PushDataCompleteNotify());
}
[NetEvent(MessageId.HeartbeatRequest)]
public RpcResult OnHeartbeatRequest() => Response(MessageId.HeartbeatResponse, new HeartbeatResponse());
2024-02-09 22:15:05 +00:00
}