diff --git a/Command/Command/Cmd/CommandGiveall.cs b/Command/Command/Cmd/CommandGiveall.cs index 2a69eabb..dac70a05 100644 --- a/Command/Command/Cmd/CommandGiveall.cs +++ b/Command/Command/Cmd/CommandGiveall.cs @@ -248,29 +248,19 @@ public class CommandGiveall : ICommand return; } - foreach (var grid in GameData.TrainPartyGridConfigData.Keys) - { - await player.TrainPartyManager!.AddGrid(grid); - } + foreach (var grid in GameData.TrainPartyGridConfigData.Keys) await player.TrainPartyManager!.AddGrid(grid); - foreach (var card in GameData.TrainPartyCardConfigData.Keys) - { - await player.TrainPartyManager!.AddCard(card); - } + foreach (var card in GameData.TrainPartyCardConfigData.Keys) await player.TrainPartyManager!.AddCard(card); foreach (var area in player.TrainPartyManager!.TrainPartyData.Areas) - { - foreach (var step in GameData.TrainPartyStepConfigData.Values.Where(stepExcel => GameData.TrainPartyAreaGoalConfigData.First(x => x.Value.AreaID == area.Value.AreaId).Value - .StepGroupList.Contains(stepExcel.GroupID))) - { - area.Value.StepList.Add(step.ID); - } - } + foreach (var step in GameData.TrainPartyStepConfigData.Values.Where(stepExcel => GameData + .TrainPartyAreaGoalConfigData.First(x => x.Value.AreaID == area.Value.AreaId).Value + .StepGroupList.Contains(stepExcel.GroupID))) + area.Value.StepList.Add(step.ID); Dictionary update = []; player.SceneData!.FloorSavedData[player.SceneInstance!.FloorId] = []; foreach (var savedValue in player.SceneInstance!.FloorInfo!.FloorSavedValue) - { if (savedValue.Name.StartsWith("Build_") || savedValue.Name == "Onboarded") { player.SceneData!.FloorSavedData[player.SceneInstance!.FloorId][savedValue.Name] = 1; @@ -281,7 +271,6 @@ public class CommandGiveall : ICommand player.SceneData!.FloorSavedData[player.SceneInstance!.FloorId][savedValue.Name] = 100; update.TryAdd(savedValue.Name, 100); } - } await player.SendPacket(new PacketUpdateFloorSavedValueNotify(update, player)); diff --git a/Command/Command/Cmd/CommandRelic.cs b/Command/Command/Cmd/CommandRelic.cs index 9b3f7824..3d2c7024 100644 --- a/Command/Command/Cmd/CommandRelic.cs +++ b/Command/Command/Cmd/CommandRelic.cs @@ -71,8 +71,8 @@ public class CommandRelic : ICommand var mainAffixGroup = itemConfig.MainAffixGroup; var mainAffixGroupConfig = GameData.RelicMainAffixData[mainAffixGroup]; - string? mainProperty = mainAffixGroupConfig[mainAffixId].Property; - + var mainProperty = mainAffixGroupConfig[mainAffixId].Property; + for (var i = 0; i < amount; i++) { var remainLevel = 5; @@ -108,7 +108,8 @@ public class CommandRelic : ICommand { var subId = subAffixGroupKeys.RandomElement(); if (subAffixes.Any(x => x.Item1 == subId)) continue; - if (subAffixGroupConfig[subId] != null && subAffixGroupConfig[subId].Property == mainProperty) continue; + if (subAffixGroupConfig[subId] != null && + subAffixGroupConfig[subId].Property == mainProperty) continue; if (remainLevel <= 0) { @@ -142,7 +143,7 @@ public class CommandRelic : ICommand await player.InventoryManager!.AddItem(itemData, false); } - + await arg.SendMsg(I18NManager.Translate("Game.Command.Relic.RelicGiven", player.Uid.ToString(), amount.ToString(), itemConfigExcel.Name ?? arg.BasicArgs[0], mainAffixId.ToString())); diff --git a/Command/Command/Cmd/CommandReload.cs b/Command/Command/Cmd/CommandReload.cs index 751eabf1..b04ce4ad 100644 --- a/Command/Command/Cmd/CommandReload.cs +++ b/Command/Command/Cmd/CommandReload.cs @@ -32,7 +32,7 @@ public class CommandReload : ICommand { // Reload the videokeys GameData.VideoKeysConfig = ResourceManager.LoadCustomFile("VideoKeys", "VideoKeysConfig") ?? - new VideoKeysConfig(); + new VideoKeysConfig(); await arg.SendMsg(I18NManager.Translate("Game.Command.Reload.ConfigReloaded", I18NManager.Translate("Word.VideoKeys"))); } diff --git a/Command/Command/Cmd/CommandUnlockAll.cs b/Command/Command/Cmd/CommandUnlockAll.cs index a459a098..4c3f3526 100644 --- a/Command/Command/Cmd/CommandUnlockAll.cs +++ b/Command/Command/Cmd/CommandUnlockAll.cs @@ -39,7 +39,8 @@ public class CommandUnlockAll : ICommand player.AvatarManager!.GetHero()!.PathId = 8002; } - await arg.SendMsg(I18NManager.Translate("Game.Command.UnlockAll.UnlockedAll", I18NManager.Translate("Word.Mission"))); + await arg.SendMsg(I18NManager.Translate("Game.Command.UnlockAll.UnlockedAll", + I18NManager.Translate("Word.Mission"))); await arg.Target!.Player!.SendPacket(new PacketPlayerKickOutScNotify()); arg.Target!.Stop(); } @@ -56,16 +57,13 @@ public class CommandUnlockAll : ICommand var player = arg.Target!.Player!; foreach (var data in GameData.TutorialDataData) - { player.TutorialData!.Tutorials[data.Key] = TutorialStatus.TutorialFinish; - } foreach (var data in GameData.TutorialGuideDataData) - { player.TutorialGuideData!.Tutorials[data.Key] = TutorialStatus.TutorialFinish; - } - await arg.SendMsg(I18NManager.Translate("Game.Command.UnlockAll.UnlockedAll", I18NManager.Translate("Word.Tutorial"))); + await arg.SendMsg(I18NManager.Translate("Game.Command.UnlockAll.UnlockedAll", + I18NManager.Translate("Word.Tutorial"))); await arg.Target!.Player!.SendPacket(new PacketPlayerKickOutScNotify()); arg.Target!.Stop(); } @@ -80,7 +78,8 @@ public class CommandUnlockAll : ICommand } var player = arg.Target!.Player!; - List swarmList = [8013101, 8013102, 8013103, 8013104, 8013105, 8013106, 8013107, 8013108, 8013109, 8013110]; + List swarmList = + [8013101, 8013102, 8013103, 8013104, 8013105, 8013106, 8013107, 8013108, 8013109, 8013110]; List ggList = [8016101, 8016102, 8016103, 8016104, 8016105, 8016106]; List duList = [8023401, 8023501, 8023601]; List udList = [8026401, 8026402]; @@ -94,7 +93,8 @@ public class CommandUnlockAll : ICommand await player.MissionManager!.FinishMainMission(id); } - await arg.SendMsg(I18NManager.Translate("Game.Command.UnlockAll.UnlockedAll", I18NManager.Translate("Word.TypesOfRogue"))); + await arg.SendMsg(I18NManager.Translate("Game.Command.UnlockAll.UnlockedAll", + I18NManager.Translate("Word.TypesOfRogue"))); await arg.Target!.Player!.SendPacket(new PacketPlayerKickOutScNotify()); arg.Target!.Stop(); } diff --git a/Common/Data/Config/Scene/FloorInfo.cs b/Common/Data/Config/Scene/FloorInfo.cs index e5df7373..3f5168c4 100644 --- a/Common/Data/Config/Scene/FloorInfo.cs +++ b/Common/Data/Config/Scene/FloorInfo.cs @@ -25,6 +25,8 @@ public class FloorInfo [JsonIgnore] public int StartGroupID { get; set; } + [JsonIgnore] public List FloorSavedValue { get; set; } = []; + public AnchorInfo? GetAnchorInfo(int groupId, int anchorId) { Groups.TryGetValue(groupId, out var group); @@ -33,8 +35,6 @@ public class FloorInfo return group.AnchorList.Find(info => info.ID == anchorId); } - [JsonIgnore] public List FloorSavedValue { get; set; } = []; - public void OnLoad() { if (Loaded) return; @@ -47,7 +47,8 @@ public class FloorInfo // Cache anchors foreach (var group in Groups.Values) { - foreach (var condition in group.SavedValueCondition.Conditions.Where(x => SavedValues.Find(s => s.Name == x.SavedValueName) == null)) + foreach (var condition in group.SavedValueCondition.Conditions.Where(x => + SavedValues.Find(s => s.Name == x.SavedValueName) == null)) FloorSavedValue.Add(new FloorSavedValueInfo { DefaultValue = 0, diff --git a/Common/Data/Config/Scene/GroupInfo.cs b/Common/Data/Config/Scene/GroupInfo.cs index a2500b59..47b01aec 100644 --- a/Common/Data/Config/Scene/GroupInfo.cs +++ b/Common/Data/Config/Scene/GroupInfo.cs @@ -1,5 +1,4 @@ -using EggLink.DanhengServer.Data.Excel; -using EggLink.DanhengServer.Database.Quests; +using EggLink.DanhengServer.Database.Quests; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Enums.Mission; using EggLink.DanhengServer.Enums.Scene; diff --git a/Common/Data/Custom/VideoKeysConfig.cs b/Common/Data/Custom/VideoKeysConfig.cs index c4b2b6b6..4e947e2b 100644 --- a/Common/Data/Custom/VideoKeysConfig.cs +++ b/Common/Data/Custom/VideoKeysConfig.cs @@ -1,21 +1,20 @@ -namespace EggLink.DanhengServer.Data.Custom +namespace EggLink.DanhengServer.Data.Custom; + +public class VideoKeysConfig { - public class VideoKeysConfig - { - public List ActivityVideoKeyData { get; set; } = new(); - public List VideoKeyInfoData { get; set; } = new(); - public int TotalCount => ActivityVideoKeyData.Count + VideoKeyInfoData.Count; - } - - public class ActivityVideoKeyInfoList - { - public int Id { get; set; } - public ulong VideoKey { get; set; } - } - - public class VideoKeyInfoList - { - public int Id { get; set; } - public ulong VideoKey { get; set; } - } + public List ActivityVideoKeyData { get; set; } = new(); + public List VideoKeyInfoData { get; set; } = new(); + public int TotalCount => ActivityVideoKeyData.Count + VideoKeyInfoData.Count; } + +public class ActivityVideoKeyInfoList +{ + public int Id { get; set; } + public ulong VideoKey { get; set; } +} + +public class VideoKeyInfoList +{ + public int Id { get; set; } + public ulong VideoKey { get; set; } +} \ No newline at end of file diff --git a/Common/Data/GameData.cs b/Common/Data/GameData.cs index 5d861d02..e04f6b74 100644 --- a/Common/Data/GameData.cs +++ b/Common/Data/GameData.cs @@ -27,6 +27,12 @@ public static class GameData #endregion + #region Pam + + public static Dictionary PamSkinConfigData { get; private set; } = []; + + #endregion + #region Avatar public static Dictionary AvatarConfigData { get; private set; } = []; @@ -128,17 +134,16 @@ public static class GameData #endregion - #region Pam - - public static Dictionary PamSkinConfigData { get; private set; } = []; - - #endregion - #region TrainParty - public static Dictionary TrainPartyPassengerConfigData { get; private set; } = []; + public static Dictionary TrainPartyPassengerConfigData { get; private set; } = + []; + public static Dictionary TrainPartyAreaConfigData { get; private set; } = []; - public static Dictionary TrainPartyAreaGoalConfigData { get; private set; } = []; + + public static Dictionary TrainPartyAreaGoalConfigData { get; private set; } = + []; + public static Dictionary TrainPartyTeamData { get; private set; } = []; public static Dictionary TrainPartyStepConfigData { get; private set; } = []; public static Dictionary TrainPartyDynamicConfigData { get; private set; } = []; diff --git a/Common/Data/ResourceManager.cs b/Common/Data/ResourceManager.cs index e62bd7dc..1fdf643d 100644 --- a/Common/Data/ResourceManager.cs +++ b/Common/Data/ResourceManager.cs @@ -39,7 +39,8 @@ public class ResourceManager var t8 = Task.Run(LoadAdventureModifier); GameData.ActivityConfig = LoadCustomFile("Activity", "ActivityConfig") ?? new ActivityConfig(); GameData.BannersConfig = LoadCustomFile("Banner", "Banners") ?? new BannersConfig(); - GameData.VideoKeysConfig = LoadCustomFile("VideoKeys", "VideoKeysConfig") ?? new VideoKeysConfig(); + GameData.VideoKeysConfig = + LoadCustomFile("VideoKeys", "VideoKeysConfig") ?? new VideoKeysConfig(); GameData.RogueMapGenData = LoadCustomFile>>("Rogue Map", "RogueMapGen") ?? []; GameData.RogueMiracleGroupData = LoadCustomFile>>("Rogue Miracle Group", "RogueMiracleGroup") ?? []; diff --git a/Common/Database/TrainParty/GameTrainPartyData.cs b/Common/Database/TrainParty/GameTrainPartyData.cs index 69461dbf..fccf45b8 100644 --- a/Common/Database/TrainParty/GameTrainPartyData.cs +++ b/Common/Database/TrainParty/GameTrainPartyData.cs @@ -65,18 +65,24 @@ public class GameTrainPartyAreaInfo AreaStepInfo = new AreaStepInfo { AreaGlobalId = (uint)GameData.TrainPartyAreaGoalConfigData.First(x => x.Value.AreaID == AreaId).Key, - AreaStepList = { StepList.Select(x => new BuildAreaStep + AreaStepList = { - StepId = (uint)x, - Status = BuildGoalStep.Finish - }) } + StepList.Select(x => new BuildAreaStep + { + StepId = (uint)x, + Status = BuildGoalStep.Finish + }) + } }, Progress = 100, - DynamicInfo = { DynamicInfo.Select(x => new AreaDynamicInfo + DynamicInfo = { - DiceSlotId = (uint)x.Key, - DiyDynamicId = (uint)x.Value - }) } + DynamicInfo.Select(x => new AreaDynamicInfo + { + DiceSlotId = (uint)x.Key, + DiyDynamicId = (uint)x.Value + }) + } }; foreach (var step in StepList) diff --git a/Common/Enums/Item/ItemSubTypeEnum.cs b/Common/Enums/Item/ItemSubTypeEnum.cs index c3b3c0b1..e48030bc 100644 --- a/Common/Enums/Item/ItemSubTypeEnum.cs +++ b/Common/Enums/Item/ItemSubTypeEnum.cs @@ -2,7 +2,6 @@ public enum ItemSubTypeEnum { - Unknown = 0, Virtual = 101, GameplayCounter = 102, diff --git a/Common/Internationalization/I18nManager.cs b/Common/Internationalization/I18nManager.cs index 2cee935c..eea6d8f1 100644 --- a/Common/Internationalization/I18nManager.cs +++ b/Common/Internationalization/I18nManager.cs @@ -71,7 +71,8 @@ public static class I18NManager { var languageStr = "EggLink.DanhengServer.Internationalization.Message.Language" + langStr; - var languageType = Type.GetType(languageStr) ?? Type.GetType("EggLink.DanhengServer.Internationalization.Message.LanguageEN")!; + var languageType = Type.GetType(languageStr) ?? + Type.GetType("EggLink.DanhengServer.Internationalization.Message.LanguageEN")!; var language = Activator.CreateInstance(languageType) ?? throw new Exception("Language not found"); List langs = [language]; diff --git a/DanhengKcpSharp/DanhengConnection.cs b/DanhengKcpSharp/DanhengConnection.cs index 68dd6f43..67dbfc1a 100644 --- a/DanhengKcpSharp/DanhengConnection.cs +++ b/DanhengKcpSharp/DanhengConnection.cs @@ -35,10 +35,7 @@ public class DanhengConnection Conversation = conversation; RemoteEndPoint = remote; CancelToken = new CancellationTokenSource(); - if (ConfigManager.Config.GameServer.UsePacketEncryption) - { - XorKey = Crypto.ClientSecretKey!.GetXorKey(); - } + if (ConfigManager.Config.GameServer.UsePacketEncryption) XorKey = Crypto.ClientSecretKey!.GetXorKey(); Start(); } diff --git a/GameServer/Game/Battle/Skill/Action/MazeRemoveMazeBuff.cs b/GameServer/Game/Battle/Skill/Action/MazeRemoveMazeBuff.cs index 83b31fbd..165bf737 100644 --- a/GameServer/Game/Battle/Skill/Action/MazeRemoveMazeBuff.cs +++ b/GameServer/Game/Battle/Skill/Action/MazeRemoveMazeBuff.cs @@ -1,6 +1,6 @@ using EggLink.DanhengServer.GameServer.Game.Player; -using EggLink.DanhengServer.GameServer.Game.Scene.Entity; using EggLink.DanhengServer.GameServer.Game.Scene; +using EggLink.DanhengServer.GameServer.Game.Scene.Entity; namespace EggLink.DanhengServer.GameServer.Game.Battle.Skill.Action; diff --git a/GameServer/Game/Challenge/ChallengeInstance.cs b/GameServer/Game/Challenge/ChallengeInstance.cs index 93beebee..ad2721aa 100644 --- a/GameServer/Game/Challenge/ChallengeInstance.cs +++ b/GameServer/Game/Challenge/ChallengeInstance.cs @@ -448,4 +448,4 @@ public class ChallengeInstance } #endregion -} +} \ No newline at end of file diff --git a/GameServer/Game/ChessRogue/Cell/ChessRogueCellInstance.cs b/GameServer/Game/ChessRogue/Cell/ChessRogueCellInstance.cs index 77221b09..3c140106 100644 --- a/GameServer/Game/ChessRogue/Cell/ChessRogueCellInstance.cs +++ b/GameServer/Game/ChessRogue/Cell/ChessRogueCellInstance.cs @@ -194,7 +194,7 @@ public class ChessRogueCellInstance //BlockType = (uint)BlockType, IsUnlock = true, RoomId = (uint)RoomId, - IsUnlocked = true, + IsUnlocked = true //PosX = (uint)GetRow(), //MarkType = (uint)MarkType }; diff --git a/GameServer/Game/Lineup/LineupManager.cs b/GameServer/Game/Lineup/LineupManager.cs index cb233607..518c9150 100644 --- a/GameServer/Game/Lineup/LineupManager.cs +++ b/GameServer/Game/Lineup/LineupManager.cs @@ -44,7 +44,7 @@ public class LineupManager : BasePlayerManager public LineupInfo? GetCurLineup() { - LineupInfo? lineup = GetLineup(LineupData.GetCurLineupIndex()); + var lineup = GetLineup(LineupData.GetCurLineupIndex()); return lineup; } diff --git a/GameServer/Game/Mission/FinishAction/Handler/MissionHandlerSetFloorSavedValue.cs b/GameServer/Game/Mission/FinishAction/Handler/MissionHandlerSetFloorSavedValue.cs index 166ae32c..e7216697 100644 --- a/GameServer/Game/Mission/FinishAction/Handler/MissionHandlerSetFloorSavedValue.cs +++ b/GameServer/Game/Mission/FinishAction/Handler/MissionHandlerSetFloorSavedValue.cs @@ -19,7 +19,8 @@ public class MissionHandlerSetFloorSavedValue : MissionFinishActionHandler } value[ParamString[2]] = int.Parse(ParamString[3]); // ParamString[2] is the key - await Player.SendPacket(new PacketUpdateFloorSavedValueNotify(ParamString[2], int.Parse(ParamString[3]), Player)); + await Player.SendPacket( + new PacketUpdateFloorSavedValueNotify(ParamString[2], int.Parse(ParamString[3]), Player)); Player.TaskManager?.SceneTaskTrigger.TriggerFloor(plane, floor); } diff --git a/GameServer/Game/Mission/MissionManager.cs b/GameServer/Game/Mission/MissionManager.cs index d369bf69..9ac011c4 100644 --- a/GameServer/Game/Mission/MissionManager.cs +++ b/GameServer/Game/Mission/MissionManager.cs @@ -86,7 +86,9 @@ public class MissionManager : BasePlayerManager x.MainMissionLink == missionId)) await Player.MessageManager!.AddMessageSection(sectionConfigExcel.ID); - foreach (var info in mission.MissionInfo!.SubMissionList.Where(x => x.FinishType is MissionFinishTypeEnum.MessagePerformSectionFinish or MissionFinishTypeEnum.MessageSectionFinish)) + foreach (var info in mission.MissionInfo!.SubMissionList.Where(x => + x.FinishType is MissionFinishTypeEnum.MessagePerformSectionFinish + or MissionFinishTypeEnum.MessageSectionFinish)) await Player.MessageManager!.AddMessageSection(info.ParamInt1); return list; diff --git a/GameServer/Game/Scene/SceneEntityLoader.cs b/GameServer/Game/Scene/SceneEntityLoader.cs index cc5812b5..3f6097d4 100644 --- a/GameServer/Game/Scene/SceneEntityLoader.cs +++ b/GameServer/Game/Scene/SceneEntityLoader.cs @@ -1,6 +1,5 @@ using EggLink.DanhengServer.Data; using EggLink.DanhengServer.Data.Config.Scene; -using EggLink.DanhengServer.Database.Scene; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Enums.Mission; using EggLink.DanhengServer.Enums.Scene; @@ -50,8 +49,10 @@ public class SceneEntityLoader(SceneInstance scene) if (oldGroupId.Contains(group.Id)) // check if it should be unloaded { - if (group.ForceUnloadCondition.IsTrue(Scene.Player.MissionManager!.Data, false) || // condition: Force Unload Condition - group.UnloadCondition.IsTrue(Scene.Player.MissionManager!.Data, false)) // condition: Unload Condition anyone of the conditions is true then unload + if (group.ForceUnloadCondition.IsTrue(Scene.Player.MissionManager!.Data, + false) || // condition: Force Unload Condition + group.UnloadCondition.IsTrue(Scene.Player.MissionManager!.Data, + false)) // condition: Unload Condition anyone of the conditions is true then unload { foreach (var entity in Scene.Entities.Values.Where(entity => entity.GroupID == group.Id)) { @@ -64,7 +65,7 @@ public class SceneEntityLoader(SceneInstance scene) } else if (group.OwnerMainMissionID != 0 && Scene.Player.MissionManager!.GetMainMissionStatus(group.OwnerMainMissionID) != - MissionPhaseEnum.Accept) // condition: Owner Main Mission ID + MissionPhaseEnum.Accept) // condition: Owner Main Mission ID { foreach (var entity in Scene.Entities.Values.Where(entity => entity.GroupID == group.Id)) { @@ -89,21 +90,22 @@ public class SceneEntityLoader(SceneInstance scene) public virtual async ValueTask?> LoadGroup(GroupInfo info, bool forceLoad = false) { - if (!LoadGroups.Contains(info.Id)) return null; // check if group should be loaded in this dimension - var missionData = Scene.Player.MissionManager!.Data; // get mission data - if (info.LoadSide == GroupLoadSideEnum.Client) return null; // check if group should be loaded on client side - if (info.GroupName.Contains("TrainVisitor")) return null; // certain group name + if (!LoadGroups.Contains(info.Id)) return null; // check if group should be loaded in this dimension + var missionData = Scene.Player.MissionManager!.Data; // get mission data + if (info.LoadSide == GroupLoadSideEnum.Client) return null; // check if group should be loaded on client side + if (info.GroupName.Contains("TrainVisitor")) return null; // certain group name if (info.GroupName.Contains("DeployPuzzle_Repeat_Area")) return null; if (info.GroupName.Contains("TrainVisiter")) return null; - if (info.SystemUnlockCondition != null) // condition: System Unlock Condition + if (info.SystemUnlockCondition != null) // condition: System Unlock Condition { - var result = info.SystemUnlockCondition.Operation != OperationEnum.Or; // operation + var result = info.SystemUnlockCondition.Operation != OperationEnum.Or; // operation foreach (var conditionId in info.SystemUnlockCondition.Conditions) { GameData.GroupSystemUnlockDataData.TryGetValue(conditionId, out var unlockExcel); if (unlockExcel == null) continue; - var part = Scene.Player.QuestManager?.UnlockHandler.GetUnlockStatus(unlockExcel.UnlockID) ?? false; // check if unlock condition is met + var part = Scene.Player.QuestManager?.UnlockHandler.GetUnlockStatus(unlockExcel.UnlockID) ?? + false; // check if unlock condition is met if (info.SystemUnlockCondition.Operation == OperationEnum.Or && part) { result = true; @@ -124,20 +126,24 @@ public class SceneEntityLoader(SceneInstance scene) if (!result) return null; } - if (!(info.OwnerMainMissionID == 0 || // condition: Owner Main Mission ID + if (!(info.OwnerMainMissionID == 0 || // condition: Owner Main Mission ID Scene.Player.MissionManager!.GetMainMissionStatus(info.OwnerMainMissionID) == - MissionPhaseEnum.Accept)) return null; // check if main mission is accepted + MissionPhaseEnum.Accept)) return null; // check if main mission is accepted - if (Scene.FloorId == 20332001 && info.Id == 109) // certain group id + if (Scene.FloorId == 20332001 && info.Id == 109) // certain group id if (Scene.Player.SceneData?.FloorSavedData.GetValueOrDefault(20332001, []) .GetValueOrDefault("ShowFeather", 0) != 1) return null; // a temp solution for Sunday - if ((!info.LoadCondition.IsTrue(missionData) || info.UnloadCondition.IsTrue(missionData, false) || // condition: Load Condition, Unload Condition, Force Unload Condition - info.ForceUnloadCondition.IsTrue(missionData, false)) && !forceLoad) return null; // check if group should be loaded forcefully + if ((!info.LoadCondition.IsTrue(missionData) || + info.UnloadCondition.IsTrue(missionData, + false) || // condition: Load Condition, Unload Condition, Force Unload Condition + info.ForceUnloadCondition.IsTrue(missionData, false)) && + !forceLoad) return null; // check if group should be loaded forcefully if (!info.SavedValueCondition.IsTrue( - Scene.Player.SceneData!.FloorSavedData.GetValueOrDefault(Scene.FloorId, [])) && !forceLoad) // condition: Saved Value Condition + Scene.Player.SceneData!.FloorSavedData.GetValueOrDefault(Scene.FloorId, [])) && + !forceLoad) // condition: Saved Value Condition return null; if (Scene.Entities.Values.ToList().FindIndex(x => x.GroupID == info.Id) != @@ -145,7 +151,7 @@ public class SceneEntityLoader(SceneInstance scene) return null; // load - Scene.Groups.Add(info.Id); // add group to loaded groups + Scene.Groups.Add(info.Id); // add group to loaded groups var entityList = new List(); foreach (var npc in info.NPCList) diff --git a/GameServer/Game/TrainParty/TrainPartyManager.cs b/GameServer/Game/TrainParty/TrainPartyManager.cs index afccd4da..d7714409 100644 --- a/GameServer/Game/TrainParty/TrainPartyManager.cs +++ b/GameServer/Game/TrainParty/TrainPartyManager.cs @@ -1,9 +1,9 @@ using EggLink.DanhengServer.Data; +using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Database; using EggLink.DanhengServer.Database.TrainParty; using EggLink.DanhengServer.GameServer.Game.Player; using EggLink.DanhengServer.Proto; -using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Util; using GameTrainPartyCardInfo = EggLink.DanhengServer.Database.TrainParty.GameTrainPartyCardInfo; @@ -11,26 +11,25 @@ namespace EggLink.DanhengServer.GameServer.Game.TrainParty; public class TrainPartyManager : BasePlayerManager { - public GameTrainPartyData TrainPartyData { get; } - public TrainPartyTeamExcel TeamExcel { get; } - public TrainPartyManager(PlayerInstance player) : base(player) { TrainPartyData = DatabaseHelper.Instance!.GetInstanceOrCreateNew(player.Uid); - foreach (var excel in GameData.TrainPartyAreaConfigData.Where(excel => !TrainPartyData.Areas.ContainsKey(excel.Key))) - { + foreach (var excel in GameData.TrainPartyAreaConfigData.Where(excel => + !TrainPartyData.Areas.ContainsKey(excel.Key))) TrainPartyData.Areas[excel.Key] = new GameTrainPartyAreaInfo { AreaId = excel.Key, StepList = [excel.Value.FirstStep] }; - } TeamExcel = GameData.TrainPartyTeamData.Values.ToList().RandomElement(); } + public GameTrainPartyData TrainPartyData { get; } + public TrainPartyTeamExcel TeamExcel { get; } + public async ValueTask AddCard(int cardId) { if (TrainPartyData.Cards.Values.FirstOrDefault(x => x.CardId == cardId) != null) return; @@ -121,10 +120,13 @@ public class TrainPartyManager : BasePlayerManager { return new TrainPartyGamePassengerInfo { - PassengerList = { TeamExcel.PassengerList.Select(x => new TrainPartyGamePassenger + PassengerList = { - PassengerId = (uint)x - }) }, + TeamExcel.PassengerList.Select(x => new TrainPartyGamePassenger + { + PassengerId = (uint)x + }) + }, CurPassengerId = (uint)TeamExcel.PassengerList.RandomElement(), MtRankId = 104 }; diff --git a/GameServer/Plugin/Event/PluginEvent.cs b/GameServer/Plugin/Event/PluginEvent.cs index 68f71e7e..640cf12c 100644 --- a/GameServer/Plugin/Event/PluginEvent.cs +++ b/GameServer/Plugin/Event/PluginEvent.cs @@ -5,6 +5,7 @@ using EggLink.DanhengServer.GameServer.Game.Player; using EggLink.DanhengServer.GameServer.Game.Scene; using EggLink.DanhengServer.GameServer.Game.Scene.Entity; using EggLink.DanhengServer.Proto; +using LineupInfo = EggLink.DanhengServer.Database.Lineup.LineupInfo; namespace EggLink.DanhengServer.GameServer.Plugin.Event; @@ -44,26 +45,32 @@ public static class PluginEvent { OnPlayerLoadScene?.Invoke(player, scene); } + public static void InvokeOnPlayerEnterBattle(PlayerInstance player, BattleInstance battle) { OnPlayerEnterBattle?.Invoke(player, battle); } + public static void InvokeOnPlayerQuitBattle(PlayerInstance player, PVEBattleResultCsReq result) { OnPlayerQuitBattle?.Invoke(player, result); } + public static void InvokeOnPlayerEnterChallenge(PlayerInstance player, ChallengeInstance challenge) { OnPlayerEnterChallenge?.Invoke(player, challenge); } + public static void InvokeOnPlayerQuitChallenge(PlayerInstance player, ChallengeInstance? challenge) { OnPlayerQuitChallenge?.Invoke(player, challenge); } - public static void InvokeOnPlayerSyncLineup(PlayerInstance player, Database.Lineup.LineupInfo? lineup) + + public static void InvokeOnPlayerSyncLineup(PlayerInstance player, LineupInfo? lineup) { OnPlayerSyncLineup?.Invoke(player, lineup); } + public static void InvokeOnPlayerUseCommand(ICommandSender sender, string command) { OnPlayerUseCommand?.Invoke(sender, command); @@ -93,7 +100,7 @@ public static class PluginEvent public delegate void OnPlayerQuitChallengeHandler(PlayerInstance player, ChallengeInstance? challenge); - public delegate void OnPlayerSyncLineupHandler(PlayerInstance player, Database.Lineup.LineupInfo? lineup); + public delegate void OnPlayerSyncLineupHandler(PlayerInstance player, LineupInfo? lineup); public delegate void OnPlayerUseCommandHandler(ICommandSender sender, string command); diff --git a/GameServer/Server/Packet/Recv/PamSkin/HandlerSelectPamSkinCsReq.cs b/GameServer/Server/Packet/Recv/PamSkin/HandlerSelectPamSkinCsReq.cs index aaf868f1..d5a3670b 100644 --- a/GameServer/Server/Packet/Recv/PamSkin/HandlerSelectPamSkinCsReq.cs +++ b/GameServer/Server/Packet/Recv/PamSkin/HandlerSelectPamSkinCsReq.cs @@ -14,10 +14,7 @@ public class HandlerSelectPamSkinCsReq : Handler var player = connection.Player!; // Check if the skin is valid - if (GameData.PamSkinConfigData.ContainsKey((int)req.PamSkinId)) - { - player.Data.CurrentPamSkin = (int)req.PamSkinId; - } + if (GameData.PamSkinConfigData.ContainsKey((int)req.PamSkinId)) player.Data.CurrentPamSkin = (int)req.PamSkinId; var prevSkinId = player.Data.CurrentPamSkin; await connection.SendPacket(new PacketSelectPamSkinScRsp(player, prevSkinId)); diff --git a/GameServer/Server/Packet/Recv/Scene/HandlerSceneCastSkillCsReq.cs b/GameServer/Server/Packet/Recv/Scene/HandlerSceneCastSkillCsReq.cs index b369ddd9..9517b108 100644 --- a/GameServer/Server/Packet/Recv/Scene/HandlerSceneCastSkillCsReq.cs +++ b/GameServer/Server/Packet/Recv/Scene/HandlerSceneCastSkillCsReq.cs @@ -40,7 +40,8 @@ public class HandlerSceneCastSkillCsReq : Handler // Cast skill effects if (caster.AvatarInfo.Excel != null && caster.AvatarInfo.Excel!.MazeSkill != null) { - mazeSkill = MazeSkillManager.GetSkill(caster.AvatarInfo.GetAvatarId(), (int)req.SkillIndex, req); + mazeSkill = MazeSkillManager.GetSkill(caster.AvatarInfo.GetAvatarId(), (int)req.SkillIndex, + req); mazeSkill.OnCast(caster, player); } } diff --git a/GameServer/Server/Packet/Send/Player/PacketGetVideoVersionKeyScRsp.cs b/GameServer/Server/Packet/Send/Player/PacketGetVideoVersionKeyScRsp.cs index 9aa2cf7b..79da2587 100644 --- a/GameServer/Server/Packet/Send/Player/PacketGetVideoVersionKeyScRsp.cs +++ b/GameServer/Server/Packet/Send/Player/PacketGetVideoVersionKeyScRsp.cs @@ -1,37 +1,33 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Custom; using EggLink.DanhengServer.Kcp; using EggLink.DanhengServer.Proto; -using System.Numerics; -using System.Linq; -namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Player +namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Player; + +public class PacketGetVideoVersionKeyScRsp : BasePacket { - public class PacketGetVideoVersionKeyScRsp : BasePacket + public PacketGetVideoVersionKeyScRsp() : base(CmdIds.GetVideoVersionKeyScRsp) { - public PacketGetVideoVersionKeyScRsp() : base(CmdIds.GetVideoVersionKeyScRsp) + var proto = new GetVideoVersionKeyScRsp { - var proto = new GetVideoVersionKeyScRsp + ActivityVideoKeyInfoList = { - ActivityVideoKeyInfoList = + GameData.VideoKeysConfig.ActivityVideoKeyData.Select(activity => new VideoKeyInfo { - GameData.VideoKeysConfig.ActivityVideoKeyData.Select(activity => new VideoKeyInfo - { - Id = (uint)activity.Id, - VideoKey = (ulong)activity.VideoKey - }) - }, - VideoKeyInfoList = + Id = (uint)activity.Id, + VideoKey = activity.VideoKey + }) + }, + VideoKeyInfoList = + { + GameData.VideoKeysConfig.VideoKeyInfoData.Select(video => new VideoKeyInfo { - GameData.VideoKeysConfig.VideoKeyInfoData.Select(video => new VideoKeyInfo - { - Id = (uint)video.Id, - VideoKey = (ulong)video.VideoKey - }) - } - }; + Id = (uint)video.Id, + VideoKey = video.VideoKey + }) + } + }; - SetData(proto); - } + SetData(proto); } -} +} \ No newline at end of file diff --git a/GameServer/Server/Packet/Send/Player/PacketServerAnnounceNotify.cs b/GameServer/Server/Packet/Send/Player/PacketServerAnnounceNotify.cs index 14756b28..0002ba97 100644 --- a/GameServer/Server/Packet/Send/Player/PacketServerAnnounceNotify.cs +++ b/GameServer/Server/Packet/Send/Player/PacketServerAnnounceNotify.cs @@ -20,4 +20,4 @@ public class PacketServerAnnounceNotify : BasePacket if (ConfigManager.Config.ServerOption.ServerAnnounce.EnableAnnounce) SetData(proto); } -} +} \ No newline at end of file diff --git a/GameServer/Server/Packet/Send/Scene/PacketUpdateFloorSavedValueNotify.cs b/GameServer/Server/Packet/Send/Scene/PacketUpdateFloorSavedValueNotify.cs index 4c1a190b..739ba41c 100644 --- a/GameServer/Server/Packet/Send/Scene/PacketUpdateFloorSavedValueNotify.cs +++ b/GameServer/Server/Packet/Send/Scene/PacketUpdateFloorSavedValueNotify.cs @@ -6,7 +6,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene; public class PacketUpdateFloorSavedValueNotify : BasePacket { - public PacketUpdateFloorSavedValueNotify(string name, int savedValue, PlayerInstance player) : base(CmdIds.UpdateFloorSavedValueNotify) + public PacketUpdateFloorSavedValueNotify(string name, int savedValue, PlayerInstance player) : base( + CmdIds.UpdateFloorSavedValueNotify) { var proto = new UpdateFloorSavedValueNotify { @@ -19,7 +20,8 @@ public class PacketUpdateFloorSavedValueNotify : BasePacket SetData(proto); } - public PacketUpdateFloorSavedValueNotify(Dictionary update, PlayerInstance player) : base(CmdIds.UpdateFloorSavedValueNotify) + public PacketUpdateFloorSavedValueNotify(Dictionary update, PlayerInstance player) : base( + CmdIds.UpdateFloorSavedValueNotify) { var proto = new UpdateFloorSavedValueNotify { @@ -27,10 +29,7 @@ public class PacketUpdateFloorSavedValueNotify : BasePacket PlaneId = (uint)player.SceneInstance!.PlaneId }; - foreach (var i in update) - { - proto.SavedValue.Add(i.Key, i.Value); - } + foreach (var i in update) proto.SavedValue.Add(i.Key, i.Value); SetData(proto); } diff --git a/GameServer/Server/Packet/Send/TrainParty/PacketTrainPartyBuildDiyScRsp.cs b/GameServer/Server/Packet/Send/TrainParty/PacketTrainPartyBuildDiyScRsp.cs index 5654f441..1bdd34ec 100644 --- a/GameServer/Server/Packet/Send/TrainParty/PacketTrainPartyBuildDiyScRsp.cs +++ b/GameServer/Server/Packet/Send/TrainParty/PacketTrainPartyBuildDiyScRsp.cs @@ -8,7 +8,6 @@ public class PacketTrainPartyBuildDiyScRsp : BasePacket { public PacketTrainPartyBuildDiyScRsp(GameTrainPartyAreaInfo? area) : base(CmdIds.TrainPartyBuildDiyScRsp) { - var proto = area == null ? new TrainPartyBuildDiyScRsp {