mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-13 03:24:36 +01:00
Packets 😭
This commit is contained in:
@@ -79,6 +79,10 @@ namespace Common.Database
|
||||
{
|
||||
User.collection.ReplaceOne(Builders<UserScheme>.Filter.Eq(user => user.Id, Id), this);
|
||||
}
|
||||
public uint GetCreationTime()
|
||||
{
|
||||
return (uint)((DateTimeOffset)Id.CreationTime).ToUnixTimeSeconds();
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
|
||||
|
||||
79
Common/Utils/ExcelReader/MissionData.cs
Normal file
79
Common/Utils/ExcelReader/MissionData.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Common.Utils.ExcelReader
|
||||
{
|
||||
public class MissionData : BaseExcelReader<MissionData, MissionDataExcel>
|
||||
{
|
||||
public override string FileName { get { return "MissionData.json"; } }
|
||||
|
||||
public MissionDataExcel? FromId(int id)
|
||||
{
|
||||
return All.Where(mission => mission.Id == id).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
public partial class MissionDataExcel
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
[JsonProperty("subType")]
|
||||
public int SubType { get; set; }
|
||||
|
||||
[JsonProperty("title")]
|
||||
public HashName Title { get; set; }
|
||||
|
||||
[JsonProperty("description")]
|
||||
public HashName Description { get; set; }
|
||||
|
||||
[JsonProperty("thumb")]
|
||||
public string Thumb { get; set; }
|
||||
|
||||
[JsonProperty("finishWay")]
|
||||
public int FinishWay { get; set; }
|
||||
|
||||
[JsonProperty("finishParaInt")]
|
||||
public int FinishParaInt { get; set; }
|
||||
|
||||
[JsonProperty("finishParaStr")]
|
||||
public string FinishParaStr { get; set; }
|
||||
|
||||
[JsonProperty("totalProgress")]
|
||||
public int TotalProgress { get; set; }
|
||||
|
||||
[JsonProperty("rewardId")]
|
||||
public int RewardId { get; set; }
|
||||
|
||||
[JsonProperty("LinkType")]
|
||||
public int LinkType { get; set; }
|
||||
|
||||
[JsonProperty("LinkParams")]
|
||||
public int[] LinkParams { get; set; }
|
||||
|
||||
[JsonProperty("TextmapTag")]
|
||||
public HashName TextmapTag { get; set; }
|
||||
|
||||
[JsonProperty("LinkParamStr")]
|
||||
public string LinkParamStr { get; set; }
|
||||
|
||||
[JsonProperty("PreviewTime")]
|
||||
public int PreviewTime { get; set; }
|
||||
|
||||
[JsonProperty("NoDisplay")]
|
||||
public bool NoDisplay { get; set; }
|
||||
|
||||
[JsonProperty("IsNeedDisplay")]
|
||||
public bool IsNeedDisplay { get; set; }
|
||||
|
||||
[JsonProperty("Priority")]
|
||||
public int Priority { get; set; }
|
||||
|
||||
[JsonProperty("DataImpl")]
|
||||
public object DataImpl { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public int Id { get; set; }
|
||||
}
|
||||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
|
||||
}
|
||||
13
GameServer/Handlers/GetBuffEffectReqHandler.cs
Normal file
13
GameServer/Handlers/GetBuffEffectReqHandler.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetBuffEffectReq)]
|
||||
internal class GetBuffEffectReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
session.Send(Packet.FromProto(new GetBuffEffectRsp() { retcode = GetBuffEffectRsp.Retcode.Succ }, CmdId.GetBuffEffectRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
13
GameServer/Handlers/GetGobackReqHandler.cs
Normal file
13
GameServer/Handlers/GetGobackReqHandler.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetGobackReq)]
|
||||
internal class GetGobackReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
session.Send(Packet.FromProto(new GetGobackRsp() { retcode = GetGobackRsp.Retcode.Succ }, CmdId.GetGobackRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
23
GameServer/Handlers/GetLoginActivityReqHandler.cs
Normal file
23
GameServer/Handlers/GetLoginActivityReqHandler.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetLoginActivityReq)]
|
||||
internal class GetLoginActivityReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetLoginActivityRsp Rsp = new () { retcode = GetLoginActivityRsp.Retcode.Succ };
|
||||
|
||||
Rsp.LoginLists.Add(new LoginActivityData
|
||||
{
|
||||
Id = 581,
|
||||
LoginDays = 1,
|
||||
AcceptTime = session.Player.User.GetCreationTime(),
|
||||
DurationEndTime = session.Player.User.GetCreationTime() + 604800
|
||||
});
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetLoginActivityRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
CustomHeadId = 161001,
|
||||
Scoin = session.Player.Equipment.MaterialList.Where(mat => mat.Id == 100).FirstOrDefault()?.Num ?? 0,
|
||||
IsAll = true,
|
||||
RegisterTime = (uint)User.Id.Timestamp,
|
||||
RegisterTime = User.GetCreationTime(),
|
||||
PayHcoin = 0,
|
||||
WarshipAvatar = User.WarshipAvatar,
|
||||
SelfDesc = User.SelfDesc,
|
||||
|
||||
33
GameServer/Handlers/GetMissionDataReqHandler.cs
Normal file
33
GameServer/Handlers/GetMissionDataReqHandler.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetMissionDataReq)]
|
||||
internal class GetMissionDataReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetMissionDataRsp Rsp = new()
|
||||
{
|
||||
retcode = GetMissionDataRsp.Retcode.Succ,
|
||||
IsAll = true
|
||||
};
|
||||
|
||||
MissionDataExcel[] missionDatas = MissionData.GetInstance().All;
|
||||
|
||||
Rsp.MissionLists.AddRange(missionDatas.Select(mission => new Mission()
|
||||
{
|
||||
MissionId = (uint)mission.Id,
|
||||
Status = MissionStatus.MissionFinish,
|
||||
Priority = (uint)mission.Priority,
|
||||
Progress = (uint)mission.TotalProgress,
|
||||
BeginTime = session.Player.User.GetCreationTime(),
|
||||
EndTime = 2073239999,
|
||||
CycleId = 1
|
||||
}));
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetMissionDataRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
22
GameServer/Handlers/GetPlayerCardReqHandler.cs
Normal file
22
GameServer/Handlers/GetPlayerCardReqHandler.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetPlayerCardReq)]
|
||||
internal class GetPlayerCardReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetPlayerCardRsp Rsp = new()
|
||||
{
|
||||
retcode = GetPlayerCardRsp.Retcode.Succ,
|
||||
Type = PlayerCardType.CardAll,
|
||||
ElfIdLists = new uint[] { 0 },
|
||||
AvatarIdLists = new uint[] { 0, 0, 0 },
|
||||
};
|
||||
Rsp.MedalLists.AddRange(new Medal[] { new Medal() { Id = 0, EndTime = 0, ExtraParam = 0 }, new Medal() { Id = 0, EndTime = 0, ExtraParam = 0 } });
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetPlayerCardRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
GetPlayerTokenRsp Rsp = new () { };
|
||||
UserScheme? CurrentUser = User.FromToken(Packet.AccountToken);
|
||||
|
||||
if (CurrentUser == null || CurrentUser.Uid != uint.Parse(Packet.AccountUid))
|
||||
if (CurrentUser is null || CurrentUser.Uid != uint.Parse(Packet.AccountUid))
|
||||
{
|
||||
Rsp.retcode = GetPlayerTokenRsp.Retcode.AccountVerifyError;
|
||||
Rsp.Msg = "Account verification failed, please re-login!";
|
||||
|
||||
15
GameServer/Handlers/GetRpgTaleReqHandler.cs
Normal file
15
GameServer/Handlers/GetRpgTaleReqHandler.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetRpgTaleReq)]
|
||||
internal class GetRpgTaleReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetRpgTaleReq Data = packet.GetDecodedBody<GetRpgTaleReq>();
|
||||
|
||||
session.Send(Packet.FromProto(new GetRpgTaleRsp() { retcode = GetRpgTaleRsp.Retcode.Succ, IsAll = Data.IsAll, TaleId = Data.TaleId }, CmdId.GetRpgTaleRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
20
GameServer/Handlers/GetStageChapterReqHandler.cs
Normal file
20
GameServer/Handlers/GetStageChapterReqHandler.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
[PacketCmdId(CmdId.GetStageChapterReq)]
|
||||
internal class GetStageChapterReqHandler : IPacketHandler
|
||||
{
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
GetStageChapterRsp Rsp = new() { retcode = GetStageChapterRsp.Retcode.Succ };
|
||||
|
||||
for (uint i = 1; i < 38; i++)
|
||||
{
|
||||
Rsp.ChapterLists.Add(new() { ChapterId = i, HasTakeChallenge = 0 });
|
||||
}
|
||||
|
||||
session.Send(Packet.FromProto(Rsp, CmdId.GetStageChapterRsp));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user