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

125 lines
5.1 KiB
C#
Raw 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-01-27 13:08:24 +00:00
Retcode = (uint)RetcodeStatus.RetSucc,
2024-01-27 13:06:07 +00:00
DownloadData = new ClientDownloadData(),
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-01-27 13:08:24 +00:00
Retcode = (uint)RetcodeStatus.RetSucc,
2024-01-27 13:06:07 +00:00
Gender = Gender.GenderMan,
2024-01-27 13:08:24 +00:00
Cdkjkpnjjjas ={
new Hlbbodklpbo
2024-01-27 13:06:07 +00:00
{
2024-01-27 13:08:24 +00:00
Peihhlcchfj = HeroBasicType.BoyWarrior,
2024-01-27 13:06:07 +00:00
Rank = 1,
2024-01-27 13:08:24 +00:00
Chmeifanmags = {}
2024-01-27 13:06:07 +00:00
}
},
CurBasicType = HeroBasicType.BoyWarrior,
2024-01-27 13:08:24 +00:00
Bhepmbpaojp = false,
Cnlbajkmnbn = false
2024-01-27 13:06:07 +00:00
});
}
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-01-27 13:08:24 +00:00
Retcode = (uint)RetcodeStatus.RetSucc,
//IsNewPlayer = false,
2024-01-27 13:06:07 +00:00
LoginRandom = request.LoginRandom,
Stamina = 100,
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-01-27 13:08:24 +00:00
Retcode = (uint)RetcodeStatus.RetSucc,
Uid = 1337,
//BlackInfo = null,
Msg = "OK",
2024-01-27 13:06:07 +00:00
SecretKeySeed = 0
});
2024-01-27 13:08:24 +00:00
byte[] decodedBytes = Convert.FromBase64String("eyJPcGdpbW5rb2tuanMiOlt7Iklvbm1sb2tjZ25nIjowLCJCZWdpblRpbWUiOjAsIkpvZGlwZ2xkb2hqIjoiIiwiR2djYWFrZ2ZjYm8iOmZhbHNlLCJFbmRUaW1lIjoyMDIxOTc4Nzc0LCJEZWxnam5jaGxwaiI6IiIsIkNvbmZpZ0lkIjowLCJKaGpiZ21tcGNjaiI6IkZyZWVTUiBpcyBhIGZyZWUgYW5kIG9wZW4tc291cmNlIHNvZnR3YXJlLCBpZiB5b3UgcGFpZCBmb3IgdGhpcywgeW91IGhhdmUgYmVlbiBzY2FtbWVkISBGcmVlU1LmmK/kuIDkuKrlhY3otLnkuJTlvIDmupDnmoTova/ku7bvvIzlpoLmnpzkvaDmmK/oirHpkrHkubDmnaXnmoTvvIzor7TmmI7kvaDooqvpqpfkuobvvIFyZXBvc2l0b3J5IGxpbmsg5LuT5bqT5Zyw5Z2AOmh0dHBzOi8vZ2l0Lnhlb25kZXYuY29tL01vdXgyMzMzMy9GcmVlU1IiLCJLcGZmY2hjb2xlZCI6MH1dfQ==");
string decodedJsonData = Encoding.UTF8.GetString(decodedBytes);
ServerAnnounceNotify announceNotify = JsonConvert.DeserializeObject<ServerAnnounceNotify>(decodedJsonData);
session.Send(10, announceNotify);
/*session.Send(10, new ServerAnnounceNotify
2024-01-27 13:06:07 +00:00
{
2024-01-27 13:08:24 +00:00
Opgimnkoknjs =
{
new AnnounceData
{
BeginTime = 0,
EndTime = DateTimeOffset.Now.ToUnixTimeSeconds() + 10,
Jhjbgmmpccj = @"FreeSR is a free and open-source software, if you paid for this, you have been scammed! FreeSR是一个免费且开源的软件如果你是花钱买来的说明你被骗了repository link 仓库地址:https://git.xeondev.com/Moux23333/FreeSR"
}
}
});*/
2024-01-27 13:06:07 +00:00
}
}
}