diff --git a/Common/Utils/ExcelReader/SingleWantedStageGroup.cs b/Common/Utils/ExcelReader/SingleWantedStageGroup.cs new file mode 100644 index 0000000..80919a0 --- /dev/null +++ b/Common/Utils/ExcelReader/SingleWantedStageGroup.cs @@ -0,0 +1,37 @@ +using Newtonsoft.Json; + +namespace Common.Utils.ExcelReader +{ + public class SingleWantedStageGroup : BaseExcelReader + { + public override string FileName { get { return "SingleWantedStageGroup.json"; } } + + public SingleWantedStageGroupExcel? FromGroupId(int groupId) + { + return All.FirstOrDefault(group => group.StageGroupId == groupId); + } + } + +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public partial class SingleWantedStageGroupExcel + { + [JsonProperty("StageIDList")] + public int[] StageIdList { get; set; } + + [JsonProperty("MPStageIDList")] + public int[] MpStageIdList { get; set; } + + [JsonProperty("StageGroupThemeID")] + public int StageGroupThemeId { get; set; } + + [JsonProperty("StageGroupDesc")] + public HashName StageGroupDesc { get; set; } + + [JsonProperty("DataImpl")] + public object DataImpl { get; set; } + + [JsonProperty("StageGroupID")] + public int StageGroupId { get; set; } + } +#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. +} diff --git a/GameServer/Handlers/GachaReqHandler.cs b/GameServer/Handlers/GachaReqHandler.cs new file mode 100644 index 0000000..83a6a0c --- /dev/null +++ b/GameServer/Handlers/GachaReqHandler.cs @@ -0,0 +1,30 @@ +using Common.Resources.Proto; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GachaReq)] + internal class GachaReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + GachaReq Data = packet.GetDecodedBody(); + GachaRsp Rsp = new() + { + retcode = GachaRsp.Retcode.Succ, + GachaRandom = Data.GachaRandom, + IsUseFreeGacha = Data.IsUseFreeGacha + }; + Rsp.ItemLists.Add(new() + { + ItemId = 10106, + Level = 0, + Num = 5, + GiftItemId = 80026, + GiftLevel = 0, + GiftNum = 50 + }); + + session.Send(Packet.FromProto(Rsp, CmdId.GachaRsp)); + } + } +} diff --git a/GameServer/Handlers/GetChapterActivityDataReqHandler.cs b/GameServer/Handlers/GetChapterActivityDataReqHandler.cs new file mode 100644 index 0000000..4697312 --- /dev/null +++ b/GameServer/Handlers/GetChapterActivityDataReqHandler.cs @@ -0,0 +1,13 @@ +using Common.Resources.Proto; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GetChapterActivityDataReq)] + internal class GetChapterActivityDataReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + session.Send(Packet.FromProto(new GetChapterActivityDataRsp() { retcode = GetChapterActivityDataRsp.Retcode.Succ }, CmdId.GetChapterActivityDataRsp)); + } + } +} diff --git a/GameServer/Handlers/GetGachaDisplayReqHandler.cs b/GameServer/Handlers/GetGachaDisplayReqHandler.cs new file mode 100644 index 0000000..ddffe49 --- /dev/null +++ b/GameServer/Handlers/GetGachaDisplayReqHandler.cs @@ -0,0 +1,57 @@ +using Common; +using Common.Resources.Proto; +using Common.Utils.ExcelReader; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GetGachaDisplayReq)] + internal class GetGachaDisplayReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + GetGachaDisplayRsp Rsp = new() + { + retcode = GetGachaDisplayRsp.Retcode.Succ, + IsAll = true, + Type = GachaType.GachaTypeError, + GachaRandom = (uint)Global.GetUnixInSeconds() + }; + Rsp.GachaDisplayInfoLists.Add(new() + { + GachaType = GachaType.GachaCustomAvatar, + CommonData = new() + { + TitleImage = "SpriteOutput/Gacha/TitleKakin3", + Title = "5.18~6.16", + Content = "To feed ur gacha addiction", + IsEnablePrompt = true, + GachaId = 30115600, + DataBeginTime = 1684353600, + DataEndTime = 2684353600, + UpAvatarLists = AvatarData.GetInstance().All.Where(avatar => avatar.AvatarId < 9000).Select(avatar => (uint)avatar.AvatarId).ToArray() + }, + CustomGachaData = new() + { + TicketHcoinCost = 280, + TicketMaterialId = 1103, + IsEnableBaodi = true, + GachaType = GachaType.GachaCustomAvatar, + GachaTimes = 0, + DisplayMaxTimes = 100, + NoProtectGachaTimes = 0, + DisplayVideoAvatar = 0, + ShiningType = 1, + ExId = 1, + ProtectDisplayInfo = new() + { + NoProtectGachaTimes = 0, + DisplayKeyAvatar = 0, + protect_display_type = GachaProtectDisplayInfo.ProtectDisplayType.NoDisplay + } + } + }); + + session.Send(Packet.FromProto(Rsp, CmdId.GetGachaDisplayRsp)); + } + } +} diff --git a/GameServer/Handlers/GetThemeWantedReqHandler.cs b/GameServer/Handlers/GetThemeWantedReqHandler.cs new file mode 100644 index 0000000..f59a8c9 --- /dev/null +++ b/GameServer/Handlers/GetThemeWantedReqHandler.cs @@ -0,0 +1,39 @@ +using Common; +using Common.Resources.Proto; +using Common.Utils.ExcelReader; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GetThemeWantedReq)] + internal class GetThemeWantedReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + GetThemeWantedRsp Rsp = new() + { + retcode = GetThemeWantedRsp.Retcode.Succ, + ThemeWantedActivity = new() + { + ScheduleId = 1, + ActivityId = 11104, + OpenStageGroupIdLists = new uint[] { 13, 14, 15, 16 } + } + }; + foreach (uint groupId in Rsp.ThemeWantedActivity.OpenStageGroupIdLists) + { + SingleWantedStageGroupExcel? groupData = SingleWantedStageGroup.GetInstance().FromGroupId((int)groupId); + if(groupData is not null) + { + Rsp.ThemeWantedActivity.StageGroupInfoLists.Add(new() + { + StageGroupId = groupId, + Progress = (uint)groupData.StageIdList.Length, + UnlockMpProgressLists = groupData.MpStageIdList.Select((mpStage, index) => (uint)index + 1).ToArray() + }); + } + } + + session.Send(Packet.FromProto(Rsp, CmdId.GetThemeWantedRsp)); + } + } +} diff --git a/GameServer/Handlers/StageEndReqHandler.cs b/GameServer/Handlers/StageEndReqHandler.cs index e78cdc0..fed6281 100644 --- a/GameServer/Handlers/StageEndReqHandler.cs +++ b/GameServer/Handlers/StageEndReqHandler.cs @@ -41,7 +41,12 @@ namespace PemukulPaku.GameServer.Handlers Equipment.AddMaterial((int)DropItem.ItemId, (int)DropItem.Num); } - session.Player.User.Hcoin += DecodedBody.ChallengeIndexLists.Length * 5; + if(DecodedBody.ChallengeIndexLists is not null) + { + session.Player.User.Hcoin += DecodedBody.ChallengeIndexLists.Length * 5; + Rsp.ChallengeLists.AddRange(DecodedBody.ChallengeIndexLists.Select(challengeIndex => new StageChallengeData() { ChallengeIndex = challengeIndex, Reward = new() { Hcoin = 5 } })); + } + session.Player.User.Exp += 100; session.ProcessPacket(Packet.FromProto(new GetMainDataReq() { }, CmdId.GetMainDataReq)); @@ -52,7 +57,6 @@ namespace PemukulPaku.GameServer.Handlers Rsp.PlayerExpReward = 100; Rsp.AvatarExpReward = DecodedBody.AvatarExpReward; Rsp.ScoinReward = DecodedBody.ScoinReward; - Rsp.ChallengeLists.AddRange(DecodedBody.ChallengeIndexLists.Select(challengeIndex => new StageChallengeData() { ChallengeIndex = challengeIndex, Reward = new() { Hcoin = 5 } })); } session.Send(Packet.FromProto(Rsp, CmdId.StageEndRsp));