From 16cdb3809742c26a35987c4b90062fae80cca525 Mon Sep 17 00:00:00 2001 From: Somebody Date: Sat, 16 Mar 2024 22:50:34 +0800 Subject: [PATCH] implement some mission --- Common/Data/Config/GroupInfo.cs | 67 ++++- Common/Data/Config/MissionInfo.cs | 33 +++ Common/Data/Config/PropInfo.cs | 25 +- Common/Data/Excel/ItemConfigExcel.cs | 5 + Common/Data/Excel/MainMissionExcel.cs | 43 +++ Common/Data/Excel/RelicConfigExcel.cs | 30 ++ .../Data/Excel/RelicMainAffixConfigExcel.cs | 28 ++ Common/Data/Excel/RelicSubAffixConfigExcel.cs | 29 ++ Common/Data/Excel/SpecialAvatarExcel.cs | 67 +++++ Common/Data/Excel/SpecialAvatarRelicExcel.cs | 29 ++ Common/Data/Excel/SubMissionExcel.cs | 18 ++ Common/Data/GameData.cs | 15 +- Common/Data/ResourceManager.cs | 38 ++- Common/Database/Avatar/AvatarData.cs | 48 +++- Common/Database/Inventory/InventoryData.cs | 77 ++++- Common/Database/Lineup/LineupData.cs | 16 +- Common/Database/Mission/MissionData.cs | 6 +- Common/Database/Scene/SceneData.cs | 8 +- Common/Database/Tutorial/TutorialData.cs | 12 + Common/Enums/FinishActionTypeEnum.cs | 19 ++ Common/Enums/MissionFinishTypeEnum.cs | 83 ++++++ Common/Enums/MissionPhaseEnum.cs | 19 +- Common/Enums/MissionTakeTypeEnum.cs | 14 + Common/Enums/RelicTypeEnum.cs | 13 + Common/Enums/SpecialAvatarTypeEnum.cs | 14 + Common/Proto/MissionAcceptScNotify.cs | 225 +++++++++++++++ Common/Proto/PlayerHeroBasicTypeInfo.cs | 40 +-- Common/Proto/PlayerSyncScNotify.cs | 266 +++++++++--------- Common/Util/Extensions.cs | 5 + Common/Util/GameTools.cs | 35 +++ GameServer/Command/Cmd/CommandGive.cs | 9 +- GameServer/Command/CommandManager.cs | 10 +- GameServer/Game/Avatar/AvatarManager.cs | 8 + GameServer/Game/Battle/BattleInstance.cs | 30 +- GameServer/Game/Battle/BattleManager.cs | 39 ++- GameServer/Game/Inventory/InventoryManager.cs | 136 ++++++++- GameServer/Game/Lineup/LineupManager.cs | 23 +- .../Handler/MissionHandlerChangeLineup.cs | 51 ++++ .../Mission/MissionFinishActionAttribute.cs | 10 + .../Mission/MissionFinishActionHandler.cs | 10 + GameServer/Game/Mission/MissionManager.cs | 195 ++++++++++++- GameServer/Game/Player/PlayerInstance.cs | 87 +++++- GameServer/Game/Scene/Entity/EntityProp.cs | 23 +- GameServer/Game/Scene/SceneEntityLoader.cs | 78 +++-- GameServer/Game/Scene/SceneInstance.cs | 63 ++++- GameServer/GameServer.csproj | 2 - .../Avatar/HandlerDressRelicAvatarCsReq.cs | 25 ++ .../Recv/Avatar/HandlerTakeOffRelicCsReq.cs | 18 ++ .../Battle/HandlerPVEBattleResultCsReq.cs | 5 - .../Battle/HandlerSceneEnterStageCsReq.cs | 20 ++ .../Mission/HandlerAcceptMainMissionCsReq.cs | 19 ++ .../Mission/HandlerFinishTalkMissionCsReq.cs | 19 ++ .../Mission/HandlerGetMissionDataCsReq.cs | 13 + .../Mission/HandlerGetMissionStatusCsReq.cs | 2 +- .../Player/HandlerPlayerLoginFinishCsReq.cs | 6 +- .../Recv/Scene/HandlerEnterSectionCsReq.cs | 16 ++ .../Scene/HandlerGetNpcTakenRewardCsReq.cs | 21 ++ .../Recv/Scene/HandlerGetSceneMapInfoCsReq.cs | 2 +- .../Scene/HandlerSceneEntityTeleportCsReq.cs | 20 ++ .../HandlerSetGroupCustomSaveDataCsReq.cs | 17 ++ .../Tutorial/HandlerFinishTutorialCsReq.cs | 26 ++ .../Recv/Tutorial/HandlerGetTutorialCsReq.cs | 18 ++ .../Tutorial/HandlerUnlockTutorialCsReq.cs | 25 ++ .../Send/Battle/PacketSceneEnterStageScRsp.cs | 33 +++ .../Lineup/PacketGetCurLineupDataScRsp.cs | 7 +- .../Mission/PacketAcceptMainMissionScRsp.cs | 17 ++ .../Mission/PacketFinishTalkMissionScRsp.cs | 22 ++ .../Send/Mission/PacketGetMissionDataScRsp.cs | 41 +++ .../Mission/PacketGetMissionStatusScRsp.cs | 18 +- .../Mission/PacketMissionAcceptScNotify.cs | 22 ++ .../PacketStartFinishMainMissionScNotify.cs | 17 ++ .../PacketStartFinishSubMissionScNotify.cs | 17 ++ .../Send/Player/PacketPlayerSyncScNotify.cs | 82 +++++- .../Scene/PacketGetNpcTakenRewardScRsp.cs | 16 ++ .../Send/Scene/PacketGetSceneMapInfoScRsp.cs | 9 +- .../Scene/PacketSceneGroupRefreshScNotify.cs | 61 ++-- .../PacketSetGroupCustomSaveDataScRsp.cs | 17 ++ .../Tutorial/PacketFinishTutorialScRsp.cs | 26 ++ .../Send/Tutorial/PacketGetTutorialScRsp.cs | 22 ++ .../Tutorial/PacketUnlockTutorialScRsp.cs | 25 ++ 80 files changed, 2513 insertions(+), 312 deletions(-) create mode 100644 Common/Data/Config/MissionInfo.cs create mode 100644 Common/Data/Excel/MainMissionExcel.cs create mode 100644 Common/Data/Excel/RelicConfigExcel.cs create mode 100644 Common/Data/Excel/RelicMainAffixConfigExcel.cs create mode 100644 Common/Data/Excel/RelicSubAffixConfigExcel.cs create mode 100644 Common/Data/Excel/SpecialAvatarExcel.cs create mode 100644 Common/Data/Excel/SpecialAvatarRelicExcel.cs create mode 100644 Common/Data/Excel/SubMissionExcel.cs create mode 100644 Common/Database/Tutorial/TutorialData.cs create mode 100644 Common/Enums/FinishActionTypeEnum.cs create mode 100644 Common/Enums/MissionFinishTypeEnum.cs create mode 100644 Common/Enums/MissionTakeTypeEnum.cs create mode 100644 Common/Enums/RelicTypeEnum.cs create mode 100644 Common/Enums/SpecialAvatarTypeEnum.cs create mode 100644 Common/Proto/MissionAcceptScNotify.cs create mode 100644 Common/Util/GameTools.cs create mode 100644 GameServer/Game/Mission/Handler/MissionHandlerChangeLineup.cs create mode 100644 GameServer/Game/Mission/MissionFinishActionAttribute.cs create mode 100644 GameServer/Game/Mission/MissionFinishActionHandler.cs create mode 100644 GameServer/Server/Packet/Recv/Avatar/HandlerDressRelicAvatarCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Avatar/HandlerTakeOffRelicCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Battle/HandlerSceneEnterStageCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Mission/HandlerAcceptMainMissionCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Mission/HandlerFinishTalkMissionCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Mission/HandlerGetMissionDataCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Scene/HandlerEnterSectionCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Scene/HandlerGetNpcTakenRewardCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Scene/HandlerSceneEntityTeleportCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Scene/HandlerSetGroupCustomSaveDataCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Tutorial/HandlerFinishTutorialCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Tutorial/HandlerGetTutorialCsReq.cs create mode 100644 GameServer/Server/Packet/Recv/Tutorial/HandlerUnlockTutorialCsReq.cs create mode 100644 GameServer/Server/Packet/Send/Battle/PacketSceneEnterStageScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Mission/PacketAcceptMainMissionScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Mission/PacketFinishTalkMissionScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Mission/PacketGetMissionDataScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Mission/PacketMissionAcceptScNotify.cs create mode 100644 GameServer/Server/Packet/Send/Mission/PacketStartFinishMainMissionScNotify.cs create mode 100644 GameServer/Server/Packet/Send/Mission/PacketStartFinishSubMissionScNotify.cs create mode 100644 GameServer/Server/Packet/Send/Scene/PacketGetNpcTakenRewardScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Scene/PacketSetGroupCustomSaveDataScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Tutorial/PacketFinishTutorialScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Tutorial/PacketGetTutorialScRsp.cs create mode 100644 GameServer/Server/Packet/Send/Tutorial/PacketUnlockTutorialScRsp.cs diff --git a/Common/Data/Config/GroupInfo.cs b/Common/Data/Config/GroupInfo.cs index 4469366f..f4eb489e 100644 --- a/Common/Data/Config/GroupInfo.cs +++ b/Common/Data/Config/GroupInfo.cs @@ -1,6 +1,8 @@ -using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Database.Mission; +using EggLink.DanhengServer.Enums; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +using static System.Formats.Asn1.AsnWriter; namespace EggLink.DanhengServer.Data.Config { @@ -36,6 +38,69 @@ namespace EggLink.DanhengServer.Data.Config [JsonConverter(typeof(StringEnumConverter))] public OperationEnum Operation { get; set; } = OperationEnum.And; + + public bool IsTrue(MissionData mission, bool defaultResult = true) + { + if (Conditions.Count == 0) + { + return defaultResult; + } + bool canLoad = Operation == OperationEnum.And; + // check load condition + foreach (var condition in Conditions) + { + if (condition.Type == ConditionTypeEnum.MainMission) + { + mission.MainMissionInfo.TryGetValue(condition.ID, out var info); + if (info != condition.Phase) + { + if (Operation == OperationEnum.And) + { + canLoad = false; + break; + } + } + else + { + if (Operation == OperationEnum.Or) + { + canLoad = true; + break; + } + } + } else + { + // sub mission + var mainMissionId = int.Parse(condition.ID.ToString()[..^2]); + mission.MissionInfo.TryGetValue(mainMissionId, out var info); + info ??= new() { { mainMissionId, new() + { + MissionId = condition.ID, + Status = MissionPhaseEnum.None + }} }; + if (info.TryGetValue(condition.ID, out var missionInfo)) + { + if (missionInfo.Status != condition.Phase) + { + if (Operation == OperationEnum.And) + { + canLoad = false; + break; + } + } + else + { + if (Operation == OperationEnum.Or) + { + canLoad = true; + break; + } + } + } + } + } + return canLoad; + } } public class Condition diff --git a/Common/Data/Config/MissionInfo.cs b/Common/Data/Config/MissionInfo.cs new file mode 100644 index 00000000..f5118dd5 --- /dev/null +++ b/Common/Data/Config/MissionInfo.cs @@ -0,0 +1,33 @@ +using EggLink.DanhengServer.Enums; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace EggLink.DanhengServer.Data.Config +{ + public class MissionInfo + { + public int MainMissionID { get; set; } + public List StartSubMissionList { get; set; } = []; + public List FinishSubMissionList { get; set; } = []; + public List SubMissionList { get; set; } = []; + } + + public class SubMissionInfo + { + public int ID { get; set; } + public int MainMissionID { get; set; } + public List TakeParamIntList { get; set; } = []; // the mission's prerequisites + [JsonConverter(typeof(StringEnumConverter))] + public MissionFinishTypeEnum FinishType { get; set; } + public int ParamInt1 { get; set; } + public int ParamInt2 { get; set; } + public List FinishActionList { get; set; } = []; + } + + public class FinishActionInfo + { + [JsonConverter(typeof(StringEnumConverter))] + public FinishActionTypeEnum FinishActionType { get; set; } + public List FinishActionPara { get; set; } = []; + } +} diff --git a/Common/Data/Config/PropInfo.cs b/Common/Data/Config/PropInfo.cs index d0ef875a..defa9a90 100644 --- a/Common/Data/Config/PropInfo.cs +++ b/Common/Data/Config/PropInfo.cs @@ -26,16 +26,31 @@ namespace EggLink.DanhengServer.Data.Config public PropStateEnum State { get; set; } = PropStateEnum.Closed; [JsonIgnore()] - public int UnlockDoorID { get; set; } + public List UnlockDoorID { get; set; } = []; public void Load() { - if (InitLevelGraph?.Contains("_OpenDoor_") == true) + if (ValueSource != null) { - var va = ValueSource?.Values.First()["Value"]; - if (va != null) + foreach (var v in ValueSource.Values) { - UnlockDoorID = int.Parse(va.ToString().Split(",")[1]); + try + { + if (v["Value"] != null && v["Key"] != null) + { + if (v["Key"]?.ToString().Contains("Door") == true) + { + try + { + UnlockDoorID.Add(int.Parse(v["Value"]!.ToString().Split(",")[1])); + } + catch + { + } + } + } + } + catch { } } } } diff --git a/Common/Data/Excel/ItemConfigExcel.cs b/Common/Data/Excel/ItemConfigExcel.cs index 7ff00fc1..51d35851 100644 --- a/Common/Data/Excel/ItemConfigExcel.cs +++ b/Common/Data/Excel/ItemConfigExcel.cs @@ -31,5 +31,10 @@ namespace EggLink.DanhengServer.Data.Excel { return ID; } + + public override void Loaded() + { + GameData.ItemConfigData[ID] = this; + } } } diff --git a/Common/Data/Excel/MainMissionExcel.cs b/Common/Data/Excel/MainMissionExcel.cs new file mode 100644 index 00000000..49c3096d --- /dev/null +++ b/Common/Data/Excel/MainMissionExcel.cs @@ -0,0 +1,43 @@ +using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Enums; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("MainMission.json")] + public class MainMissionExcel : ExcelResource + { + public int MainMissionID { get; set; } + public HashName Name { get; set; } = new(); + [JsonConverter(typeof(StringEnumConverter))] + public OperationEnum TakeOperation { get; set; } + [JsonConverter(typeof(StringEnumConverter))] + public OperationEnum BeginOperation { get; set; } + + public List TakeParam { get; set; } = []; + public List BeginParam { get; set; } = []; + public int RewardID { get; set; } + + [JsonIgnore()] + public MissionInfo? MissionInfo { get; set; } + + + public override int GetId() + { + return MainMissionID; + } + + public override void Loaded() + { + GameData.MainMissionData[GetId()] = this; + } + } + + public class MissionParam + { + [JsonConverter(typeof(StringEnumConverter))] + public MissionTakeTypeEnum Type { get; set; } + public int Value { get; set; } + } +} diff --git a/Common/Data/Excel/RelicConfigExcel.cs b/Common/Data/Excel/RelicConfigExcel.cs new file mode 100644 index 00000000..f2a63d85 --- /dev/null +++ b/Common/Data/Excel/RelicConfigExcel.cs @@ -0,0 +1,30 @@ +using EggLink.DanhengServer.Enums; + +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("RelicConfig.json")] + public class RelicConfigExcel : ExcelResource + { + public int ID { get; set; } + public int SetID { get; set; } + + public RelicTypeEnum Type { get; set; } + public int MainAffixGroup { get; set; } + public int SubAffixGroup { get; set; } + public int MaxLevel { get; set; } + public int ExpType { get; set; } + + public int ExpProvide { get; set; } + public int CoinCost { get; set; } + + public override int GetId() + { + return ID; + } + + public override void Loaded() + { + GameData.RelicConfigData[ID] = this; + } + } +} diff --git a/Common/Data/Excel/RelicMainAffixConfigExcel.cs b/Common/Data/Excel/RelicMainAffixConfigExcel.cs new file mode 100644 index 00000000..2d351da6 --- /dev/null +++ b/Common/Data/Excel/RelicMainAffixConfigExcel.cs @@ -0,0 +1,28 @@ +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("RelicMainAffixConfig.json")] + public class RelicMainAffixConfigExcel : ExcelResource + { + public int GroupID { get; set; } + public int AffixID { get; set; } + + public bool IsAvailable { get; set; } + + public override int GetId() + { + return GroupID * 100 + AffixID; + } + + public override void Loaded() + { + GameData.RelicMainAffixData.TryGetValue(GroupID, out var affixes); + if (affixes != null) + { + affixes[AffixID] = this; + } else + { + GameData.RelicMainAffixData[GroupID] = new() { { AffixID, this } }; + } + } + } +} diff --git a/Common/Data/Excel/RelicSubAffixConfigExcel.cs b/Common/Data/Excel/RelicSubAffixConfigExcel.cs new file mode 100644 index 00000000..ec7a701e --- /dev/null +++ b/Common/Data/Excel/RelicSubAffixConfigExcel.cs @@ -0,0 +1,29 @@ +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("RelicSubAffixConfig.json")] + public class RelicSubAffixConfigExcel : ExcelResource + { + public int GroupID { get; set; } + public int AffixID { get; set; } + + public int StepNum { get; set; } + + public override int GetId() + { + return GroupID * 100 + AffixID; + } + + public override void Loaded() + { + GameData.RelicSubAffixData.TryGetValue(GroupID, out var affixes); + if (affixes != null) + { + affixes[AffixID] = this; + } + else + { + GameData.RelicSubAffixData[GroupID] = new() { { AffixID, this } }; + } + } + } +} diff --git a/Common/Data/Excel/SpecialAvatarExcel.cs b/Common/Data/Excel/SpecialAvatarExcel.cs new file mode 100644 index 00000000..2b159a5f --- /dev/null +++ b/Common/Data/Excel/SpecialAvatarExcel.cs @@ -0,0 +1,67 @@ +using EggLink.DanhengServer.Database.Avatar; +using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Proto; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("SpecialAvatar.json")] + public class SpecialAvatarExcel : ExcelResource + { + public int SpecialAvatarID { get; set; } + public int WorldLevel { get; set; } + public int AvatarID { get; set; } + + [JsonConverter(typeof(StringEnumConverter))] + public SpecialAvatarTypeEnum Type { get; set; } + + public int Level { get; set; } + public int Promotion { get; set; } + public int Rank { get; set; } + public int EquipmentID { get; set; } + public int EquipmentLevel { get; set; } + public int EquipmentPromotion { get; set; } + public int EquipmentRank { get; set; } + public int RelicPropertyType { get; set; } + public int RelicPropertyTypeExtra { get; set; } + + public override int GetId() + { + return SpecialAvatarID * 10 + WorldLevel; + } + + public override void Loaded() + { + GameData.SpecialAvatarData[GetId()] = this; + } + + public override void AfterAllDone() + { + // TODO Relic handler + } + + public AvatarInfo ToAvatarData() + { + return new() + { + AvatarId = SpecialAvatarID, + Level = Level, + Promotion = Promotion, + Rank = Rank, + EquipData = new() + { + ItemId = EquipmentID, + Level = EquipmentLevel, + Promotion = EquipmentPromotion, + Rank = EquipmentRank + } + }; + } + } +} diff --git a/Common/Data/Excel/SpecialAvatarRelicExcel.cs b/Common/Data/Excel/SpecialAvatarRelicExcel.cs new file mode 100644 index 00000000..260707f2 --- /dev/null +++ b/Common/Data/Excel/SpecialAvatarRelicExcel.cs @@ -0,0 +1,29 @@ +using Newtonsoft.Json; + +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("SpecialAvatarRelic.json")] + public class SpecialAvatarRelicExcel : ExcelResource + { + public int RelicPropertyType { get; set; } + public List RelicIDList { get; set; } = []; + + public override int GetId() + { + return RelicPropertyType; + } + + public override void Loaded() + { + GameData.SpecialAvatarRelicData[GetId()] = this; + } + } + + public class SpecialAvatarRelicInfo + { + [JsonProperty("BDHIKPAMCJF")] + public int RelicID { get; set; } + [JsonProperty("PKAFFFBFJII")] + public int RelicLevel { get; set; } + } +} diff --git a/Common/Data/Excel/SubMissionExcel.cs b/Common/Data/Excel/SubMissionExcel.cs new file mode 100644 index 00000000..9d82acfc --- /dev/null +++ b/Common/Data/Excel/SubMissionExcel.cs @@ -0,0 +1,18 @@ +namespace EggLink.DanhengServer.Data.Excel +{ + [ResourceEntity("SubMission.json")] + public class SubMissionExcel : ExcelResource + { + public int SubMissionID { get; set; } + + public override int GetId() + { + return SubMissionID; + } + + public override void Loaded() + { + GameData.SubMissionData[GetId()] = this; + } + } +} diff --git a/Common/Data/GameData.cs b/Common/Data/GameData.cs index 5d183d66..5e97d077 100644 --- a/Common/Data/GameData.cs +++ b/Common/Data/GameData.cs @@ -1,6 +1,5 @@ using EggLink.DanhengServer.Data.Config; using EggLink.DanhengServer.Data.Excel; -using System.Collections.Generic; namespace EggLink.DanhengServer.Data { @@ -18,10 +17,20 @@ namespace EggLink.DanhengServer.Data public static Dictionary QuestDataData { get; private set; } = []; public static Dictionary FloorInfoData { get; private set; } = []; + public static Dictionary ItemConfigData { get; private set; } = []; + public static Dictionary> RelicMainAffixData { get; private set; } = []; // groupId, affixId + public static Dictionary> RelicSubAffixData { get; private set; } = []; // groupId, affixId + public static Dictionary RelicConfigData { get; private set; } = []; - public static void GetFloorInfo(int planeId, int floorId, out FloorInfo outter) + public static Dictionary SpecialAvatarData { get; private set; } = []; + public static Dictionary SpecialAvatarRelicData { get; private set; } = []; + + public static Dictionary MainMissionData { get; private set; } = []; + public static Dictionary SubMissionData { get; private set; } = []; + + public static void GetFloorInfo(int planeId, int floorId, out FloorInfo outer) { - FloorInfoData.TryGetValue("P" + planeId + "_F" + floorId, out outter!); + FloorInfoData.TryGetValue("P" + planeId + "_F" + floorId, out outer!); } } } diff --git a/Common/Data/ResourceManager.cs b/Common/Data/ResourceManager.cs index 27716da7..967ec138 100644 --- a/Common/Data/ResourceManager.cs +++ b/Common/Data/ResourceManager.cs @@ -18,6 +18,7 @@ namespace EggLink.DanhengServer.Data { LoadExcel(); LoadFloorInfo(); + LoadMissionInfo(); } public static void LoadExcel() @@ -168,9 +169,44 @@ namespace EggLink.DanhengServer.Data } } if (missingGroupInfos) - Logger.Warn("Group infos are missing, please check your resources folder: {resources}/Config/LevelOutput/Group. Teleports, monster battles, and natural world spawns may not work!"); + Logger.Warn($"Group infos are missing, please check your resources folder: {ConfigManager.Config.Path.ResourcePath}/Config/LevelOutput/Group. Teleports, monster battles, and natural world spawns may not work!"); Logger.Info("Loaded " + GameData.FloorInfoData.Count + " floor infos."); } + + public static void LoadMissionInfo() + { + Logger.Info("Loading mission files..."); + DirectoryInfo directory = new(ConfigManager.Config.Path.ResourcePath + "/Config/Level/Mission"); + if (!directory.Exists) + { + Logger.Warn($"Mission infos are missing, please check your resources folder: {ConfigManager.Config.Path.ResourcePath}/Config/Level/Mission. Missions may not work!"); + return; + } + bool missingMissionInfos = false; + var count = 0; + foreach (var missionExcel in GameData.MainMissionData) + { + var path = $"{ConfigManager.Config.Path.ResourcePath}/Config/Level/Mission/{missionExcel.Key}/MissionInfo_{missionExcel.Key}.json"; + if (!File.Exists(path)) + { + missingMissionInfos = true; + continue; + } + var json = File.ReadAllText(path); + var missionInfo = JsonConvert.DeserializeObject(json); + if (missionInfo != null) + { + GameData.MainMissionData[missionExcel.Key].MissionInfo = missionInfo; + count++; + } else + { + missingMissionInfos = true; + } + } + if (missingMissionInfos) + Logger.Warn($"Mission infos are missing, please check your resources folder: {ConfigManager.Config.Path.ResourcePath}/Config/Level/Mission. Missions may not work!"); + Logger.Info("Loaded " + count + " mission infos."); + } } } diff --git a/Common/Database/Avatar/AvatarData.cs b/Common/Database/Avatar/AvatarData.cs index 15c80fd8..5dea8b0f 100644 --- a/Common/Database/Avatar/AvatarData.cs +++ b/Common/Database/Avatar/AvatarData.cs @@ -22,6 +22,7 @@ namespace EggLink.DanhengServer.Database.Avatar public class AvatarInfo { public int AvatarId { get; set; } + public int HeroId { get; set; } public int Level { get; set; } public int Exp { get; set; } public int Promotion { get; set; } @@ -36,6 +37,9 @@ namespace EggLink.DanhengServer.Database.Avatar public int EquipId { get; set; } = 0; public Dictionary Relic { get; set; } = []; + [JsonIgnore()] + public ItemData? EquipData { get; set; } // for special avatar + [JsonIgnore()] public AvatarConfigExcel? Excel; [JsonIgnore()] @@ -73,6 +77,11 @@ namespace EggLink.DanhengServer.Database.Avatar return isExtraLineup ? ExtraLineupSp : CurrentSp; } + public int GetAvatarId() + { + return HeroId > 0 ? HeroId : AvatarId; + } + public void SetCurHp(int value, bool isExtraLineup) { if (isExtraLineup) @@ -101,7 +110,7 @@ namespace EggLink.DanhengServer.Database.Avatar { var proto = new Proto.Avatar() { - BaseAvatarId = (uint)(AvatarId == 1005 ? 8001 : AvatarId), // 1005 will trigger npe + BaseAvatarId = (uint)GetAvatarId(), // 1005 will trigger npe Level = (uint)Level, Exp = (uint)Exp, Promotion = (uint)Promotion, @@ -155,7 +164,7 @@ namespace EggLink.DanhengServer.Database.Avatar }, Actor = new() { - BaseAvatarId = (uint)(AvatarId == 1005? 8001 : AvatarId), + BaseAvatarId = (uint)GetAvatarId(), AvatarType = avatarType } }; @@ -165,7 +174,7 @@ namespace EggLink.DanhengServer.Database.Avatar { return new() { - Id = (uint)(AvatarId == 1005 ? 8001 : AvatarId), + Id = (uint)GetAvatarId(), Slot = (uint)slot, AvatarType = avatarType, Hp = info.IsExtraLineup() ? (uint)ExtraLineupHp : (uint)CurrentHp, @@ -181,12 +190,12 @@ namespace EggLink.DanhengServer.Database.Avatar { var proto = new BattleAvatar() { - Id = (uint)(AvatarId == 1005 ? 8001 : AvatarId), + Id = (uint)GetAvatarId(), AvatarType = avatarType, Level = (uint)Level, Promotion = (uint)Promotion, Rank = (uint)Rank, - Index = (uint)lineup.GetSlot(AvatarId), + Index = (uint)lineup.GetSlot(GetAvatarId()), Hp = (uint)GetCurHp(lineup.LineupType != 0), SpBar = new() { @@ -243,6 +252,35 @@ namespace EggLink.DanhengServer.Database.Avatar Rank = (uint)item.Rank, }); } + } else if (EquipData != null) + { + proto.EquipmentList.Add(new BattleEquipment() + { + Id = (uint)EquipData.ItemId, + Level = (uint)EquipData.Level, + Promotion = (uint)EquipData.Promotion, + Rank = (uint)EquipData.Rank, + }); + } + + return proto; + } + + public PlayerHeroBasicTypeInfo ToHeroProto() + { + var proto = new PlayerHeroBasicTypeInfo() + { + BasicType = (HeroBasicType)HeroId, + Rank = (uint)Rank, + }; + + foreach (var skill in SkillTree) + { + proto.SkillTree.Add(new AvatarSkillTree() + { + PointId = (uint)skill.Key, + Level = (uint)skill.Value + }); } return proto; diff --git a/Common/Database/Inventory/InventoryData.cs b/Common/Database/Inventory/InventoryData.cs index b5a46155..27963179 100644 --- a/Common/Database/Inventory/InventoryData.cs +++ b/Common/Database/Inventory/InventoryData.cs @@ -1,4 +1,7 @@ -using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Data.Excel; +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Util; using SqlSugar; namespace EggLink.DanhengServer.Database.Inventory @@ -33,6 +36,54 @@ namespace EggLink.DanhengServer.Database.Inventory public int EquipAvatar { get; set; } + #region Action + + public void AddRandomRelicMainAffix() + { + GameData.RelicConfigData.TryGetValue(ItemId, out var config); + if (config == null) return; + var affixId = GameTools.GetRandomRelicMainAffix(config.MainAffixGroup); + MainAffix = affixId; + } + + public void IncreaseRandomRelicSubAffix() + { + GameData.RelicConfigData.TryGetValue(ItemId, out var config); + if (config == null) return; + GameData.RelicSubAffixData.TryGetValue(config.SubAffixGroup, out var affixes); + if (affixes == null) return; + var element = SubAffixes.RandomElement(); + var affix = affixes.Values.ToList().Find(x => x.AffixID == element.Id); + if (affix == null) return; + element.IncreaseStep(affix.StepNum); + } + + public void AddRandomRelicSubAffix(int count = 1) + { + GameData.RelicConfigData.TryGetValue(ItemId, out var config); + if (config == null) + { + return; + } + GameData.RelicSubAffixData.TryGetValue(config.SubAffixGroup, out var affixes); + + if (affixes == null) + { + return; + } + + for (int i = 0; i < count; i++) + { + var affixConfig = affixes.Values.ToList().RandomElement(); + ItemSubAffix subAffix = new(affixConfig, 1); + SubAffixes.Add(subAffix); + } + } + + #endregion + + #region Serialization + public Material ToMaterialProto() { return new() @@ -78,6 +129,8 @@ namespace EggLink.DanhengServer.Database.Inventory BaseAvatarId = (uint)EquipAvatar }; } + + #endregion } public class ItemSubAffix @@ -87,6 +140,28 @@ namespace EggLink.DanhengServer.Database.Inventory public int Count { get; set; } public int Step { get; set; } + public ItemSubAffix() { } + + public ItemSubAffix(RelicSubAffixConfigExcel excel, int count) + { + Id = excel.AffixID; + Count = count; + Step = Extensions.RandomInt(0, excel.StepNum * count); + } + + public ItemSubAffix(int id, int count, int step) + { + Id = id; + Count = count; + Step = step; + } + + public void IncreaseStep(int stepNum) + { + Count++; + Step += Extensions.RandomInt(0, stepNum); + } + public RelicAffix ToProto() => new() { AffixId = (uint)Id, diff --git a/Common/Database/Lineup/LineupData.cs b/Common/Database/Lineup/LineupData.cs index aa3bb14f..0bae5635 100644 --- a/Common/Database/Lineup/LineupData.cs +++ b/Common/Database/Lineup/LineupData.cs @@ -1,4 +1,6 @@ -using EggLink.DanhengServer.Database.Avatar; +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Database.Avatar; +using EggLink.DanhengServer.Proto; using Newtonsoft.Json; using SqlSugar; using System; @@ -43,7 +45,7 @@ namespace EggLink.DanhengServer.Database.Lineup { foreach (var avatar in BaseAvatars) { - var avatarInfo = AvatarData?.Avatars?.Find(item => item.AvatarId == avatar.BaseAvatarId); + var avatarInfo = AvatarData?.Avatars?.Find(item => item.GetAvatarId() == avatar.BaseAvatarId); if (avatarInfo != null) { if (avatarInfo.CurrentHp <= 0 && !allowRevive) @@ -75,7 +77,7 @@ namespace EggLink.DanhengServer.Database.Lineup Name = Name, MaxMp = 5, Mp = (uint)(LineupData?.Mp ?? 0), - ExtraLineupType = Proto.ExtraLineupType.LineupNone, + ExtraLineupType = ExtraLineupType.LineupNone, Index = (uint)(LineupData?.Lineups?.Values.ToList().IndexOf(this) ?? 0), }; if (BaseAvatars?.Find(item => item.BaseAvatarId == LeaderAvatarId) != null) @@ -94,11 +96,15 @@ namespace EggLink.DanhengServer.Database.Lineup var assistPlayer = DatabaseHelper.Instance?.GetInstance(avatar.AssistUid); if (assistPlayer != null) { - info.AvatarList.Add(assistPlayer?.Avatars?.Find(item => item.AvatarId == avatar.BaseAvatarId)?.ToLineupInfo(BaseAvatars.IndexOf(avatar), this, Proto.AvatarType.AvatarAssistType)); + info.AvatarList.Add(assistPlayer?.Avatars?.Find(item => item.GetAvatarId() == avatar.BaseAvatarId)?.ToLineupInfo(BaseAvatars.IndexOf(avatar), this, Proto.AvatarType.AvatarAssistType)); } } else if (avatar.SpecialAvatarId != 0) { - + var specialAvatar = GameData.SpecialAvatarData[avatar.SpecialAvatarId]; + if (specialAvatar != null) + { + info.AvatarList.Add(specialAvatar.ToAvatarData().ToLineupInfo(BaseAvatars.IndexOf(avatar), this, AvatarType.AvatarTrialType)); + } } else { info.AvatarList.Add(AvatarData?.Avatars?.Find(item => item.AvatarId == avatar.BaseAvatarId)?.ToLineupInfo(BaseAvatars.IndexOf(avatar), this)); diff --git a/Common/Database/Mission/MissionData.cs b/Common/Database/Mission/MissionData.cs index b797ac0f..3ea7c517 100644 --- a/Common/Database/Mission/MissionData.cs +++ b/Common/Database/Mission/MissionData.cs @@ -3,11 +3,13 @@ using SqlSugar; namespace EggLink.DanhengServer.Database.Mission { - [SugarTable("mission")] + [SugarTable("Mission")] public class MissionData : BaseDatabaseData { [SugarColumn(IsJson = true)] - public Dictionary MissionInfo { get; set; } = []; + public Dictionary> MissionInfo { get; set; } = []; // Dictionary> + [SugarColumn(IsJson = true)] + public Dictionary MainMissionInfo { get; set; } = []; // Dictionary } public class MissionInfo diff --git a/Common/Database/Scene/SceneData.cs b/Common/Database/Scene/SceneData.cs index 455a9c1e..1521e2e5 100644 --- a/Common/Database/Scene/SceneData.cs +++ b/Common/Database/Scene/SceneData.cs @@ -3,11 +3,17 @@ using SqlSugar; namespace EggLink.DanhengServer.Database.Scene { - [SugarTable("scene")] + [SugarTable("Scene")] public class SceneData : BaseDatabaseData { [SugarColumn(IsJson = true)] public Dictionary>> ScenePropData { get; set; } = []; // Dictionary> + + [SugarColumn(IsJson = true)] + public Dictionary> UnlockSectionIdList { get; set; } = []; // Dictionary> + + [SugarColumn(IsJson = true)] + public Dictionary> CustomSaveData { get; set; } = []; // Dictionary> } public class ScenePropData diff --git a/Common/Database/Tutorial/TutorialData.cs b/Common/Database/Tutorial/TutorialData.cs new file mode 100644 index 00000000..f8a5c237 --- /dev/null +++ b/Common/Database/Tutorial/TutorialData.cs @@ -0,0 +1,12 @@ +using EggLink.DanhengServer.Proto; +using SqlSugar; + +namespace EggLink.DanhengServer.Database.Tutorial +{ + [SugarTable("Tutorial")] + public class TutorialData : BaseDatabaseData + { + [SugarColumn(IsJson = true)] + public Dictionary Tutorials { get; set; } = []; + } +} diff --git a/Common/Enums/FinishActionTypeEnum.cs b/Common/Enums/FinishActionTypeEnum.cs new file mode 100644 index 00000000..ea55bfbf --- /dev/null +++ b/Common/Enums/FinishActionTypeEnum.cs @@ -0,0 +1,19 @@ +namespace EggLink.DanhengServer.Enums +{ + public enum FinishActionTypeEnum + { + None = 0, + ChangeLineup = 1, + addMissionItem = 2, + delMissionItem = 3, + EnterEntryIfNotThere = 4, + addRecoverMissionItem = 5, + Recover = 6, + delMission = 7, + DisableMission = 8, + delSubMission = 9, + SetFloorSavedValue = 10, + ActivateGameplayCounter = 11, + SetGroupState = 12, + } +} diff --git a/Common/Enums/MissionFinishTypeEnum.cs b/Common/Enums/MissionFinishTypeEnum.cs new file mode 100644 index 00000000..df605cec --- /dev/null +++ b/Common/Enums/MissionFinishTypeEnum.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Enums +{ + public enum MissionFinishTypeEnum + { + FinishMission = 1, + Talk = 2, + StageWin = 3, + EnterFloor = 4, + SubMissionFinishCnt = 5, + PropState = 6, + GetTrialAvatar = 7, + DelTrialAvatar = 8, + KillMonster = 9, + CreateCharacter = 10, + MessagePerformSectionFinish = 11, + ConsumeMissionItem = 12, + EnterMapByEntrance = 13, + EnterRaidScene = 14, + MessageSectionFinish = 15, + RaidFinishCnt = 16, + UseSelectedItem = 17, + LeaveFloor = 18, + PlayerLevel = 19, + ItemNum = 20, + GetItem = 21, + BoxingClubAccomplish = 22, + LeavePlane = 23, + WaitDays = 24, + BuyShopGoods = 25, + KillMonsterList = 26, + NotInFloor = 27, + TeamLeaderChange = 28, + GetTrialAvatarList = 29, + KillMonsterGroupList = 30, + InteractPropList = 31, + ChallengeFinishCnt = 32, + ChallengeFinish = 33, + CocoonFinish = 34, + AnyCocoonFinish = 35, + AnyFarmElementFinish = 36, + TrainVisitorMissionFinish = 37, + RoguePassAreaProgress = 38, + RogueEnterRoomWithLevel = 39, + PropDestruct = 40, + RogueExploreScore = 41, + RogueAreaProgressScore = 42, + NotInPlane = 43, + TreasureChestOpenCnt = 44, + EnterPlane = 45, + ActivityFightFirstFinishDifficulty = 46, + PunkLordStageFinish = 47, + KillMonsterInBattle = 48, + MuseumWorkDayCnt = 49, + MuseumPhaseFinish = 50, + ActivityExpeditionFinishCnt = 51, + AlleyNormalOrderFinish = 52, + AlleyLogisticsShopLink = 53, + AlleySpecialOrderFinishById = 54, + TreasureDungeonAccomplish = 55, + RogueDLCEnterLayerCnt = 56, + RogueDLCFinishCnt = 57, + RogueDLCFinishWithMainStoryCnt = 58, + RogueDLCFinishWithSubStoryGroupCnt = 59, + AetherDivideCertainFinishHyperlinkDuel = 60, + AetherDivideCollectSpiritType = 61, + HeliobusSnsSpecialComment = 62, + HeliobusPhase = 63, + RogueNousFinishStoryCnt = 64, + SpaceZooHybridCount = 65, + SpaceZooUnlockSpecialID = 66, + SpaceZooExpPoint = 67, + SpaceZooOpCatteryCount = 68, + ActivityStrongChallengeEndScore = 69, + ActivityStrongChallengeBegin = 70, + ChallengeStorySettleCnt = 71, + } +} diff --git a/Common/Enums/MissionPhaseEnum.cs b/Common/Enums/MissionPhaseEnum.cs index cf9e5ce7..5835dd4d 100644 --- a/Common/Enums/MissionPhaseEnum.cs +++ b/Common/Enums/MissionPhaseEnum.cs @@ -1,4 +1,6 @@ -namespace EggLink.DanhengServer.Enums +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Enums { public enum MissionPhaseEnum { @@ -7,4 +9,19 @@ Finish = 2, Cancel = 3, } + + public static class MissionStatusExtensions + { + public static MissionStatus ToProto(this MissionPhaseEnum status) + { + return status switch + { + MissionPhaseEnum.None => MissionStatus.MissionNone, + MissionPhaseEnum.Doing => MissionStatus.MissionDoing, + MissionPhaseEnum.Finish => MissionStatus.MissionFinish, + MissionPhaseEnum.Cancel => MissionStatus.MissionNone, + _ => MissionStatus.MissionNone, + }; + } + } } diff --git a/Common/Enums/MissionTakeTypeEnum.cs b/Common/Enums/MissionTakeTypeEnum.cs new file mode 100644 index 00000000..5dd38663 --- /dev/null +++ b/Common/Enums/MissionTakeTypeEnum.cs @@ -0,0 +1,14 @@ +namespace EggLink.DanhengServer.Enums +{ + public enum MissionTakeTypeEnum + { + MultiSequence = 0, + Auto = 1, + PlayerLevel = 2, + WorldLevel = 3, + Manual = 4, + SequenceNextDay = 5, + MuseumPhaseRenewPointReach = 6, + HeliobusPhaseReach = 7, + } +} diff --git a/Common/Enums/RelicTypeEnum.cs b/Common/Enums/RelicTypeEnum.cs new file mode 100644 index 00000000..6290f822 --- /dev/null +++ b/Common/Enums/RelicTypeEnum.cs @@ -0,0 +1,13 @@ +namespace EggLink.DanhengServer.Enums +{ + public enum RelicTypeEnum + { + Unknow = 0, + HEAD = 1, + HAND = 2, + BODY = 3, + FOOT = 4, + NECK = 5, + OBJECT = 6 + } +} diff --git a/Common/Enums/SpecialAvatarTypeEnum.cs b/Common/Enums/SpecialAvatarTypeEnum.cs new file mode 100644 index 00000000..2a8715a4 --- /dev/null +++ b/Common/Enums/SpecialAvatarTypeEnum.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Enums +{ + public enum SpecialAvatarTypeEnum + { + TYPE_TRIAL = 1, + TYPE_PLOT = 2, // mission + } +} diff --git a/Common/Proto/MissionAcceptScNotify.cs b/Common/Proto/MissionAcceptScNotify.cs new file mode 100644 index 00000000..37546c87 --- /dev/null +++ b/Common/Proto/MissionAcceptScNotify.cs @@ -0,0 +1,225 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: MissionAcceptScNotify.proto +// +#pragma warning disable 1591, 0612, 3021, 8981 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace EggLink.DanhengServer.Proto { + + /// Holder for reflection information generated from MissionAcceptScNotify.proto + public static partial class MissionAcceptScNotifyReflection { + + #region Descriptor + /// File descriptor for MissionAcceptScNotify.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static MissionAcceptScNotifyReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChtNaXNzaW9uQWNjZXB0U2NOb3RpZnkucHJvdG8iNAoVTWlzc2lvbkFjY2Vw", + "dFNjTm90aWZ5EhsKE3N1Yl9taXNzaW9uX2lkX2xpc3QYDiADKA1CHqoCG0Vn", + "Z0xpbmsuRGFuaGVuZ1NlcnZlci5Qcm90b2IGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.MissionAcceptScNotify), global::EggLink.DanhengServer.Proto.MissionAcceptScNotify.Parser, new[]{ "SubMissionIdList" }, null, null, null, null) + })); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")] + public sealed partial class MissionAcceptScNotify : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MissionAcceptScNotify()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::EggLink.DanhengServer.Proto.MissionAcceptScNotifyReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MissionAcceptScNotify() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MissionAcceptScNotify(MissionAcceptScNotify other) : this() { + subMissionIdList_ = other.subMissionIdList_.Clone(); + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MissionAcceptScNotify Clone() { + return new MissionAcceptScNotify(this); + } + + /// Field number for the "sub_mission_id_list" field. + public const int SubMissionIdListFieldNumber = 14; + private static readonly pb::FieldCodec _repeated_subMissionIdList_codec + = pb::FieldCodec.ForUInt32(114); + private readonly pbc::RepeatedField subMissionIdList_ = new pbc::RepeatedField(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pbc::RepeatedField SubMissionIdList { + get { return subMissionIdList_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as MissionAcceptScNotify); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(MissionAcceptScNotify other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if(!subMissionIdList_.Equals(other.subMissionIdList_)) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + hash ^= subMissionIdList_.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + subMissionIdList_.WriteTo(output, _repeated_subMissionIdList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + subMissionIdList_.WriteTo(ref output, _repeated_subMissionIdList_codec); + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + size += subMissionIdList_.CalculateSize(_repeated_subMissionIdList_codec); + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(MissionAcceptScNotify other) { + if (other == null) { + return; + } + subMissionIdList_.Add(other.subMissionIdList_); + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 114: + case 112: { + subMissionIdList_.AddEntriesFrom(input, _repeated_subMissionIdList_codec); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 114: + case 112: { + subMissionIdList_.AddEntriesFrom(ref input, _repeated_subMissionIdList_codec); + break; + } + } + } + } + #endif + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Common/Proto/PlayerHeroBasicTypeInfo.cs b/Common/Proto/PlayerHeroBasicTypeInfo.cs index 4cd2259a..ada3f45a 100644 --- a/Common/Proto/PlayerHeroBasicTypeInfo.cs +++ b/Common/Proto/PlayerHeroBasicTypeInfo.cs @@ -25,15 +25,15 @@ namespace EggLink.DanhengServer.Proto { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch1QbGF5ZXJIZXJvQmFzaWNUeXBlSW5mby5wcm90bxoVQXZhdGFyU2tpbGxU", - "cmVlLnByb3RvGhNIZXJvQmFzaWNUeXBlLnByb3RvInIKF1BsYXllckhlcm9C", + "cmVlLnByb3RvGhNIZXJvQmFzaWNUeXBlLnByb3RvInEKF1BsYXllckhlcm9C", "YXNpY1R5cGVJbmZvEiIKCmJhc2ljX3R5cGUYAiABKA4yDi5IZXJvQmFzaWNU", - "eXBlEgwKBHJhbmsYCyABKA0SJQoLQ0hNRUlGQU5NQUcYDCADKAsyEC5BdmF0", - "YXJTa2lsbFRyZWVCHqoCG0VnZ0xpbmsuRGFuaGVuZ1NlcnZlci5Qcm90b2IG", - "cHJvdG8z")); + "eXBlEgwKBHJhbmsYCyABKA0SJAoKc2tpbGxfdHJlZRgMIAMoCzIQLkF2YXRh", + "clNraWxsVHJlZUIeqgIbRWdnTGluay5EYW5oZW5nU2VydmVyLlByb3RvYgZw", + "cm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::EggLink.DanhengServer.Proto.AvatarSkillTreeReflection.Descriptor, global::EggLink.DanhengServer.Proto.HeroBasicTypeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.PlayerHeroBasicTypeInfo), global::EggLink.DanhengServer.Proto.PlayerHeroBasicTypeInfo.Parser, new[]{ "BasicType", "Rank", "CHMEIFANMAG" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.PlayerHeroBasicTypeInfo), global::EggLink.DanhengServer.Proto.PlayerHeroBasicTypeInfo.Parser, new[]{ "BasicType", "Rank", "SkillTree" }, null, null, null, null) })); } #endregion @@ -77,7 +77,7 @@ namespace EggLink.DanhengServer.Proto { public PlayerHeroBasicTypeInfo(PlayerHeroBasicTypeInfo other) : this() { basicType_ = other.basicType_; rank_ = other.rank_; - cHMEIFANMAG_ = other.cHMEIFANMAG_.Clone(); + skillTree_ = other.skillTree_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -111,15 +111,15 @@ namespace EggLink.DanhengServer.Proto { } } - /// Field number for the "CHMEIFANMAG" field. - public const int CHMEIFANMAGFieldNumber = 12; - private static readonly pb::FieldCodec _repeated_cHMEIFANMAG_codec + /// Field number for the "skill_tree" field. + public const int SkillTreeFieldNumber = 12; + private static readonly pb::FieldCodec _repeated_skillTree_codec = pb::FieldCodec.ForMessage(98, global::EggLink.DanhengServer.Proto.AvatarSkillTree.Parser); - private readonly pbc::RepeatedField cHMEIFANMAG_ = new pbc::RepeatedField(); + private readonly pbc::RepeatedField skillTree_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField CHMEIFANMAG { - get { return cHMEIFANMAG_; } + public pbc::RepeatedField SkillTree { + get { return skillTree_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -139,7 +139,7 @@ namespace EggLink.DanhengServer.Proto { } if (BasicType != other.BasicType) return false; if (Rank != other.Rank) return false; - if(!cHMEIFANMAG_.Equals(other.cHMEIFANMAG_)) return false; + if(!skillTree_.Equals(other.skillTree_)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -149,7 +149,7 @@ namespace EggLink.DanhengServer.Proto { int hash = 1; if (BasicType != global::EggLink.DanhengServer.Proto.HeroBasicType.None) hash ^= BasicType.GetHashCode(); if (Rank != 0) hash ^= Rank.GetHashCode(); - hash ^= cHMEIFANMAG_.GetHashCode(); + hash ^= skillTree_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -176,7 +176,7 @@ namespace EggLink.DanhengServer.Proto { output.WriteRawTag(88); output.WriteUInt32(Rank); } - cHMEIFANMAG_.WriteTo(output, _repeated_cHMEIFANMAG_codec); + skillTree_.WriteTo(output, _repeated_skillTree_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -195,7 +195,7 @@ namespace EggLink.DanhengServer.Proto { output.WriteRawTag(88); output.WriteUInt32(Rank); } - cHMEIFANMAG_.WriteTo(ref output, _repeated_cHMEIFANMAG_codec); + skillTree_.WriteTo(ref output, _repeated_skillTree_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -212,7 +212,7 @@ namespace EggLink.DanhengServer.Proto { if (Rank != 0) { size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Rank); } - size += cHMEIFANMAG_.CalculateSize(_repeated_cHMEIFANMAG_codec); + size += skillTree_.CalculateSize(_repeated_skillTree_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -231,7 +231,7 @@ namespace EggLink.DanhengServer.Proto { if (other.Rank != 0) { Rank = other.Rank; } - cHMEIFANMAG_.Add(other.cHMEIFANMAG_); + skillTree_.Add(other.skillTree_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -256,7 +256,7 @@ namespace EggLink.DanhengServer.Proto { break; } case 98: { - cHMEIFANMAG_.AddEntriesFrom(input, _repeated_cHMEIFANMAG_codec); + skillTree_.AddEntriesFrom(input, _repeated_skillTree_codec); break; } } @@ -283,7 +283,7 @@ namespace EggLink.DanhengServer.Proto { break; } case 98: { - cHMEIFANMAG_.AddEntriesFrom(ref input, _repeated_cHMEIFANMAG_codec); + skillTree_.AddEntriesFrom(ref input, _repeated_skillTree_codec); break; } } diff --git a/Common/Proto/PlayerSyncScNotify.cs b/Common/Proto/PlayerSyncScNotify.cs index 19f35a70..f49ab5a0 100644 --- a/Common/Proto/PlayerSyncScNotify.cs +++ b/Common/Proto/PlayerSyncScNotify.cs @@ -24,36 +24,36 @@ namespace EggLink.DanhengServer.Proto { static PlayerSyncScNotifyReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChhQbGF5ZXJTeW5jU2NOb3RpZnkucHJvdG8aEUdyb3VwU3RhdHVzLnByb3Rv", - "Gg9FcXVpcG1lbnQucHJvdG8aG1BsYXllckJvYXJkTW9kdWxlU3luYy5wcm90", - "bxoRTkpLUEVESUhPSkkucHJvdG8aEU1pc3Npb25TeW5jLnByb3RvGhVQbGF5", - "ZXJCYXNpY0luZm8ucHJvdG8aHVBsYXllckhlcm9CYXNpY1R5cGVJbmZvLnBy", - "b3RvGhBBdmF0YXJTeW5jLnByb3RvGhVXYWl0RGVsUmVzb3VyY2UucHJvdG8a", - "C1F1ZXN0LnByb3RvGhNTZWN0aW9uU3RhdHVzLnByb3RvGgtSZWxpYy5wcm90", - "bxoOSXRlbUxpc3QucHJvdG8aEUJhc2ljTW9kdWxlLnByb3RvGg5NYXRlcmlh", - "bC5wcm90bxoWTWlzc2lvbkV2ZW50U3luYy5wcm90byLvBQoSUGxheWVyU3lu", - "Y1NjTm90aWZ5EicKDG1pc3Npb25fc3luYxgFIAEoCzIRLk1pc3Npb25FdmVu", - "dFN5bmMSIQoLUE5PT0xEQUhMRVAYeyADKAsyDC5Hcm91cFN0YXR1cxIeChV0", - "b3RhbF9hY2hpZXZlbWVudF9leHAY4wogASgNEiAKDW1hdGVyaWFsX2xpc3QY", - "DyADKAsyCS5NYXRlcmlhbBIXCg9yZW1vdmVfdGlkX2xpc3QYCCADKA0SJAoL", - "SEtGQUZDRkZHT0kYxgggAygLMg4uU2VjdGlvblN0YXR1cxIiCg5lcXVpcG1l", - "bnRfbGlzdBgGIAMoCzIKLkVxdWlwbWVudBITCgtPR0dFSEdLRElLThgNIAMo", - "DRIsCgtLTkJMRE9FSE5LUBjbDCABKAsyFi5QbGF5ZXJCb2FyZE1vZHVsZVN5", - "bmMSIgoLRUZFSEtPSEtFSEwYgwogAygLMgwuTkpLUEVESUhPSkkSIAoLQURL", - "Sk9GTkhCRkgYAyABKAsyCy5BdmF0YXJTeW5jEhQKC01DRUpBSUdLRkZNGMMK", - "IAMoDRIlCgtISUpET0RLTkdNThgJIAMoCzIQLldhaXREZWxSZXNvdXJjZRIk", - "CgpiYXNpY19pbmZvGAQgASgLMhAuUGxheWVyQmFzaWNJbmZvEhoKCnF1ZXN0", - "X2xpc3QYCiADKAsyBi5RdWVzdBIaCgpyZWxpY19saXN0GAEgAygLMgYuUmVs", - "aWMSHwoLRkxFS0hCRkpIUEIY+gMgASgLMgkuSXRlbUxpc3QSHwoLRUtQTUJJ", - "S01ORkMY5QggAygLMgkuTWF0ZXJpYWwSJwoRYmFzaWNfbW9kdWxlX3N5bmMY", - "ByABKAsyDC5CYXNpY01vZHVsZRIhCgtIREZLSUFBTUVOQxgCIAEoCzIMLk1p", - "c3Npb25TeW5jEjYKFGJhc2ljX3R5cGVfaW5mb19saXN0GAsgAygLMhguUGxh", - "eWVySGVyb0Jhc2ljVHlwZUluZm9CHqoCG0VnZ0xpbmsuRGFuaGVuZ1NlcnZl", - "ci5Qcm90b2IGcHJvdG8z")); + "ChhQbGF5ZXJTeW5jU2NOb3RpZnkucHJvdG8aC1JlbGljLnByb3RvGhtQbGF5", + "ZXJCb2FyZE1vZHVsZVN5bmMucHJvdG8aEU5KS1BFRElIT0pJLnByb3RvGhFH", + "cm91cFN0YXR1cy5wcm90bxoPRXF1aXBtZW50LnByb3RvGgtRdWVzdC5wcm90", + "bxoRQmFzaWNNb2R1bGUucHJvdG8aFVdhaXREZWxSZXNvdXJjZS5wcm90bxoO", + "SXRlbUxpc3QucHJvdG8aFk1pc3Npb25FdmVudFN5bmMucHJvdG8aHVBsYXll", + "ckhlcm9CYXNpY1R5cGVJbmZvLnByb3RvGhFNaXNzaW9uU3luYy5wcm90bxoQ", + "QXZhdGFyU3luYy5wcm90bxoOTWF0ZXJpYWwucHJvdG8aE1NlY3Rpb25TdGF0", + "dXMucHJvdG8aFVBsYXllckJhc2ljSW5mby5wcm90byKKBgoSUGxheWVyU3lu", + "Y1NjTm90aWZ5Ei0KEm1pc3Npb25fZXZlbnRfc3luYxgFIAEoCzIRLk1pc3Np", + "b25FdmVudFN5bmMSIQoLUE5PT0xEQUhMRVAYeyADKAsyDC5Hcm91cFN0YXR1", + "cxIeChV0b3RhbF9hY2hpZXZlbWVudF9leHAY4wogASgNEiAKDW1hdGVyaWFs", + "X2xpc3QYDyADKAsyCS5NYXRlcmlhbBIdChVyZW1vdmVfcmVsaWNfdGlkX2xp", + "c3QYCCADKA0SJAoLSEtGQUZDRkZHT0kYxgggAygLMg4uU2VjdGlvblN0YXR1", + "cxIiCg5lcXVpcG1lbnRfbGlzdBgGIAMoCzIKLkVxdWlwbWVudBIhChlyZW1v", + "dmVfZXF1aXBtZW50X3RpZF9saXN0GA0gAygNEiwKC0tOQkxET0VITktQGNsM", + "IAEoCzIWLlBsYXllckJvYXJkTW9kdWxlU3luYxIiCgtFRkVIS09IS0VITBiD", + "CiADKAsyDC5OSktQRURJSE9KSRIgCgthdmF0YXJfc3luYxgDIAEoCzILLkF2", + "YXRhclN5bmMSFAoLTUNFSkFJR0tGRk0YwwogAygNEiUKC0hJSkRPREtOR01O", + "GAkgAygLMhAuV2FpdERlbFJlc291cmNlEiQKCmJhc2ljX2luZm8YBCABKAsy", + "EC5QbGF5ZXJCYXNpY0luZm8SGgoKcXVlc3RfbGlzdBgKIAMoCzIGLlF1ZXN0", + "EhoKCnJlbGljX2xpc3QYASADKAsyBi5SZWxpYxIfCgtGTEVLSEJGSkhQQhj6", + "AyABKAsyCS5JdGVtTGlzdBIfCgtFS1BNQklLTU5GQxjlCCADKAsyCS5NYXRl", + "cmlhbBInChFiYXNpY19tb2R1bGVfc3luYxgHIAEoCzIMLkJhc2ljTW9kdWxl", + "EiIKDG1pc3Npb25fc3luYxgCIAEoCzIMLk1pc3Npb25TeW5jEjYKFGJhc2lj", + "X3R5cGVfaW5mb19saXN0GAsgAygLMhguUGxheWVySGVyb0Jhc2ljVHlwZUlu", + "Zm9CHqoCG0VnZ0xpbmsuRGFuaGVuZ1NlcnZlci5Qcm90b2IGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { global::EggLink.DanhengServer.Proto.GroupStatusReflection.Descriptor, global::EggLink.DanhengServer.Proto.EquipmentReflection.Descriptor, global::EggLink.DanhengServer.Proto.PlayerBoardModuleSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.NJKPEDIHOJIReflection.Descriptor, global::EggLink.DanhengServer.Proto.MissionSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.PlayerBasicInfoReflection.Descriptor, global::EggLink.DanhengServer.Proto.PlayerHeroBasicTypeInfoReflection.Descriptor, global::EggLink.DanhengServer.Proto.AvatarSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.WaitDelResourceReflection.Descriptor, global::EggLink.DanhengServer.Proto.QuestReflection.Descriptor, global::EggLink.DanhengServer.Proto.SectionStatusReflection.Descriptor, global::EggLink.DanhengServer.Proto.RelicReflection.Descriptor, global::EggLink.DanhengServer.Proto.ItemListReflection.Descriptor, global::EggLink.DanhengServer.Proto.BasicModuleReflection.Descriptor, global::EggLink.DanhengServer.Proto.MaterialReflection.Descriptor, global::EggLink.DanhengServer.Proto.MissionEventSyncReflection.Descriptor, }, + new pbr::FileDescriptor[] { global::EggLink.DanhengServer.Proto.RelicReflection.Descriptor, global::EggLink.DanhengServer.Proto.PlayerBoardModuleSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.NJKPEDIHOJIReflection.Descriptor, global::EggLink.DanhengServer.Proto.GroupStatusReflection.Descriptor, global::EggLink.DanhengServer.Proto.EquipmentReflection.Descriptor, global::EggLink.DanhengServer.Proto.QuestReflection.Descriptor, global::EggLink.DanhengServer.Proto.BasicModuleReflection.Descriptor, global::EggLink.DanhengServer.Proto.WaitDelResourceReflection.Descriptor, global::EggLink.DanhengServer.Proto.ItemListReflection.Descriptor, global::EggLink.DanhengServer.Proto.MissionEventSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.PlayerHeroBasicTypeInfoReflection.Descriptor, global::EggLink.DanhengServer.Proto.MissionSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.AvatarSyncReflection.Descriptor, global::EggLink.DanhengServer.Proto.MaterialReflection.Descriptor, global::EggLink.DanhengServer.Proto.SectionStatusReflection.Descriptor, global::EggLink.DanhengServer.Proto.PlayerBasicInfoReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.PlayerSyncScNotify), global::EggLink.DanhengServer.Proto.PlayerSyncScNotify.Parser, new[]{ "MissionSync", "PNOOLDAHLEP", "TotalAchievementExp", "MaterialList", "RemoveTidList", "HKFAFCFFGOI", "EquipmentList", "OGGEHGKDIKN", "KNBLDOEHNKP", "EFEHKOHKEHL", "ADKJOFNHBFH", "MCEJAIGKFFM", "HIJDODKNGMN", "BasicInfo", "QuestList", "RelicList", "FLEKHBFJHPB", "EKPMBIKMNFC", "BasicModuleSync", "HDFKIAAMENC", "BasicTypeInfoList" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::EggLink.DanhengServer.Proto.PlayerSyncScNotify), global::EggLink.DanhengServer.Proto.PlayerSyncScNotify.Parser, new[]{ "MissionEventSync", "PNOOLDAHLEP", "TotalAchievementExp", "MaterialList", "RemoveRelicTidList", "HKFAFCFFGOI", "EquipmentList", "RemoveEquipmentTidList", "KNBLDOEHNKP", "EFEHKOHKEHL", "AvatarSync", "MCEJAIGKFFM", "HIJDODKNGMN", "BasicInfo", "QuestList", "RelicList", "FLEKHBFJHPB", "EKPMBIKMNFC", "BasicModuleSync", "MissionSync", "BasicTypeInfoList" }, null, null, null, null) })); } #endregion @@ -95,17 +95,17 @@ namespace EggLink.DanhengServer.Proto { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public PlayerSyncScNotify(PlayerSyncScNotify other) : this() { - missionSync_ = other.missionSync_ != null ? other.missionSync_.Clone() : null; + missionEventSync_ = other.missionEventSync_ != null ? other.missionEventSync_.Clone() : null; pNOOLDAHLEP_ = other.pNOOLDAHLEP_.Clone(); totalAchievementExp_ = other.totalAchievementExp_; materialList_ = other.materialList_.Clone(); - removeTidList_ = other.removeTidList_.Clone(); + removeRelicTidList_ = other.removeRelicTidList_.Clone(); hKFAFCFFGOI_ = other.hKFAFCFFGOI_.Clone(); equipmentList_ = other.equipmentList_.Clone(); - oGGEHGKDIKN_ = other.oGGEHGKDIKN_.Clone(); + removeEquipmentTidList_ = other.removeEquipmentTidList_.Clone(); kNBLDOEHNKP_ = other.kNBLDOEHNKP_ != null ? other.kNBLDOEHNKP_.Clone() : null; eFEHKOHKEHL_ = other.eFEHKOHKEHL_.Clone(); - aDKJOFNHBFH_ = other.aDKJOFNHBFH_ != null ? other.aDKJOFNHBFH_.Clone() : null; + avatarSync_ = other.avatarSync_ != null ? other.avatarSync_.Clone() : null; mCEJAIGKFFM_ = other.mCEJAIGKFFM_.Clone(); hIJDODKNGMN_ = other.hIJDODKNGMN_.Clone(); basicInfo_ = other.basicInfo_ != null ? other.basicInfo_.Clone() : null; @@ -114,7 +114,7 @@ namespace EggLink.DanhengServer.Proto { fLEKHBFJHPB_ = other.fLEKHBFJHPB_ != null ? other.fLEKHBFJHPB_.Clone() : null; eKPMBIKMNFC_ = other.eKPMBIKMNFC_.Clone(); basicModuleSync_ = other.basicModuleSync_ != null ? other.basicModuleSync_.Clone() : null; - hDFKIAAMENC_ = other.hDFKIAAMENC_ != null ? other.hDFKIAAMENC_.Clone() : null; + missionSync_ = other.missionSync_ != null ? other.missionSync_.Clone() : null; basicTypeInfoList_ = other.basicTypeInfoList_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -125,15 +125,15 @@ namespace EggLink.DanhengServer.Proto { return new PlayerSyncScNotify(this); } - /// Field number for the "mission_sync" field. - public const int MissionSyncFieldNumber = 5; - private global::EggLink.DanhengServer.Proto.MissionEventSync missionSync_; + /// Field number for the "mission_event_sync" field. + public const int MissionEventSyncFieldNumber = 5; + private global::EggLink.DanhengServer.Proto.MissionEventSync missionEventSync_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::EggLink.DanhengServer.Proto.MissionEventSync MissionSync { - get { return missionSync_; } + public global::EggLink.DanhengServer.Proto.MissionEventSync MissionEventSync { + get { return missionEventSync_; } set { - missionSync_ = value; + missionEventSync_ = value; } } @@ -171,15 +171,15 @@ namespace EggLink.DanhengServer.Proto { get { return materialList_; } } - /// Field number for the "remove_tid_list" field. - public const int RemoveTidListFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_removeTidList_codec + /// Field number for the "remove_relic_tid_list" field. + public const int RemoveRelicTidListFieldNumber = 8; + private static readonly pb::FieldCodec _repeated_removeRelicTidList_codec = pb::FieldCodec.ForUInt32(66); - private readonly pbc::RepeatedField removeTidList_ = new pbc::RepeatedField(); + private readonly pbc::RepeatedField removeRelicTidList_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField RemoveTidList { - get { return removeTidList_; } + public pbc::RepeatedField RemoveRelicTidList { + get { return removeRelicTidList_; } } /// Field number for the "HKFAFCFFGOI" field. @@ -204,15 +204,15 @@ namespace EggLink.DanhengServer.Proto { get { return equipmentList_; } } - /// Field number for the "OGGEHGKDIKN" field. - public const int OGGEHGKDIKNFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_oGGEHGKDIKN_codec + /// Field number for the "remove_equipment_tid_list" field. + public const int RemoveEquipmentTidListFieldNumber = 13; + private static readonly pb::FieldCodec _repeated_removeEquipmentTidList_codec = pb::FieldCodec.ForUInt32(106); - private readonly pbc::RepeatedField oGGEHGKDIKN_ = new pbc::RepeatedField(); + private readonly pbc::RepeatedField removeEquipmentTidList_ = new pbc::RepeatedField(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public pbc::RepeatedField OGGEHGKDIKN { - get { return oGGEHGKDIKN_; } + public pbc::RepeatedField RemoveEquipmentTidList { + get { return removeEquipmentTidList_; } } /// Field number for the "KNBLDOEHNKP" field. @@ -238,15 +238,15 @@ namespace EggLink.DanhengServer.Proto { get { return eFEHKOHKEHL_; } } - /// Field number for the "ADKJOFNHBFH" field. - public const int ADKJOFNHBFHFieldNumber = 3; - private global::EggLink.DanhengServer.Proto.AvatarSync aDKJOFNHBFH_; + /// Field number for the "avatar_sync" field. + public const int AvatarSyncFieldNumber = 3; + private global::EggLink.DanhengServer.Proto.AvatarSync avatarSync_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::EggLink.DanhengServer.Proto.AvatarSync ADKJOFNHBFH { - get { return aDKJOFNHBFH_; } + public global::EggLink.DanhengServer.Proto.AvatarSync AvatarSync { + get { return avatarSync_; } set { - aDKJOFNHBFH_ = value; + avatarSync_ = value; } } @@ -341,15 +341,15 @@ namespace EggLink.DanhengServer.Proto { } } - /// Field number for the "HDFKIAAMENC" field. - public const int HDFKIAAMENCFieldNumber = 2; - private global::EggLink.DanhengServer.Proto.MissionSync hDFKIAAMENC_; + /// Field number for the "mission_sync" field. + public const int MissionSyncFieldNumber = 2; + private global::EggLink.DanhengServer.Proto.MissionSync missionSync_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] - public global::EggLink.DanhengServer.Proto.MissionSync HDFKIAAMENC { - get { return hDFKIAAMENC_; } + public global::EggLink.DanhengServer.Proto.MissionSync MissionSync { + get { return missionSync_; } set { - hDFKIAAMENC_ = value; + missionSync_ = value; } } @@ -379,17 +379,17 @@ namespace EggLink.DanhengServer.Proto { if (ReferenceEquals(other, this)) { return true; } - if (!object.Equals(MissionSync, other.MissionSync)) return false; + if (!object.Equals(MissionEventSync, other.MissionEventSync)) return false; if(!pNOOLDAHLEP_.Equals(other.pNOOLDAHLEP_)) return false; if (TotalAchievementExp != other.TotalAchievementExp) return false; if(!materialList_.Equals(other.materialList_)) return false; - if(!removeTidList_.Equals(other.removeTidList_)) return false; + if(!removeRelicTidList_.Equals(other.removeRelicTidList_)) return false; if(!hKFAFCFFGOI_.Equals(other.hKFAFCFFGOI_)) return false; if(!equipmentList_.Equals(other.equipmentList_)) return false; - if(!oGGEHGKDIKN_.Equals(other.oGGEHGKDIKN_)) return false; + if(!removeEquipmentTidList_.Equals(other.removeEquipmentTidList_)) return false; if (!object.Equals(KNBLDOEHNKP, other.KNBLDOEHNKP)) return false; if(!eFEHKOHKEHL_.Equals(other.eFEHKOHKEHL_)) return false; - if (!object.Equals(ADKJOFNHBFH, other.ADKJOFNHBFH)) return false; + if (!object.Equals(AvatarSync, other.AvatarSync)) return false; if(!mCEJAIGKFFM_.Equals(other.mCEJAIGKFFM_)) return false; if(!hIJDODKNGMN_.Equals(other.hIJDODKNGMN_)) return false; if (!object.Equals(BasicInfo, other.BasicInfo)) return false; @@ -398,7 +398,7 @@ namespace EggLink.DanhengServer.Proto { if (!object.Equals(FLEKHBFJHPB, other.FLEKHBFJHPB)) return false; if(!eKPMBIKMNFC_.Equals(other.eKPMBIKMNFC_)) return false; if (!object.Equals(BasicModuleSync, other.BasicModuleSync)) return false; - if (!object.Equals(HDFKIAAMENC, other.HDFKIAAMENC)) return false; + if (!object.Equals(MissionSync, other.MissionSync)) return false; if(!basicTypeInfoList_.Equals(other.basicTypeInfoList_)) return false; return Equals(_unknownFields, other._unknownFields); } @@ -407,17 +407,17 @@ namespace EggLink.DanhengServer.Proto { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override int GetHashCode() { int hash = 1; - if (missionSync_ != null) hash ^= MissionSync.GetHashCode(); + if (missionEventSync_ != null) hash ^= MissionEventSync.GetHashCode(); hash ^= pNOOLDAHLEP_.GetHashCode(); if (TotalAchievementExp != 0) hash ^= TotalAchievementExp.GetHashCode(); hash ^= materialList_.GetHashCode(); - hash ^= removeTidList_.GetHashCode(); + hash ^= removeRelicTidList_.GetHashCode(); hash ^= hKFAFCFFGOI_.GetHashCode(); hash ^= equipmentList_.GetHashCode(); - hash ^= oGGEHGKDIKN_.GetHashCode(); + hash ^= removeEquipmentTidList_.GetHashCode(); if (kNBLDOEHNKP_ != null) hash ^= KNBLDOEHNKP.GetHashCode(); hash ^= eFEHKOHKEHL_.GetHashCode(); - if (aDKJOFNHBFH_ != null) hash ^= ADKJOFNHBFH.GetHashCode(); + if (avatarSync_ != null) hash ^= AvatarSync.GetHashCode(); hash ^= mCEJAIGKFFM_.GetHashCode(); hash ^= hIJDODKNGMN_.GetHashCode(); if (basicInfo_ != null) hash ^= BasicInfo.GetHashCode(); @@ -426,7 +426,7 @@ namespace EggLink.DanhengServer.Proto { if (fLEKHBFJHPB_ != null) hash ^= FLEKHBFJHPB.GetHashCode(); hash ^= eKPMBIKMNFC_.GetHashCode(); if (basicModuleSync_ != null) hash ^= BasicModuleSync.GetHashCode(); - if (hDFKIAAMENC_ != null) hash ^= HDFKIAAMENC.GetHashCode(); + if (missionSync_ != null) hash ^= MissionSync.GetHashCode(); hash ^= basicTypeInfoList_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -447,32 +447,32 @@ namespace EggLink.DanhengServer.Proto { output.WriteRawMessage(this); #else relicList_.WriteTo(output, _repeated_relicList_codec); - if (hDFKIAAMENC_ != null) { + if (missionSync_ != null) { output.WriteRawTag(18); - output.WriteMessage(HDFKIAAMENC); + output.WriteMessage(MissionSync); } - if (aDKJOFNHBFH_ != null) { + if (avatarSync_ != null) { output.WriteRawTag(26); - output.WriteMessage(ADKJOFNHBFH); + output.WriteMessage(AvatarSync); } if (basicInfo_ != null) { output.WriteRawTag(34); output.WriteMessage(BasicInfo); } - if (missionSync_ != null) { + if (missionEventSync_ != null) { output.WriteRawTag(42); - output.WriteMessage(MissionSync); + output.WriteMessage(MissionEventSync); } equipmentList_.WriteTo(output, _repeated_equipmentList_codec); if (basicModuleSync_ != null) { output.WriteRawTag(58); output.WriteMessage(BasicModuleSync); } - removeTidList_.WriteTo(output, _repeated_removeTidList_codec); + removeRelicTidList_.WriteTo(output, _repeated_removeRelicTidList_codec); hIJDODKNGMN_.WriteTo(output, _repeated_hIJDODKNGMN_codec); questList_.WriteTo(output, _repeated_questList_codec); basicTypeInfoList_.WriteTo(output, _repeated_basicTypeInfoList_codec); - oGGEHGKDIKN_.WriteTo(output, _repeated_oGGEHGKDIKN_codec); + removeEquipmentTidList_.WriteTo(output, _repeated_removeEquipmentTidList_codec); materialList_.WriteTo(output, _repeated_materialList_codec); pNOOLDAHLEP_.WriteTo(output, _repeated_pNOOLDAHLEP_codec); if (fLEKHBFJHPB_ != null) { @@ -502,32 +502,32 @@ namespace EggLink.DanhengServer.Proto { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { relicList_.WriteTo(ref output, _repeated_relicList_codec); - if (hDFKIAAMENC_ != null) { + if (missionSync_ != null) { output.WriteRawTag(18); - output.WriteMessage(HDFKIAAMENC); + output.WriteMessage(MissionSync); } - if (aDKJOFNHBFH_ != null) { + if (avatarSync_ != null) { output.WriteRawTag(26); - output.WriteMessage(ADKJOFNHBFH); + output.WriteMessage(AvatarSync); } if (basicInfo_ != null) { output.WriteRawTag(34); output.WriteMessage(BasicInfo); } - if (missionSync_ != null) { + if (missionEventSync_ != null) { output.WriteRawTag(42); - output.WriteMessage(MissionSync); + output.WriteMessage(MissionEventSync); } equipmentList_.WriteTo(ref output, _repeated_equipmentList_codec); if (basicModuleSync_ != null) { output.WriteRawTag(58); output.WriteMessage(BasicModuleSync); } - removeTidList_.WriteTo(ref output, _repeated_removeTidList_codec); + removeRelicTidList_.WriteTo(ref output, _repeated_removeRelicTidList_codec); hIJDODKNGMN_.WriteTo(ref output, _repeated_hIJDODKNGMN_codec); questList_.WriteTo(ref output, _repeated_questList_codec); basicTypeInfoList_.WriteTo(ref output, _repeated_basicTypeInfoList_codec); - oGGEHGKDIKN_.WriteTo(ref output, _repeated_oGGEHGKDIKN_codec); + removeEquipmentTidList_.WriteTo(ref output, _repeated_removeEquipmentTidList_codec); materialList_.WriteTo(ref output, _repeated_materialList_codec); pNOOLDAHLEP_.WriteTo(ref output, _repeated_pNOOLDAHLEP_codec); if (fLEKHBFJHPB_ != null) { @@ -556,24 +556,24 @@ namespace EggLink.DanhengServer.Proto { [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public int CalculateSize() { int size = 0; - if (missionSync_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MissionSync); + if (missionEventSync_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MissionEventSync); } size += pNOOLDAHLEP_.CalculateSize(_repeated_pNOOLDAHLEP_codec); if (TotalAchievementExp != 0) { size += 2 + pb::CodedOutputStream.ComputeUInt32Size(TotalAchievementExp); } size += materialList_.CalculateSize(_repeated_materialList_codec); - size += removeTidList_.CalculateSize(_repeated_removeTidList_codec); + size += removeRelicTidList_.CalculateSize(_repeated_removeRelicTidList_codec); size += hKFAFCFFGOI_.CalculateSize(_repeated_hKFAFCFFGOI_codec); size += equipmentList_.CalculateSize(_repeated_equipmentList_codec); - size += oGGEHGKDIKN_.CalculateSize(_repeated_oGGEHGKDIKN_codec); + size += removeEquipmentTidList_.CalculateSize(_repeated_removeEquipmentTidList_codec); if (kNBLDOEHNKP_ != null) { size += 2 + pb::CodedOutputStream.ComputeMessageSize(KNBLDOEHNKP); } size += eFEHKOHKEHL_.CalculateSize(_repeated_eFEHKOHKEHL_codec); - if (aDKJOFNHBFH_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ADKJOFNHBFH); + if (avatarSync_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(AvatarSync); } size += mCEJAIGKFFM_.CalculateSize(_repeated_mCEJAIGKFFM_codec); size += hIJDODKNGMN_.CalculateSize(_repeated_hIJDODKNGMN_codec); @@ -589,8 +589,8 @@ namespace EggLink.DanhengServer.Proto { if (basicModuleSync_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(BasicModuleSync); } - if (hDFKIAAMENC_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(HDFKIAAMENC); + if (missionSync_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MissionSync); } size += basicTypeInfoList_.CalculateSize(_repeated_basicTypeInfoList_codec); if (_unknownFields != null) { @@ -605,21 +605,21 @@ namespace EggLink.DanhengServer.Proto { if (other == null) { return; } - if (other.missionSync_ != null) { - if (missionSync_ == null) { - MissionSync = new global::EggLink.DanhengServer.Proto.MissionEventSync(); + if (other.missionEventSync_ != null) { + if (missionEventSync_ == null) { + MissionEventSync = new global::EggLink.DanhengServer.Proto.MissionEventSync(); } - MissionSync.MergeFrom(other.MissionSync); + MissionEventSync.MergeFrom(other.MissionEventSync); } pNOOLDAHLEP_.Add(other.pNOOLDAHLEP_); if (other.TotalAchievementExp != 0) { TotalAchievementExp = other.TotalAchievementExp; } materialList_.Add(other.materialList_); - removeTidList_.Add(other.removeTidList_); + removeRelicTidList_.Add(other.removeRelicTidList_); hKFAFCFFGOI_.Add(other.hKFAFCFFGOI_); equipmentList_.Add(other.equipmentList_); - oGGEHGKDIKN_.Add(other.oGGEHGKDIKN_); + removeEquipmentTidList_.Add(other.removeEquipmentTidList_); if (other.kNBLDOEHNKP_ != null) { if (kNBLDOEHNKP_ == null) { KNBLDOEHNKP = new global::EggLink.DanhengServer.Proto.PlayerBoardModuleSync(); @@ -627,11 +627,11 @@ namespace EggLink.DanhengServer.Proto { KNBLDOEHNKP.MergeFrom(other.KNBLDOEHNKP); } eFEHKOHKEHL_.Add(other.eFEHKOHKEHL_); - if (other.aDKJOFNHBFH_ != null) { - if (aDKJOFNHBFH_ == null) { - ADKJOFNHBFH = new global::EggLink.DanhengServer.Proto.AvatarSync(); + if (other.avatarSync_ != null) { + if (avatarSync_ == null) { + AvatarSync = new global::EggLink.DanhengServer.Proto.AvatarSync(); } - ADKJOFNHBFH.MergeFrom(other.ADKJOFNHBFH); + AvatarSync.MergeFrom(other.AvatarSync); } mCEJAIGKFFM_.Add(other.mCEJAIGKFFM_); hIJDODKNGMN_.Add(other.hIJDODKNGMN_); @@ -656,11 +656,11 @@ namespace EggLink.DanhengServer.Proto { } BasicModuleSync.MergeFrom(other.BasicModuleSync); } - if (other.hDFKIAAMENC_ != null) { - if (hDFKIAAMENC_ == null) { - HDFKIAAMENC = new global::EggLink.DanhengServer.Proto.MissionSync(); + if (other.missionSync_ != null) { + if (missionSync_ == null) { + MissionSync = new global::EggLink.DanhengServer.Proto.MissionSync(); } - HDFKIAAMENC.MergeFrom(other.HDFKIAAMENC); + MissionSync.MergeFrom(other.MissionSync); } basicTypeInfoList_.Add(other.basicTypeInfoList_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -683,17 +683,17 @@ namespace EggLink.DanhengServer.Proto { break; } case 18: { - if (hDFKIAAMENC_ == null) { - HDFKIAAMENC = new global::EggLink.DanhengServer.Proto.MissionSync(); + if (missionSync_ == null) { + MissionSync = new global::EggLink.DanhengServer.Proto.MissionSync(); } - input.ReadMessage(HDFKIAAMENC); + input.ReadMessage(MissionSync); break; } case 26: { - if (aDKJOFNHBFH_ == null) { - ADKJOFNHBFH = new global::EggLink.DanhengServer.Proto.AvatarSync(); + if (avatarSync_ == null) { + AvatarSync = new global::EggLink.DanhengServer.Proto.AvatarSync(); } - input.ReadMessage(ADKJOFNHBFH); + input.ReadMessage(AvatarSync); break; } case 34: { @@ -704,10 +704,10 @@ namespace EggLink.DanhengServer.Proto { break; } case 42: { - if (missionSync_ == null) { - MissionSync = new global::EggLink.DanhengServer.Proto.MissionEventSync(); + if (missionEventSync_ == null) { + MissionEventSync = new global::EggLink.DanhengServer.Proto.MissionEventSync(); } - input.ReadMessage(MissionSync); + input.ReadMessage(MissionEventSync); break; } case 50: { @@ -723,7 +723,7 @@ namespace EggLink.DanhengServer.Proto { } case 66: case 64: { - removeTidList_.AddEntriesFrom(input, _repeated_removeTidList_codec); + removeRelicTidList_.AddEntriesFrom(input, _repeated_removeRelicTidList_codec); break; } case 74: { @@ -740,7 +740,7 @@ namespace EggLink.DanhengServer.Proto { } case 106: case 104: { - oGGEHGKDIKN_.AddEntriesFrom(input, _repeated_oGGEHGKDIKN_codec); + removeEquipmentTidList_.AddEntriesFrom(input, _repeated_removeEquipmentTidList_codec); break; } case 122: { @@ -806,17 +806,17 @@ namespace EggLink.DanhengServer.Proto { break; } case 18: { - if (hDFKIAAMENC_ == null) { - HDFKIAAMENC = new global::EggLink.DanhengServer.Proto.MissionSync(); + if (missionSync_ == null) { + MissionSync = new global::EggLink.DanhengServer.Proto.MissionSync(); } - input.ReadMessage(HDFKIAAMENC); + input.ReadMessage(MissionSync); break; } case 26: { - if (aDKJOFNHBFH_ == null) { - ADKJOFNHBFH = new global::EggLink.DanhengServer.Proto.AvatarSync(); + if (avatarSync_ == null) { + AvatarSync = new global::EggLink.DanhengServer.Proto.AvatarSync(); } - input.ReadMessage(ADKJOFNHBFH); + input.ReadMessage(AvatarSync); break; } case 34: { @@ -827,10 +827,10 @@ namespace EggLink.DanhengServer.Proto { break; } case 42: { - if (missionSync_ == null) { - MissionSync = new global::EggLink.DanhengServer.Proto.MissionEventSync(); + if (missionEventSync_ == null) { + MissionEventSync = new global::EggLink.DanhengServer.Proto.MissionEventSync(); } - input.ReadMessage(MissionSync); + input.ReadMessage(MissionEventSync); break; } case 50: { @@ -846,7 +846,7 @@ namespace EggLink.DanhengServer.Proto { } case 66: case 64: { - removeTidList_.AddEntriesFrom(ref input, _repeated_removeTidList_codec); + removeRelicTidList_.AddEntriesFrom(ref input, _repeated_removeRelicTidList_codec); break; } case 74: { @@ -863,7 +863,7 @@ namespace EggLink.DanhengServer.Proto { } case 106: case 104: { - oGGEHGKDIKN_.AddEntriesFrom(ref input, _repeated_oGGEHGKDIKN_codec); + removeEquipmentTidList_.AddEntriesFrom(ref input, _repeated_removeEquipmentTidList_codec); break; } case 122: { diff --git a/Common/Util/Extensions.cs b/Common/Util/Extensions.cs index 40626fc2..64f20948 100644 --- a/Common/Util/Extensions.cs +++ b/Common/Util/Extensions.cs @@ -91,6 +91,11 @@ public static class Extensions return values[index]; } + public static int RandomInt (int from, int to) + { + return new Random().Next(from, to); + } + public static string ToArrayString(this List list) { return list.JoinFormat(", ", ""); diff --git a/Common/Util/GameTools.cs b/Common/Util/GameTools.cs new file mode 100644 index 00000000..68e2e7b1 --- /dev/null +++ b/Common/Util/GameTools.cs @@ -0,0 +1,35 @@ +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Database.Inventory; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Util +{ + public static class GameTools + { + public static int GetRandomRelicMainAffix(int GroupId) + { + GameData.RelicMainAffixData.TryGetValue(GroupId, out var affixes); + if (affixes == null) + { + return 0; + } + List affixList = []; + foreach (var affix in affixes.Values) + { + if (affix.IsAvailable) + { + affixList.Add(affix.AffixID); + } + } + if (affixList.Count == 0) + { + return 0; + } + return affixList.RandomElement(); + } + } +} diff --git a/GameServer/Command/Cmd/CommandGive.cs b/GameServer/Command/Cmd/CommandGive.cs index df2ec27b..d7d2f979 100644 --- a/GameServer/Command/Cmd/CommandGive.cs +++ b/GameServer/Command/Cmd/CommandGive.cs @@ -1,6 +1,6 @@ namespace EggLink.DanhengServer.Command.Cmd { - [CommandInfo("give", "Give item to player", "give l r p x")] + [CommandInfo("give", "Give item to player", "give l x")] public class CommandGive : ICommand { [CommandDefault] @@ -18,8 +18,11 @@ arg.SendMsg("Target not found."); return; } - - + arg.CharacterArgs.TryGetValue("x", out var str); + if (str == null) str = "1"; + + player.InventoryManager!.AddItem(int.Parse(arg.BasicArgs[0]), int.Parse(str)); + arg.SendMsg($"Give @{player.Uid} item of {arg.BasicArgs[0]}"); } } } diff --git a/GameServer/Command/CommandManager.cs b/GameServer/Command/CommandManager.cs index 68f28165..74e1fcf5 100644 --- a/GameServer/Command/CommandManager.cs +++ b/GameServer/Command/CommandManager.cs @@ -93,7 +93,13 @@ namespace EggLink.DanhengServer.Command if (canRun) { isFound = true; - method.Invoke(command, [arg]); + try + { + method.Invoke(command, [arg]); + } catch + { + Logger.Error($"An error happened when execute command \"{input}\""); + } break; } } @@ -114,7 +120,7 @@ namespace EggLink.DanhengServer.Command } else { - Logger.Info($"Command {cmd} not found."); + Logger.Info($"Command \"{cmd}\" not found."); } } } diff --git a/GameServer/Game/Avatar/AvatarManager.cs b/GameServer/Game/Avatar/AvatarManager.cs index 9c51eb44..5be368e2 100644 --- a/GameServer/Game/Avatar/AvatarManager.cs +++ b/GameServer/Game/Avatar/AvatarManager.cs @@ -3,6 +3,7 @@ using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Database; using EggLink.DanhengServer.Database.Avatar; using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Proto; namespace EggLink.DanhengServer.Game.Avatar { @@ -40,6 +41,7 @@ namespace EggLink.DanhengServer.Game.Avatar { return; } + var avatar = new AvatarInfo(avatarExcel) { AvatarId = avatarId, @@ -49,6 +51,11 @@ namespace EggLink.DanhengServer.Game.Avatar CurrentSp = 0 }; + if (avatarId >= 8001) + { + avatar.HeroId = 8001; + } + if (AvatarData?.Avatars == null) { AvatarData!.Avatars = []; @@ -60,6 +67,7 @@ namespace EggLink.DanhengServer.Game.Avatar public AvatarInfo? GetAvatar(int baseAvatarId) { + if (baseAvatarId > 8000) baseAvatarId = 1005; return AvatarData?.Avatars?.Find(avatar => avatar.AvatarId == baseAvatarId); } } diff --git a/GameServer/Game/Battle/BattleInstance.cs b/GameServer/Game/Battle/BattleInstance.cs index 6cf87591..7483fc0c 100644 --- a/GameServer/Game/Battle/BattleInstance.cs +++ b/GameServer/Game/Battle/BattleInstance.cs @@ -1,4 +1,7 @@ -using EggLink.DanhengServer.Data.Excel; +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Data.Excel; +using EggLink.DanhengServer.Database; +using EggLink.DanhengServer.Database.Avatar; using EggLink.DanhengServer.Game.Player; using EggLink.DanhengServer.Proto; @@ -44,10 +47,31 @@ namespace EggLink.DanhengServer.Game.Battle foreach (var avatar in Lineup.BaseAvatars!) { - var avatarInstance = Player.AvatarManager!.GetAvatar(avatar.BaseAvatarId); + AvatarInfo? avatarInstance = null; + var avatarType = AvatarType.AvatarFormalType; + if (avatar.AssistUid != 0) + { + var player = DatabaseHelper.Instance!.GetInstance(avatar.AssistUid); + if (player != null) + { + avatarInstance = player.Avatars!.Find(item => item.GetAvatarId() == avatar.BaseAvatarId); + avatarType = AvatarType.AvatarAssistType; + } + } else if (avatar.SpecialAvatarId != 0) + { + GameData.SpecialAvatarData.TryGetValue(avatar.SpecialAvatarId, out var specialAvatar); + if (specialAvatar != null) + { + avatarInstance = specialAvatar.ToAvatarData(); + avatarType = AvatarType.AvatarTrialType; + } + } else + { + avatarInstance = Player.AvatarManager!.GetAvatar(avatar.BaseAvatarId); + } if (avatarInstance == null) continue; - proto.BattleAvatarList.Add(avatarInstance.ToBattleProto(Player.LineupManager!.GetCurLineup()!, Player.InventoryManager!.Data)); + proto.BattleAvatarList.Add(avatarInstance.ToBattleProto(Player.LineupManager!.GetCurLineup()!, Player.InventoryManager!.Data, avatarType)); } return proto; diff --git a/GameServer/Game/Battle/BattleManager.cs b/GameServer/Game/Battle/BattleManager.cs index 00b1d269..1e69645d 100644 --- a/GameServer/Game/Battle/BattleManager.cs +++ b/GameServer/Game/Battle/BattleManager.cs @@ -6,17 +6,36 @@ using EggLink.DanhengServer.Proto; using EggLink.DanhengServer.Server.Packet.Send.Battle; using EggLink.DanhengServer.Server.Packet.Send.Lineup; using EggLink.DanhengServer.Util; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace EggLink.DanhengServer.Game.Battle { public class BattleManager(PlayerInstance player) : BasePlayerManager(player) { + public void StartStage(int eventId) + { + if (Player.BattleInstance != null) return; + + GameData.StageConfigData.TryGetValue(eventId, out var stageConfig); + if (stageConfig == null) + { + GameData.StageConfigData.TryGetValue(eventId * 10 + Player.Data.WorldLevel, out stageConfig); + if (stageConfig == null) + { + Player.SendPacket(new PacketSceneEnterStageScRsp()); + return; + } + } + + BattleInstance battleInstance = new(Player, Player.LineupManager!.GetCurLineup()!, [stageConfig]) + { + WorldLevel = Player.Data.WorldLevel, + }; + + Player.BattleInstance = battleInstance; + + Player.SendPacket(new PacketSceneEnterStageScRsp(battleInstance)); + } + public void StartCocoonStage(int cocoonId, int wave, int worldLevel) { if (Player.BattleInstance != null) return; @@ -52,7 +71,7 @@ namespace EggLink.DanhengServer.Game.Battle return; } - BattleInstance battleInstance = new(Player, Player.LineupManager.GetCurLineup()!, stageConfigExcels) + BattleInstance battleInstance = new(Player, Player.LineupManager!.GetCurLineup()!, stageConfigExcels) { StaminaCost = cost, WorldLevel = config.WorldLevel, @@ -111,7 +130,7 @@ namespace EggLink.DanhengServer.Game.Battle if (updateStatus) { - var lineup = player.LineupManager.GetCurLineup()!; + var lineup = player.LineupManager!.GetCurLineup()!; // Update battle status foreach (var avatar in req.Stt.AvatarBattleList) { @@ -119,7 +138,7 @@ namespace EggLink.DanhengServer.Game.Battle if (avatarInstance == null) continue; var prop = avatar.AvatarStatus; - int curHp = (int)Math.Round(prop.LeftHp / prop.MaxHp * 10000); + int curHp = (int)Math.Min(Math.Round(prop.LeftHp / prop.MaxHp * 10000), minimumHp); int curSp = (int)prop.LeftSp * 100; avatarInstance.SetCurHp(curHp, lineup.LineupType != 0); @@ -144,6 +163,8 @@ namespace EggLink.DanhengServer.Game.Battle } } } + // call battle end + Player.MissionManager!.OnBattleFinish(req); Player.BattleInstance = null; Player.SendPacket(new PacketPVEBattleResultScRsp(req, Player, battle)); diff --git a/GameServer/Game/Inventory/InventoryManager.cs b/GameServer/Game/Inventory/InventoryManager.cs index b52f0472..6cef8ed2 100644 --- a/GameServer/Game/Inventory/InventoryManager.cs +++ b/GameServer/Game/Inventory/InventoryManager.cs @@ -1,6 +1,10 @@ -using EggLink.DanhengServer.Database; +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Database; using EggLink.DanhengServer.Database.Inventory; +using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Server.Packet.Send.Player; +using EggLink.DanhengServer.Util; namespace EggLink.DanhengServer.Game.Inventory { @@ -21,9 +25,137 @@ namespace EggLink.DanhengServer.Game.Inventory Data = inventory!; } - public void AddItem(int itemId, int count) + public void AddItem(int itemId, int count, bool notify = false) { + GameData.ItemConfigData.TryGetValue(itemId, out var itemConfig); + if (itemConfig == null) return; + ItemData? itemData = null; + + switch (itemConfig.ItemMainType) + { + case ItemMainTypeEnum.Equipment: + itemData = PutItem(itemId, 1, rank: 1, level: 1, uniqueId: ++Data.NextUniqueId); + break; + case ItemMainTypeEnum.Usable: + switch (itemConfig.ItemSubType) + { + case ItemSubTypeEnum.HeadIcon: + Player.PlayerUnlockData!.HeadIcons.Add(itemId); + break; + case ItemSubTypeEnum.ChatBubble: + Player.PlayerUnlockData!.ChatBubbles.Add(itemId); + break; + case ItemSubTypeEnum.PhoneTheme: + Player.PlayerUnlockData!.PhoneThemes.Add(itemId); + break; + } + break; + case ItemMainTypeEnum.Relic: + var item = PutItem(itemId, 1, rank: 1, level: 0, uniqueId: ++Data.NextUniqueId); + item.AddRandomRelicMainAffix(); + item.AddRandomRelicSubAffix(3); + Data.RelicItems.Find(x => x.UniqueId == item.UniqueId)!.SubAffixes = item.SubAffixes; + itemData = item; + break; + default: + itemData = PutItem(itemId, Math.Min(count, itemConfig.PileLimit)); + break; + } + + if (itemData != null) + { + Player.SendPacket(new PacketPlayerSyncScNotify(itemData)); + } + + DatabaseHelper.Instance?.UpdateInstance(Data); } + + public ItemData PutItem(int itemId, int count, int rank = 0, int promotion = 0, int level = 0, int exp = 0, int totalExp = 0, int mainAffix = 0, List? subAffixes = null, int uniqueId = 0) + { + var item = new ItemData() + { + ItemId = itemId, + Count = count, + Rank = rank, + Promotion = promotion, + Level = level, + Exp = exp, + TotalExp = totalExp, + MainAffix = mainAffix, + SubAffixes = subAffixes ?? [], + }; + + if (uniqueId > 0) + { + item.UniqueId = uniqueId; + } + + switch (GameData.ItemConfigData[itemId].ItemMainType) + { + case ItemMainTypeEnum.Material: + Data.MaterialItems.Add(item); + break; + case ItemMainTypeEnum.Equipment: + Data.EquipmentItems.Add(item); + break; + case ItemMainTypeEnum.Relic: + Data.RelicItems.Add(item); + break; + } + + return item; + } + + #region Equip + + public void EquipRelic(int baseAvatarId, int relicUniqueId, int slot) + { + var itemData = Data.RelicItems.Find(x => x.UniqueId == relicUniqueId); + var avatarData = Player.AvatarManager!.GetAvatar(baseAvatarId); + if (itemData == null || avatarData == null) return; + avatarData.Relic.TryGetValue(slot, out int id); + var oldItem = Data.RelicItems.Find(x => x.UniqueId == id); + + if (itemData.EquipAvatar > 0) // already be dressed + { + var equipAvatar = Player.AvatarManager!.GetAvatar(itemData.EquipAvatar); + if (equipAvatar != null && oldItem != null) + { + // switch + equipAvatar.Relic[slot] = oldItem.UniqueId; + oldItem.EquipAvatar = equipAvatar.GetAvatarId(); + Player.SendPacket(new PacketPlayerSyncScNotify(equipAvatar, oldItem)); + } + } else + { + if (oldItem != null) + { + oldItem.EquipAvatar = 0; + } + } + itemData.EquipAvatar = avatarData.GetAvatarId(); + avatarData.Relic[slot] = itemData.UniqueId; + // save + DatabaseHelper.Instance!.UpdateInstance(Data); + DatabaseHelper.Instance!.UpdateInstance(Player.AvatarManager.AvatarData!); + Player.SendPacket(new PacketPlayerSyncScNotify(avatarData, itemData)); + } + + public void UnequipRelic(int baseAvatarId, int slot) + { + var avatarData = Player.AvatarManager!.GetAvatar(baseAvatarId); + if (avatarData == null) return; + avatarData.Relic.TryGetValue(slot, out var uniqueId); + var itemData = Data.RelicItems.Find(x => x.UniqueId == uniqueId); + if (itemData == null) return; + avatarData.Relic.Remove(slot); + itemData.EquipAvatar = 0; + DatabaseHelper.Instance!.UpdateInstance(Data); + DatabaseHelper.Instance!.UpdateInstance(Player.AvatarManager.AvatarData!); + Player.SendPacket(new PacketPlayerSyncScNotify(avatarData)); + } + + #endregion } } diff --git a/GameServer/Game/Lineup/LineupManager.cs b/GameServer/Game/Lineup/LineupManager.cs index 1f16ff55..6da4258d 100644 --- a/GameServer/Game/Lineup/LineupManager.cs +++ b/GameServer/Game/Lineup/LineupManager.cs @@ -1,7 +1,6 @@ using EggLink.DanhengServer.Database; using EggLink.DanhengServer.Database.Lineup; using EggLink.DanhengServer.Game.Player; -using Newtonsoft.Json; namespace EggLink.DanhengServer.Game.Lineup { @@ -88,5 +87,27 @@ namespace EggLink.DanhengServer.Game.Lineup { AddAvatar(LineupData.CurLineup, avatarId); } + + public void AddSpecialAvatarToCurTeam(int specialAvatarId) + { + LineupInfo.TryGetValue(LineupData.CurLineup, out LineupInfo? lineup); + if (lineup == null) + { + lineup = new() + { + Name = "Lineup " + LineupData.CurLineup, + LineupType = 0, + BaseAvatars = [new() { BaseAvatarId = specialAvatarId, SpecialAvatarId = specialAvatarId }], + LineupData = LineupData, + AvatarData = Player.AvatarManager!.AvatarData, + }; + LineupInfo.Add(LineupData.CurLineup, lineup); + } else + { + lineup.BaseAvatars?.Add(new() { BaseAvatarId = specialAvatarId, SpecialAvatarId = specialAvatarId }); + LineupInfo[LineupData.CurLineup] = lineup; + } + DatabaseHelper.Instance?.UpdateInstance(LineupData); + } } } diff --git a/GameServer/Game/Mission/Handler/MissionHandlerChangeLineup.cs b/GameServer/Game/Mission/Handler/MissionHandlerChangeLineup.cs new file mode 100644 index 00000000..2a9049e8 --- /dev/null +++ b/GameServer/Game/Mission/Handler/MissionHandlerChangeLineup.cs @@ -0,0 +1,51 @@ +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Database; +using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Game.Mission.Handler +{ + [MissionFinishAction(FinishActionTypeEnum.ChangeLineup)] + public class MissionHandlerChangeLineup : MissionFinishActionHandler + { + + public override void OnHandle(List Params, PlayerInstance Player) + { + var avatars = Player.LineupManager!.GetCurLineup()!.BaseAvatars!; + avatars.Clear(); + var count = 0; + foreach (var avatarId in Params) + { + if (count++ >= 4) break; + GameData.SpecialAvatarData.TryGetValue(avatarId * 10 + Player.Data.WorldLevel, out var specialAvatar); + if (specialAvatar == null) + { + GameData.AvatarConfigData.TryGetValue(avatarId, out var avatar); + if (avatar == null) continue; + avatars.Add(new Database.Lineup.AvatarInfo() + { + BaseAvatarId = avatarId, + }); + } else + { + avatars.Add(new Database.Lineup.AvatarInfo() + { + BaseAvatarId = specialAvatar.AvatarID, + SpecialAvatarId = avatarId * 10 + Player.Data.WorldLevel, + }); + } + } + GameData.SpecialAvatarData.TryGetValue(Params[4] * 10 + Player.Data.WorldLevel, out var leaderAvatar); + if (leaderAvatar == null) + { + Player.LineupManager!.GetCurLineup()!.LeaderAvatarId = Params[4]; + } else + { + Player.LineupManager!.GetCurLineup()!.LeaderAvatarId = leaderAvatar.AvatarID; + } + DatabaseHelper.Instance!.UpdateInstance(Player.LineupManager!.LineupData); + Player.SceneInstance!.SyncLineup(); + } + } +} diff --git a/GameServer/Game/Mission/MissionFinishActionAttribute.cs b/GameServer/Game/Mission/MissionFinishActionAttribute.cs new file mode 100644 index 00000000..496afe1b --- /dev/null +++ b/GameServer/Game/Mission/MissionFinishActionAttribute.cs @@ -0,0 +1,10 @@ +using EggLink.DanhengServer.Enums; + +namespace EggLink.DanhengServer.Game.Mission +{ + [AttributeUsage(AttributeTargets.Class)] + public class MissionFinishActionAttribute(FinishActionTypeEnum finishAction) : Attribute + { + public FinishActionTypeEnum FinishAction { get; } = finishAction; + } +} diff --git a/GameServer/Game/Mission/MissionFinishActionHandler.cs b/GameServer/Game/Mission/MissionFinishActionHandler.cs new file mode 100644 index 00000000..31efa035 --- /dev/null +++ b/GameServer/Game/Mission/MissionFinishActionHandler.cs @@ -0,0 +1,10 @@ +using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Game.Player; + +namespace EggLink.DanhengServer.Game.Mission +{ + public abstract class MissionFinishActionHandler + { + public abstract void OnHandle(List Params, PlayerInstance Player); + } +} diff --git a/GameServer/Game/Mission/MissionManager.cs b/GameServer/Game/Mission/MissionManager.cs index b9c7bc35..9761f14d 100644 --- a/GameServer/Game/Mission/MissionManager.cs +++ b/GameServer/Game/Mission/MissionManager.cs @@ -1,13 +1,19 @@ -using EggLink.DanhengServer.Database; +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Database; using EggLink.DanhengServer.Database.Mission; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Game.Scene.Entity; +using EggLink.DanhengServer.Server.Packet.Send.Mission; +using EggLink.DanhengServer.Server.Packet.Send.Player; +using System.Reflection; namespace EggLink.DanhengServer.Game.Mission { public class MissionManager : BasePlayerManager { public MissionData Data; + public Dictionary ActionHandlers = []; public MissionManager(PlayerInstance player) : base(player) { var mission = DatabaseHelper.Instance?.GetInstance(player.Uid); @@ -20,15 +26,196 @@ namespace EggLink.DanhengServer.Game.Mission mission = DatabaseHelper.Instance?.GetInstance(player.Uid); } Data = mission!; + + var types = Assembly.GetExecutingAssembly().GetTypes(); + foreach (var type in types) + { + var attr = type.GetCustomAttribute(); + if (attr != null) + { + var handler = (MissionFinishActionHandler)Activator.CreateInstance(type, null)!; + ActionHandlers.Add(attr.FinishAction, handler); + } + } } - public MissionPhaseEnum GetMissionStatus(int missionId) + public void AcceptMainMission(int missionId) { - if (Data.MissionInfo.TryGetValue(missionId, out var info)) + if (Data.MissionInfo.ContainsKey(missionId)) return; + // Get entry sub mission + GameData.MainMissionData.TryGetValue(missionId, out var mission); + if (mission == null) return; + + Data.MissionInfo.Add(missionId, []); + mission.MissionInfo?.StartSubMissionList.ForEach(AcceptSubMission); + } + + public void AcceptSubMission(int missionId) + { + AcceptSubMission(missionId, true); + } + + public Proto.MissionSync? AcceptSubMission(int missionId, bool sendPacket) + { + var mainMissionId = int.Parse(missionId.ToString()[..^2]); + if (!Data.MissionInfo.TryGetValue(mainMissionId, out Dictionary? value)) return null; + if (value == null || value.ContainsKey(missionId)) return null; + // Get entry sub mission + GameData.SubMissionData.TryGetValue(missionId, out var mission); + if (mission == null) return null; + + value.Add(missionId, new MissionInfo() { - return info.Status; + Status = MissionPhaseEnum.Doing, + MissionId = missionId, + }); + var sync = new Proto.MissionSync(); + sync.MissionList.Add(new Proto.Mission() + { + Id = (uint)missionId, + Status = Proto.MissionStatus.MissionDoing, + }); + + DatabaseHelper.Instance?.UpdateInstance(Data); + if (sendPacket) + Player.SendPacket(new PacketPlayerSyncScNotify(sync)); + Player.SceneInstance!.SyncGroupInfo(); + return sync; + } + + public void FinishSubMission(int missionId) + { + var mainMissionId = int.Parse(missionId.ToString()[..^2]); + if (!Data.MissionInfo.TryGetValue(mainMissionId, out var value)) return; + GameData.MainMissionData.TryGetValue(mainMissionId, out var mainMission); + if (mainMission == null) return; + if (value == null || !value.TryGetValue(missionId, out var mission)) return; + if (mission.Status != MissionPhaseEnum.Doing) return; + mission.Status = MissionPhaseEnum.Finish; + var sync = new Proto.MissionSync(); + sync.MissionList.Add(new Proto.Mission() + { + Id = (uint)missionId, + Status = Proto.MissionStatus.MissionFinish, + }); + + // get next sub mission + foreach (var nextMission in mainMission.MissionInfo?.SubMissionList ?? []) + { + bool canAccept = true; + foreach (var id in nextMission.TakeParamIntList) + { + if (GetSubMissionStatus(id) != MissionPhaseEnum.Finish) + { + canAccept = false; + } + } + if (canAccept) + { + var s = AcceptSubMission(nextMission.ID, false); + if (s != null) + { + sync.MissionList.Add(new Proto.Mission() + { + Id = (uint)nextMission.ID, + Status = Proto.MissionStatus.MissionDoing, + }); + } + } + if (nextMission.FinishType == MissionFinishTypeEnum.PropState) + { + foreach (var entity in Player.SceneInstance!.Entities.Values) + { + if (entity is EntityProp prop && prop.PropInfo.ID == nextMission.ParamInt2) + { + prop.SetState(PropStateEnum.Closed); + } + } + } + } + if (mainMission.MissionInfo != null) + HandleFinishAction(mainMission.MissionInfo, missionId); + Player.SendPacket(new PacketPlayerSyncScNotify(sync)); + Player.SendPacket(new PacketStartFinishSubMissionScNotify(missionId)); + + DatabaseHelper.Instance?.UpdateInstance(Data); + } + + public void HandleFinishAction(Data.Config.MissionInfo info, int subMissionId) + { + var subMission = info.SubMissionList.Find(x => x.ID == subMissionId); + if (subMission == null) return; + + foreach (var action in subMission.FinishActionList) + { + HandleFinishAction(action); + } + } + + public void HandleFinishAction(Data.Config.FinishActionInfo actionInfo) + { + ActionHandlers.TryGetValue(actionInfo.FinishActionType, out var handler); + handler?.OnHandle(actionInfo.FinishActionPara, Player); + } + + public MissionPhaseEnum GetMainMissionStatus(int missionId) + { + if (Data.MainMissionInfo.TryGetValue(missionId, out var info)) + { + return info!; } return MissionPhaseEnum.None; } + + public MissionPhaseEnum GetSubMissionStatus(int missionId) + { + var mainMissionId = int.Parse(missionId.ToString()[..^2]); + if (Data.MissionInfo.TryGetValue(mainMissionId, out var info)) + { + if (info.TryGetValue(missionId, out var mission)) + { + return mission.Status; + } + } + return MissionPhaseEnum.None; + } + + public Data.Config.SubMissionInfo? GetSubMissionInfo(int missionId) + { + var mainMissionId = int.Parse(missionId.ToString()[..^2]); + if (GameData.MainMissionData.TryGetValue(mainMissionId, out var mainMission)) + { + return mainMission.MissionInfo?.SubMissionList.Find(x => x.ID == missionId); + } + return null; + } + + public List GetRunningSubMissionIdList() + { + var list = new List(); + foreach (var mainMission in Data.MissionInfo.Values) + { + foreach (var subMission in mainMission.Values) + { + if (subMission.Status == MissionPhaseEnum.Doing) + { + list.Add(subMission.MissionId); + } + } + } + return list; + } + + public void OnBattleFinish(Proto.PVEBattleResultCsReq req) + { + foreach (var mission in GetRunningSubMissionIdList()) + { + var subMission = GetSubMissionInfo(mission); + if (subMission != null && subMission.FinishType == MissionFinishTypeEnum.StageWin && req.EndStatus == Proto.BattleEndStatus.BattleEndWin) + { + FinishSubMission(mission); + } + } + } } } diff --git a/GameServer/Game/Player/PlayerInstance.cs b/GameServer/Game/Player/PlayerInstance.cs index 7e657dce..dc754bf8 100644 --- a/GameServer/Game/Player/PlayerInstance.cs +++ b/GameServer/Game/Player/PlayerInstance.cs @@ -4,6 +4,7 @@ using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Database; using EggLink.DanhengServer.Database.Player; using EggLink.DanhengServer.Database.Scene; +using EggLink.DanhengServer.Database.Tutorial; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Game.Avatar; using EggLink.DanhengServer.Game.Battle; @@ -40,6 +41,7 @@ namespace EggLink.DanhengServer.Game.Player public PlayerData Data { get; set; } = data; public PlayerUnlockData? PlayerUnlockData { get; private set; } public SceneData? SceneData { get; private set; } + public TutorialData? TutorialData { get; private set; } public SceneInstance? SceneInstance { get; private set; } public ushort Uid { get; set; } public Connection? Connection { get; set; } @@ -80,11 +82,13 @@ namespace EggLink.DanhengServer.Game.Player InitialPlayerManager(); - AddAvatar(1005); + //AddAvatar(8001); LineupManager?.SetCurLineup(1); - LineupManager?.AddAvatarToCurTeam(1005); + //LineupManager?.AddAvatarToCurTeam(8001); + LineupManager?.AddSpecialAvatarToCurTeam(10010050); EnterScene(2000101, 0, false); + MissionManager!.AcceptMainMission(1000101); Initialized = true; } @@ -120,6 +124,19 @@ namespace EggLink.DanhengServer.Game.Player } SceneData = scene!; + var tutorial = DatabaseHelper.Instance?.GetInstance(Uid); + if (tutorial == null) + { + DatabaseHelper.Instance?.SaveInstance(new TutorialData() + { + Uid = Uid, + }); + tutorial = DatabaseHelper.Instance?.GetInstance(Uid); + } + TutorialData = tutorial!; + + + if (!IsNewPlayer) { LoadScene(Data.PlaneId, Data.FloorId, Data.EntryId, Data.Pos!, Data.Rot!, false); @@ -203,10 +220,11 @@ namespace EggLink.DanhengServer.Game.Player { GameData.InteractConfigData.TryGetValue(interactId, out var config); if (config == null || config.SrcState != prop.State) return prop; - var oldState = prop.State; - var newState = prop.State = config.TargetState; + prop.SetState(config.TargetState); + var newState = prop.State; SendPacket(new PacketGroupStateChangeScNotify(Data.EntryId, prop.GroupID, prop.State)); + switch (prop.Excel.PropType) { case PropTypeEnum.PROP_TREASURE_CHEST: @@ -218,7 +236,7 @@ namespace EggLink.DanhengServer.Game.Player case PropTypeEnum.PROP_DESTRUCT: if (newState == PropStateEnum.Closed) { - prop.State = PropStateEnum.Open; + prop.SetState(PropStateEnum.Open); } break; case PropTypeEnum.PROP_MAZE_PUZZLE: @@ -228,7 +246,7 @@ namespace EggLink.DanhengServer.Game.Player { if (p.Excel.PropType == PropTypeEnum.PROP_TREASURE_CHEST) { - p.State = PropStateEnum.ChestUsed; + p.SetState(PropStateEnum.ChestUsed); } else if (p.Excel.PropType == PropTypeEnum.PROP_MAZE_PUZZLE) { @@ -236,16 +254,36 @@ namespace EggLink.DanhengServer.Game.Player } else { - p.State = PropStateEnum.Open; + p.SetState(PropStateEnum.Open); } } } break; } - if (prop.Group.SaveType == SaveTypeEnum.Save) + // for door unlock + if (prop.PropInfo.UnlockDoorID.Count > 0) { - SetScenePropData(SceneInstance.FloorId, prop.GroupID, prop.PropInfo.ID, prop.State); + foreach (var id in prop.PropInfo.UnlockDoorID) + { + foreach (var p in SceneInstance.GetEntitiesInGroup(prop.GroupID)) + { + if (id == p.PropInfo.ID) + { + p.SetState(PropStateEnum.Open); + } + } + } + } + foreach (var id in MissionManager!.GetRunningSubMissionIdList()) + { + if (MissionManager.GetSubMissionInfo(id)?.FinishType == MissionFinishTypeEnum.PropState) + { + if (MissionManager.GetSubMissionInfo(id)?.ParamInt2 == prop.PropInfo.ID) + { + MissionManager.FinishSubMission(id); + } + } } return prop; } @@ -361,6 +399,37 @@ namespace EggLink.DanhengServer.Game.Player } } + public void EnterSection(int sectionId) + { + if (SceneInstance != null) + { + SceneData!.UnlockSectionIdList.TryGetValue(SceneInstance.FloorId, out var unlockList); + if (unlockList == null) + { + unlockList = [sectionId]; + SceneData.UnlockSectionIdList.Add(SceneInstance.FloorId, unlockList); + } else + { + SceneData.UnlockSectionIdList[SceneInstance.FloorId].Add(sectionId); + } + DatabaseHelper.Instance?.UpdateInstance(SceneData); + } + } + + public void SetCustomSaveData(int entryId, int groupId, string data) + { + if (SceneData != null) + { + if (!SceneData.CustomSaveData.TryGetValue(entryId, out var entryData)) + { + entryData = []; + SceneData.CustomSaveData.Add(entryId, entryData); + } + entryData[groupId] = data; + DatabaseHelper.Instance?.UpdateInstance(SceneData); + } + } + #endregion #region Serialization diff --git a/GameServer/Game/Scene/Entity/EntityProp.cs b/GameServer/Game/Scene/Entity/EntityProp.cs index c117c972..16b1792c 100644 --- a/GameServer/Game/Scene/Entity/EntityProp.cs +++ b/GameServer/Game/Scene/Entity/EntityProp.cs @@ -2,6 +2,7 @@ using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Scene; using EggLink.DanhengServer.Util; namespace EggLink.DanhengServer.Game.Scene.Entity @@ -12,7 +13,7 @@ namespace EggLink.DanhengServer.Game.Scene.Entity public int GroupID { get; set; } = group.Id; public Position Position { get; set; } = prop.ToPositionProto(); public Position Rotation { get; set; } = prop.ToRotationProto(); - public PropStateEnum State { get; set; } = PropStateEnum.Closed; + public PropStateEnum State { get; private set; } = PropStateEnum.Closed; public int InstId { get; set; } = prop.ID; public MazePropExcel Excel { get; set; } = excel; public PropInfo PropInfo { get; set; } = prop; @@ -20,6 +21,26 @@ namespace EggLink.DanhengServer.Game.Scene.Entity public PropRogueInfo? RogueInfo { get; set; } + public void SetState(PropStateEnum state) + { + SetState(state, scene.IsLoaded); + } + + public void SetState(PropStateEnum state, bool sendPacket) + { + State = state; + if (sendPacket) + { + scene.Player.SendPacket(new PacketSceneGroupRefreshScNotify(this)); + } + + // save + if (Group.SaveType == SaveTypeEnum.Save) + { + scene.Player.SetScenePropData(scene.FloorId, Group.Id, PropInfo.ID, state); + } + } + public SceneEntityInfo ToProto() { var prop = new ScenePropInfo() diff --git a/GameServer/Game/Scene/SceneEntityLoader.cs b/GameServer/Game/Scene/SceneEntityLoader.cs index 315c85e9..0522c763 100644 --- a/GameServer/Game/Scene/SceneEntityLoader.cs +++ b/GameServer/Game/Scene/SceneEntityLoader.cs @@ -2,6 +2,7 @@ using EggLink.DanhengServer.Data.Config; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Game.Scene.Entity; +using EggLink.DanhengServer.Server.Packet.Send.Scene; namespace EggLink.DanhengServer.Game.Scene { @@ -23,36 +24,59 @@ namespace EggLink.DanhengServer.Game.Scene scene.IsLoaded = true; } - public void LoadGroup(GroupInfo info) + public void SyncEntity() { - if (info.LoadCondition.Conditions.Count > 0) + bool refreshed = false; + var oldGroupId = new List(); + foreach (var entity in scene.Entities.Values) { - bool canLoad = info.LoadCondition.Operation == OperationEnum.And; - // check load condition - foreach (var condition in info.LoadCondition.Conditions) + if (!oldGroupId.Contains(entity.GroupID)) + oldGroupId.Add(entity.GroupID); + } + + var removeList = new List(); + + foreach (var group in scene.FloorInfo!.Groups.Values) + { + if (group.LoadSide == GroupLoadSideEnum.Client) { - if (scene.Player.MissionManager!.GetMissionStatus(condition.ID) != condition.Phase) - { - if (info.LoadCondition.Operation == OperationEnum.And) - { - canLoad = false; - break; - } - } - else - { - if (info.LoadCondition.Operation == OperationEnum.Or) - { - canLoad = true; - break; - } - } + continue; } - if (!canLoad) + + if (oldGroupId.Contains(group.Id)) // check if it should be unloaded { - return; + if (group.UnloadCondition.IsTrue(scene.Player.MissionManager!.Data, false) || group.ForceUnloadCondition.IsTrue(scene.Player.MissionManager!.Data, false)) + { + foreach (var entity in scene.Entities.Values) + { + if (entity.GroupID == group.Id) + { + scene.RemoveEntity(entity); + removeList.Add(entity); + refreshed = true; + } + } + } + } else // check if it should be loaded + { + refreshed = LoadGroup(group) || refreshed; + // LoadGroup will send the packet } } + if (refreshed) + { + scene.Player.SendPacket(new PacketSceneGroupRefreshScNotify(null, removeList)); + } + } + + public bool LoadGroup(GroupInfo info) + { + var missionData = scene.Player.MissionManager!.Data; + if (!info.LoadCondition.IsTrue(missionData) || info.UnloadCondition.IsTrue(missionData, false) || info.ForceUnloadCondition.IsTrue(missionData, false)) + { + return false; + } + foreach (var npc in info.NPCList) { try @@ -82,6 +106,8 @@ namespace EggLink.DanhengServer.Game.Scene { } } + + return true; } public void LoadNpc(NpcInfo info, GroupInfo group) @@ -148,10 +174,10 @@ namespace EggLink.DanhengServer.Game.Scene if (excel.PropType == PropTypeEnum.PROP_SPRING) { scene.HealingSprings.Add(prop); - prop.State = PropStateEnum.CheckPointEnable; + prop.SetState(PropStateEnum.CheckPointEnable); } else { - prop.State = info.State; + prop.SetState(info.State); } if (group.SaveType == SaveTypeEnum.Save) @@ -160,7 +186,7 @@ namespace EggLink.DanhengServer.Game.Scene var propData = scene.Player.GetScenePropData(scene.FloorId, group.Id, info.ID); if (propData != null) { - prop.State = propData.State; + prop.SetState(propData.State); } } } diff --git a/GameServer/Game/Scene/SceneInstance.cs b/GameServer/Game/Scene/SceneInstance.cs index 683b5439..209994a0 100644 --- a/GameServer/Game/Scene/SceneInstance.cs +++ b/GameServer/Game/Scene/SceneInstance.cs @@ -6,6 +6,7 @@ using EggLink.DanhengServer.Database.Avatar; using EggLink.DanhengServer.Game.Player; using EggLink.DanhengServer.Game.Scene.Entity; using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet; namespace EggLink.DanhengServer.Game.Scene { @@ -67,19 +68,25 @@ namespace EggLink.DanhengServer.Game.Scene var assistPlayer = DatabaseHelper.Instance?.GetInstance(avatar.AssistUid); if (assistPlayer != null) { - var assistAvatar = assistPlayer.Avatars?.Find(x => x.AvatarId == avatar.BaseAvatarId); + var assistAvatar = assistPlayer.Avatars?.Find(x => x.GetAvatarId() == avatar.BaseAvatarId); if (assistAvatar != null) { - AvatarInfo.Add(assistAvatar.AvatarId, new(assistAvatar, AvatarType.AvatarAssistType)); + AvatarInfo.Add(assistAvatar.GetAvatarId(), new(assistAvatar, AvatarType.AvatarAssistType)); } } } else if (avatar.SpecialAvatarId != 0) { - + var specialAvatar = GameData.SpecialAvatarData[avatar.SpecialAvatarId]; + if (specialAvatar != null) + { + var avatarData = specialAvatar.ToAvatarData(); + avatarData.EntityId = ++LastEntityId; + AvatarInfo.Add(avatarData.EntityId, new(avatarData, AvatarType.AvatarTrialType)); + } } else { var avatarData = Player.AvatarManager?.GetAvatar(avatar.BaseAvatarId); - if (avatarData?.AvatarId == avatar.BaseAvatarId) + if (avatarData?.GetAvatarId() == avatar.BaseAvatarId) { avatarData.EntityId = ++LastEntityId; AvatarInfo.Add(avatarData.EntityId, new(avatarData, AvatarType.AvatarFormalType)); @@ -90,6 +97,11 @@ namespace EggLink.DanhengServer.Game.Scene LeaderAvatarId = Player.LineupManager?.GetCurLineup()?.LeaderAvatarId ?? 0; } + public void SyncGroupInfo() + { + EntityLoader?.SyncEntity(); + } + #endregion #region Scene Details @@ -168,19 +180,23 @@ namespace EggLink.DanhengServer.Game.Scene { playerGroupInfo.EntityList.Add(avatar.Value.AvatarInfo.ToSceneEntityInfo(avatar.Value.AvatarType)); } - - if (LeaderAvatarId != 0) + if (playerGroupInfo.EntityList.Count > 0) { - sceneInfo.LeaderEntityId = (uint)LeaderAvatarId; - } else - { - LeaderAvatarId = AvatarInfo.Keys.First(); - sceneInfo.LeaderEntityId = (uint)LeaderAvatarId; + if (LeaderAvatarId != 0) + { + sceneInfo.LeaderEntityId = (uint)LeaderAvatarId; + } + else + { + LeaderAvatarId = AvatarInfo.Keys.First(); + sceneInfo.LeaderEntityId = (uint)LeaderAvatarId; + } } sceneInfo.EntityGroupList.Add(playerGroupInfo); List groups = []; // other groups + // add entities to groups foreach (var entity in Entities) { if (entity.Value.GroupID == 0) continue; @@ -199,6 +215,31 @@ namespace EggLink.DanhengServer.Game.Scene sceneInfo.EntityGroupList.Add(group); } + // custom save data + Player.SceneData!.CustomSaveData.TryGetValue(EntryId, out var data); + + if (data != null) + { + foreach (var customData in data) + { + sceneInfo.CustomSaveData.Add(new CustomSaveData() + { + GroupId = (uint)customData.Key, + SaveData = customData.Value + }); + } + } + + // unlock section + Player.SceneData!.UnlockSectionIdList.TryGetValue(FloorId, out var unlockSectionList); + if (unlockSectionList != null) + { + foreach (var sectionId in unlockSectionList) + { + sceneInfo.LightenSectionList.Add((uint)sectionId); + } + } + return sceneInfo; } diff --git a/GameServer/GameServer.csproj b/GameServer/GameServer.csproj index 6a1ffe6d..6b046c2a 100644 --- a/GameServer/GameServer.csproj +++ b/GameServer/GameServer.csproj @@ -18,7 +18,6 @@ - @@ -28,7 +27,6 @@ - diff --git a/GameServer/Server/Packet/Recv/Avatar/HandlerDressRelicAvatarCsReq.cs b/GameServer/Server/Packet/Recv/Avatar/HandlerDressRelicAvatarCsReq.cs new file mode 100644 index 00000000..c1c75e4a --- /dev/null +++ b/GameServer/Server/Packet/Recv/Avatar/HandlerDressRelicAvatarCsReq.cs @@ -0,0 +1,25 @@ +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Avatar +{ + [Opcode(CmdIds.DressRelicAvatarCsReq)] + public class HandlerDressRelicAvatarCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = DressRelicAvatarCsReq.Parser.ParseFrom(data); + + foreach (var param in req.SwitchList) + { + connection.Player!.InventoryManager!.EquipRelic((int)req.BaseAvatarId, (int)param.RelicUniqueId, (int) param.RelicType); + } + + connection.SendPacket(CmdIds.DressRelicAvatarScRsp); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Avatar/HandlerTakeOffRelicCsReq.cs b/GameServer/Server/Packet/Recv/Avatar/HandlerTakeOffRelicCsReq.cs new file mode 100644 index 00000000..83f91238 --- /dev/null +++ b/GameServer/Server/Packet/Recv/Avatar/HandlerTakeOffRelicCsReq.cs @@ -0,0 +1,18 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Avatar +{ + [Opcode(CmdIds.TakeOffRelicCsReq)] + public class HandlerTakeOffRelicCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = TakeOffRelicCsReq.Parser.ParseFrom(data); + foreach (var param in req.RelicTypeList) + { + connection.Player!.InventoryManager!.UnequipRelic((int)req.BaseAvatarId, (int)param); + } + connection.SendPacket(CmdIds.TakeOffRelicScRsp); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Battle/HandlerPVEBattleResultCsReq.cs b/GameServer/Server/Packet/Recv/Battle/HandlerPVEBattleResultCsReq.cs index 1428df21..8712ba6f 100644 --- a/GameServer/Server/Packet/Recv/Battle/HandlerPVEBattleResultCsReq.cs +++ b/GameServer/Server/Packet/Recv/Battle/HandlerPVEBattleResultCsReq.cs @@ -1,9 +1,4 @@ using EggLink.DanhengServer.Proto; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace EggLink.DanhengServer.Server.Packet.Recv.Battle { diff --git a/GameServer/Server/Packet/Recv/Battle/HandlerSceneEnterStageCsReq.cs b/GameServer/Server/Packet/Recv/Battle/HandlerSceneEnterStageCsReq.cs new file mode 100644 index 00000000..c9155712 --- /dev/null +++ b/GameServer/Server/Packet/Recv/Battle/HandlerSceneEnterStageCsReq.cs @@ -0,0 +1,20 @@ +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Battle +{ + [Opcode(CmdIds.SceneEnterStageCsReq)] + public class HandlerSceneEnterStageCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = SceneEnterStageCsReq.Parser.ParseFrom(data); + var player = connection.Player!; + player.BattleManager!.StartStage((int)req.EventId); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Mission/HandlerAcceptMainMissionCsReq.cs b/GameServer/Server/Packet/Recv/Mission/HandlerAcceptMainMissionCsReq.cs new file mode 100644 index 00000000..01f45b98 --- /dev/null +++ b/GameServer/Server/Packet/Recv/Mission/HandlerAcceptMainMissionCsReq.cs @@ -0,0 +1,19 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Mission; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Mission +{ + [Opcode(CmdIds.AcceptMainMissionCsReq)] + public class HandlerAcceptMainMissionCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = AcceptMainMissionCsReq.Parser.ParseFrom(data); + var missionId = req.MainMissionId; + + connection.Player!.MissionManager!.AcceptMainMission((int)missionId); + + connection.SendPacket(new PacketAcceptMainMissionScRsp(missionId)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Mission/HandlerFinishTalkMissionCsReq.cs b/GameServer/Server/Packet/Recv/Mission/HandlerFinishTalkMissionCsReq.cs new file mode 100644 index 00000000..098b5b0c --- /dev/null +++ b/GameServer/Server/Packet/Recv/Mission/HandlerFinishTalkMissionCsReq.cs @@ -0,0 +1,19 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Mission; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Mission +{ + [Opcode(CmdIds.FinishTalkMissionCsReq)] + public class HandlerFinishTalkMissionCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = FinishTalkMissionCsReq.Parser.ParseFrom(data); + var player = connection.Player!; + var missionId = int.Parse(req.TalkStr.Split('_')[1]); + player.MissionManager!.FinishSubMission(missionId); + + connection.SendPacket(new PacketFinishTalkMissionScRsp(req.TalkStr)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionDataCsReq.cs b/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionDataCsReq.cs new file mode 100644 index 00000000..c72b0c3e --- /dev/null +++ b/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionDataCsReq.cs @@ -0,0 +1,13 @@ +using EggLink.DanhengServer.Server.Packet.Send.Mission; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Mission +{ + [Opcode(CmdIds.GetMissionDataCsReq)] + public class HandlerGetMissionDataCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + connection.SendPacket(new PacketGetMissionDataScRsp(connection.Player!)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionStatusCsReq.cs b/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionStatusCsReq.cs index 2e4d3471..7fc5d0ec 100644 --- a/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionStatusCsReq.cs +++ b/GameServer/Server/Packet/Recv/Mission/HandlerGetMissionStatusCsReq.cs @@ -11,7 +11,7 @@ namespace EggLink.DanhengServer.Server.Packet.Recv.Mission var req = GetMissionStatusCsReq.Parser.ParseFrom(data); if (req != null) { - connection.SendPacket(new PacketGetMissionStatusScRsp(req)); + connection.SendPacket(new PacketGetMissionStatusScRsp(req, connection.Player!)); } } } diff --git a/GameServer/Server/Packet/Recv/Player/HandlerPlayerLoginFinishCsReq.cs b/GameServer/Server/Packet/Recv/Player/HandlerPlayerLoginFinishCsReq.cs index 92627212..a4f7a5cb 100644 --- a/GameServer/Server/Packet/Recv/Player/HandlerPlayerLoginFinishCsReq.cs +++ b/GameServer/Server/Packet/Recv/Player/HandlerPlayerLoginFinishCsReq.cs @@ -1,4 +1,6 @@ -namespace EggLink.DanhengServer.Server.Packet.Recv.Player +using EggLink.DanhengServer.Server.Packet.Send.Mission; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Player { [Opcode(CmdIds.PlayerLoginFinishCsReq)] public class HandlerPlayerLoginFinishCsReq : Handler @@ -7,6 +9,8 @@ { connection.SendPacket(CmdIds.PlayerLoginFinishScRsp); connection.SendPacket(CmdIds.GetArchiveDataScRsp); + var list = connection.Player!.MissionManager!.GetRunningSubMissionIdList(); + connection.SendPacket(new PacketMissionAcceptScNotify(list)); } } } diff --git a/GameServer/Server/Packet/Recv/Scene/HandlerEnterSectionCsReq.cs b/GameServer/Server/Packet/Recv/Scene/HandlerEnterSectionCsReq.cs new file mode 100644 index 00000000..d0e98497 --- /dev/null +++ b/GameServer/Server/Packet/Recv/Scene/HandlerEnterSectionCsReq.cs @@ -0,0 +1,16 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Scene +{ + [Opcode(CmdIds.EnterSectionCsReq)] + public class HandlerEnterSectionCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = EnterSectionCsReq.Parser.ParseFrom(data); + var player = connection.Player!; + player.EnterSection((int)req.SectionId); + connection.SendPacket(CmdIds.EnterSectionScRsp); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Scene/HandlerGetNpcTakenRewardCsReq.cs b/GameServer/Server/Packet/Recv/Scene/HandlerGetNpcTakenRewardCsReq.cs new file mode 100644 index 00000000..9a43869e --- /dev/null +++ b/GameServer/Server/Packet/Recv/Scene/HandlerGetNpcTakenRewardCsReq.cs @@ -0,0 +1,21 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Scene; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Scene +{ + [Opcode(CmdIds.GetNpcTakenRewardCsReq)] + public class HandlerGetNpcTakenRewardCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = GetNpcTakenRewardCsReq.Parser.ParseFrom(data); + + connection.SendPacket(new PacketGetNpcTakenRewardScRsp(req.NpcId)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Scene/HandlerGetSceneMapInfoCsReq.cs b/GameServer/Server/Packet/Recv/Scene/HandlerGetSceneMapInfoCsReq.cs index 10261ed3..eec504fc 100644 --- a/GameServer/Server/Packet/Recv/Scene/HandlerGetSceneMapInfoCsReq.cs +++ b/GameServer/Server/Packet/Recv/Scene/HandlerGetSceneMapInfoCsReq.cs @@ -9,7 +9,7 @@ namespace EggLink.DanhengServer.Server.Packet.Recv.Scene public override void OnHandle(Connection connection, byte[] header, byte[] data) { var req = GetSceneMapInfoCsReq.Parser.ParseFrom(data); - connection.SendPacket(new PacketGetSceneMapInfoScRsp(req)); + connection.SendPacket(new PacketGetSceneMapInfoScRsp(req, connection.Player!)); } } } diff --git a/GameServer/Server/Packet/Recv/Scene/HandlerSceneEntityTeleportCsReq.cs b/GameServer/Server/Packet/Recv/Scene/HandlerSceneEntityTeleportCsReq.cs new file mode 100644 index 00000000..e6453e70 --- /dev/null +++ b/GameServer/Server/Packet/Recv/Scene/HandlerSceneEntityTeleportCsReq.cs @@ -0,0 +1,20 @@ +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Scene +{ + [Opcode(CmdIds.SceneEntityTeleportCsReq)] + public class HandlerSceneEntityTeleportCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = SceneEntityTeleportCsReq.Parser.ParseFrom(data); + + + } + } +} diff --git a/GameServer/Server/Packet/Recv/Scene/HandlerSetGroupCustomSaveDataCsReq.cs b/GameServer/Server/Packet/Recv/Scene/HandlerSetGroupCustomSaveDataCsReq.cs new file mode 100644 index 00000000..a84b970c --- /dev/null +++ b/GameServer/Server/Packet/Recv/Scene/HandlerSetGroupCustomSaveDataCsReq.cs @@ -0,0 +1,17 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Scene; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Scene +{ + [Opcode(CmdIds.SetGroupCustomSaveDataCsReq)] + public class HandlerSetGroupCustomSaveDataCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = SetGroupCustomSaveDataCsReq.Parser.ParseFrom(data); + var player = connection.Player!; + player.SetCustomSaveData((int)req.EntryId, (int)req.GroupId, req.SaveData); + connection.SendPacket(new PacketSetGroupCustomSaveDataScRsp(req.EntryId, req.GroupId)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Tutorial/HandlerFinishTutorialCsReq.cs b/GameServer/Server/Packet/Recv/Tutorial/HandlerFinishTutorialCsReq.cs new file mode 100644 index 00000000..3ff38bdc --- /dev/null +++ b/GameServer/Server/Packet/Recv/Tutorial/HandlerFinishTutorialCsReq.cs @@ -0,0 +1,26 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Tutorial; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Tutorial +{ + [Opcode(CmdIds.FinishTutorialCsReq)] + public class HandlerFinishTutorialCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = FinishTutorialCsReq.Parser.ParseFrom(data); + var player = connection.Player!; + if (player.TutorialData!.Tutorials.TryGetValue((int)req.TutorialId, out var _)) + { + player.TutorialData!.Tutorials[(int)req.TutorialId] = TutorialStatus.TutorialFinish; + } + + connection.SendPacket(new PacketFinishTutorialScRsp(req.TutorialId)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Tutorial/HandlerGetTutorialCsReq.cs b/GameServer/Server/Packet/Recv/Tutorial/HandlerGetTutorialCsReq.cs new file mode 100644 index 00000000..56c0c84a --- /dev/null +++ b/GameServer/Server/Packet/Recv/Tutorial/HandlerGetTutorialCsReq.cs @@ -0,0 +1,18 @@ +using EggLink.DanhengServer.Server.Packet.Send.Tutorial; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Tutorial +{ + [Opcode(CmdIds.GetTutorialCsReq)] + public class HandlerGetTutorialCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + connection.SendPacket(new PacketGetTutorialScRsp(connection.Player!)); + } + } +} diff --git a/GameServer/Server/Packet/Recv/Tutorial/HandlerUnlockTutorialCsReq.cs b/GameServer/Server/Packet/Recv/Tutorial/HandlerUnlockTutorialCsReq.cs new file mode 100644 index 00000000..8f6c6f3b --- /dev/null +++ b/GameServer/Server/Packet/Recv/Tutorial/HandlerUnlockTutorialCsReq.cs @@ -0,0 +1,25 @@ +using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Server.Packet.Send.Tutorial; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Recv.Tutorial +{ + [Opcode(CmdIds.UnlockTutorialCsReq)] + public class HandlerUnlockTutorialCsReq : Handler + { + public override void OnHandle(Connection connection, byte[] header, byte[] data) + { + var req = UnlockTutorialCsReq.Parser.ParseFrom(data); + var player = connection.Player!; + if (!player.TutorialData!.Tutorials.TryGetValue((int)req.TutorialId, out var _)) + { + player.TutorialData!.Tutorials.Add((int)req.TutorialId, TutorialStatus.TutorialUnlock); + } + connection.SendPacket(new PacketUnlockTutorialScRsp(req.TutorialId)); + } + } +} diff --git a/GameServer/Server/Packet/Send/Battle/PacketSceneEnterStageScRsp.cs b/GameServer/Server/Packet/Send/Battle/PacketSceneEnterStageScRsp.cs new file mode 100644 index 00000000..ed833fad --- /dev/null +++ b/GameServer/Server/Packet/Send/Battle/PacketSceneEnterStageScRsp.cs @@ -0,0 +1,33 @@ +using EggLink.DanhengServer.Game.Battle; +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Send.Battle +{ + public class PacketSceneEnterStageScRsp : BasePacket + { + public PacketSceneEnterStageScRsp() : base(CmdIds.SceneEnterStageScRsp) + { + var proto = new SceneEnterStageScRsp() + { + Retcode = 1, + }; + + SetData(proto); + } + + public PacketSceneEnterStageScRsp(BattleInstance battleInstance) : base(CmdIds.SceneEnterStageScRsp) + { + var proto = new SceneEnterStageScRsp() + { + BattleInfo = battleInstance.ToProto(), + }; + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Lineup/PacketGetCurLineupDataScRsp.cs b/GameServer/Server/Packet/Send/Lineup/PacketGetCurLineupDataScRsp.cs index 27dcccb2..9f99aa7f 100644 --- a/GameServer/Server/Packet/Send/Lineup/PacketGetCurLineupDataScRsp.cs +++ b/GameServer/Server/Packet/Send/Lineup/PacketGetCurLineupDataScRsp.cs @@ -1,10 +1,5 @@ using EggLink.DanhengServer.Game.Player; using EggLink.DanhengServer.Proto; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace EggLink.DanhengServer.Server.Packet.Send.Lineup { @@ -14,7 +9,7 @@ namespace EggLink.DanhengServer.Server.Packet.Send.Lineup { var data = new GetCurLineupDataScRsp() { - Lineup = player.LineupManager!.GetCurLineup()!.ToProto(), + Lineup = player.LineupManager?.GetCurLineup()?.ToProto() ?? new(), }; SetData(data); diff --git a/GameServer/Server/Packet/Send/Mission/PacketAcceptMainMissionScRsp.cs b/GameServer/Server/Packet/Send/Mission/PacketAcceptMainMissionScRsp.cs new file mode 100644 index 00000000..3f65348e --- /dev/null +++ b/GameServer/Server/Packet/Send/Mission/PacketAcceptMainMissionScRsp.cs @@ -0,0 +1,17 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Mission +{ + public class PacketAcceptMainMissionScRsp : BasePacket + { + public PacketAcceptMainMissionScRsp(uint missionId) : base(CmdIds.AcceptMainMissionScRsp) + { + var proto = new AcceptMainMissionScRsp() + { + MainMissionId = missionId, + }; + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Mission/PacketFinishTalkMissionScRsp.cs b/GameServer/Server/Packet/Send/Mission/PacketFinishTalkMissionScRsp.cs new file mode 100644 index 00000000..d9be1cc5 --- /dev/null +++ b/GameServer/Server/Packet/Send/Mission/PacketFinishTalkMissionScRsp.cs @@ -0,0 +1,22 @@ +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Send.Mission +{ + public class PacketFinishTalkMissionScRsp : BasePacket + { + public PacketFinishTalkMissionScRsp(string talkStr) : base(CmdIds.FinishTalkMissionScRsp) + { + var proto = new FinishTalkMissionScRsp() + { + TalkStr = talkStr, + }; + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Mission/PacketGetMissionDataScRsp.cs b/GameServer/Server/Packet/Send/Mission/PacketGetMissionDataScRsp.cs new file mode 100644 index 00000000..9b394fcc --- /dev/null +++ b/GameServer/Server/Packet/Send/Mission/PacketGetMissionDataScRsp.cs @@ -0,0 +1,41 @@ +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Mission +{ + public class PacketGetMissionDataScRsp : BasePacket + { + public PacketGetMissionDataScRsp(PlayerInstance player) : base(CmdIds.GetMissionDataScRsp) + { + var proto = new GetMissionDataScRsp(); + + foreach (var mission in GameData.MainMissionData.Keys) + { + if (player.MissionManager!.GetMainMissionStatus(mission) == MissionPhaseEnum.Doing) + { + proto.MissionDataList.Add(new MissionData() + { + Id = (uint)mission, + Status = MissionStatus.MissionDoing + }); + } + } + + foreach (var mission in GameData.SubMissionData.Keys) + { + if (player.MissionManager!.GetSubMissionStatus(mission) == MissionPhaseEnum.Doing) + { + proto.MissionList.Add(new Proto.Mission() + { + Id = (uint)mission, + Status = MissionStatus.MissionDoing + }); + } + } + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Mission/PacketGetMissionStatusScRsp.cs b/GameServer/Server/Packet/Send/Mission/PacketGetMissionStatusScRsp.cs index 97764c1a..0998598e 100644 --- a/GameServer/Server/Packet/Send/Mission/PacketGetMissionStatusScRsp.cs +++ b/GameServer/Server/Packet/Send/Mission/PacketGetMissionStatusScRsp.cs @@ -1,24 +1,34 @@ -using EggLink.DanhengServer.Proto; +using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Proto; namespace EggLink.DanhengServer.Server.Packet.Send.Mission { public class PacketGetMissionStatusScRsp : BasePacket { - public PacketGetMissionStatusScRsp(GetMissionStatusCsReq req) : base(CmdIds.GetMissionStatusScRsp) + public PacketGetMissionStatusScRsp(GetMissionStatusCsReq req, PlayerInstance player) : base(CmdIds.GetMissionStatusScRsp) { var proto = new GetMissionStatusScRsp(); foreach (var item in req.MainMissionIdList) { - proto.FinishedMainMissionIdList.Add(item); + var status = player.MissionManager!.GetMainMissionStatus((int)item); + if (status == MissionPhaseEnum.Finish) + { + proto.FinishedMainMissionIdList.Add(item); + } else + { + proto.UnfinishedMainMissionIdList.Add(item); + } } foreach (var item in req.SubMissionIdList) { + var status = player.MissionManager!.GetSubMissionStatus((int)item); proto.SubMissionStatusList.Add(new Proto.Mission() { Id = item, - Status = MissionStatus.MissionFinish, + Status = status.ToProto(), }); } diff --git a/GameServer/Server/Packet/Send/Mission/PacketMissionAcceptScNotify.cs b/GameServer/Server/Packet/Send/Mission/PacketMissionAcceptScNotify.cs new file mode 100644 index 00000000..f18f64e7 --- /dev/null +++ b/GameServer/Server/Packet/Send/Mission/PacketMissionAcceptScNotify.cs @@ -0,0 +1,22 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Mission +{ + public class PacketMissionAcceptScNotify : BasePacket + { + public PacketMissionAcceptScNotify(int missionId) : this([missionId]) + { + } + + public PacketMissionAcceptScNotify(List missionIds) : base(CmdIds.MissionAcceptScNotify) + { + var proto = new MissionAcceptScNotify(); + foreach (var missionId in missionIds) + { + proto.SubMissionIdList.Add((uint)missionId); + } + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Mission/PacketStartFinishMainMissionScNotify.cs b/GameServer/Server/Packet/Send/Mission/PacketStartFinishMainMissionScNotify.cs new file mode 100644 index 00000000..7f4209cc --- /dev/null +++ b/GameServer/Server/Packet/Send/Mission/PacketStartFinishMainMissionScNotify.cs @@ -0,0 +1,17 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Mission +{ + public class PacketStartFinishMainMissionScNotify : BasePacket + { + public PacketStartFinishMainMissionScNotify(int missionId) : base(CmdIds.StartFinishMainMissionScNotify) + { + var proto = new StartFinishMainMissionScNotify() + { + MainMissionId = (uint)missionId, + }; + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Mission/PacketStartFinishSubMissionScNotify.cs b/GameServer/Server/Packet/Send/Mission/PacketStartFinishSubMissionScNotify.cs new file mode 100644 index 00000000..0e8ff018 --- /dev/null +++ b/GameServer/Server/Packet/Send/Mission/PacketStartFinishSubMissionScNotify.cs @@ -0,0 +1,17 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Mission +{ + public class PacketStartFinishSubMissionScNotify : BasePacket + { + public PacketStartFinishSubMissionScNotify(int missionId) : base(CmdIds.StartFinishSubMissionScNotify) + { + var proto = new StartFinishSubMissionScNotify() + { + SubMissionId = (uint)missionId, + }; + + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Player/PacketPlayerSyncScNotify.cs b/GameServer/Server/Packet/Send/Player/PacketPlayerSyncScNotify.cs index 01b879bb..4dc4f70c 100644 --- a/GameServer/Server/Packet/Send/Player/PacketPlayerSyncScNotify.cs +++ b/GameServer/Server/Packet/Send/Player/PacketPlayerSyncScNotify.cs @@ -1,4 +1,9 @@ -using System; +using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Database.Avatar; +using EggLink.DanhengServer.Database.Inventory; +using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Proto; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,9 +13,82 @@ namespace EggLink.DanhengServer.Server.Packet.Send.Player { public class PacketPlayerSyncScNotify : BasePacket { - public PacketPlayerSyncScNotify() : base(CmdIds.PlayerSyncScNotify) + public PacketPlayerSyncScNotify(ItemData item) : base(CmdIds.PlayerSyncScNotify) { + AddItemToProto(item, out var proto); + SetData(proto); + } + public PacketPlayerSyncScNotify(AvatarInfo avatar) : base(CmdIds.PlayerSyncScNotify) + { + var proto = new PlayerSyncScNotify + { + AvatarSync = new() + }; + proto.AvatarSync.AvatarList.Add(avatar.ToProto()); + + if (avatar.HeroId > 0) + { + proto.BasicTypeInfoList.Add(avatar.ToHeroProto()); + } + + SetData(proto); + } + + public PacketPlayerSyncScNotify(AvatarInfo avatar, ItemData item) : base(CmdIds.PlayerSyncScNotify) + { + AddItemToProto(item, out var proto); + proto.AvatarSync = new(); + proto.AvatarSync.AvatarList.Add(avatar.ToProto()); + + if (avatar.HeroId > 0) + { + proto.BasicTypeInfoList.Add(avatar.ToHeroProto()); + } + + SetData(proto); + } + + public PacketPlayerSyncScNotify(MissionSync mission) : base(CmdIds.PlayerSyncScNotify) + { + var proto = new PlayerSyncScNotify + { + MissionSync = mission, + }; + + SetData(proto); + } + + private void AddItemToProto(ItemData item, out PlayerSyncScNotify notify) + { + notify = new PlayerSyncScNotify(); + GameData.ItemConfigData.TryGetValue(item.ItemId, out var itemConfig); + if (itemConfig == null) return; + switch (itemConfig.ItemMainType) + { + case ItemMainTypeEnum.Equipment: + if (item.Count > 0) + { + notify.EquipmentList.Add(item.ToEquipmentProto()); + } else + { + notify.RemoveEquipmentTidList.Add((uint)item.UniqueId); + } + break; + case ItemMainTypeEnum.Relic: + if (item.Count > 0) + { + notify.RelicList.Add(item.ToRelicProto()); + } + else + { + notify.RemoveRelicTidList.Add((uint)item.UniqueId); + } + break; + case ItemMainTypeEnum.Material: + notify.MaterialList.Add(item.ToMaterialProto()); + break; + } } } } diff --git a/GameServer/Server/Packet/Send/Scene/PacketGetNpcTakenRewardScRsp.cs b/GameServer/Server/Packet/Send/Scene/PacketGetNpcTakenRewardScRsp.cs new file mode 100644 index 00000000..42ce364c --- /dev/null +++ b/GameServer/Server/Packet/Send/Scene/PacketGetNpcTakenRewardScRsp.cs @@ -0,0 +1,16 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Scene +{ + public class PacketGetNpcTakenRewardScRsp : BasePacket + { + public PacketGetNpcTakenRewardScRsp(uint npcId) : base(CmdIds.GetNpcTakenRewardScRsp) + { + var proto = new GetNpcTakenRewardScRsp() + { + NpcId = npcId, + }; + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Scene/PacketGetSceneMapInfoScRsp.cs b/GameServer/Server/Packet/Send/Scene/PacketGetSceneMapInfoScRsp.cs index e4e83303..39578e99 100644 --- a/GameServer/Server/Packet/Send/Scene/PacketGetSceneMapInfoScRsp.cs +++ b/GameServer/Server/Packet/Send/Scene/PacketGetSceneMapInfoScRsp.cs @@ -1,13 +1,14 @@ using EggLink.DanhengServer.Data; using EggLink.DanhengServer.Data.Config; using EggLink.DanhengServer.Enums; +using EggLink.DanhengServer.Game.Player; using EggLink.DanhengServer.Proto; namespace EggLink.DanhengServer.Server.Packet.Send.Scene { public class PacketGetSceneMapInfoScRsp : BasePacket { - public PacketGetSceneMapInfoScRsp(GetSceneMapInfoCsReq req) : base(CmdIds.GetSceneMapInfoScRsp) + public PacketGetSceneMapInfoScRsp(GetSceneMapInfoCsReq req, PlayerInstance player) : base(CmdIds.GetSceneMapInfoScRsp) { var rsp = new GetSceneMapInfoScRsp(); foreach (var entry in req.EntryIdList) @@ -73,11 +74,11 @@ namespace EggLink.DanhengServer.Server.Packet.Send.Scene mazeMap.MazePropList.Add(mazeProp); } - for (int i = 0; i < 100; i++) + player.SceneData!.UnlockSectionIdList.TryGetValue(mapData.FloorID, out var sections); + foreach (var section in sections ?? []) { - mazeMap.LightenSectionList.Add((uint)i); + mazeMap.LightenSectionList.Add((uint)section); } - rsp.MapList.Add(mazeMap); } SetData(rsp); diff --git a/GameServer/Server/Packet/Send/Scene/PacketSceneGroupRefreshScNotify.cs b/GameServer/Server/Packet/Send/Scene/PacketSceneGroupRefreshScNotify.cs index ea9bdfbc..47468fc1 100644 --- a/GameServer/Server/Packet/Send/Scene/PacketSceneGroupRefreshScNotify.cs +++ b/GameServer/Server/Packet/Send/Scene/PacketSceneGroupRefreshScNotify.cs @@ -1,39 +1,45 @@ using EggLink.DanhengServer.Game.Scene.Entity; using EggLink.DanhengServer.Proto; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace EggLink.DanhengServer.Server.Packet.Send.Scene { public class PacketSceneGroupRefreshScNotify : BasePacket { - public PacketSceneGroupRefreshScNotify(List entity, bool isAdd = true) : base(CmdIds.SceneGroupRefreshScNotify) + public PacketSceneGroupRefreshScNotify(List? addEntity = null, List? removeEntity = null) : base(CmdIds.SceneGroupRefreshScNotify) { var proto = new SceneGroupRefreshScNotify(); Dictionary refreshInfo = []; - foreach (var e in entity) + foreach (var e in addEntity ?? []) { var group = new GroupRefreshInfo() { GroupId = (uint)e.GroupID }; - if (isAdd) + group.RefreshEntity.Add(new SceneEntityRefreshInfo() { - group.RefreshEntity.Add(new SceneEntityRefreshInfo() - { - AddEntity = e.ToProto() - }); + AddEntity = e.ToProto() + }); + + if (refreshInfo.TryGetValue(e.GroupID, out GroupRefreshInfo? value)) + { + value.RefreshEntity.AddRange(group.RefreshEntity); } else { - group.RefreshEntity.Add(new SceneEntityRefreshInfo() - { - DelEntity = (uint)e.EntityID - }); + refreshInfo[e.GroupID] = group; } + } + + foreach (var e in removeEntity ?? []) + { + var group = new GroupRefreshInfo() + { + GroupId = (uint)e.GroupID + }; + group.RefreshEntity.Add(new SceneEntityRefreshInfo() + { + DelEntity = (uint)e.EntityID + }); if (refreshInfo.TryGetValue(e.GroupID, out GroupRefreshInfo? value)) { @@ -50,28 +56,9 @@ namespace EggLink.DanhengServer.Server.Packet.Send.Scene SetData(proto); } - public PacketSceneGroupRefreshScNotify(IGameEntity entity, bool isAdd = true) : base(CmdIds.SceneGroupRefreshScNotify) + public PacketSceneGroupRefreshScNotify(IGameEntity? addEntity = null, IGameEntity? removeEntity = null) : + this(addEntity == null ? [] : [addEntity], removeEntity == null ? [] : [removeEntity]) { - var proto = new SceneGroupRefreshScNotify(); - var group = new GroupRefreshInfo(); - if (isAdd) - { - group.RefreshEntity.Add(new SceneEntityRefreshInfo() - { - AddEntity = entity.ToProto() - }); - } - else - { - group.RefreshEntity.Add(new SceneEntityRefreshInfo() - { - DelEntity = (uint)entity.EntityID - }); - } - group.GroupId = (uint)entity.GroupID; - proto.GroupRefreshList.Add(group); - - SetData(proto); } } } diff --git a/GameServer/Server/Packet/Send/Scene/PacketSetGroupCustomSaveDataScRsp.cs b/GameServer/Server/Packet/Send/Scene/PacketSetGroupCustomSaveDataScRsp.cs new file mode 100644 index 00000000..51652498 --- /dev/null +++ b/GameServer/Server/Packet/Send/Scene/PacketSetGroupCustomSaveDataScRsp.cs @@ -0,0 +1,17 @@ +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Scene +{ + public class PacketSetGroupCustomSaveDataScRsp : BasePacket + { + public PacketSetGroupCustomSaveDataScRsp(uint entryId, uint groupId) : base(CmdIds.SetGroupCustomSaveDataScRsp) + { + var proto = new SetGroupCustomSaveDataScRsp() + { + EntryId = entryId, + GroupId = groupId + }; + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Tutorial/PacketFinishTutorialScRsp.cs b/GameServer/Server/Packet/Send/Tutorial/PacketFinishTutorialScRsp.cs new file mode 100644 index 00000000..a85b2058 --- /dev/null +++ b/GameServer/Server/Packet/Send/Tutorial/PacketFinishTutorialScRsp.cs @@ -0,0 +1,26 @@ +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Send.Tutorial +{ + public class PacketFinishTutorialScRsp : BasePacket + { + public PacketFinishTutorialScRsp(uint tutorialId) : base(CmdIds.FinishTutorialScRsp) + { + var rsp = new FinishTutorialScRsp + { + Tutorial = new Proto.Tutorial + { + Id = tutorialId, + Status = TutorialStatus.TutorialFinish, + } + }; + + SetData(rsp); + } + } +} diff --git a/GameServer/Server/Packet/Send/Tutorial/PacketGetTutorialScRsp.cs b/GameServer/Server/Packet/Send/Tutorial/PacketGetTutorialScRsp.cs new file mode 100644 index 00000000..741c4777 --- /dev/null +++ b/GameServer/Server/Packet/Send/Tutorial/PacketGetTutorialScRsp.cs @@ -0,0 +1,22 @@ +using EggLink.DanhengServer.Game.Player; +using EggLink.DanhengServer.Proto; + +namespace EggLink.DanhengServer.Server.Packet.Send.Tutorial +{ + public class PacketGetTutorialScRsp : BasePacket + { + public PacketGetTutorialScRsp(PlayerInstance player) : base(CmdIds.GetTutorialScRsp) + { + var proto = new GetTutorialScRsp(); + foreach (var item in player.TutorialData!.Tutorials) + { + proto.TutorialList.Add(new Proto.Tutorial() + { + Id = (uint)item.Key, + Status = item.Value, + }); + } + SetData(proto); + } + } +} diff --git a/GameServer/Server/Packet/Send/Tutorial/PacketUnlockTutorialScRsp.cs b/GameServer/Server/Packet/Send/Tutorial/PacketUnlockTutorialScRsp.cs new file mode 100644 index 00000000..ad878349 --- /dev/null +++ b/GameServer/Server/Packet/Send/Tutorial/PacketUnlockTutorialScRsp.cs @@ -0,0 +1,25 @@ +using EggLink.DanhengServer.Proto; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EggLink.DanhengServer.Server.Packet.Send.Tutorial +{ + public class PacketUnlockTutorialScRsp : BasePacket + { + public PacketUnlockTutorialScRsp(uint tutorialId) : base(CmdIds.UnlockTutorialScRsp) + { + var proto = new UnlockTutorialScRsp + { + Tutorial = new() + { + Id = tutorialId, + Status = TutorialStatus.TutorialUnlock, + } + }; + SetData(proto); + } + } +}