2023-10-14 15:05:58 +00:00
|
|
|
|
using AscNet.Common.MsgPack;
|
2023-10-14 17:20:25 +00:00
|
|
|
|
using MessagePack;
|
2023-10-14 15:05:58 +00:00
|
|
|
|
|
|
|
|
|
namespace AscNet.GameServer.Handlers
|
|
|
|
|
{
|
2024-04-13 04:47:55 +00:00
|
|
|
|
#region MsgPackScheme
|
|
|
|
|
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
2023-10-14 17:20:25 +00:00
|
|
|
|
[MessagePackObject(true)]
|
2023-10-14 16:13:29 +00:00
|
|
|
|
public class GuideGroupFinishRequest
|
|
|
|
|
{
|
|
|
|
|
public int GroupId;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-14 17:20:25 +00:00
|
|
|
|
[MessagePackObject(true)]
|
2023-10-14 16:13:29 +00:00
|
|
|
|
public class GuideGroupFinishResponse
|
|
|
|
|
{
|
|
|
|
|
public int Code;
|
|
|
|
|
public List<dynamic>? RewardGoodsList;
|
|
|
|
|
}
|
2023-11-11 01:12:11 +00:00
|
|
|
|
|
|
|
|
|
[MessagePackObject(true)]
|
|
|
|
|
public class GuideCompleteRequest
|
|
|
|
|
{
|
|
|
|
|
public int GuideGroupId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MessagePackObject(true)]
|
|
|
|
|
public class NotifyGuide
|
|
|
|
|
{
|
|
|
|
|
public int GuideGroupId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MessagePackObject(true)]
|
|
|
|
|
public class GuideCompleteResponse
|
|
|
|
|
{
|
|
|
|
|
public int Code;
|
|
|
|
|
public List<dynamic>? RewardGoodsList;
|
|
|
|
|
}
|
2024-04-13 04:47:55 +00:00
|
|
|
|
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
|
|
|
|
#endregion
|
|
|
|
|
|
2023-10-14 15:05:58 +00:00
|
|
|
|
internal class GuideModule
|
|
|
|
|
{
|
|
|
|
|
[RequestPacketHandler("GuideOpenRequest")]
|
|
|
|
|
public static void GuideOpenRequestHandler(Session session, Packet.Request packet)
|
|
|
|
|
{
|
2024-04-06 01:27:56 +00:00
|
|
|
|
GuideCompleteRequest request = packet.Deserialize<GuideCompleteRequest>();
|
|
|
|
|
|
|
|
|
|
session.player.PlayerData.GuideData.Add(request.GuideGroupId);
|
|
|
|
|
session.SendPush(new NotifyGuide() { GuideGroupId = request.GuideGroupId });
|
2023-10-14 15:05:58 +00:00
|
|
|
|
session.SendResponse(new GuideOpenResponse(), packet.Id);
|
|
|
|
|
}
|
2023-10-14 16:13:29 +00:00
|
|
|
|
|
|
|
|
|
// TODO: Invalid, need proper types
|
2023-10-14 15:05:58 +00:00
|
|
|
|
[RequestPacketHandler("GuideGroupFinishRequest")]
|
|
|
|
|
public static void GuideGroupFinishRequestHandler(Session session, Packet.Request packet)
|
|
|
|
|
{
|
2023-10-14 16:13:29 +00:00
|
|
|
|
session.SendResponse(new GuideGroupFinishResponse(), packet.Id);
|
2023-10-14 15:05:58 +00:00
|
|
|
|
}
|
2023-11-11 01:12:11 +00:00
|
|
|
|
|
|
|
|
|
[RequestPacketHandler("GuideCompleteRequest")]
|
|
|
|
|
public static void GuideCompleteRequestHandler(Session session, Packet.Request packet)
|
|
|
|
|
{
|
|
|
|
|
GuideCompleteRequest request = MessagePackSerializer.Deserialize<GuideCompleteRequest>(packet.Content);
|
|
|
|
|
|
|
|
|
|
session.player.PlayerData.GuideData.Add(request.GuideGroupId);
|
|
|
|
|
session.SendPush(new NotifyGuide() { GuideGroupId = request.GuideGroupId });
|
|
|
|
|
session.SendResponse(new GuideCompleteResponse(), packet.Id);
|
|
|
|
|
}
|
2023-10-14 15:05:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|