From 0705c4373f8ccc5e6fd2fabbce262eb4840d650b Mon Sep 17 00:00:00 2001 From: rfi Date: Sun, 19 Nov 2023 14:44:27 +0700 Subject: [PATCH] hardcoded disclamer mail --- AscNet.Common/MsgPack/Types.cs | 6 ++-- AscNet.GameServer/Handlers/AccountModule.cs | 24 ++++++++++++++++ AscNet.GameServer/Handlers/MailModule.cs | 31 +++++++++++++++++++++ 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 AscNet.GameServer/Handlers/MailModule.cs diff --git a/AscNet.Common/MsgPack/Types.cs b/AscNet.Common/MsgPack/Types.cs index 33ebaa3..dc5d7c1 100644 --- a/AscNet.Common/MsgPack/Types.cs +++ b/AscNet.Common/MsgPack/Types.cs @@ -2768,9 +2768,9 @@ namespace AscNet.Common.MsgPack public string SendName { get; set; } public string Title { get; set; } public string Content { get; set; } - public uint CreateTime { get; set; } - public uint SendTime { get; set; } - public uint ExpireTime { get; set; } + public long CreateTime { get; set; } + public long SendTime { get; set; } + public long ExpireTime { get; set; } [MessagePack.MessagePackObject(true)] public class NotifyMailsNewMailListRewardGoodsList { diff --git a/AscNet.GameServer/Handlers/AccountModule.cs b/AscNet.GameServer/Handlers/AccountModule.cs index ad33dec..26da99f 100644 --- a/AscNet.GameServer/Handlers/AccountModule.cs +++ b/AscNet.GameServer/Handlers/AccountModule.cs @@ -175,6 +175,30 @@ namespace AscNet.GameServer.Handlers session.SendPush(notifyAssistData); session.SendPush(notifyChatLoginData); + #region DisclamerMail + NotifyMails notifyMails = new(); + notifyMails.NewMailList.Add(new NotifyMails.NotifyMailsNewMailList() + { + Id = "0", + Status = 0, // MAIL_STATUS_UNREAD + SendName = "AscNet Developers", + Title = "[IMPORTANT] Important Info Regarding This Server Software", + Content = @"Hello Commandant! +Welcome to AscNet, we are happy that you are using this Server Software. +This Server Software is always free and if you are paying to gain access to this you are being SCAMMED, we encourage you to help prevent another buyer like you by making a PSA or telling others whom you may see as potential users. +Sorry for the inconvinience. + +欢迎来到 AscNet,我们很高兴您使用本服务器软件。 +本服务器软件始终是免费的,如果您是通过付费来使用本软件,那您就被骗了,我们鼓励您告诉其他潜在用户,以防止再有像您这样的买家。 +不便之处,敬请原谅。", + CreateTime = ((DateTimeOffset)Process.GetCurrentProcess().StartTime).ToUnixTimeSeconds(), + SendTime = ((DateTimeOffset)Process.GetCurrentProcess().StartTime).ToUnixTimeSeconds(), + ExpireTime = DateTimeOffset.Now.ToUnixTimeSeconds() * 2, + IsForbidDelete = true + }); + session.SendPush(notifyMails); + #endregion + // NEEDED to not softlock! session.SendPush(new NotifyFubenPrequelData() { FubenPrequelData = new() }); session.SendPush(new NotifyPrequelChallengeRefreshTime() { NextRefreshTime = (uint)DateTimeOffset.Now.ToUnixTimeSeconds() + 3600 * 24 }); diff --git a/AscNet.GameServer/Handlers/MailModule.cs b/AscNet.GameServer/Handlers/MailModule.cs new file mode 100644 index 0000000..59bedf0 --- /dev/null +++ b/AscNet.GameServer/Handlers/MailModule.cs @@ -0,0 +1,31 @@ +using AscNet.Common.MsgPack; +using MessagePack; + +namespace AscNet.GameServer.Handlers +{ + #region MsgPackScheme +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + [MessagePackObject(true)] + public class MailReadResponse + { + public int Code; + } + + [MessagePackObject(true)] + public class MailReadRequest + { + public string Id; + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + #endregion + + internal class MailModule + { + + [RequestPacketHandler("MailReadRequest")] + public static void MailReadRequestHandler(Session session, Packet.Request packet) + { + session.SendResponse(new MailReadResponse(), packet.Id); + } + } +}