This repository has been archived on 2024-03-29. You can view files and clone it, but cannot push or open issues or pull requests.
FreeSR/FreeSR.Gateserver/Manager/Handlers/PlayerReqGroup.cs

110 lines
4.6 KiB
C#
Raw Permalink Normal View History

2024-01-27 13:06:07 +00:00
namespace FreeSR.Gateserver.Manager.Handlers
{
using FreeSR.Gateserver.Manager.Handlers.Core;
using FreeSR.Gateserver.Network;
using FreeSR.Proto;
using NLog;
2024-01-27 13:08:24 +00:00
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using Newtonsoft.Json;
2024-01-27 13:06:07 +00:00
internal static class PlayerReqGroup
{
private static readonly Logger s_log = LogManager.GetCurrentClassLogger();
2024-01-27 13:08:24 +00:00
[Handler(CmdType.CmdPlayerHeartBeatCsReq)]
2024-01-27 13:06:07 +00:00
public static void OnPlayerHeartBeatCsReq(NetSession session, int cmdId, object data)
{
var heartbeatReq = data as PlayerHeartBeatCsReq;
2024-01-27 13:08:24 +00:00
session.Send(CmdType.CmdPlayerHeartBeatScRsp, new PlayerHeartBeatScRsp
2024-01-27 13:06:07 +00:00
{
2024-02-21 06:41:22 +00:00
Retcode = 0,
2024-01-27 13:06:07 +00:00
2024-02-21 06:41:22 +00:00
DownloadData = new ClientDownloadData
{
Version = 51,
Time = DateTimeOffset.Now.ToUnixTimeMilliseconds(),
Data = Convert.FromBase64String("G0x1YVMBGZMNChoKBAQICHhWAAAAAAAAAAAAAAAod0ABD0BGcmVlU1JMdWEudHh0AAAAAAAAAAAAAQccAAAAJABAAClAQAApgEAAKcBAAFYAAQAsgAABXUBBAOSAQQAkAUAAKcFBAikBQgIpQUIC7AAAAWyAAACWgAIA6cDCAMEAwwEWAQMAqoABgKlBgQCpQUMDqYFDAxLAQwMRQACAqUGBAJ9BRIiewP1/GQCAABIAAAAEA0NTBAxVbml0eUVuZ2luZQQLR2FtZU9iamVjdAQFRmluZAQpVUlSb290L0Fib3ZlRGlhbG9nL0JldGFIaW50RGlhbG9nKENsb25lKQQYR2V0Q29tcG9uZW50c0luQ2hpbGRyZW4EB3R5cGVvZgQEUlBHBAdDbGllbnQEDkxvY2FsaXplZFRleHQTAAAAAAAAAAAEB0xlbmd0aBMBAAAAAAAAAAQLZ2FtZU9iamVjdAQFbmFtZQQJSGludFRleHQEBXRleHQUYTxiPkZyZWVTUiBpcyBhIGZyZWUgc29mdHdhcmUuRnJlZVNS5piv5LiA5Liq5YWN6LS56L2v5Lu244CCIGh0dHBzOi8vZGlzY29yZC5nZy9yZXZlcnNlZHJvb21zPC9iPgEAAAABAAAAAAAcAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAAEAAAABAAAAAQAAAAEAAAABAAAAAUAAAAFAAAABQAAAAUAAAAFAAAABgAAAAYAAAAEAAAACQAAAAYAAAAEb2JqBgAAABwAAAAHY29tcHRzDgAAABwAAAAMKGZvciBpbmRleCkSAAAAGwAAAAwoZm9yIGxpbWl0KRIAAAAbAAAACyhmb3Igc3RlcCkSAAAAGwAAAAJpEwAAABoAAAABAAAABV9FTlY=")
},
2024-01-27 13:06:07 +00:00
ClientTimeMs = heartbeatReq.ClientTimeMs,
2024-01-27 13:08:24 +00:00
ServerTimeMs = (ulong)DateTimeOffset.Now.ToUnixTimeMilliseconds()
2024-01-27 13:06:07 +00:00
});
}
2024-01-27 13:08:24 +00:00
[Handler(CmdType.CmdGetHeroBasicTypeInfoCsReq)]
2024-01-27 13:06:07 +00:00
public static void OnGetHeroBasicTypeInfoCsReq(NetSession session, int cmdId, object _)
{
2024-01-27 13:08:24 +00:00
session.Send(CmdType.CmdGetHeroBasicTypeInfoScRsp, new GetHeroBasicTypeInfoScRsp
2024-01-27 13:06:07 +00:00
{
2024-02-21 06:41:22 +00:00
Retcode = 0,
2024-01-27 13:06:07 +00:00
Gender = Gender.GenderMan,
2024-02-21 06:41:22 +00:00
BasicTypeInfoLists ={
new PlayerHeroBasicTypeInfo
2024-01-27 13:06:07 +00:00
{
2024-02-21 06:41:22 +00:00
BasicType = HeroBasicType.BoyWarrior,
2024-01-27 13:06:07 +00:00
Rank = 1,
2024-02-21 06:41:22 +00:00
Knhaecbafbas = {}
2024-01-27 13:06:07 +00:00
}
},
CurBasicType = HeroBasicType.BoyWarrior,
});
}
2024-01-27 13:08:24 +00:00
[Handler(CmdType.CmdGetBasicInfoCsReq)]
2024-01-27 13:06:07 +00:00
public static void OnGetBasicInfoCsReq(NetSession session, int cmdId, object _)
{
2024-01-27 13:08:24 +00:00
session.Send(CmdType.CmdGetBasicInfoScRsp, new GetBasicInfoScRsp
2024-01-27 13:06:07 +00:00
{
CurDay = 1,
ExchangeTimes = 0,
Retcode = 0,
NextRecoverTime = 2281337,
WeekCocoonFinishedCount = 0
});
}
2024-01-27 13:08:24 +00:00
[Handler(CmdType.CmdPlayerLoginCsReq)]
2024-01-27 13:06:07 +00:00
public static void OnPlayerLoginCsReq(NetSession session, int cmdId, object data)
{
var request = data as PlayerLoginCsReq;
2024-01-27 13:08:24 +00:00
session.Send(CmdType.CmdPlayerLoginScRsp, new PlayerLoginScRsp
2024-01-27 13:06:07 +00:00
{
2024-02-21 06:41:22 +00:00
Retcode = 0,
2024-01-27 13:08:24 +00:00
//IsNewPlayer = false,
2024-01-27 13:06:07 +00:00
LoginRandom = request.LoginRandom,
2024-02-21 06:41:22 +00:00
Stamina = 240,
2024-01-27 13:08:24 +00:00
ServerTimestampMs = (ulong)DateTimeOffset.Now.ToUnixTimeSeconds() * 1000,
2024-01-27 13:06:07 +00:00
BasicInfo = new PlayerBasicInfo
{
Nickname = "xeondev",
2024-01-27 13:08:24 +00:00
Level = 70,
2024-01-27 13:06:07 +00:00
Exp = 0,
Stamina = 100,
2024-01-27 13:08:24 +00:00
Mcoin = 0,
Hcoin = 0,
Scoin = 0,
WorldLevel = 6
2024-01-27 13:06:07 +00:00
}
});
}
2024-01-27 13:08:24 +00:00
[Handler(CmdType.CmdPlayerGetTokenCsReq)]
2024-01-27 13:06:07 +00:00
public static void OnPlayerGetTokenCsReq(NetSession session, int cmdId, object data)
{
2024-01-27 13:08:24 +00:00
session.Send(CmdType.CmdPlayerGetTokenScRsp, new PlayerGetTokenScRsp
2024-01-27 13:06:07 +00:00
{
2024-02-21 06:41:22 +00:00
Retcode = 0,
2024-01-27 13:08:24 +00:00
Uid = 1337,
//BlackInfo = null,
Msg = "OK",
2024-01-27 13:06:07 +00:00
SecretKeySeed = 0
});
}
}
}