style: format code

This commit is contained in:
StopWuyu
2024-11-16 19:16:00 +08:00
parent f75a07abfb
commit 57d696f996
28 changed files with 159 additions and 151 deletions

View File

@@ -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<string, int> 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));

View File

@@ -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()));

View File

@@ -32,7 +32,7 @@ public class CommandReload : ICommand
{
// Reload the videokeys
GameData.VideoKeysConfig = ResourceManager.LoadCustomFile<VideoKeysConfig>("VideoKeys", "VideoKeysConfig") ??
new VideoKeysConfig();
new VideoKeysConfig();
await arg.SendMsg(I18NManager.Translate("Game.Command.Reload.ConfigReloaded",
I18NManager.Translate("Word.VideoKeys")));
}

View File

@@ -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<int> swarmList = [8013101, 8013102, 8013103, 8013104, 8013105, 8013106, 8013107, 8013108, 8013109, 8013110];
List<int> swarmList =
[8013101, 8013102, 8013103, 8013104, 8013105, 8013106, 8013107, 8013108, 8013109, 8013110];
List<int> ggList = [8016101, 8016102, 8016103, 8016104, 8016105, 8016106];
List<int> duList = [8023401, 8023501, 8023601];
List<int> 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();
}

View File

@@ -25,6 +25,8 @@ public class FloorInfo
[JsonIgnore] public int StartGroupID { get; set; }
[JsonIgnore] public List<FloorSavedValueInfo> 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<FloorSavedValueInfo> 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,

View File

@@ -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;

View File

@@ -1,21 +1,20 @@
namespace EggLink.DanhengServer.Data.Custom
namespace EggLink.DanhengServer.Data.Custom;
public class VideoKeysConfig
{
public class VideoKeysConfig
{
public List<ActivityVideoKeyInfoList> ActivityVideoKeyData { get; set; } = new();
public List<VideoKeyInfoList> 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<ActivityVideoKeyInfoList> ActivityVideoKeyData { get; set; } = new();
public List<VideoKeyInfoList> 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; }
}

View File

@@ -27,6 +27,12 @@ public static class GameData
#endregion
#region Pam
public static Dictionary<int, PamSkinConfigExcel> PamSkinConfigData { get; private set; } = [];
#endregion
#region Avatar
public static Dictionary<int, AvatarConfigExcel> AvatarConfigData { get; private set; } = [];
@@ -128,17 +134,16 @@ public static class GameData
#endregion
#region Pam
public static Dictionary<int, PamSkinConfigExcel> PamSkinConfigData { get; private set; } = [];
#endregion
#region TrainParty
public static Dictionary<int, TrainPartyPassengerConfigExcel> TrainPartyPassengerConfigData { get; private set; } = [];
public static Dictionary<int, TrainPartyPassengerConfigExcel> TrainPartyPassengerConfigData { get; private set; } =
[];
public static Dictionary<int, TrainPartyAreaConfigExcel> TrainPartyAreaConfigData { get; private set; } = [];
public static Dictionary<int, TrainPartyAreaGoalConfigExcel> TrainPartyAreaGoalConfigData { get; private set; } = [];
public static Dictionary<int, TrainPartyAreaGoalConfigExcel> TrainPartyAreaGoalConfigData { get; private set; } =
[];
public static Dictionary<int, TrainPartyTeamExcel> TrainPartyTeamData { get; private set; } = [];
public static Dictionary<int, TrainPartyStepConfigExcel> TrainPartyStepConfigData { get; private set; } = [];
public static Dictionary<int, TrainPartyDynamicConfigExcel> TrainPartyDynamicConfigData { get; private set; } = [];

View File

@@ -39,7 +39,8 @@ public class ResourceManager
var t8 = Task.Run(LoadAdventureModifier);
GameData.ActivityConfig = LoadCustomFile<ActivityConfig>("Activity", "ActivityConfig") ?? new ActivityConfig();
GameData.BannersConfig = LoadCustomFile<BannersConfig>("Banner", "Banners") ?? new BannersConfig();
GameData.VideoKeysConfig = LoadCustomFile<VideoKeysConfig>("VideoKeys", "VideoKeysConfig") ?? new VideoKeysConfig();
GameData.VideoKeysConfig =
LoadCustomFile<VideoKeysConfig>("VideoKeys", "VideoKeysConfig") ?? new VideoKeysConfig();
GameData.RogueMapGenData = LoadCustomFile<Dictionary<int, List<int>>>("Rogue Map", "RogueMapGen") ?? [];
GameData.RogueMiracleGroupData =
LoadCustomFile<Dictionary<int, List<int>>>("Rogue Miracle Group", "RogueMiracleGroup") ?? [];

View File

@@ -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)

View File

@@ -2,7 +2,6 @@
public enum ItemSubTypeEnum
{
Unknown = 0,
Virtual = 101,
GameplayCounter = 102,

View File

@@ -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<object> langs = [language];

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -448,4 +448,4 @@ public class ChallengeInstance
}
#endregion
}
}

View File

@@ -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
};

View File

@@ -44,7 +44,7 @@ public class LineupManager : BasePlayerManager
public LineupInfo? GetCurLineup()
{
LineupInfo? lineup = GetLineup(LineupData.GetCurLineupIndex());
var lineup = GetLineup(LineupData.GetCurLineupIndex());
return lineup;
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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<List<IGameEntity>?> 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<IGameEntity>();
foreach (var npc in info.NPCList)

View File

@@ -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<GameTrainPartyData>(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
};

View File

@@ -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);

View File

@@ -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));

View File

@@ -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);
}
}

View File

@@ -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);
}
}
}

View File

@@ -20,4 +20,4 @@ public class PacketServerAnnounceNotify : BasePacket
if (ConfigManager.Config.ServerOption.ServerAnnounce.EnableAnnounce) SetData(proto);
}
}
}

View File

@@ -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<string, int> update, PlayerInstance player) : base(CmdIds.UpdateFloorSavedValueNotify)
public PacketUpdateFloorSavedValueNotify(Dictionary<string, int> 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);
}

View File

@@ -8,7 +8,6 @@ public class PacketTrainPartyBuildDiyScRsp : BasePacket
{
public PacketTrainPartyBuildDiyScRsp(GameTrainPartyAreaInfo? area) : base(CmdIds.TrainPartyBuildDiyScRsp)
{
var proto = area == null
? new TrainPartyBuildDiyScRsp
{