From 35313b8787d3197a66ec5a4bfd6e76da227d527f Mon Sep 17 00:00:00 2001 From: rafi1212122 Date: Thu, 1 Jun 2023 15:55:13 +0700 Subject: [PATCH] warship & nick change --- Common/Utils/ExcelReader/DressData.cs | 110 ++++++++++++++ .../Utils/ExcelReader/EntryThemeItemData.cs | 41 ++++++ Common/Utils/ExcelReader/MaterialData.cs | 137 ++++++++++++++++++ .../Handlers/GetWarshipDataReqHandler.cs | 59 ++++++++ .../Handlers/GetWarshipItemDataReqHandler.cs | 21 +++ .../Handlers/GetWarshipTrialDataReqHandler.cs | 25 ++++ .../Handlers/NicknameModifyReqHandler.cs | 18 +++ GameServer/Handlers/SetWarshipReqHandler.cs | 24 +++ 8 files changed, 435 insertions(+) create mode 100644 Common/Utils/ExcelReader/DressData.cs create mode 100644 Common/Utils/ExcelReader/EntryThemeItemData.cs create mode 100644 Common/Utils/ExcelReader/MaterialData.cs create mode 100644 GameServer/Handlers/GetWarshipDataReqHandler.cs create mode 100644 GameServer/Handlers/GetWarshipItemDataReqHandler.cs create mode 100644 GameServer/Handlers/GetWarshipTrialDataReqHandler.cs create mode 100644 GameServer/Handlers/NicknameModifyReqHandler.cs create mode 100644 GameServer/Handlers/SetWarshipReqHandler.cs diff --git a/Common/Utils/ExcelReader/DressData.cs b/Common/Utils/ExcelReader/DressData.cs new file mode 100644 index 0000000..f0b6323 --- /dev/null +++ b/Common/Utils/ExcelReader/DressData.cs @@ -0,0 +1,110 @@ +using Newtonsoft.Json; + +namespace Common.Utils.ExcelReader +{ + public class DressData : BaseExcelReader + { + public override string FileName { get { return "DressData.json"; } } + } + +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public partial class DressDataExcel + { + [JsonProperty("name")] + public HashName Name { get; set; } + + [JsonProperty("rarity")] + public int Rarity { get; set; } + + [JsonProperty("avatarIDList")] + public int[] AvatarIdList { get; set; } + + [JsonProperty("roleID")] + public int RoleId { get; set; } + + [JsonProperty("iconPath")] + public string IconPath { get; set; } + + [JsonProperty("dressType")] + public int DressType { get; set; } + + [JsonProperty("getWay")] + public HashName GetWay { get; set; } + + [JsonProperty("desc")] + public HashName Desc { get; set; } + + [JsonProperty("coin")] + public int Coin { get; set; } + + [JsonProperty("dressResource")] + public string DressResource { get; set; } + + [JsonProperty("cardPath")] + public string CardPath { get; set; } + + [JsonProperty("tachiePath")] + public string TachiePath { get; set; } + + [JsonProperty("avatarIconPath")] + public string AvatarIconPath { get; set; } + + [JsonProperty("avatarIconSidePath")] + public string AvatarIconSidePath { get; set; } + + [JsonProperty("imagePath")] + public string ImagePath { get; set; } + + [JsonProperty("LinkIDList")] + public int[] LinkIdList { get; set; } + + [JsonProperty("avatarGachaFigure")] + public string AvatarGachaFigure { get; set; } + + [JsonProperty("show")] + public int Show { get; set; } + + [JsonProperty("PreviewStageID")] + public int PreviewStageId { get; set; } + + [JsonProperty("DressTagList")] + public int[] DressTagList { get; set; } + + [JsonProperty("RechargeShowName")] + public HashName RechargeShowName { get; set; } + + [JsonProperty("RechargeShowAvatarName")] + public HashName RechargeShowAvatarName { get; set; } + + [JsonProperty("RechargeShowPicPath")] + public string RechargeShowPicPath { get; set; } + + [JsonProperty("ArtifactID")] + public int ArtifactId { get; set; } + + [JsonProperty("MVPVoicePattern")] + public string MvpVoicePattern { get; set; } + + [JsonProperty("UISelectVoice")] + public string UiSelectVoice { get; set; } + + [JsonProperty("UILevelupVoice")] + public string UiLevelupVoice { get; set; } + + [JsonProperty("GachaMainDropDisplayConfig")] + public int[] GachaMainDropDisplayConfig { get; set; } + + [JsonProperty("GachaGiftDropDisplayConfig")] + public object[] GachaGiftDropDisplayConfig { get; set; } + + [JsonProperty("IsCollaboration")] + public bool IsCollaboration { get; set; } + + [JsonProperty("DataImpl")] + public object DataImpl { get; set; } + + [JsonProperty("dressID")] + public int DressId { 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/Common/Utils/ExcelReader/EntryThemeItemData.cs b/Common/Utils/ExcelReader/EntryThemeItemData.cs new file mode 100644 index 0000000..2fd13bb --- /dev/null +++ b/Common/Utils/ExcelReader/EntryThemeItemData.cs @@ -0,0 +1,41 @@ +using Newtonsoft.Json; + +namespace Common.Utils.ExcelReader +{ + public class EntryThemeItemData : BaseExcelReader + { + public override string FileName { get { return "EntryThemeItemData.json"; } } + } + +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public partial class EntryThemeItemDataExcel + { + [JsonProperty("UnlockType")] + public int UnlockType { get; set; } + + [JsonProperty("UnlockPartID")] + public int UnlockPartId { get; set; } + + [JsonProperty("Rarity")] + public int Rarity { get; set; } + + [JsonProperty("ItemName")] + public string ItemName { get; set; } + + [JsonProperty("ItemDesc")] + public string ItemDesc { get; set; } + + [JsonProperty("iconPath")] + public string IconPath { get; set; } + + [JsonProperty("ImagePath")] + public string ImagePath { get; set; } + + [JsonProperty("DataImpl")] + public object DataImpl { get; set; } + + [JsonProperty("ThemeItemID")] + public int ThemeItemId { 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/Common/Utils/ExcelReader/MaterialData.cs b/Common/Utils/ExcelReader/MaterialData.cs new file mode 100644 index 0000000..6c5a711 --- /dev/null +++ b/Common/Utils/ExcelReader/MaterialData.cs @@ -0,0 +1,137 @@ +using Newtonsoft.Json; + +namespace Common.Utils.ExcelReader +{ + public class MaterialData : BaseExcelReader + { + public override string FileName { get { return "MaterialData.json"; } } + } + +#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable. + public partial class MaterialDataExcel + { + [JsonProperty("rarity")] + public int Rarity { get; set; } + + [JsonProperty("maxRarity")] + public int MaxRarity { get; set; } + + [JsonProperty("cost")] + public int Cost { get; set; } + + [JsonProperty("maxLv")] + public int MaxLv { get; set; } + + [JsonProperty("sellPriceBase_1")] + public int SellPriceBase1 { get; set; } + + [JsonProperty("sellPriceAdd")] + public int SellPriceAdd { get; set; } + + [JsonProperty("ServantExpProvide")] + public int ServantExpProvide { get; set; } + + [JsonProperty("gearExpProvideBase")] + public int GearExpProvideBase { get; set; } + + [JsonProperty("gearExpPorvideAdd")] + public int GearExpPorvideAdd { get; set; } + + [JsonProperty("ItemType")] + public string ItemType { get; set; } + + [JsonProperty("useID")] + public int UseId { get; set; } + + [JsonProperty("BaseType")] + public int BaseType { get; set; } + + [JsonProperty("displayTitle")] + public HashName DisplayTitle { get; set; } + + [JsonProperty("displayDescription")] + public HashName DisplayDescription { get; set; } + + [JsonProperty("iconPath")] + public string IconPath { get; set; } + + [JsonProperty("imagePath")] + public string ImagePath { get; set; } + + [JsonProperty("characterExpProvide")] + public int CharacterExpProvide { get; set; } + + [JsonProperty("LinkIDList")] + public int[] LinkIdList { get; set; } + + [JsonProperty("ShopUseList")] + public string[] ShopUseList { get; set; } + + [JsonProperty("displayBGDescription")] + public HashName DisplayBgDescription { get; set; } + + [JsonProperty("quantityLimit")] + public int QuantityLimit { get; set; } + + [JsonProperty("SortID")] + public int SortId { get; set; } + + [JsonProperty("AffixTrainType")] + public int AffixTrainType { get; set; } + + [JsonProperty("AffixRandomValueIncress")] + public int AffixRandomValueIncress { get; set; } + + [JsonProperty("AffixTitleExp")] + public int AffixTitleExp { get; set; } + + [JsonProperty("quickBuyType")] + public int QuickBuyType { get; set; } + + [JsonProperty("shopType")] + public int ShopType { get; set; } + + [JsonProperty("idShopGoods")] + public int IdShopGoods { get; set; } + + [JsonProperty("quickBuyConfirm")] + public bool QuickBuyConfirm { get; set; } + + [JsonProperty("hideInInventory")] + public bool HideInInventory { get; set; } + + [JsonProperty("hideNumInTips")] + public bool HideNumInTips { get; set; } + + [JsonProperty("SellPriceID_1")] + public int SellPriceId1 { get; set; } + + [JsonProperty("costVitality")] + public int CostVitality { get; set; } + + [JsonProperty("enableQuickSell")] + public bool EnableQuickSell { get; set; } + + [JsonProperty("advSellBonusNum")] + public int AdvSellBonusNum { get; set; } + + [JsonProperty("TagType")] + public int TagType { get; set; } + + [JsonProperty("GachaMainDropDisplayConfig")] + public object[] GachaMainDropDisplayConfig { get; set; } + + [JsonProperty("GachaGiftDropDisplayConfig")] + public object[] GachaGiftDropDisplayConfig { get; set; } + + [JsonProperty("alwaysShowPopUp")] + public bool AlwaysShowPopUp { 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. +} \ No newline at end of file diff --git a/GameServer/Handlers/GetWarshipDataReqHandler.cs b/GameServer/Handlers/GetWarshipDataReqHandler.cs new file mode 100644 index 0000000..957ff81 --- /dev/null +++ b/GameServer/Handlers/GetWarshipDataReqHandler.cs @@ -0,0 +1,59 @@ +using Common.Resources.Proto; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GetWarshipDataReq)] + internal class GetWarshipDataReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + GetWarshipDataRsp Rsp = new() + { + retcode = GetWarshipDataRsp.Retcode.Succ, + IsAll = true + }; + + List Warships = new() + { + new() + { + WarshipId = 0, + BgmPlayMode = 0, + IsWeatherFixed = false, + WeatherIdx = 0 + }, + new() + { + WarshipId = 400002, + BgmPlayMode = 0, + IsWeatherFixed = false, + WeatherIdx = 0 + }, + new() + { + WarshipId = 400003, + BgmPlayMode = 0, + IsWeatherFixed = false, + WeatherIdx = 0 + }, + new() + { + WarshipId = 400004, + BgmPlayMode = 0, + IsWeatherFixed = false, + WeatherIdx = 0 + }, + new() + { + WarshipId = 400006, + BgmPlayMode = 0, + IsWeatherFixed = false, + WeatherIdx = 0 + } + }; + Rsp.WarshipLists.AddRange(Warships); + + session.Send(Packet.FromProto(Rsp, CmdId.GetWarshipDataRsp)); + } + } +} diff --git a/GameServer/Handlers/GetWarshipItemDataReqHandler.cs b/GameServer/Handlers/GetWarshipItemDataReqHandler.cs new file mode 100644 index 0000000..98f8f8c --- /dev/null +++ b/GameServer/Handlers/GetWarshipItemDataReqHandler.cs @@ -0,0 +1,21 @@ +using Common.Resources.Proto; +using Common.Utils.ExcelReader; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GetWarshipItemDataReq)] + internal class GetWarshipItemDataReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + GetWarshipItemDataRsp Rsp = new() + { + retcode = GetWarshipItemDataRsp.Retcode.Succ, + IsAll = true, + WarshipItemIdLists = EntryThemeItemData.GetInstance().All.Select(theme => (uint)theme.ThemeItemId).ToArray() + }; + + session.Send(Packet.FromProto(Rsp, CmdId.GetWarshipItemDataRsp)); + } + } +} diff --git a/GameServer/Handlers/GetWarshipTrialDataReqHandler.cs b/GameServer/Handlers/GetWarshipTrialDataReqHandler.cs new file mode 100644 index 0000000..7d016f8 --- /dev/null +++ b/GameServer/Handlers/GetWarshipTrialDataReqHandler.cs @@ -0,0 +1,25 @@ +using Common; +using Common.Resources.Proto; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.GetWarshipTrialDataReq)] + internal class GetWarshipTrialDataReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + GetWarshipTrialDataRsp Rsp = new() + { + retcode = GetWarshipTrialDataRsp.Retcode.Succ, + IsAll = true + }; + Rsp.TrialWarshipLists.Add(new TrialWarship() + { + SampleId = 410002, + EndTime = (uint)Global.GetUnixInSeconds() + 400000 + }); + + session.Send(Packet.FromProto(Rsp, CmdId.GetWarshipTrialDataRsp)); + } + } +} diff --git a/GameServer/Handlers/NicknameModifyReqHandler.cs b/GameServer/Handlers/NicknameModifyReqHandler.cs new file mode 100644 index 0000000..5e5d349 --- /dev/null +++ b/GameServer/Handlers/NicknameModifyReqHandler.cs @@ -0,0 +1,18 @@ +using Common.Resources.Proto; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.NicknameModifyReq)] + internal class NicknameModifyReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + NicknameModifyReq Data = packet.GetDecodedBody(); + + session.Player.User.Nick = Data.Nickname; + + GetMainDataRsp MainDataRsp = new() { retcode = GetMainDataRsp.Retcode.Succ, Nickname = session.Player.User.Nick }; + session.Send(Packet.FromProto(MainDataRsp, CmdId.GetMainDataRsp), Packet.FromProto(new NicknameModifyRsp() { retcode = NicknameModifyRsp.Retcode.Succ }, CmdId.NicknameModifyRsp)); + } + } +} diff --git a/GameServer/Handlers/SetWarshipReqHandler.cs b/GameServer/Handlers/SetWarshipReqHandler.cs new file mode 100644 index 0000000..581dc27 --- /dev/null +++ b/GameServer/Handlers/SetWarshipReqHandler.cs @@ -0,0 +1,24 @@ +using Common.Resources.Proto; + +namespace PemukulPaku.GameServer.Handlers +{ + [PacketCmdId(CmdId.SetWarshipReq)] + internal class SetWarshipReqHandler : IPacketHandler + { + public void Handle(Session session, Packet packet) + { + SetWarshipReq Data = packet.GetDecodedBody(); + + session.Player.User.WarshipId = (int)Data.WarshipId; + + GetMainDataRsp MainDataRsp = new() + { + retcode = GetMainDataRsp.Retcode.Succ, + WarshipTheme = new() { WarshipId = (uint)session.Player.User.WarshipId } + }; + SetWarshipRsp Rsp = new() { retcode = SetWarshipRsp.Retcode.Succ }; + + session.Send(Packet.FromProto(MainDataRsp, CmdId.GetMainDataRsp), Packet.FromProto(Rsp, CmdId.SetWarshipRsp)); + } + } +}