2024-02-12 01:15:49 +00:00
|
|
|
|
using GameServer.Controllers.Attributes;
|
2024-02-17 13:49:28 +00:00
|
|
|
|
using GameServer.Controllers.Combat;
|
2024-02-12 01:15:49 +00:00
|
|
|
|
using GameServer.Network;
|
|
|
|
|
using GameServer.Network.Messages;
|
|
|
|
|
using Protocol;
|
|
|
|
|
|
|
|
|
|
namespace GameServer.Controllers;
|
|
|
|
|
internal class CombatMessageController : Controller
|
|
|
|
|
{
|
|
|
|
|
public CombatMessageController(PlayerSession session) : base(session)
|
|
|
|
|
{
|
|
|
|
|
// CombatMessageController.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NetEvent(MessageId.CombatSendPackRequest)] // TODO: CombatSendPackRequest is important
|
2024-02-20 19:39:08 +00:00
|
|
|
|
public async Task<RpcResult> OnCombatSendPackRequest(CombatSendPackRequest request, CombatManager combatManager)
|
2024-02-17 13:49:28 +00:00
|
|
|
|
{
|
|
|
|
|
CombatReceivePackNotify combatPackNotify = new();
|
|
|
|
|
|
|
|
|
|
foreach (CombatSendData sendData in request.Data)
|
|
|
|
|
{
|
|
|
|
|
if (sendData.Request != null)
|
|
|
|
|
{
|
|
|
|
|
CombatRequestContext context = new(sendData.Request);
|
|
|
|
|
CombatResponseData? responseData = await combatManager.HandleRequest(context);
|
|
|
|
|
|
|
|
|
|
combatPackNotify.Data.AddRange(context.Notifies.Select(notify => new CombatReceiveData
|
|
|
|
|
{
|
|
|
|
|
CombatNotifyData = notify
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
if (responseData != null)
|
|
|
|
|
{
|
|
|
|
|
combatPackNotify.Data.Add(new CombatReceiveData
|
|
|
|
|
{
|
|
|
|
|
CombatResponseData = responseData
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await Session.Push(MessageId.CombatReceivePackNotify, combatPackNotify);
|
|
|
|
|
return Response(MessageId.CombatSendPackResponse, new CombatSendPackResponse());
|
|
|
|
|
}
|
2024-02-12 01:15:49 +00:00
|
|
|
|
}
|