mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 12:16:03 +08:00
style: cleanup code
This commit is contained in:
@@ -3,7 +3,6 @@ using EggLink.DanhengServer.Enums.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Internationalization;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.Command.Command.Cmd;
|
||||
@@ -105,15 +104,9 @@ public class CommandScene : ICommand
|
||||
}
|
||||
|
||||
var scene = arg.Target!.Player!.SceneInstance!;
|
||||
foreach (var groupId in scene.Groups)
|
||||
{
|
||||
await scene.UpdateGroupProperty(groupId, "Lock", 0);
|
||||
}
|
||||
foreach (var groupId in scene.Groups) await scene.UpdateGroupProperty(groupId, "Lock", 0);
|
||||
|
||||
foreach (var groupId in scene.Groups)
|
||||
{
|
||||
await scene.UpdateGroupProperty(groupId, "PlateArrived", 2);
|
||||
}
|
||||
foreach (var groupId in scene.Groups) await scene.UpdateGroupProperty(groupId, "PlateArrived", 2);
|
||||
|
||||
if (arg.Target.Player.SceneInstance!.FloorId == 20431001)
|
||||
{
|
||||
@@ -124,17 +117,13 @@ public class CommandScene : ICommand
|
||||
// update floor saved data
|
||||
if (arg.Target.Player.SceneData!.FloorSavedData.TryGetValue(arg.Target.Player.SceneInstance!.FloorId,
|
||||
out var savedData))
|
||||
{
|
||||
savedData[savedValueName] = savedValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
arg.Target.Player.SceneData!.FloorSavedData[arg.Target.Player.SceneInstance!.FloorId] =
|
||||
new Dictionary<string, int>
|
||||
{
|
||||
{ savedValueName, savedValue }
|
||||
};
|
||||
}
|
||||
|
||||
// send packet to client
|
||||
await arg.Target.Player.SendPacket(
|
||||
|
||||
@@ -86,7 +86,7 @@ public class ServerOption
|
||||
public LogOption LogOption { get; set; } = new();
|
||||
public ServerConfig ServerConfig { get; set; } = new();
|
||||
public int FarmingDropRate { get; set; } = 1;
|
||||
public bool UseCache { get; set; } = false; // didnt recommend
|
||||
public bool UseCache { get; set; } = false; // didnt recommend
|
||||
|
||||
public int ValidFarmingDropRate()
|
||||
{
|
||||
@@ -98,7 +98,7 @@ public class ServerConfig
|
||||
{
|
||||
public bool RunDispatch { get; set; } = true;
|
||||
public string FromDispatchBaseUrl { get; set; } = "";
|
||||
public bool RunGateway { get; set; } = true; // if run gateway, also run game server
|
||||
public bool RunGateway { get; set; } = true; // if run gateway, also run game server
|
||||
public List<ServerRegion> Regions { get; set; } = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ using EggLink.DanhengServer.Enums.Task;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Scene;
|
||||
|
||||
@@ -54,56 +53,40 @@ public class GroupInfo
|
||||
foreach (var prop in PropList) prop.Load(this);
|
||||
|
||||
foreach (var source in ValueSource?.Values ?? [])
|
||||
{
|
||||
if (source["Key"]?.ToString() == "FSV")
|
||||
{
|
||||
var value = source["Value"];
|
||||
if (value != null)
|
||||
ControlFloorSavedValue.Add(value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var info in LevelGraphConfig?.OnInitSequece ?? [])
|
||||
{
|
||||
foreach (var configInfo in info.TaskList)
|
||||
{
|
||||
if (configInfo is TriggerBattle battle)
|
||||
{
|
||||
if (battle.EventID.GetValue() > 0)
|
||||
RelatedBattleId.Add(battle.EventID.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var configInfo in info.TaskList)
|
||||
if (configInfo is TriggerBattle battle)
|
||||
if (battle.EventID.GetValue() > 0)
|
||||
RelatedBattleId.Add(battle.EventID.GetValue());
|
||||
|
||||
foreach (var info in LevelGraphConfig?.OnStartSequece ?? [])
|
||||
{
|
||||
foreach (var configInfo in info.TaskList)
|
||||
{
|
||||
if (configInfo is TriggerBattle battle)
|
||||
{
|
||||
if (battle.EventID.GetValue() > 0)
|
||||
RelatedBattleId.Add(battle.EventID.GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var configInfo in info.TaskList)
|
||||
if (configInfo is TriggerBattle battle)
|
||||
if (battle.EventID.GetValue() > 0)
|
||||
RelatedBattleId.Add(battle.EventID.GetValue());
|
||||
|
||||
if (LoadSide != GroupLoadSideEnum.Client) return;
|
||||
foreach (var info in AtmosphereCondition.Conditions)
|
||||
{
|
||||
if (info.TryGetValue("SubMissionID", out var value) && value is long v)
|
||||
{
|
||||
// try cast to int
|
||||
var missionId = (int)v;
|
||||
RelatedMissionId.Add(missionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AtmosphereCondition
|
||||
{
|
||||
public List<Dictionary<string, object>> Conditions { get; set; } = [];
|
||||
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public OperationEnum Operation { get; set; } = OperationEnum.And;
|
||||
}
|
||||
@@ -135,7 +118,10 @@ public class LoadCondition
|
||||
conditionChecks.Add(CheckFunc);
|
||||
continue;
|
||||
|
||||
bool CheckFunc() => status == condition.Phase;
|
||||
bool CheckFunc()
|
||||
{
|
||||
return status == condition.Phase;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,7 +135,10 @@ public class LoadCondition
|
||||
conditionChecks.Add(CheckFunc);
|
||||
continue;
|
||||
|
||||
bool CheckFunc() => status == condition.Phase;
|
||||
bool CheckFunc()
|
||||
{
|
||||
return status == condition.Phase;
|
||||
}
|
||||
}
|
||||
|
||||
return Operation switch
|
||||
@@ -184,7 +173,10 @@ public class SavedValueLoadCondition
|
||||
conditionChecks.Add(CheckFunc);
|
||||
continue;
|
||||
|
||||
bool CheckFunc() => UtilTools.CompareNumberByOperationEnum(status, condition.Value, condition.Operation);
|
||||
bool CheckFunc()
|
||||
{
|
||||
return UtilTools.CompareNumberByOperationEnum(status, condition.Value, condition.Operation);
|
||||
}
|
||||
}
|
||||
|
||||
switch (Operation)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Threading;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
using EggLink.DanhengServer.Data.Custom;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("ChallengePeakBossConfig.json")]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using EggLink.DanhengServer.Data.Custom;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
@@ -17,7 +16,9 @@ public class ChallengePeakConfigExcel : ExcelResource
|
||||
public List<int> NpcMonsterIDList { get; set; } = [];
|
||||
public List<int> NormalTargetList { get; set; } = [];
|
||||
|
||||
[JsonIgnore] public Dictionary<int, List<ChallengeConfigExcel.ChallengeMonsterInfo>> ChallengeMonsters { get; } = [];
|
||||
[JsonIgnore]
|
||||
public Dictionary<int, List<ChallengeConfigExcel.ChallengeMonsterInfo>> ChallengeMonsters { get; } = [];
|
||||
|
||||
[JsonIgnore] public ChallengePeakBossConfigExcel? BossExcel { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
@@ -31,8 +32,8 @@ public class ChallengePeakConfigExcel : ExcelResource
|
||||
|
||||
ChallengeMonsters.Add(MazeGroupID, []);
|
||||
for (var i = 0; i < ConfigIDList.Count; i++)
|
||||
{
|
||||
ChallengeMonsters[MazeGroupID].Add(new ChallengeConfigExcel.ChallengeMonsterInfo(ConfigIDList[i], NpcMonsterIDList[i], EventIDList[i]));
|
||||
}
|
||||
ChallengeMonsters[MazeGroupID]
|
||||
.Add(new ChallengeConfigExcel.ChallengeMonsterInfo(ConfigIDList[i], NpcMonsterIDList[i],
|
||||
EventIDList[i]));
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public static class GameData
|
||||
public static Dictionary<int, MazeSkillExcel> MazeSkillData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarSkinExcel> AvatarSkinData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarDemoConfigExcel> AvatarDemoConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, ExpTypeExcel> ExpTypeData { get; private set; } = [];
|
||||
public static Dictionary<int, ExpTypeExcel> ExpTypeData { get; } = [];
|
||||
|
||||
public static Dictionary<int, MultiplePathAvatarConfigExcel> MultiplePathAvatarConfigData { get; private set; } =
|
||||
[];
|
||||
@@ -76,7 +76,10 @@ public static class GameData
|
||||
public static Dictionary<int, ChallengeConfigExcel> ChallengeConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, ChallengeTargetExcel> ChallengeTargetData { get; private set; } = [];
|
||||
public static Dictionary<int, ChallengeGroupExcel> ChallengeGroupData { get; private set; } = [];
|
||||
public static Dictionary<int, ChallengePeakGroupConfigExcel> ChallengePeakGroupConfigData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<int, ChallengePeakGroupConfigExcel> ChallengePeakGroupConfigData { get; private set; } =
|
||||
[];
|
||||
|
||||
public static Dictionary<int, ChallengePeakConfigExcel> ChallengePeakConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, ChallengePeakBossConfigExcel> ChallengePeakBossConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, List<ChallengeRewardExcel>> ChallengeRewardData { get; private set; } = [];
|
||||
@@ -131,7 +134,7 @@ public static class GameData
|
||||
public static Dictionary<int, AchievementDataExcel> AchievementDataData { get; private set; } = [];
|
||||
public static Dictionary<int, QuestDataExcel> QuestDataData { get; private set; } = [];
|
||||
public static Dictionary<int, FinishWayExcel> FinishWayData { get; private set; } = [];
|
||||
public static Dictionary<int, PlayerLevelConfigExcel> PlayerLevelConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, PlayerLevelConfigExcel> PlayerLevelConfigData { get; } = [];
|
||||
public static Dictionary<int, BackGroundMusicExcel> BackGroundMusicData { get; private set; } = [];
|
||||
public static Dictionary<int, ChatBubbleConfigExcel> ChatBubbleConfigData { get; private set; } = [];
|
||||
public static Dictionary<string, RechargeConfigExcel> RechargeConfigData { get; private set; } = [];
|
||||
@@ -154,10 +157,10 @@ public static class GameData
|
||||
#region Maze
|
||||
|
||||
[JsonConverter(typeof(ConcurrentDictionaryConverter<string, FloorInfo>))]
|
||||
public static ConcurrentDictionary<string, FloorInfo> FloorInfoData { get; private set; } = [];
|
||||
public static ConcurrentDictionary<string, FloorInfo> FloorInfoData { get; } = [];
|
||||
|
||||
public static Dictionary<int, NPCDataExcel> NpcDataData { get; private set; } = [];
|
||||
public static Dictionary<int, MapEntranceExcel> MapEntranceData { get; private set; } = [];
|
||||
public static Dictionary<int, MapEntranceExcel> MapEntranceData { get; } = [];
|
||||
public static Dictionary<int, MazePlaneExcel> MazePlaneData { get; private set; } = [];
|
||||
public static Dictionary<int, MazePuzzleSwitchHandExcel> MazePuzzleSwitchHandData { get; private set; } = [];
|
||||
public static Dictionary<int, MazeChestExcel> MazeChestData { get; private set; } = [];
|
||||
@@ -200,7 +203,7 @@ public static class GameData
|
||||
public static Dictionary<int, ItemUseBuffDataExcel> ItemUseBuffDataData { get; private set; } = [];
|
||||
public static Dictionary<int, ItemUseDataExcel> ItemUseDataData { get; private set; } = [];
|
||||
public static Dictionary<int, EquipmentConfigExcel> EquipmentConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, EquipmentExpTypeExcel> EquipmentExpTypeData { get; private set; } = [];
|
||||
public static Dictionary<int, EquipmentExpTypeExcel> EquipmentExpTypeData { get; } = [];
|
||||
public static Dictionary<int, EquipmentExpItemConfigExcel> EquipmentExpItemConfigData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<int, EquipmentPromotionConfigExcel> EquipmentPromotionConfigData { get; private set; } =
|
||||
|
||||
@@ -142,19 +142,21 @@ public class ResourceCache
|
||||
typeof(GameData).GetProperties(BindingFlags.Public | BindingFlags.Static),
|
||||
prop =>
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadingItem", $"{prop.DeclaringType?.Name}.{prop.Name}"));
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadingItem",
|
||||
$"{prop.DeclaringType?.Name}.{prop.Name}"));
|
||||
if (cacheData.GameDataValues.TryGetValue(prop.Name, out var valueBytes))
|
||||
prop.SetValue(null, JsonConvert.DeserializeObject(
|
||||
Encoding.UTF8.GetString(
|
||||
CompressionHelper.Decompress(valueBytes)), prop.PropertyType, Serializer
|
||||
)
|
||||
);
|
||||
}
|
||||
catch (Exception e)
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(I18NManager.Translate("Server.ServerInfo.FailedToLoadItem", $"{prop.DeclaringType?.Name}.{prop.Name}"));
|
||||
Logger.Error(I18NManager.Translate("Server.ServerInfo.FailedToLoadItem",
|
||||
$"{prop.DeclaringType?.Name}.{prop.Name}"));
|
||||
Logger.Error(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ public class ResourceManager
|
||||
GameData.RogueMiracleGroupData =
|
||||
LoadCustomFile<Dictionary<int, List<int>>>("Rogue Miracle Group", "RogueMiracleGroup") ?? [];
|
||||
GameData.SceneRainbowGroupPropertyData =
|
||||
LoadCustomFile<SceneRainbowGroupPropertyConfig>("Scene Rainbow Group Property", "SceneRainbowGroupProperty") ?? new SceneRainbowGroupPropertyConfig();
|
||||
LoadCustomFile<SceneRainbowGroupPropertyConfig>("Scene Rainbow Group Property",
|
||||
"SceneRainbowGroupProperty") ?? new SceneRainbowGroupPropertyConfig();
|
||||
GameData.RogueMiracleEffectData =
|
||||
LoadCustomFile<RogueMiracleEffectConfig>("Rogue Miracle Effect", "RogueMiracleEffectGen") ??
|
||||
new RogueMiracleEffectConfig();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Database.Player;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
@@ -284,6 +283,7 @@ public class FormalAvatarInfo : BaseAvatarInfo
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public List<MultiPathAvatarInfo> ToAvatarPathProto()
|
||||
{
|
||||
var res = new List<MultiPathAvatarInfo>();
|
||||
@@ -537,13 +537,10 @@ public class PathInfo(int pathId)
|
||||
|
||||
public Dictionary<int, int> GetSkillTree()
|
||||
{
|
||||
if (EnhanceInfos.TryGetValue(EnhanceId, out var enhance))
|
||||
{
|
||||
return enhance.SkillTree;
|
||||
}
|
||||
if (EnhanceInfos.TryGetValue(EnhanceId, out var enhance)) return enhance.SkillTree;
|
||||
|
||||
EnhanceInfos[EnhanceId] = new EnhanceInfo(EnhanceId);
|
||||
|
||||
|
||||
// create default skill tree
|
||||
var avatarExcel = GameData.AvatarConfigData.GetValueOrDefault(PathId);
|
||||
if (avatarExcel == null) return [];
|
||||
@@ -551,10 +548,7 @@ public class PathInfo(int pathId)
|
||||
var skills = avatarExcel.DefaultSkillTree.GetValueOrDefault(EnhanceId);
|
||||
if (skills == null) return [];
|
||||
|
||||
foreach (var skill in skills)
|
||||
{
|
||||
EnhanceInfos[EnhanceId].SkillTree.Add(skill.PointID, skill.Level);
|
||||
}
|
||||
foreach (var skill in skills) EnhanceInfos[EnhanceId].SkillTree.Add(skill.PointID, skill.Level);
|
||||
|
||||
return EnhanceInfos[EnhanceId].SkillTree;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@ public class ChallengeData : BaseDatabaseDataHelper
|
||||
[SugarColumn(IsJson = true)] public Dictionary<int, ChallengeHistoryData> History { get; set; } = new();
|
||||
|
||||
[SugarColumn(IsNullable = true)] public string? ChallengeInstance { get; set; }
|
||||
[SugarColumn] public string Instance { get; set; } = ""; // placeholder
|
||||
[SugarColumn] public string Instance { get; set; } = ""; // placeholder
|
||||
|
||||
[SugarColumn(IsJson = true)] public Dictionary<int, ChallengeGroupReward> TakenRewards { get; set; } = new();
|
||||
[SugarColumn(IsJson = true)] public Dictionary<int, ChallengePeakLevelData> PeakLevelDatas { get; set; } = new();
|
||||
[SugarColumn(IsJson = true)] public Dictionary<int, ChallengePeakBossLevelData> PeakBossLevelDatas { get; set; } = new();
|
||||
|
||||
[SugarColumn(IsJson = true)]
|
||||
public Dictionary<int, ChallengePeakBossLevelData> PeakBossLevelDatas { get; set; } = new();
|
||||
|
||||
public void Delete(int challengeId)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,13 @@ namespace EggLink.DanhengServer.Database.Friend;
|
||||
[SugarTable("friend_record_data")]
|
||||
public class FriendRecordData : BaseDatabaseDataHelper
|
||||
{
|
||||
[SugarColumn(IsJson = true)] public List<FriendDevelopmentInfoPb> DevelopmentInfos { get; set; } = []; // max 20 entries
|
||||
[SugarColumn(IsJson = true)] public Dictionary<uint, ChallengeGroupStatisticsPb> ChallengeGroupStatistics { get; set; } = []; // cur group statistics
|
||||
[SugarColumn(IsJson = true)]
|
||||
public List<FriendDevelopmentInfoPb> DevelopmentInfos { get; set; } = []; // max 20 entries
|
||||
|
||||
[SugarColumn(IsJson = true)]
|
||||
public Dictionary<uint, ChallengeGroupStatisticsPb> ChallengeGroupStatistics { get; set; } =
|
||||
[]; // cur group statistics
|
||||
|
||||
public uint NextRecordId { get; set; }
|
||||
|
||||
public void AddAndRemoveOld(FriendDevelopmentInfoPb info)
|
||||
@@ -18,14 +23,10 @@ public class FriendRecordData : BaseDatabaseDataHelper
|
||||
|
||||
// if param equal remove
|
||||
foreach (var infoPb in same.ToArray())
|
||||
{
|
||||
// ReSharper disable once UsageOfDefaultStructEquality
|
||||
if (infoPb.Params.SequenceEqual(info.Params))
|
||||
{
|
||||
// remove
|
||||
DevelopmentInfos.Remove(infoPb);
|
||||
}
|
||||
}
|
||||
|
||||
DevelopmentInfos.Add(info);
|
||||
}
|
||||
@@ -112,43 +113,28 @@ public class ChallengeGroupStatisticsPb
|
||||
if (MemoryGroupStatistics != null)
|
||||
{
|
||||
foreach (var memoryGroupStatistic in MemoryGroupStatistics.Values)
|
||||
{
|
||||
proto.GroupTotalStars += memoryGroupStatistic.Stars;
|
||||
}
|
||||
|
||||
var maxFloor = MemoryGroupStatistics.Values.MaxBy(x => x.Level);
|
||||
if (maxFloor != null)
|
||||
{
|
||||
proto.MemoryGroup = maxFloor.ToProto();
|
||||
}
|
||||
if (maxFloor != null) proto.MemoryGroup = maxFloor.ToProto();
|
||||
}
|
||||
|
||||
if (StoryGroupStatistics != null)
|
||||
{
|
||||
foreach (var storyGroupStatistic in StoryGroupStatistics.Values)
|
||||
{
|
||||
proto.GroupTotalStars += storyGroupStatistic.Stars;
|
||||
}
|
||||
|
||||
var maxFloor = StoryGroupStatistics.Values.MaxBy(x => x.Level);
|
||||
if (maxFloor != null)
|
||||
{
|
||||
proto.StoryGroup = maxFloor.ToProto();
|
||||
}
|
||||
if (maxFloor != null) proto.StoryGroup = maxFloor.ToProto();
|
||||
}
|
||||
|
||||
if (BossGroupStatistics != null)
|
||||
{
|
||||
foreach (var bossGroupStatistic in BossGroupStatistics.Values)
|
||||
{
|
||||
proto.GroupTotalStars += bossGroupStatistic.Stars;
|
||||
}
|
||||
|
||||
var maxFloor = BossGroupStatistics.Values.MaxBy(x => x.Level);
|
||||
if (maxFloor != null)
|
||||
{
|
||||
proto.BossGroup = maxFloor.ToProto();
|
||||
}
|
||||
if (maxFloor != null) proto.BossGroup = maxFloor.ToProto();
|
||||
}
|
||||
|
||||
return proto;
|
||||
|
||||
@@ -51,10 +51,7 @@ public class SceneData : BaseDatabaseDataHelper
|
||||
|
||||
public int GetFloorSavedValue(int floorId, string key)
|
||||
{
|
||||
if (FloorSavedData.TryGetValue(floorId, out var data) && data.TryGetValue(key, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
if (FloorSavedData.TryGetValue(floorId, out var data) && data.TryGetValue(key, out var value)) return value;
|
||||
|
||||
// get default value if not found
|
||||
var floor = GameData.GetFloorInfo(floorId);
|
||||
@@ -70,10 +67,7 @@ public class SceneData : BaseDatabaseDataHelper
|
||||
if (floor == null) return [];
|
||||
|
||||
var savedValues = new Dictionary<string, int>();
|
||||
foreach (var value in floor.FloorSavedValue)
|
||||
{
|
||||
savedValues[value.Name] = GetFloorSavedValue(floorId, value.Name);
|
||||
}
|
||||
foreach (var value in floor.FloorSavedValue) savedValues[value.Name] = GetFloorSavedValue(floorId, value.Name);
|
||||
|
||||
return savedValues;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using EggLink.DanhengServer.Enums;
|
||||
using System.Globalization;
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using System.Globalization;
|
||||
|
||||
namespace EggLink.DanhengServer.Util;
|
||||
|
||||
@@ -23,20 +22,15 @@ public static class UtilTools
|
||||
if (actions.Count == 0) return defaultValue;
|
||||
|
||||
foreach (var action in actions)
|
||||
{
|
||||
try
|
||||
{
|
||||
var returnValue = action.Invoke();
|
||||
if (!returnValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!returnValue) return false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -45,20 +39,16 @@ public static class UtilTools
|
||||
{
|
||||
if (actions.Count == 0) return defaultValue;
|
||||
foreach (var action in actions)
|
||||
{
|
||||
try
|
||||
{
|
||||
var returnValue = action.Invoke();
|
||||
if (returnValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (returnValue) return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace EggLink.DanhengServer.Kcp;
|
||||
|
||||
public class DanhengListener
|
||||
{
|
||||
public delegate DanhengConnection ConnectionCreatedHandler(KcpConversation conversation, IPEndPoint remote);
|
||||
|
||||
private static UdpClient? UDPClient;
|
||||
private static IPEndPoint? ListenAddress;
|
||||
private static IKcpTransport<IKcpMultiplexConnection>? KCPTransport;
|
||||
@@ -25,7 +27,6 @@ public class DanhengListener
|
||||
KeepAliveOptions = new KcpKeepAliveOptions(1000, 30000)
|
||||
};
|
||||
|
||||
public delegate DanhengConnection ConnectionCreatedHandler(KcpConversation conversation, IPEndPoint remote);
|
||||
public static ConnectionCreatedHandler? CreateConnection { get; set; } = null;
|
||||
|
||||
private static Socket? UDPListener => UDPClient?.Client;
|
||||
|
||||
@@ -8,16 +8,12 @@ namespace EggLink.DanhengServer.Kcp;
|
||||
|
||||
public static class PacketLogHelper
|
||||
{
|
||||
private delegate IMessage ParseIMessage(byte[] data);
|
||||
private static ConcurrentDictionary<ushort, ParseIMessage> CachedParsers { get; } = [];
|
||||
|
||||
public static string ConvertPacketToJson(ushort opcode, byte[] payload)
|
||||
{
|
||||
var descriptor = GetParser(opcode);
|
||||
if (descriptor == null)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
if (descriptor == null) throw new Exception();
|
||||
|
||||
var message = descriptor(payload);
|
||||
var formatter = JsonFormatter.Default;
|
||||
@@ -27,10 +23,7 @@ public static class PacketLogHelper
|
||||
|
||||
private static ParseIMessage? GetParser(ushort opcode)
|
||||
{
|
||||
if (CachedParsers.TryGetValue(opcode, out var parser))
|
||||
{
|
||||
return parser;
|
||||
}
|
||||
if (CachedParsers.TryGetValue(opcode, out var parser)) return parser;
|
||||
|
||||
lock (CachedParsers)
|
||||
{
|
||||
@@ -42,7 +35,7 @@ public static class PacketLogHelper
|
||||
if (typ == null) return null;
|
||||
var desc = typ.GetProperty("Descriptor", BindingFlags.Public | BindingFlags.Static);
|
||||
if (desc?.GetMethod == null) return null;
|
||||
|
||||
|
||||
// get parser
|
||||
if (desc.GetValue(null) is not MessageDescriptor parserProperty) return null;
|
||||
|
||||
@@ -60,4 +53,6 @@ public static class PacketLogHelper
|
||||
return parser;
|
||||
}
|
||||
}
|
||||
|
||||
private delegate IMessage ParseIMessage(byte[] data);
|
||||
}
|
||||
@@ -50,14 +50,12 @@ public class AvatarManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
AvatarData.FormalAvatars.Add(avatar);
|
||||
|
||||
if (avatarExcel.Rarity == RarityEnum.CombatPowerAvatarRarityType5 && avatarExcel.AvatarID <= 3000)
|
||||
{
|
||||
// add development
|
||||
Player.FriendRecordData!.AddAndRemoveOld(new FriendDevelopmentInfoPb
|
||||
{
|
||||
DevelopmentType = DevelopmentType.DevelopmentUnlockAvatar,
|
||||
Params = { { "AvatarId", (uint)avatarExcel.AvatarID } }
|
||||
});
|
||||
}
|
||||
|
||||
if (sync)
|
||||
await Player.SendPacket(new PacketPlayerSyncScNotify(avatar));
|
||||
|
||||
@@ -237,10 +237,13 @@ public class BattleInstance(PlayerInstance player, LineupInfo lineup, List<Stage
|
||||
BattleStageId = (uint)(Stages.FirstOrDefault()?.StageID ?? 0),
|
||||
BattleWaveId = (uint)(proto.MonsterWaveList.Count + 1),
|
||||
MonsterParam = new SceneMonsterWaveParam(),
|
||||
MonsterList = { waveIds.Select(x => new SceneMonster
|
||||
MonsterList =
|
||||
{
|
||||
MonsterId = (uint)x
|
||||
}) }
|
||||
waveIds.Select(x => new SceneMonster
|
||||
{
|
||||
MonsterId = (uint)x
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -279,16 +282,12 @@ public class BattleInstance(PlayerInstance player, LineupInfo lineup, List<Stage
|
||||
|
||||
// global buff
|
||||
foreach (var buff in GameData.AvatarGlobalBuffConfigData.Values)
|
||||
{
|
||||
if (Player.AvatarManager!.GetFormalAvatar(buff.AvatarID) != null)
|
||||
{
|
||||
// add buff
|
||||
Buffs.Add(new MazeBuff(buff.MazeBuffID, 1, -1)
|
||||
{
|
||||
WaveFlag = -1
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var buff in Buffs)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,8 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
public StageConfigExcel? NextBattleStageConfig { get; set; }
|
||||
public List<int> NextBattleMonsterIds { get; set; } = [];
|
||||
|
||||
public async ValueTask<BattleInstance?> StartBattle(BaseGameEntity attackEntity, List<BaseGameEntity> targetEntityList,
|
||||
public async ValueTask<BattleInstance?> StartBattle(BaseGameEntity attackEntity,
|
||||
List<BaseGameEntity> targetEntityList,
|
||||
bool isSkill)
|
||||
{
|
||||
if (Player.BattleInstance != null) return Player.BattleInstance;
|
||||
|
||||
@@ -65,17 +65,15 @@ public class ChallengeEntityLoader(SceneInstance scene, PlayerInstance player) :
|
||||
// Get current stage monster infos
|
||||
var stages = instance.GetStageMonsters();
|
||||
|
||||
if (!stages.TryGetValue(group.Id, out var challengeMonsters))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!stages.TryGetValue(group.Id, out var challengeMonsters)) return null;
|
||||
|
||||
// Get challenge monster info
|
||||
if (challengeMonsters.All(x => x.ConfigId != info.ID)) return null;
|
||||
var challengeMonsterInfo = challengeMonsters.First(x => x.ConfigId == info.ID);
|
||||
|
||||
// Get excels from game data
|
||||
if (!GameData.NpcMonsterDataData.TryGetValue(challengeMonsterInfo.NpcMonsterId, out var npcMonsterExcel)) return null;
|
||||
if (!GameData.NpcMonsterDataData.TryGetValue(challengeMonsterInfo.NpcMonsterId, out var npcMonsterExcel))
|
||||
return null;
|
||||
|
||||
// Create monster from group monster info
|
||||
var entity = new EntityMonster(Scene, info.ToPositionProto(), info.ToRotationProto(), group.Id, info.ID,
|
||||
|
||||
@@ -10,7 +10,6 @@ using EggLink.DanhengServer.GameServer.Server.Packet.Send.Challenge;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Proto.ServerSide;
|
||||
using Google.Protobuf;
|
||||
using System;
|
||||
using static EggLink.DanhengServer.GameServer.Plugin.Event.PluginEvent;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Challenge;
|
||||
@@ -285,7 +284,6 @@ public class ChallengeManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
var proto = ChallengeDataPb.Parser.ParseFrom(protoByte);
|
||||
|
||||
if (proto != null)
|
||||
{
|
||||
ChallengeInstance = proto.ChallengeTypeCase switch
|
||||
{
|
||||
ChallengeDataPb.ChallengeTypeOneofCase.Memory => new ChallengeMemoryInstance(Player, proto),
|
||||
@@ -294,11 +292,8 @@ public class ChallengeManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
ChallengeDataPb.ChallengeTypeOneofCase.Boss => new ChallengeBossInstance(Player, proto),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
ChallengeData.ChallengeInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SaveBattleRecord(BaseLegacyChallengeInstance inst)
|
||||
|
||||
@@ -13,7 +13,6 @@ public abstract class BaseChallengeInstance(PlayerInstance player, ChallengeData
|
||||
|
||||
public virtual void OnBattleStart(BattleInstance battle)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual async ValueTask OnBattleEnd(BattleInstance battle, PVEBattleResultCsReq req)
|
||||
@@ -23,5 +22,7 @@ public abstract class BaseChallengeInstance(PlayerInstance player, ChallengeData
|
||||
|
||||
public abstract Dictionary<int, List<ChallengeConfigExcel.ChallengeMonsterInfo>> GetStageMonsters();
|
||||
|
||||
public virtual void OnUpdate() { }
|
||||
public virtual void OnUpdate()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,12 @@ using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Challenge.Definitions;
|
||||
|
||||
public abstract class BaseLegacyChallengeInstance(PlayerInstance player, ChallengeDataPb data) : BaseChallengeInstance(player, data)
|
||||
public abstract class BaseLegacyChallengeInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
: BaseChallengeInstance(player, data)
|
||||
{
|
||||
public abstract CurChallenge ToProto();
|
||||
public bool IsWin { get; set; }
|
||||
public abstract ChallengeConfigExcel Config { get; }
|
||||
public abstract CurChallenge ToProto();
|
||||
|
||||
public abstract uint GetStars();
|
||||
public abstract int GetCurrentExtraLineupType();
|
||||
|
||||
@@ -12,11 +12,11 @@ using EggLink.DanhengServer.GameServer.Server.Packet.Send.Lineup;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Proto.ServerSide;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using SqlSugar;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Challenge.Instances;
|
||||
|
||||
public class ChallengeBossInstance(PlayerInstance player, ChallengeDataPb data) : BaseLegacyChallengeInstance(player, data)
|
||||
public class ChallengeBossInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
: BaseLegacyChallengeInstance(player, data)
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ChallengeBossInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
},
|
||||
RoundCount = (uint)Config.ChallengeCountDown,
|
||||
ScoreId = Data.Boss.ScoreStage1,
|
||||
ScoreTwo = Data.Boss.ScoreStage2,
|
||||
ScoreTwo = Data.Boss.ScoreStage2
|
||||
};
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public class ChallengeBossInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
Player.FriendRecordData!.AddAndRemoveOld(new FriendDevelopmentInfoPb
|
||||
{
|
||||
DevelopmentType = DevelopmentType.DevelopmentBossChallenge,
|
||||
Params = {{ "ChallengeId", (uint)Config.ID } }
|
||||
Params = { { "ChallengeId", (uint)Config.ID } }
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -333,6 +333,5 @@ public class ChallengeBossInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
Player.ChallengeManager!.SaveInstance(this);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -14,11 +14,30 @@ using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Challenge.Instances;
|
||||
|
||||
public class ChallengeMemoryInstance(PlayerInstance player, ChallengeDataPb data) : BaseLegacyChallengeInstance(player, data)
|
||||
public class ChallengeMemoryInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
: BaseLegacyChallengeInstance(player, data)
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public override ChallengeConfigExcel Config { get; } = GameData.ChallengeConfigData[(int)data.Memory.ChallengeMazeId];
|
||||
public override ChallengeConfigExcel Config { get; } =
|
||||
GameData.ChallengeConfigData[(int)data.Memory.ChallengeMazeId];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Serialization
|
||||
|
||||
public override CurChallenge ToProto()
|
||||
{
|
||||
return new CurChallenge
|
||||
{
|
||||
ChallengeId = Data.Memory.ChallengeMazeId,
|
||||
DeadAvatarNum = Data.Memory.DeadAvatarNum,
|
||||
ExtraLineupType = (ExtraLineupType)Data.Memory.CurrentExtraLineup,
|
||||
Status = (ChallengeStatus)Data.Memory.CurStatus,
|
||||
StageInfo = new ChallengeCurBuffInfo(),
|
||||
RoundCount = (uint)(Config.ChallengeCountDown - Data.Memory.RoundsLeft)
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -61,23 +80,6 @@ public class ChallengeMemoryInstance(PlayerInstance player, ChallengeDataPb data
|
||||
|
||||
#endregion
|
||||
|
||||
#region Serialization
|
||||
|
||||
public override CurChallenge ToProto()
|
||||
{
|
||||
return new CurChallenge
|
||||
{
|
||||
ChallengeId = Data.Memory.ChallengeMazeId,
|
||||
DeadAvatarNum = Data.Memory.DeadAvatarNum,
|
||||
ExtraLineupType = (ExtraLineupType)Data.Memory.CurrentExtraLineup,
|
||||
Status = (ChallengeStatus)Data.Memory.CurStatus,
|
||||
StageInfo = new ChallengeCurBuffInfo(),
|
||||
RoundCount = (uint)(Config.ChallengeCountDown - Data.Memory.RoundsLeft)
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handlers
|
||||
|
||||
public override void OnBattleStart(BattleInstance battle)
|
||||
|
||||
@@ -16,15 +16,6 @@ namespace EggLink.DanhengServer.GameServer.Game.Challenge.Instances;
|
||||
|
||||
public class ChallengePeakInstance(PlayerInstance player, ChallengeDataPb data) : BaseChallengeInstance(player, data)
|
||||
{
|
||||
|
||||
#region Properties
|
||||
|
||||
public ChallengePeakConfigExcel Config { get; } = GameData.ChallengePeakConfigData[(int)data.Peak.CurrentPeakLevelId];
|
||||
public List<int> AllBattleTargets { get; } = [];
|
||||
public bool IsWin { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Setter & Getter
|
||||
|
||||
public override Dictionary<int, List<ChallengeConfigExcel.ChallengeMonsterInfo>> GetStageMonsters()
|
||||
@@ -35,16 +26,24 @@ public class ChallengePeakInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
|
||||
monsters.Add(Config.MazeGroupID, []);
|
||||
for (var i = 0; i < Config.ConfigIDList.Count; i++)
|
||||
{
|
||||
monsters[Config.MazeGroupID].Add(new ChallengeConfigExcel.ChallengeMonsterInfo(Config.ConfigIDList[i],
|
||||
Config.NpcMonsterIDList[i], Config.BossExcel.HardEventIDList[i]));
|
||||
}
|
||||
|
||||
return monsters;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public ChallengePeakConfigExcel Config { get; } =
|
||||
GameData.ChallengePeakConfigData[(int)data.Peak.CurrentPeakLevelId];
|
||||
|
||||
public List<int> AllBattleTargets { get; } = [];
|
||||
public bool IsWin { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
//#region Serialization
|
||||
|
||||
//#endregion
|
||||
@@ -54,12 +53,10 @@ public class ChallengePeakInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
public override void OnBattleStart(BattleInstance battle)
|
||||
{
|
||||
foreach (var peakBuff in Data.Peak.Buffs)
|
||||
{
|
||||
battle.Buffs.Add(new MazeBuff((int)peakBuff, 1, -1)
|
||||
{
|
||||
WaveFlag = -1
|
||||
});
|
||||
}
|
||||
|
||||
if (Data.Peak.IsHard && Config.BossExcel != null)
|
||||
{
|
||||
@@ -99,11 +96,12 @@ public class ChallengePeakInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
Data.Peak.Stars = res.Item1;
|
||||
Data.Peak.RoundCnt = req.Stt.RoundCnt;
|
||||
IsWin = true;
|
||||
|
||||
|
||||
await Player.SendPacket(new PacketChallengePeakSettleScNotify(this, res.Item2));
|
||||
|
||||
// Call MissionManager
|
||||
await Player.MissionManager!.HandleFinishType(MissionFinishTypeEnum.ChallengePeakBattleFinish, this);
|
||||
await Player.MissionManager!.HandleFinishType(MissionFinishTypeEnum.ChallengePeakBattleFinish,
|
||||
this);
|
||||
|
||||
await Player.ChallengePeakManager!.SaveHistory(this, res.Item2);
|
||||
|
||||
@@ -158,10 +156,7 @@ public class ChallengePeakInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
}
|
||||
}
|
||||
|
||||
if (Data.Peak.IsHard && Config.BossExcel != null)
|
||||
{
|
||||
stars = 3;
|
||||
}
|
||||
if (Data.Peak.IsHard && Config.BossExcel != null) stars = 3;
|
||||
|
||||
return (Math.Min(stars, 3), finishedIds);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,37 @@ using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Challenge.Instances;
|
||||
|
||||
public class ChallengeStoryInstance(PlayerInstance player, ChallengeDataPb data) : BaseLegacyChallengeInstance(player, data)
|
||||
public class ChallengeStoryInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
: BaseLegacyChallengeInstance(player, data)
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public override ChallengeConfigExcel Config { get; } = GameData.ChallengeConfigData[(int)data.Story.ChallengeMazeId];
|
||||
public override ChallengeConfigExcel Config { get; } =
|
||||
GameData.ChallengeConfigData[(int)data.Story.ChallengeMazeId];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Serialization
|
||||
|
||||
public override CurChallenge ToProto()
|
||||
{
|
||||
return new CurChallenge
|
||||
{
|
||||
ChallengeId = Data.Story.ChallengeMazeId,
|
||||
ExtraLineupType = (ExtraLineupType)Data.Story.CurrentExtraLineup,
|
||||
Status = (ChallengeStatus)Data.Story.CurStatus,
|
||||
StageInfo = new ChallengeCurBuffInfo
|
||||
{
|
||||
CurStoryBuffs = new ChallengeStoryBuffList
|
||||
{
|
||||
BuffList = { Data.Story.Buffs }
|
||||
}
|
||||
},
|
||||
RoundCount = (uint)Config.ChallengeCountDown,
|
||||
ScoreId = Data.Story.ScoreStage1,
|
||||
ScoreTwo = Data.Story.ScoreStage2
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -78,30 +104,6 @@ public class ChallengeStoryInstance(PlayerInstance player, ChallengeDataPb data)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Serialization
|
||||
|
||||
public override CurChallenge ToProto()
|
||||
{
|
||||
return new CurChallenge
|
||||
{
|
||||
ChallengeId = Data.Story.ChallengeMazeId,
|
||||
ExtraLineupType = (ExtraLineupType)Data.Story.CurrentExtraLineup,
|
||||
Status = (ChallengeStatus)Data.Story.CurStatus,
|
||||
StageInfo = new ChallengeCurBuffInfo
|
||||
{
|
||||
CurStoryBuffs = new ChallengeStoryBuffList
|
||||
{
|
||||
BuffList = { Data.Story.Buffs }
|
||||
}
|
||||
},
|
||||
RoundCount = (uint)Config.ChallengeCountDown,
|
||||
ScoreId = Data.Story.ScoreStage1,
|
||||
ScoreTwo = Data.Story.ScoreStage2
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Handlers
|
||||
|
||||
public override void OnBattleStart(BattleInstance battle)
|
||||
|
||||
@@ -12,18 +12,19 @@ using ChallengePeakLevelInfo = EggLink.DanhengServer.Proto.ChallengePeakLevelInf
|
||||
namespace EggLink.DanhengServer.GameServer.Game.ChallengePeak;
|
||||
|
||||
/// <summary>
|
||||
/// this class is used to manage the challenge peak for a player
|
||||
/// but the challenge instance shouldnt be stored here ( see ChallengeManager )
|
||||
/// this class is used to manage the challenge peak for a player
|
||||
/// but the challenge instance shouldnt be stored here ( see ChallengeManager )
|
||||
/// </summary>
|
||||
/// <see cref="EggLink.DanhengServer.GameServer.Game.Challenge.ChallengeManager"/>
|
||||
/// <see cref="EggLink.DanhengServer.GameServer.Game.Challenge.ChallengeManager" />
|
||||
public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
public bool BossIsHard { get; set; } = true;
|
||||
|
||||
public ChallengePeakLevelInfo GetChallengePeakInfo(int groupId)
|
||||
{
|
||||
var proto = new ChallengePeakLevelInfo
|
||||
{
|
||||
PeakGroupId = (uint)groupId,
|
||||
PeakGroupId = (uint)groupId
|
||||
};
|
||||
|
||||
var data = GameData.ChallengePeakGroupConfigData.GetValueOrDefault(groupId);
|
||||
@@ -69,7 +70,7 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
// boss
|
||||
var bossLevelId = data.BossLevelID;
|
||||
if (bossLevelId <= 0) return proto;
|
||||
|
||||
|
||||
var bossLevelData = GameData.ChallengePeakBossConfigData.GetValueOrDefault(bossLevelId);
|
||||
if (bossLevelData == null) return proto;
|
||||
|
||||
@@ -83,7 +84,8 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
|
||||
HashSet<uint> targetIds = [];
|
||||
HashSet<uint> avatarIds = [];
|
||||
if (Player.ChallengeManager!.ChallengeData.PeakBossLevelDatas.TryGetValue(bossLevelId << 2 | 0, out var bossPbData)) // easy (is hard = 0)
|
||||
if (Player.ChallengeManager!.ChallengeData.PeakBossLevelDatas.TryGetValue((bossLevelId << 2) | 0,
|
||||
out var bossPbData)) // easy (is hard = 0)
|
||||
{
|
||||
bossProto.PeakEasyBoss.PeakLevelAvatarIdList.AddRange(bossPbData.BaseAvatarList);
|
||||
bossProto.PeakEasyBoss.BossDisplayAvatarIdList.AddRange(bossPbData.BaseAvatarList);
|
||||
@@ -92,18 +94,13 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
bossProto.PeakEasyBoss.IsFinished = true;
|
||||
bossProto.PeakEasyBoss.BuffId = bossPbData.BuffId;
|
||||
|
||||
foreach (var targetId in bossPbData.FinishedTargetList)
|
||||
{
|
||||
targetIds.Add(targetId);
|
||||
}
|
||||
foreach (var targetId in bossPbData.FinishedTargetList) targetIds.Add(targetId);
|
||||
|
||||
foreach (var avatarId in bossPbData.BaseAvatarList)
|
||||
{
|
||||
avatarIds.Add(avatarId);
|
||||
}
|
||||
foreach (var avatarId in bossPbData.BaseAvatarList) avatarIds.Add(avatarId);
|
||||
}
|
||||
|
||||
if (Player.ChallengeManager!.ChallengeData.PeakBossLevelDatas.TryGetValue(bossLevelId << 2 | 1, out var bossHardPbData)) // easy (is hard = 1)
|
||||
if (Player.ChallengeManager!.ChallengeData.PeakBossLevelDatas.TryGetValue((bossLevelId << 2) | 1,
|
||||
out var bossHardPbData)) // easy (is hard = 1)
|
||||
{
|
||||
bossProto.IsUltraBossWin = true;
|
||||
bossProto.PeakHardBoss.PeakLevelAvatarIdList.AddRange(bossHardPbData.BaseAvatarList);
|
||||
@@ -113,15 +110,9 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
bossProto.PeakHardBoss.IsFinished = true;
|
||||
bossProto.PeakHardBoss.BuffId = bossHardPbData.BuffId;
|
||||
|
||||
foreach (var targetId in bossHardPbData.FinishedTargetList)
|
||||
{
|
||||
targetIds.Add(targetId);
|
||||
}
|
||||
foreach (var targetId in bossHardPbData.FinishedTargetList) targetIds.Add(targetId);
|
||||
|
||||
foreach (var avatarId in bossHardPbData.BaseAvatarList)
|
||||
{
|
||||
avatarIds.Add(avatarId);
|
||||
}
|
||||
foreach (var avatarId in bossHardPbData.BaseAvatarList) avatarIds.Add(avatarId);
|
||||
}
|
||||
|
||||
foreach (var avatarId in avatarIds)
|
||||
@@ -156,7 +147,7 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
{
|
||||
LevelId = (int)lineup.PeakLevelId,
|
||||
BaseAvatarList = avatarIds
|
||||
}; // reset
|
||||
}; // reset
|
||||
}
|
||||
|
||||
await Player.SendPacket(new PacketChallengePeakGroupDataUpdateScNotify(GetChallengePeakInfo(groupId)));
|
||||
@@ -168,22 +159,21 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
{
|
||||
// is hard
|
||||
var isHard = inst.Data.Peak.IsHard;
|
||||
var levelId = (int)inst.Data.Peak.CurrentPeakLevelId << 2 | (isHard ? 1 : 0);
|
||||
var levelId = ((int)inst.Data.Peak.CurrentPeakLevelId << 2) | (isHard ? 1 : 0);
|
||||
|
||||
// get old data
|
||||
if (Player.ChallengeManager!.ChallengeData.PeakBossLevelDatas.TryGetValue(levelId, out var oldData) &&
|
||||
oldData.FinishedTargetList.Count > targetIds.Count && oldData.RoundCnt < inst.Data.Peak.RoundCnt)
|
||||
{
|
||||
// better data already exists, do not overwrite
|
||||
return;
|
||||
}
|
||||
|
||||
// Save boss data
|
||||
var data = new ChallengePeakBossLevelData
|
||||
{
|
||||
LevelId = (int)inst.Data.Peak.CurrentPeakLevelId,
|
||||
IsHard = isHard,
|
||||
BaseAvatarList = Player.LineupManager!.GetCurLineup()?.BaseAvatars?.Select(x => (uint)x.BaseAvatarId).ToList() ?? [],
|
||||
BaseAvatarList = Player.LineupManager!.GetCurLineup()?.BaseAvatars?.Select(x => (uint)x.BaseAvatarId)
|
||||
.ToList() ?? [],
|
||||
RoundCnt = inst.Data.Peak.RoundCnt,
|
||||
BuffId = inst.Data.Peak.Buffs.FirstOrDefault(),
|
||||
FinishedTargetList = targetIds,
|
||||
@@ -201,9 +191,7 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
{
|
||||
var targetFrameId = data.PeakStar + 226000;
|
||||
if (Player.Data.HeadFrame.HeadFrameId < targetFrameId)
|
||||
{
|
||||
await Player.SetPlayerHeadFrameId(targetFrameId, long.MaxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -214,15 +202,14 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
// get old data
|
||||
if (Player.ChallengeManager!.ChallengeData.PeakLevelDatas.TryGetValue(levelId, out var oldData) &&
|
||||
oldData.FinishedTargetList.Count > targetIds.Count && oldData.RoundCnt < inst.Data.Peak.RoundCnt)
|
||||
{
|
||||
// better data already exists, do not overwrite
|
||||
return;
|
||||
}
|
||||
|
||||
var data = new ChallengePeakLevelData
|
||||
{
|
||||
LevelId = levelId,
|
||||
BaseAvatarList = Player.LineupManager!.GetCurLineup()?.BaseAvatars?.Select(x => (uint)x.BaseAvatarId).ToList() ?? [],
|
||||
BaseAvatarList = Player.LineupManager!.GetCurLineup()?.BaseAvatars?.Select(x => (uint)x.BaseAvatarId)
|
||||
.ToList() ?? [],
|
||||
RoundCnt = inst.Data.Peak.RoundCnt,
|
||||
FinishedTargetList = targetIds,
|
||||
PeakStar = (uint)targetIds.Count
|
||||
@@ -231,7 +218,9 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
Player.ChallengeManager!.ChallengeData.PeakLevelDatas[levelId] = data;
|
||||
}
|
||||
|
||||
await Player.SendPacket(new PacketChallengePeakGroupDataUpdateScNotify(GetChallengePeakInfo((int)inst.Data.Peak.CurrentPeakGroupId)));
|
||||
await Player.SendPacket(
|
||||
new PacketChallengePeakGroupDataUpdateScNotify(
|
||||
GetChallengePeakInfo((int)inst.Data.Peak.CurrentPeakGroupId)));
|
||||
}
|
||||
|
||||
public async ValueTask StartChallenge(int levelId, uint buffId, List<int> avatarIdList)
|
||||
@@ -255,21 +244,17 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
// Get lineup
|
||||
var lineup = Player.LineupManager!.GetExtraLineup(ExtraLineupType.LineupChallenge)!;
|
||||
if (avatarIds.Count > 0)
|
||||
{
|
||||
lineup.BaseAvatars = avatarIds.Select(x => new LineupAvatarInfo
|
||||
{
|
||||
BaseAvatarId = x
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
lineup.BaseAvatars = Player.ChallengeManager!.ChallengeData.PeakLevelDatas.GetValueOrDefault(levelId)
|
||||
?.BaseAvatarList
|
||||
.Select(x => new LineupAvatarInfo
|
||||
{
|
||||
BaseAvatarId = (int)x
|
||||
}).ToList() ?? [];
|
||||
}
|
||||
|
||||
// Set technique points to full
|
||||
lineup.Mp = 5; // Max Mp
|
||||
@@ -304,10 +289,7 @@ public class ChallengePeakManager(PlayerInstance player) : BasePlayerManager(pla
|
||||
if (excel.BossExcel != null)
|
||||
data.Peak.IsHard = BossIsHard;
|
||||
|
||||
if (buffId > 0)
|
||||
{
|
||||
data.Peak.Buffs.Add(buffId);
|
||||
}
|
||||
if (buffId > 0) data.Peak.Buffs.Add(buffId);
|
||||
|
||||
var instance = new ChallengePeakInstance(Player, data);
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Reflection;
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Config.AdventureAbility;
|
||||
using EggLink.DanhengServer.Data.Custom;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using System.Collections.Frozen;
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Database;
|
||||
using EggLink.DanhengServer.Database.Friend;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
@@ -14,7 +15,6 @@ using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Google.Protobuf.Collections;
|
||||
using System.Collections.Frozen;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Inventory;
|
||||
|
||||
@@ -67,14 +67,12 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
itemData = await PutItem(itemId, 1, rank, level: level, uniqueId: ++Data.NextUniqueId);
|
||||
|
||||
if (itemConfig.Rarity == ItemRarityEnum.SuperRare)
|
||||
{
|
||||
// add development
|
||||
Player.FriendRecordData!.AddAndRemoveOld(new FriendDevelopmentInfoPb
|
||||
{
|
||||
DevelopmentType = DevelopmentType.DevelopmentUnlockEquipment,
|
||||
Params = { { "EquipmentTid", (uint)itemConfig.ID } }
|
||||
});
|
||||
}
|
||||
break;
|
||||
case ItemMainTypeEnum.Usable:
|
||||
switch (itemConfig.ItemSubType)
|
||||
@@ -715,7 +713,8 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
for (var i = 0; i < count; i++) // do count times
|
||||
{
|
||||
if (useConfig.PreviewSkillPoint != 0) await Player.LineupManager!.GainMp((int)useConfig.PreviewSkillPoint);
|
||||
if (useConfig.PreviewSkillPoint != 0)
|
||||
await Player.LineupManager!.GainMp((int)useConfig.PreviewSkillPoint);
|
||||
|
||||
if (baseAvatarId > 0)
|
||||
{
|
||||
@@ -746,7 +745,8 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
if (useConfig.PreviewPowerPercent != 0)
|
||||
{
|
||||
avatar.SetCurSp(
|
||||
Math.Min(Math.Max(avatar.CurrentHp + (int)(useConfig.PreviewPowerPercent * 10000), 0), 10000),
|
||||
Math.Min(Math.Max(avatar.CurrentHp + (int)(useConfig.PreviewPowerPercent * 10000), 0),
|
||||
10000),
|
||||
extraLineup);
|
||||
|
||||
await Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager.GetCurLineup()!));
|
||||
@@ -757,7 +757,8 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
// team use
|
||||
if (useConfig.PreviewHPRecoveryPercent != 0)
|
||||
{
|
||||
Player.LineupManager!.GetCurLineup()!.Heal((int)(useConfig.PreviewHPRecoveryPercent * 10000), true);
|
||||
Player.LineupManager!.GetCurLineup()!.Heal((int)(useConfig.PreviewHPRecoveryPercent * 10000),
|
||||
true);
|
||||
|
||||
await Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager.GetCurLineup()!));
|
||||
}
|
||||
@@ -771,7 +772,8 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
if (useConfig.PreviewPowerPercent != 0)
|
||||
{
|
||||
Player.LineupManager!.GetCurLineup()!.AddPercentSp((int)(useConfig.PreviewPowerPercent * 10000));
|
||||
Player.LineupManager!.GetCurLineup()!.AddPercentSp((int)(useConfig.PreviewPowerPercent *
|
||||
10000));
|
||||
|
||||
await Player.SendPacket(new PacketSyncLineupNotify(Player.LineupManager.GetCurLineup()!));
|
||||
}
|
||||
@@ -791,12 +793,8 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
}
|
||||
|
||||
if (GameData.ItemUseDataData.TryGetValue(dataId, out var useData))
|
||||
{
|
||||
foreach (var rewardId in useData.UseParam)
|
||||
{
|
||||
resItemDatas.AddRange(await HandleReward(rewardId, true));
|
||||
}
|
||||
}
|
||||
|
||||
// remove item
|
||||
await RemoveItem(itemId, count);
|
||||
|
||||
@@ -167,13 +167,10 @@ public class LineupManager : BasePlayerManager
|
||||
var trial = Player.AvatarManager!.GetTrialAvatar(avatarId, refresh);
|
||||
if (trial != null)
|
||||
{
|
||||
if (GameData.MultiplePathAvatarConfigData.TryGetValue(trial.AvatarId, out var pathExcel) && pathExcel.Gender != GenderTypeEnum.GENDER_NONE)
|
||||
{
|
||||
if (GameData.MultiplePathAvatarConfigData.TryGetValue(trial.AvatarId, out var pathExcel) &&
|
||||
pathExcel.Gender != GenderTypeEnum.GENDER_NONE)
|
||||
if (pathExcel.Gender != (GenderTypeEnum)Player.Data.CurrentGender)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
trial.CheckLevel(worldLevel);
|
||||
lineup.BaseAvatars!.Add(new LineupAvatarInfo
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge.Definitions;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ public class MissionHandlerGroupPropertyValue : MissionFinishTypeHandler
|
||||
if (prop == value) await player.MissionManager!.FinishSubMission(info.ID);
|
||||
}
|
||||
|
||||
public override async ValueTask HandleQuestFinishType(PlayerInstance player, QuestDataExcel quest, FinishWayExcel excel, object? arg)
|
||||
public override async ValueTask HandleQuestFinishType(PlayerInstance player, QuestDataExcel quest,
|
||||
FinishWayExcel excel, object? arg)
|
||||
{
|
||||
var floorId = excel.MazeFloorID;
|
||||
var groupId = excel.ParamInt1;
|
||||
|
||||
@@ -4,6 +4,7 @@ using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Mission.FinishType.Handler;
|
||||
|
||||
[MissionFinishType(MissionFinishTypeEnum.WorldLevel)]
|
||||
public class MissionHandlerWorldLevel : MissionFinishTypeHandler
|
||||
{
|
||||
@@ -12,7 +13,8 @@ public class MissionHandlerWorldLevel : MissionFinishTypeHandler
|
||||
await player.MissionManager!.FinishSubMission(info.ID);
|
||||
}
|
||||
|
||||
public override async ValueTask HandleQuestFinishType(PlayerInstance player, QuestDataExcel quest, FinishWayExcel excel, object? arg)
|
||||
public override async ValueTask HandleQuestFinishType(PlayerInstance player, QuestDataExcel quest,
|
||||
FinishWayExcel excel, object? arg)
|
||||
{
|
||||
await player.QuestManager!.UpdateQuestProgress(quest.QuestID, player.Data.WorldLevel);
|
||||
}
|
||||
|
||||
@@ -646,30 +646,24 @@ public class MissionManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
HashSet<int> mainIds = [];
|
||||
foreach (var mainMission in GameData.MainMissionData.Values)
|
||||
{
|
||||
foreach (var subMission in mainMission.MissionInfo.SubMissionList)
|
||||
foreach (var subMission in mainMission.MissionInfo.SubMissionList)
|
||||
if (targetSubIds.Contains(subMission.ID))
|
||||
{
|
||||
if (targetSubIds.Contains(subMission.ID))
|
||||
info.SceneMissionInfo.SubMissionStatusList.Add(new Proto.Mission
|
||||
{
|
||||
info.SceneMissionInfo.SubMissionStatusList.Add(new Proto.Mission
|
||||
{
|
||||
Id = (uint)subMission.ID,
|
||||
Status = GetSubMissionStatus(subMission.ID).ToProto(),
|
||||
Progress = (uint)GetMissionProgress(subMission.ID)
|
||||
});
|
||||
Id = (uint)subMission.ID,
|
||||
Status = GetSubMissionStatus(subMission.ID).ToProto(),
|
||||
Progress = (uint)GetMissionProgress(subMission.ID)
|
||||
});
|
||||
|
||||
mainIds.Add(mainMission.MainMissionID);
|
||||
}
|
||||
mainIds.Add(mainMission.MainMissionID);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var mainId in mainIds)
|
||||
{
|
||||
if (GetMainMissionStatus(mainId) == MissionPhaseEnum.Finish)
|
||||
info.SceneMissionInfo.FinishedMainMissionIdList.Add((uint)mainId);
|
||||
else if (GetMainMissionStatus(mainId) == MissionPhaseEnum.Accept)
|
||||
info.SceneMissionInfo.UnfinishedMainMissionIdList.Add((uint)mainId);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace EggLink.DanhengServer.GameServer.Game.Mission;
|
||||
|
||||
public class StoryLineManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
public StoryLineData StoryLineData { get; set; } = DatabaseHelper.Instance!.GetInstanceOrCreateNew<StoryLineData>(player.Uid);
|
||||
public StoryLineData StoryLineData { get; set; } =
|
||||
DatabaseHelper.Instance!.GetInstanceOrCreateNew<StoryLineData>(player.Uid);
|
||||
|
||||
public async ValueTask CheckIfEnterStoryLine()
|
||||
{
|
||||
@@ -221,4 +222,4 @@ public class StoryLineManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
await Player.SendPacket(new PacketStoryLineInfoScNotify(Player));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,7 @@ public class SwitchHandComponent(PlayerInstance player) : BasePlayerComponent(pl
|
||||
{
|
||||
var excel = GameData.MazePuzzleSwitchHandData.GetValueOrDefault(configId);
|
||||
if (excel == null) return (Retcode.RetInteractConfigNotExist, null);
|
||||
if (Player.SceneData!.SwitchHandData.TryGetValue(configId, out var info))
|
||||
{
|
||||
return (Retcode.RetSucc, info);
|
||||
}
|
||||
if (Player.SceneData!.SwitchHandData.TryGetValue(configId, out var info)) return (Retcode.RetSucc, info);
|
||||
|
||||
// create a new one
|
||||
info = new SwitchHandInfo
|
||||
@@ -39,7 +36,8 @@ public class SwitchHandComponent(PlayerInstance player) : BasePlayerComponent(pl
|
||||
// set default values
|
||||
var floorInfo = GameData.GetFloorInfo(excel.FloorID);
|
||||
if (floorInfo == null) return (Retcode.RetInteractConfigNotExist, null);
|
||||
if (!floorInfo.Groups.TryGetValue(excel.SwitchHandID[0], out var groupInfo)) return (Retcode.RetReqParaInvalid, null);
|
||||
if (!floorInfo.Groups.TryGetValue(excel.SwitchHandID[0], out var groupInfo))
|
||||
return (Retcode.RetReqParaInvalid, null);
|
||||
var prop = groupInfo.PropList.FirstOrDefault(x => x.ID == excel.SwitchHandID[1]);
|
||||
if (prop == null) return (Retcode.RetReqParaInvalid, null);
|
||||
|
||||
|
||||
@@ -79,32 +79,32 @@ public partial class PlayerInstance
|
||||
switch (newState)
|
||||
{
|
||||
case PropStateEnum.Closed:
|
||||
{
|
||||
foreach (var p in SceneInstance.GetEntitiesInGroup<EntityProp>(prop.GroupId))
|
||||
if (p.Excel.PropType == PropTypeEnum.PROP_TREASURE_CHEST)
|
||||
{
|
||||
await p.SetState(PropStateEnum.ChestClosed);
|
||||
}
|
||||
else if (p.Excel.PropType == prop.Excel.PropType)
|
||||
{
|
||||
// Skip
|
||||
}
|
||||
else
|
||||
{
|
||||
await p.SetState(PropStateEnum.Open);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case PropStateEnum.Open:
|
||||
{
|
||||
foreach (var p in SceneInstance.GetEntitiesInGroup<EntityProp>(prop.GroupId).Where(p =>
|
||||
p.Excel.PropType is not PropTypeEnum.PROP_TREASURE_CHEST &&
|
||||
p.Excel.PropType != prop.Excel.PropType))
|
||||
{
|
||||
foreach (var p in SceneInstance.GetEntitiesInGroup<EntityProp>(prop.GroupId))
|
||||
if (p.Excel.PropType == PropTypeEnum.PROP_TREASURE_CHEST)
|
||||
{
|
||||
await p.SetState(PropStateEnum.ChestClosed);
|
||||
}
|
||||
else if (p.Excel.PropType == prop.Excel.PropType)
|
||||
{
|
||||
// Skip
|
||||
}
|
||||
else
|
||||
{
|
||||
await p.SetState(PropStateEnum.Open);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PropStateEnum.Open:
|
||||
{
|
||||
foreach (var p in SceneInstance.GetEntitiesInGroup<EntityProp>(prop.GroupId).Where(p =>
|
||||
p.Excel.PropType is not PropTypeEnum.PROP_TREASURE_CHEST &&
|
||||
p.Excel.PropType != prop.Excel.PropType))
|
||||
await p.SetState(PropStateEnum.Open);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -142,9 +142,7 @@ public partial class PlayerInstance
|
||||
if (prop.Excel.ID == 104039)
|
||||
{
|
||||
foreach (var p in SceneInstance.GetEntitiesInGroup<EntityProp>(prop.GroupId))
|
||||
{
|
||||
await p.SetState(newState);
|
||||
}
|
||||
|
||||
await MissionManager!.OnPlayerInteractWithProp();
|
||||
}
|
||||
@@ -378,7 +376,8 @@ public partial class PlayerInstance
|
||||
Data.Pos = pos;
|
||||
Data.Rot = rot;
|
||||
var notSendMove = true;
|
||||
if (planeId != Data.PlaneId || floorId != Data.FloorId || entryId != Data.EntryId || SceneInstance == null || !mapTp)
|
||||
if (planeId != Data.PlaneId || floorId != Data.FloorId || entryId != Data.EntryId || SceneInstance == null ||
|
||||
!mapTp)
|
||||
{
|
||||
if (SceneInstance != null)
|
||||
await SceneInstance.OnDestroy();
|
||||
|
||||
@@ -238,13 +238,9 @@ public partial class PlayerInstance(PlayerData data)
|
||||
if (ConfigManager.Config.ServerOption.EnableMission) await MissionManager!.AcceptMainMissionByCondition();
|
||||
|
||||
foreach (var friendDevelopmentInfoPb in FriendRecordData.DevelopmentInfos.ToArray())
|
||||
{
|
||||
if (Extensions.GetUnixSec() - friendDevelopmentInfoPb.Time >=
|
||||
TimeSpan.TicksPerDay * 7 / TimeSpan.TicksPerSecond)
|
||||
{
|
||||
FriendRecordData.DevelopmentInfos.Remove(friendDevelopmentInfoPb);
|
||||
}
|
||||
}
|
||||
|
||||
await QuestManager!.AcceptQuestByCondition();
|
||||
}
|
||||
@@ -497,7 +493,8 @@ public partial class PlayerInstance(PlayerData data)
|
||||
|
||||
public T GetComponent<T>() where T : BasePlayerComponent
|
||||
{
|
||||
return Components.OfType<T>().FirstOrDefault() ?? throw new InvalidOperationException($"Component {typeof(T)} not found.");
|
||||
return Components.OfType<T>().FirstOrDefault() ??
|
||||
throw new InvalidOperationException($"Component {typeof(T)} not found.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -61,7 +61,8 @@ public class RaidManager : BasePlayerManager
|
||||
|
||||
#region Player Action
|
||||
|
||||
public async ValueTask<RaidRecord?> EnterRaid(int raidId, int worldLevel, List<int>? avatarList = null, bool enterSaved = false)
|
||||
public async ValueTask<RaidRecord?> EnterRaid(int raidId, int worldLevel, List<int>? avatarList = null,
|
||||
bool enterSaved = false)
|
||||
{
|
||||
if (RaidData.CurRaidId != 0) return null;
|
||||
|
||||
@@ -279,9 +280,7 @@ public class RaidManager : BasePlayerManager
|
||||
GameData.MainMissionData.TryGetValue(missionId, out var mission);
|
||||
if (mission?.MissionInfo.SubMissionList == null) continue;
|
||||
foreach (var i in mission.MissionInfo.SubMissionList.Select(x => x.LevelFloorID).ToHashSet())
|
||||
{
|
||||
floorIds.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
dict.Remove(worldLevel);
|
||||
@@ -302,4 +301,4 @@ public class RaidManager : BasePlayerManager
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -51,10 +51,7 @@ public class EraFlipperSceneComponent(SceneInstance scene) : BaseSceneComponent(
|
||||
foreach (var data in dataList)
|
||||
{
|
||||
SceneInst.Player.SceneData!.EraFlipperData.RegionState[(int)data.EraFlipperRegionId] = (int)data.State;
|
||||
if (data.EraFlipperRegionId == CurRegionId)
|
||||
{
|
||||
RegionState = (int)data.State;
|
||||
}
|
||||
if (data.EraFlipperRegionId == CurRegionId) RegionState = (int)data.State;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
CurTargetPuzzleGroupId =
|
||||
SceneInst.Player.SceneData!.FloorTargetPuzzleGroupData.GetValueOrDefault(SceneInst.FloorId, 0);
|
||||
|
||||
SceneInst.GroupPropertyUpdated += GroupPropertyUpdated;
|
||||
SceneInst.GroupPropertyUpdated += GroupPropertyUpdated;
|
||||
return ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
private async ValueTask ExecuteRainbowActions(List<RainbowActionInfo> actions)
|
||||
{
|
||||
foreach (var action in actions)
|
||||
{
|
||||
switch (action.ActionType)
|
||||
{
|
||||
case SceneActionTypeEnum.Unknown:
|
||||
@@ -66,7 +65,6 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
await CallCurrentTargetPuzzlePropertyChanged(action.Params);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async ValueTask SetGroupProperty(Dictionary<string, object> param)
|
||||
@@ -116,10 +114,8 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
// check if group property value equal to target value
|
||||
var groupPropertyValue = SceneInst.GetGroupProperty(groupId, propertyName);
|
||||
if (groupPropertyValue == propertyValue)
|
||||
{
|
||||
// execute actions
|
||||
await ExecuteRainbowActions(actions);
|
||||
}
|
||||
}
|
||||
|
||||
private async ValueTask SetFloorSavedValue(Dictionary<string, object> param)
|
||||
@@ -136,7 +132,7 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
private async ValueTask CallCurrentTargetPuzzlePropertyAction(Dictionary<string, object> param)
|
||||
{
|
||||
var propertyName = (string)(param.GetValueOrDefault("PropertyName") ?? string.Empty);
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(propertyName)) return;
|
||||
|
||||
// get current target puzzle group actions
|
||||
@@ -147,7 +143,8 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
var propertyAction = modifiedGroupActions.GetValueOrDefault(propertyName);
|
||||
|
||||
// get cur actions
|
||||
var targetActions = propertyAction?.GetValueOrDefault(SceneInst.GetGroupProperty(CurTargetPuzzleGroupId, propertyName));
|
||||
var targetActions =
|
||||
propertyAction?.GetValueOrDefault(SceneInst.GetGroupProperty(CurTargetPuzzleGroupId, propertyName));
|
||||
if (targetActions == null) return;
|
||||
|
||||
// execute actions
|
||||
@@ -158,7 +155,7 @@ public class RainbowSceneComponent(SceneInstance scene) : BaseSceneComponent(sce
|
||||
{
|
||||
var propertyName = (string)(param.GetValueOrDefault("PropertyName") ?? string.Empty);
|
||||
var propertyValue = (int)(long)(param.GetValueOrDefault("PropertyValue") ?? 0);
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(propertyName)) return;
|
||||
|
||||
// get current target puzzle group actions
|
||||
|
||||
@@ -37,6 +37,36 @@ public class EntityMonster(
|
||||
public override int EntityId { get; set; } = 0;
|
||||
public override int GroupId { get; set; } = groupId;
|
||||
|
||||
public List<string> Modifiers { get; set; } = [];
|
||||
|
||||
public async ValueTask AddModifier(string modifierName)
|
||||
{
|
||||
if (Modifiers.Contains(modifierName)) return;
|
||||
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(MonsterData.ID, out var ability);
|
||||
if (modifier == null || ability == null) return;
|
||||
|
||||
await Scene.Player.TaskManager!.AbilityLevelTask.TriggerTasks(ability, modifier.OnCreate, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
|
||||
Modifiers.Add(modifierName);
|
||||
}
|
||||
|
||||
public async ValueTask RemoveModifier(string modifierName)
|
||||
{
|
||||
if (!Modifiers.Contains(modifierName)) return;
|
||||
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(MonsterData.ID, out var ability);
|
||||
if (modifier == null || ability == null) return;
|
||||
|
||||
await Scene.Player.TaskManager!.AbilityLevelTask.TriggerTasks(ability, modifier.OnDestroy, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
|
||||
Modifiers.Remove(modifierName);
|
||||
}
|
||||
|
||||
public override async ValueTask AddBuff(SceneBuff buff)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(buff.BuffId * 10 + buff.BuffLevel, out var buffExcel)) return;
|
||||
@@ -102,36 +132,6 @@ public class EntityMonster(
|
||||
return proto;
|
||||
}
|
||||
|
||||
public List<string> Modifiers { get; set; } = [];
|
||||
|
||||
public async ValueTask AddModifier(string modifierName)
|
||||
{
|
||||
if (Modifiers.Contains(modifierName)) return;
|
||||
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(MonsterData.ID, out var ability);
|
||||
if (modifier == null || ability == null) return;
|
||||
|
||||
await Scene.Player.TaskManager!.AbilityLevelTask.TriggerTasks(ability, modifier.OnCreate, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
|
||||
Modifiers.Add(modifierName);
|
||||
}
|
||||
|
||||
public async ValueTask RemoveModifier(string modifierName)
|
||||
{
|
||||
if (!Modifiers.Contains(modifierName)) return;
|
||||
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(MonsterData.ID, out var ability);
|
||||
if (modifier == null || ability == null) return;
|
||||
|
||||
await Scene.Player.TaskManager!.AbilityLevelTask.TriggerTasks(ability, modifier.OnDestroy, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
|
||||
Modifiers.Remove(modifierName);
|
||||
}
|
||||
|
||||
public async ValueTask RemoveBuff(int buffId)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(buffId * 10 + 1, out var buffExcel)) return;
|
||||
|
||||
@@ -77,7 +77,8 @@ public class SceneEntityLoader(SceneInstance scene)
|
||||
Scene.Groups.Remove(group.Id);
|
||||
}
|
||||
else if (!group.SavedValueCondition.IsTrue(
|
||||
Scene.Player.SceneData!.GetFloorSavedValues(Scene.FloorId))) // condition: Saved Value Condition
|
||||
Scene.Player.SceneData!
|
||||
.GetFloorSavedValues(Scene.FloorId))) // condition: Saved Value Condition
|
||||
{
|
||||
foreach (var entity in Scene.Entities.Values.Where(entity => entity.GroupId == group.Id))
|
||||
{
|
||||
@@ -173,7 +174,7 @@ public class SceneEntityLoader(SceneInstance scene)
|
||||
|
||||
if (info.RelatedBattleId.Count > 0 && !Scene.Player.MissionManager!.GetRunningSubMissionList().Any(x =>
|
||||
x.FinishType == MissionFinishTypeEnum.StageWin && info.RelatedBattleId.Contains(x.ParamInt1)))
|
||||
return null; // mission not activated
|
||||
return null; // mission not activated
|
||||
|
||||
// TODO atmosphere conditions
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using EggLink.DanhengServer.Data.Config.Scene;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Database.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.Enums.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.Activity.Loaders;
|
||||
using EggLink.DanhengServer.GameServer.Game.Battle;
|
||||
@@ -18,8 +19,6 @@ using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System.Management;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Scene;
|
||||
|
||||
@@ -94,9 +93,7 @@ public class SceneInstance
|
||||
.GetValueOrDefault(entity.Value.GroupId, []);
|
||||
|
||||
foreach (var info in property.Values.Where(x => x.Side != GroupPropertySideEnum.ClientOnly))
|
||||
{
|
||||
resProperty.Add(info.Name, savedProp.GetValueOrDefault(info.Name, info.DefaultValue));
|
||||
}
|
||||
|
||||
groups.Add(new SceneEntityGroupInfo
|
||||
{
|
||||
@@ -104,6 +101,7 @@ public class SceneInstance
|
||||
GroupPropertyMap = { resProperty }
|
||||
});
|
||||
}
|
||||
|
||||
groups[groups.FindIndex(x => x.GroupId == entity.Value.GroupId)].EntityList.Add(entity.Value.ToProto());
|
||||
}
|
||||
|
||||
@@ -117,9 +115,7 @@ public class SceneInstance
|
||||
.GetValueOrDefault(groupId, []);
|
||||
|
||||
foreach (var info in property.Values.Where(x => x.Side != GroupPropertySideEnum.ClientOnly))
|
||||
{
|
||||
resProperty.Add(info.Name, savedProp.GetValueOrDefault(info.Name, info.DefaultValue));
|
||||
}
|
||||
|
||||
groups.Add(new SceneEntityGroupInfo
|
||||
{
|
||||
@@ -247,12 +243,13 @@ public class SceneInstance
|
||||
EntityLoader = new TrialActivityEntityLoader(this, Player);
|
||||
break;
|
||||
default:
|
||||
EntityLoader = Player.StoryLineManager?.StoryLineData.CurStoryLineId != 0 ? new StoryLineEntityLoader(this) : new SceneEntityLoader(this);
|
||||
EntityLoader = Player.StoryLineManager?.StoryLineData.CurStoryLineId != 0
|
||||
? new StoryLineEntityLoader(this)
|
||||
: new SceneEntityLoader(this);
|
||||
break;
|
||||
}
|
||||
|
||||
foreach (var module in floor.LevelFeatureModules.ToHashSet())
|
||||
{
|
||||
switch (module)
|
||||
{
|
||||
case LevelFeatureTypeEnum.EraFlipper:
|
||||
@@ -262,12 +259,9 @@ public class SceneInstance
|
||||
Components.Add(new RotatableRegionSceneComponent(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GameData.SceneRainbowGroupPropertyData.FloorProperty.ContainsKey(FloorId))
|
||||
{
|
||||
Components.Add(new RainbowSceneComponent(this));
|
||||
}
|
||||
|
||||
System.Threading.Tasks.Task.Run(async () => { await EntityLoader.LoadEntity(); }).Wait();
|
||||
|
||||
@@ -281,13 +275,15 @@ public class SceneInstance
|
||||
#region Event
|
||||
|
||||
public delegate ValueTask GroupPropertyUpdateArg(GroupPropertyRefreshData data);
|
||||
|
||||
public event GroupPropertyUpdateArg? GroupPropertyUpdated;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Scene Actions
|
||||
|
||||
public async ValueTask<GroupPropertyRefreshData> UpdateGroupProperty(int groupId, string name, int value, bool callEvent = true)
|
||||
public async ValueTask<GroupPropertyRefreshData> UpdateGroupProperty(int groupId, string name, int value,
|
||||
bool callEvent = true)
|
||||
{
|
||||
// save
|
||||
if (!Player.SceneData!.GroupPropertyData.TryGetValue(FloorId, out var groupData))
|
||||
@@ -318,13 +314,9 @@ public class SceneInstance
|
||||
if (callEvent && GroupPropertyUpdated != null) await GroupPropertyUpdated(res);
|
||||
|
||||
if (name == "SGP_PuzzleState" && group.ControlFloorSavedValue.Count > 0)
|
||||
{
|
||||
// set fsv
|
||||
foreach (var key in group.ControlFloorSavedValue)
|
||||
{
|
||||
await UpdateFloorSavedValue(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -337,7 +329,7 @@ public class SceneInstance
|
||||
Player.SceneData.FloorSavedData[FloorId] = floorSavedData;
|
||||
}
|
||||
|
||||
if (FloorInfo?.FloorSavedValue.All(x => x.Name != name) == true) return; // not exist
|
||||
if (FloorInfo?.FloorSavedValue.All(x => x.Name != name) == true) return; // not exist
|
||||
|
||||
floorSavedData[name] = value;
|
||||
|
||||
@@ -490,10 +482,7 @@ public class SceneInstance
|
||||
|
||||
public async ValueTask InitializeComponents()
|
||||
{
|
||||
foreach (var component in Components)
|
||||
{
|
||||
await component.Initialize();
|
||||
}
|
||||
foreach (var component in Components) await component.Initialize();
|
||||
}
|
||||
|
||||
public T? GetComponent<T>() where T : BaseSceneComponent
|
||||
@@ -724,10 +713,6 @@ public class SceneInstance
|
||||
|
||||
public class AvatarSceneInfo : BaseGameEntity, IGameModifier
|
||||
{
|
||||
public BaseAvatarInfo AvatarInfo { get; set; }
|
||||
public AvatarType AvatarType { get; set; }
|
||||
public PlayerInstance Player { get; set; }
|
||||
|
||||
public AvatarSceneInfo(BaseAvatarInfo avatarInfo, AvatarType avatarType, PlayerInstance player)
|
||||
{
|
||||
AvatarInfo = avatarInfo;
|
||||
@@ -752,10 +737,49 @@ public class AvatarSceneInfo : BaseGameEntity, IGameModifier
|
||||
}
|
||||
}
|
||||
|
||||
public BaseAvatarInfo AvatarInfo { get; set; }
|
||||
public AvatarType AvatarType { get; set; }
|
||||
public PlayerInstance Player { get; set; }
|
||||
|
||||
public override int EntityId { get; set; }
|
||||
|
||||
public override int GroupId { get; set; } = 0;
|
||||
|
||||
public List<string> Modifiers { get; set; } = [];
|
||||
|
||||
public async ValueTask AddModifier(string modifierName)
|
||||
{
|
||||
if (Modifiers.Contains(modifierName)) return;
|
||||
Modifiers.Add(modifierName);
|
||||
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(AvatarInfo.AvatarId, out var avatarAbility);
|
||||
if (modifier == null || avatarAbility == null) return;
|
||||
|
||||
await Player.TaskManager!.AbilityLevelTask.TriggerTasks(avatarAbility, modifier.OnCreate, this, [],
|
||||
new SceneCastSkillCsReq
|
||||
{
|
||||
TargetMotion = new MotionInfo
|
||||
{
|
||||
Pos = Player.Data.Pos?.ToProto() ?? new Vector(),
|
||||
Rot = Player.Data.Rot?.ToProto() ?? new Vector()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async ValueTask RemoveModifier(string modifierName)
|
||||
{
|
||||
if (!Modifiers.Contains(modifierName)) return;
|
||||
|
||||
Modifiers.Remove(modifierName);
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(AvatarInfo.AvatarId, out var avatarAbility);
|
||||
if (modifier == null || avatarAbility == null) return;
|
||||
|
||||
await Player.TaskManager!.AbilityLevelTask.TriggerTasks(avatarAbility, modifier.OnDestroy, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
}
|
||||
|
||||
public override async ValueTask AddBuff(SceneBuff buff)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(buff.BuffId * 10 + buff.BuffLevel, out var buffExcel)) return;
|
||||
@@ -819,41 +843,6 @@ public class AvatarSceneInfo : BaseGameEntity, IGameModifier
|
||||
};
|
||||
}
|
||||
|
||||
public List<string> Modifiers { get; set; } = [];
|
||||
|
||||
public async ValueTask AddModifier(string modifierName)
|
||||
{
|
||||
if (Modifiers.Contains(modifierName)) return;
|
||||
Modifiers.Add(modifierName);
|
||||
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(AvatarInfo.AvatarId, out var avatarAbility);
|
||||
if (modifier == null || avatarAbility == null) return;
|
||||
|
||||
await Player.TaskManager!.AbilityLevelTask.TriggerTasks(avatarAbility, modifier.OnCreate, this, [],
|
||||
new SceneCastSkillCsReq
|
||||
{
|
||||
TargetMotion = new MotionInfo
|
||||
{
|
||||
Pos = Player.Data.Pos?.ToProto() ?? new Vector(),
|
||||
Rot = Player.Data.Rot?.ToProto() ?? new Vector()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async ValueTask RemoveModifier(string modifierName)
|
||||
{
|
||||
if (!Modifiers.Contains(modifierName)) return;
|
||||
|
||||
Modifiers.Remove(modifierName);
|
||||
GameData.AdventureModifierData.TryGetValue(modifierName, out var modifier);
|
||||
GameData.AdventureAbilityConfigListData.TryGetValue(AvatarInfo.AvatarId, out var avatarAbility);
|
||||
if (modifier == null || avatarAbility == null) return;
|
||||
|
||||
await Player.TaskManager!.AbilityLevelTask.TriggerTasks(avatarAbility, modifier.OnDestroy, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
}
|
||||
|
||||
public async ValueTask RemoveBuff(int buffId)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(buffId * 10 + 1, out var buffExcel)) return;
|
||||
|
||||
@@ -3,7 +3,6 @@ using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Enums.Item;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Shop;
|
||||
|
||||
@@ -32,7 +31,7 @@ public class ShopService(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
var item = await Player.InventoryManager!.AddItem(itemConfig.ID, count, false);
|
||||
if (item != null)
|
||||
{
|
||||
{
|
||||
if (GameData.ItemUseDataData.TryGetValue(item.ItemId, out var useData) && useData.IsAutoUse)
|
||||
{
|
||||
var res = await Player.InventoryManager!.UseItem(item.ItemId);
|
||||
|
||||
@@ -46,7 +46,8 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
#region Manage
|
||||
|
||||
public async ValueTask<AbilityLevelResult> TriggerTasks(AdventureAbilityConfigListInfo abilities,
|
||||
List<TaskConfigInfo> tasks, BaseGameEntity casterEntity, List<BaseGameEntity> targetEntities, SceneCastSkillCsReq req,
|
||||
List<TaskConfigInfo> tasks, BaseGameEntity casterEntity, List<BaseGameEntity> targetEntities,
|
||||
SceneCastSkillCsReq req,
|
||||
string? modifierName = null)
|
||||
{
|
||||
BattleInstance? instance = null;
|
||||
@@ -98,7 +99,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
if (methodProp == null) return null;
|
||||
|
||||
method = (ExecuteTask)Delegate.CreateDelegate(typeof(ExecuteTask), this, methodProp);
|
||||
_cachedTasks[methodName] = method; // cached
|
||||
_cachedTasks[methodName] = method; // cached
|
||||
|
||||
return method;
|
||||
}
|
||||
@@ -127,13 +128,9 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
{
|
||||
var resp = await method(param with { Act = predicateTaskList.Predicate });
|
||||
if (resp is not bool r)
|
||||
{
|
||||
res = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
res = predicateTaskList.Predicate.Inverse ? !r : r;
|
||||
}
|
||||
}
|
||||
|
||||
if (res)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using System.Collections.Concurrent;
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Lineup;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using System.Collections.Concurrent;
|
||||
using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task.AvatarTask;
|
||||
@@ -12,7 +12,8 @@ public class SummonUnitLevelTask
|
||||
{
|
||||
#region Task Condition
|
||||
|
||||
public async ValueTask<object?> ByIsContainAdventureModifier(TaskConfigInfo act, List<BaseGameEntity> targetEntities,
|
||||
public async ValueTask<object?> ByIsContainAdventureModifier(TaskConfigInfo act,
|
||||
List<BaseGameEntity> targetEntities,
|
||||
EntitySummonUnit? summonUnit)
|
||||
{
|
||||
await ValueTask.CompletedTask;
|
||||
@@ -24,7 +25,8 @@ public class SummonUnitLevelTask
|
||||
|
||||
#region Manage
|
||||
|
||||
public void TriggerTasks(List<TaskConfigInfo> tasks, List<BaseGameEntity> targetEntities, EntitySummonUnit? summonUnit)
|
||||
public void TriggerTasks(List<TaskConfigInfo> tasks, List<BaseGameEntity> targetEntities,
|
||||
EntitySummonUnit? summonUnit)
|
||||
{
|
||||
foreach (var task in tasks) TriggerTask(task, targetEntities, summonUnit);
|
||||
}
|
||||
@@ -55,12 +57,13 @@ public class SummonUnitLevelTask
|
||||
if (methodProp == null) return null;
|
||||
|
||||
method = (ExecuteTask)Delegate.CreateDelegate(typeof(ExecuteTask), this, methodProp);
|
||||
_cachedTasks[methodName] = method; // cached
|
||||
_cachedTasks[methodName] = method; // cached
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
private delegate ValueTask<object?> ExecuteTask(TaskConfigInfo act, List<BaseGameEntity> targetEntities, EntitySummonUnit? summonUnit);
|
||||
private delegate ValueTask<object?> ExecuteTask(TaskConfigInfo act, List<BaseGameEntity> targetEntities,
|
||||
EntitySummonUnit? summonUnit);
|
||||
|
||||
private readonly ConcurrentDictionary<string, ExecuteTask> _cachedTasks = [];
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using System.Collections.Concurrent;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Data.Config.Scene;
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
@@ -7,9 +8,7 @@ using EggLink.DanhengServer.Enums.Scene;
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Game.Task.AvatarTask;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Task;
|
||||
|
||||
@@ -19,7 +18,8 @@ public class LevelTask(PlayerInstance player)
|
||||
|
||||
#region Prop Target
|
||||
|
||||
public async ValueTask<object?> TargetFetchAdvPropEx(TargetEvaluator act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> TargetFetchAdvPropEx(TargetEvaluator act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
await ValueTask.CompletedTask;
|
||||
|
||||
@@ -71,12 +71,13 @@ public class LevelTask(PlayerInstance player)
|
||||
if (methodProp == null) return null;
|
||||
|
||||
method = (ExecuteTask)Delegate.CreateDelegate(typeof(ExecuteTask), this, methodProp);
|
||||
_cachedTasks[methodName] = method; // cached
|
||||
_cachedTasks[methodName] = method; // cached
|
||||
|
||||
return method;
|
||||
}
|
||||
|
||||
private delegate ValueTask<object?> ExecuteTask(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null);
|
||||
private delegate ValueTask<object?> ExecuteTask(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null);
|
||||
|
||||
private readonly ConcurrentDictionary<string, ExecuteTask> _cachedTasks = [];
|
||||
|
||||
@@ -102,7 +103,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> TriggerCustomString(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> TriggerCustomString(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is TriggerCustomString triggerCustomString)
|
||||
{
|
||||
@@ -128,7 +130,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> EnterMapByCondition(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> EnterMapByCondition(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is EnterMapByCondition enterMapByCondition)
|
||||
await Player.EnterSceneByEntranceId(enterMapByCondition.EntranceID.GetValue(), 0, 0, true);
|
||||
@@ -136,7 +139,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> TriggerPerformance(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> TriggerPerformance(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is TriggerPerformance triggerPerformance)
|
||||
{
|
||||
@@ -153,7 +157,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> PredicateTaskList(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> PredicateTaskList(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is PredicateTaskList predicateTaskList)
|
||||
{
|
||||
@@ -175,7 +180,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> ChangePropState(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> ChangePropState(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType != MissionFinishTypeEnum.PropState) return null;
|
||||
|
||||
@@ -209,7 +215,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> CreateTrialPlayer(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> CreateTrialPlayer(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatar)
|
||||
await Player.LineupManager!.AddAvatarToCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
@@ -221,7 +228,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> ReplaceTrialPlayer(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> ReplaceTrialPlayer(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.GetTrialAvatar)
|
||||
{
|
||||
@@ -241,7 +249,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> StoryLineReplaceTrialPlayer(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> StoryLineReplaceTrialPlayer(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.StoryLineAddTrialAvatar)
|
||||
{
|
||||
@@ -253,7 +262,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> ReplaceVirtualTeam(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> ReplaceVirtualTeam(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (Player.LineupManager!.GetCurLineup()?.IsExtraLineup() != true) return null;
|
||||
|
||||
@@ -314,7 +324,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> DestroyTrialPlayer(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> DestroyTrialPlayer(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (subMission.SubMissionInfo?.FinishType == MissionFinishTypeEnum.DelTrialAvatar)
|
||||
await Player.LineupManager!.RemoveAvatarFromCurTeam(subMission.SubMissionInfo.ParamInt1);
|
||||
@@ -322,7 +333,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> ChangeGroupState(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> ChangeGroupState(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (group != null)
|
||||
foreach (var entity in Player.SceneInstance?.Entities.Values.ToList() ?? [])
|
||||
@@ -346,7 +358,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> TriggerEntityEvent(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> TriggerEntityEvent(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is TriggerEntityEvent triggerEntityEvent)
|
||||
if (group != null)
|
||||
@@ -359,7 +372,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> PropSetupUITrigger(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> PropSetupUITrigger(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is PropSetupUITrigger propSetupUiTrigger)
|
||||
foreach (var task in propSetupUiTrigger.ButtonCallback)
|
||||
@@ -370,7 +384,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return null;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> PropStateExecute(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> PropStateExecute(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
if (act is PropStateExecute propStateExecute)
|
||||
{
|
||||
@@ -392,7 +407,8 @@ public class LevelTask(PlayerInstance player)
|
||||
|
||||
#region Task Condition
|
||||
|
||||
public async ValueTask<object?> ByCompareSubMissionState(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> ByCompareSubMissionState(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
await ValueTask.CompletedTask;
|
||||
|
||||
@@ -405,7 +421,8 @@ public class LevelTask(PlayerInstance player)
|
||||
return false;
|
||||
}
|
||||
|
||||
public async ValueTask<object?> ByCompareFloorSavedValue(TaskConfigInfo act, SubMissionData subMission, GroupInfo? group = null)
|
||||
public async ValueTask<object?> ByCompareFloorSavedValue(TaskConfigInfo act, SubMissionData subMission,
|
||||
GroupInfo? group = null)
|
||||
{
|
||||
await ValueTask.CompletedTask;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using EggLink.DanhengServer.Command;
|
||||
using EggLink.DanhengServer.GameServer.Game.Battle;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge.Definitions;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Component;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Component;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.EraFlipper;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
@@ -20,7 +20,8 @@ public class HandlerResetEraFlipperDataCsReq : Handler
|
||||
}
|
||||
|
||||
// leave
|
||||
await connection.SendPacket(new PacketResetEraFlipperDataScRsp(component.CurRegionId, component.RegionState, req.PAHMAGPFDDJ));
|
||||
await connection.SendPacket(
|
||||
new PacketResetEraFlipperDataScRsp(component.CurRegionId, component.RegionState, req.PAHMAGPFDDJ));
|
||||
|
||||
component.LeaveFlipperRegion();
|
||||
}
|
||||
|
||||
@@ -16,14 +16,10 @@ public class HandlerMazeKillDirectCsReq : Handler
|
||||
{
|
||||
if (!connection.Player!.SceneInstance!.Entities.TryGetValue((int)entityId, out var entity)) continue;
|
||||
if (entity is EntityMonster monster)
|
||||
{
|
||||
await monster.Kill();
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove entity if it's not a monster
|
||||
connection.Player.SceneInstance.Entities.Remove((int)entityId);
|
||||
}
|
||||
}
|
||||
|
||||
await connection.SendPacket(new PacketMazeKillDirectScRsp(req.EntityList.ToList()));
|
||||
|
||||
@@ -22,7 +22,8 @@ public class HandlerPlayerGetTokenCsReq : Handler
|
||||
// call dispatch /get_account_info api to get account info
|
||||
int uid;
|
||||
|
||||
if (ConfigManager.Config.ServerOption.ServerConfig.RunDispatch || string.IsNullOrEmpty(ConfigManager.Config.ServerOption.ServerConfig.FromDispatchBaseUrl))
|
||||
if (ConfigManager.Config.ServerOption.ServerConfig.RunDispatch ||
|
||||
string.IsNullOrEmpty(ConfigManager.Config.ServerOption.ServerConfig.FromDispatchBaseUrl))
|
||||
{
|
||||
// dispatch running, use local db
|
||||
var account = DatabaseHelper.Instance?.GetInstance<AccountData>(int.Parse(req.AccountUid));
|
||||
|
||||
@@ -17,13 +17,9 @@ public class HandlerSwitchHandDataCsReq : Handler
|
||||
{
|
||||
var info = component.GetHandInfo((int)req.ConfigId);
|
||||
if (info.Item2 == null)
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandDataScRsp(info.Item1));
|
||||
}
|
||||
else
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandDataScRsp(info.Item2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -14,12 +14,8 @@ public class HandlerSwitchHandFinishCsReq : Handler
|
||||
var info = component.GetHandInfo(component.RunningHandConfigId);
|
||||
component.RunningHandConfigId = 0;
|
||||
if (info.Item2 == null)
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandFinishScRsp(info.Item1));
|
||||
}
|
||||
else
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandFinishScRsp(info.Item2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,8 @@ public class HandlerSwitchHandResetGameCsReq : Handler
|
||||
var info = component.UpdateHandInfo(req.ResetHandInfo);
|
||||
|
||||
if (info.Item2 == null)
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandResetGameScRsp(info.Item1));
|
||||
}
|
||||
else
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandResetGameScRsp(info.Item2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class HandlerSwitchHandResetHandPosCsReq : Handler
|
||||
var req = SwitchHandResetHandPosCsReq.Parser.ParseFrom(data);
|
||||
|
||||
var component = connection.Player!.GetComponent<SwitchHandComponent>();
|
||||
|
||||
|
||||
var info = component.GetHandInfo((int)req.ConfigId);
|
||||
if (info.Item2 == null)
|
||||
{
|
||||
|
||||
@@ -15,12 +15,8 @@ public class HandlerSwitchHandUpdateCsReq : Handler
|
||||
var component = connection.Player!.GetComponent<SwitchHandComponent>();
|
||||
var info = component.UpdateHandInfo(req.OperationHandInfo);
|
||||
if (info.Item2 == null)
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandUpdateScRsp(info.Item1, req.HandOperationInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
await connection.SendPacket(new PacketSwitchHandUpdateScRsp(info.Item2, req.HandOperationInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge.Instances;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge.Instances;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge.Definitions;
|
||||
using EggLink.DanhengServer.GameServer.Game.Challenge.Definitions;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
using EggLink.DanhengServer.Database.Friend;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using System.Linq;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Challenge;
|
||||
|
||||
public class PacketGetChallengeGroupStatisticsScRsp : BasePacket
|
||||
{
|
||||
public PacketGetChallengeGroupStatisticsScRsp(uint groupId, ChallengeGroupStatisticsPb? data) : base(CmdIds.GetChallengeGroupStatisticsScRsp)
|
||||
public PacketGetChallengeGroupStatisticsScRsp(uint groupId, ChallengeGroupStatisticsPb? data) : base(
|
||||
CmdIds.GetChallengeGroupStatisticsScRsp)
|
||||
{
|
||||
var proto = new GetChallengeGroupStatisticsScRsp
|
||||
{
|
||||
@@ -15,22 +15,13 @@ public class PacketGetChallengeGroupStatisticsScRsp : BasePacket
|
||||
};
|
||||
|
||||
var maxMemory = data?.MemoryGroupStatistics?.Values.MaxBy(x => x.Level);
|
||||
if (maxMemory != null)
|
||||
{
|
||||
proto.MemoryGroup = maxMemory.ToProto();
|
||||
}
|
||||
if (maxMemory != null) proto.MemoryGroup = maxMemory.ToProto();
|
||||
|
||||
var maxStory = data?.StoryGroupStatistics?.Values.MaxBy(x => x.Level);
|
||||
if (maxStory != null)
|
||||
{
|
||||
proto.StoryGroup = maxStory.ToProto();
|
||||
}
|
||||
if (maxStory != null) proto.StoryGroup = maxStory.ToProto();
|
||||
|
||||
var maxBoss = data?.BossGroupStatistics?.Values.MaxBy(x => x.Level);
|
||||
if (maxBoss != null)
|
||||
{
|
||||
proto.BossGroup = maxBoss.ToProto();
|
||||
}
|
||||
if (maxBoss != null) proto.BossGroup = maxBoss.ToProto();
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.ChallengePeak;
|
||||
|
||||
public class PacketChallengePeakGroupDataUpdateScNotify : BasePacket
|
||||
{
|
||||
public PacketChallengePeakGroupDataUpdateScNotify(ChallengePeakLevelInfo info) : base(CmdIds.ChallengePeakGroupDataUpdateScNotify)
|
||||
public PacketChallengePeakGroupDataUpdateScNotify(ChallengePeakLevelInfo info) : base(
|
||||
CmdIds.ChallengePeakGroupDataUpdateScNotify)
|
||||
{
|
||||
var proto = new ChallengePeakGroupDataUpdateScNotify
|
||||
{
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.ChallengePeak;
|
||||
|
||||
public class PacketChallengePeakSettleScNotify : BasePacket
|
||||
{
|
||||
public PacketChallengePeakSettleScNotify(ChallengePeakInstance inst, List<uint> targetIdList) : base(CmdIds.ChallengePeakSettleScNotify)
|
||||
public PacketChallengePeakSettleScNotify(ChallengePeakInstance inst, List<uint> targetIdList) : base(
|
||||
CmdIds.ChallengePeakSettleScNotify)
|
||||
{
|
||||
var proto = new ChallengePeakSettleScNotify
|
||||
{
|
||||
|
||||
@@ -15,9 +15,7 @@ public class PacketGetChallengePeakDataScRsp : BasePacket
|
||||
};
|
||||
|
||||
foreach (var groupId in GameData.ChallengePeakGroupConfigData.Keys)
|
||||
{
|
||||
proto.ChallengePeakLevelList.Add(player.ChallengePeakManager!.GetChallengePeakInfo(groupId));
|
||||
}
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.ChallengePeak;
|
||||
|
||||
public class PacketSetChallengePeakBossHardModeScRsp : BasePacket
|
||||
{
|
||||
public PacketSetChallengePeakBossHardModeScRsp(uint groupId, bool isHard) : base(CmdIds.SetChallengePeakBossHardModeScRsp)
|
||||
public PacketSetChallengePeakBossHardModeScRsp(uint groupId, bool isHard) : base(
|
||||
CmdIds.SetChallengePeakBossHardModeScRsp)
|
||||
{
|
||||
var proto = new SetChallengePeakBossHardModeScRsp
|
||||
{
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Friend;
|
||||
|
||||
public class PacketGetFriendBattleRecordDetailScRsp : BasePacket
|
||||
{
|
||||
public PacketGetFriendBattleRecordDetailScRsp(FriendRecordData recordData, ChallengeData challengeData, AvatarData avatarData) : base(
|
||||
public PacketGetFriendBattleRecordDetailScRsp(FriendRecordData recordData, ChallengeData challengeData,
|
||||
AvatarData avatarData) : base(
|
||||
CmdIds.GetFriendBattleRecordDetailScRsp)
|
||||
{
|
||||
var proto = new GetFriendBattleRecordDetailScRsp
|
||||
@@ -35,7 +36,7 @@ public class PacketGetFriendBattleRecordDetailScRsp : BasePacket
|
||||
{
|
||||
var stt = new PreLevelStatistics
|
||||
{
|
||||
PeakLevelId = (uint)preId,
|
||||
PeakLevelId = (uint)preId
|
||||
};
|
||||
|
||||
var rec = challengeData.PeakLevelDatas.GetValueOrDefault(preId);
|
||||
@@ -51,7 +52,9 @@ public class PacketGetFriendBattleRecordDetailScRsp : BasePacket
|
||||
Index = index++,
|
||||
Id = x,
|
||||
AvatarType = AvatarType.AvatarFormalType,
|
||||
Level = (uint)(avatarData.FormalAvatars.Find(avatar => avatar.BaseAvatarId == x)?.Level ?? 1)
|
||||
Level =
|
||||
(uint)(avatarData.FormalAvatars.Find(avatar => avatar.BaseAvatarId == x)?.Level ??
|
||||
1)
|
||||
})
|
||||
}
|
||||
};
|
||||
@@ -62,10 +65,9 @@ public class PacketGetFriendBattleRecordDetailScRsp : BasePacket
|
||||
peakRec.PreLevelSttList.Add(stt);
|
||||
}
|
||||
|
||||
var bossRec = challengeData.PeakBossLevelDatas.GetValueOrDefault(data.BossLevelID << 2 | 1);
|
||||
bossRec ??= challengeData.PeakBossLevelDatas.GetValueOrDefault(data.BossLevelID << 2 | 0);
|
||||
var bossRec = challengeData.PeakBossLevelDatas.GetValueOrDefault((data.BossLevelID << 2) | 1);
|
||||
bossRec ??= challengeData.PeakBossLevelDatas.GetValueOrDefault((data.BossLevelID << 2) | 0);
|
||||
if (bossRec != null)
|
||||
{
|
||||
peakRec.BossLevelStt = new BossLevelStatistics
|
||||
{
|
||||
PeakLevelId = (uint)bossRec.LevelId,
|
||||
@@ -79,13 +81,14 @@ public class PacketGetFriendBattleRecordDetailScRsp : BasePacket
|
||||
Index = (uint)index,
|
||||
Id = x,
|
||||
AvatarType = AvatarType.AvatarFormalType,
|
||||
Level = (uint)(avatarData.FormalAvatars.Find(avatar => avatar.BaseAvatarId == x)?.Level ?? 1)
|
||||
Level =
|
||||
(uint)(avatarData.FormalAvatars.Find(avatar => avatar.BaseAvatarId == x)?.Level ??
|
||||
1)
|
||||
})
|
||||
}
|
||||
},
|
||||
LeastRoundsCount = bossRec.RoundCnt
|
||||
};
|
||||
}
|
||||
|
||||
proto.PeakRecord.Add(peakRec);
|
||||
}
|
||||
@@ -101,5 +104,5 @@ public class PacketGetFriendBattleRecordDetailScRsp : BasePacket
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,9 @@ public class PacketGetFriendDevelopmentInfoScRsp : BasePacket
|
||||
public PacketGetFriendDevelopmentInfoScRsp(FriendRecordData data) : base(CmdIds.GetFriendDevelopmentInfoScRsp)
|
||||
{
|
||||
foreach (var friendDevelopmentInfoPb in data.DevelopmentInfos.ToArray())
|
||||
{
|
||||
if (Extensions.GetUnixSec() - friendDevelopmentInfoPb.Time >=
|
||||
TimeSpan.TicksPerDay * 7 / TimeSpan.TicksPerSecond)
|
||||
{
|
||||
data.DevelopmentInfos.Remove(friendDevelopmentInfoPb);
|
||||
}
|
||||
}
|
||||
|
||||
var proto = new GetFriendDevelopmentInfoScRsp
|
||||
{
|
||||
|
||||
@@ -13,12 +13,13 @@ public class PacketQueryProductInfoScRsp : BasePacket
|
||||
//PEKJLBINDGG = (ulong)Extensions.GetUnixSec() + 8640000, // 100 day
|
||||
ProductList =
|
||||
{
|
||||
GameData.RechargeConfigData.Values.Where(x => x.ProductID.Contains("chn") && !x.ProductID.Contains("cloud")).Select(x => new Product
|
||||
{
|
||||
GiftType = (ProductGiftType)x.GiftType,
|
||||
PriceTier = x.TierID,
|
||||
ProductId = x.ProductID
|
||||
})
|
||||
GameData.RechargeConfigData.Values
|
||||
.Where(x => x.ProductID.Contains("chn") && !x.ProductID.Contains("cloud")).Select(x => new Product
|
||||
{
|
||||
GiftType = (ProductGiftType)x.GiftType,
|
||||
PriceTier = x.TierID,
|
||||
ProductId = x.ProductID
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -16,10 +16,7 @@ public class PacketPlayerSyncScNotify : BasePacket
|
||||
{
|
||||
var proto = new PlayerSyncScNotify();
|
||||
|
||||
foreach (var data in datas)
|
||||
{
|
||||
data.SyncData(proto);
|
||||
}
|
||||
foreach (var data in datas) data.SyncData(proto);
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,8 @@ public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
{
|
||||
}
|
||||
|
||||
public PacketSceneGroupRefreshScNotify(SceneInstance scene, List<GroupPropertyRefreshData> refreshDataList) :base(CmdIds.SceneGroupRefreshScNotify)
|
||||
public PacketSceneGroupRefreshScNotify(SceneInstance scene, List<GroupPropertyRefreshData> refreshDataList) : base(
|
||||
CmdIds.SceneGroupRefreshScNotify)
|
||||
{
|
||||
var proto = new SceneGroupRefreshScNotify
|
||||
{
|
||||
@@ -83,6 +84,7 @@ public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
list = [];
|
||||
refreshDataDict[data.GroupId] = list;
|
||||
}
|
||||
|
||||
list.Add(data);
|
||||
}
|
||||
|
||||
@@ -95,14 +97,12 @@ public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
};
|
||||
|
||||
foreach (var data in dataList)
|
||||
{
|
||||
group.RefreshProperty.Add(new ScenePropertyRefreshInfo
|
||||
{
|
||||
GroupNewPropertyValue = data.NewValue,
|
||||
GroupOldPropertyValue = data.OldValue,
|
||||
GroupPropertyName = data.PropertyName
|
||||
});
|
||||
}
|
||||
|
||||
proto.GroupRefreshList.Add(group);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ public class PacketUpdateGroupPropertyScRsp : BasePacket
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketUpdateGroupPropertyScRsp(GroupPropertyRefreshData data, UpdateGroupPropertyCsReq req) : base(CmdIds.UpdateGroupPropertyScRsp)
|
||||
public PacketUpdateGroupPropertyScRsp(GroupPropertyRefreshData data, UpdateGroupPropertyCsReq req) : base(
|
||||
CmdIds.UpdateGroupPropertyScRsp)
|
||||
{
|
||||
var proto = new UpdateGroupPropertyScRsp
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ public class PacketSwitchHandCoinUpdateScRsp : BasePacket
|
||||
};
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketSwitchHandCoinUpdateScRsp(uint coinNum) : base(CmdIds.SwitchHandCoinUpdateScRsp)
|
||||
{
|
||||
var proto = new SwitchHandCoinUpdateScRsp
|
||||
|
||||
@@ -15,6 +15,7 @@ public class PacketSwitchHandResetGameScRsp : BasePacket
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketSwitchHandResetGameScRsp(Retcode ret) : base(CmdIds.SwitchHandResetGameScRsp)
|
||||
{
|
||||
var proto = new SwitchHandResetGameScRsp
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.SwitchHand;
|
||||
|
||||
public class PacketSwitchHandUpdateScRsp : BasePacket
|
||||
{
|
||||
public PacketSwitchHandUpdateScRsp(SwitchHandInfo info, HandOperationInfo? operationInfo) : base(CmdIds.SwitchHandUpdateScRsp)
|
||||
public PacketSwitchHandUpdateScRsp(SwitchHandInfo info, HandOperationInfo? operationInfo) : base(
|
||||
CmdIds.SwitchHandUpdateScRsp)
|
||||
{
|
||||
var proto = new SwitchHandUpdateScRsp
|
||||
{
|
||||
@@ -16,7 +17,8 @@ public class PacketSwitchHandUpdateScRsp : BasePacket
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketSwitchHandUpdateScRsp(Retcode ret, HandOperationInfo? operationInfo) : base(CmdIds.SwitchHandUpdateScRsp)
|
||||
public PacketSwitchHandUpdateScRsp(Retcode ret, HandOperationInfo? operationInfo) : base(
|
||||
CmdIds.SwitchHandUpdateScRsp)
|
||||
{
|
||||
var proto = new SwitchHandUpdateScRsp
|
||||
{
|
||||
|
||||
@@ -16,11 +16,14 @@ public class PacketTrainPartyBuildDiyScRsp : BasePacket
|
||||
: new TrainPartyBuildDiyScRsp
|
||||
{
|
||||
AreaId = (uint)area.AreaId,
|
||||
DynamicInfo = { area.DynamicInfo.Select(x => new AreaDynamicInfo
|
||||
DynamicInfo =
|
||||
{
|
||||
DiceSlotId = (uint)x.Key,
|
||||
DiyDynamicId = (uint)x.Value
|
||||
}) },
|
||||
area.DynamicInfo.Select(x => new AreaDynamicInfo
|
||||
{
|
||||
DiceSlotId = (uint)x.Key,
|
||||
DiyDynamicId = (uint)x.Value
|
||||
})
|
||||
}
|
||||
//FFLPKLLDHLM = {new CIKOHJNAGON // TODO update
|
||||
//{
|
||||
// AreaId = (uint)area.AreaId,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using EggLink.DanhengServer.Enums.Rogue;
|
||||
using System.Reflection;
|
||||
using EggLink.DanhengServer.Enums.Rogue;
|
||||
using EggLink.DanhengServer.GameServer.Game.ChessRogue;
|
||||
using EggLink.DanhengServer.GameServer.Game.ChessRogue.Modifier.ModifierEffect;
|
||||
using EggLink.DanhengServer.GameServer.Game.Lobby;
|
||||
using EggLink.DanhengServer.GameServer.Game.Mission;
|
||||
@@ -6,8 +8,6 @@ using EggLink.DanhengServer.GameServer.Game.Mission.FinishAction;
|
||||
using EggLink.DanhengServer.GameServer.Game.Mission.FinishType;
|
||||
using EggLink.DanhengServer.GameServer.Game.MultiPlayer;
|
||||
using EggLink.DanhengServer.GameServer.Game.Rogue.Event;
|
||||
using System.Reflection;
|
||||
using EggLink.DanhengServer.GameServer.Game.ChessRogue;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server;
|
||||
|
||||
|
||||
@@ -231,7 +231,8 @@ public static class HandbookGenerator
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetNameFromTextMap(BigInteger key, Dictionary<BigInteger, string> map, Dictionary<BigInteger, string> fallback)
|
||||
public static string GetNameFromTextMap(BigInteger key, Dictionary<BigInteger, string> map,
|
||||
Dictionary<BigInteger, string> fallback)
|
||||
{
|
||||
if (map.TryGetValue(key, out var value)) return value;
|
||||
if (fallback.TryGetValue(key, out value)) return value;
|
||||
|
||||
@@ -169,7 +169,9 @@ public class EntryPoint
|
||||
|
||||
if (ConfigManager.Config.ServerOption.ServerConfig.RunGateway)
|
||||
{
|
||||
var handler = new DanhengListener.ConnectionCreatedHandler((conversation, remote) => new Connection(conversation, remote));
|
||||
var handler =
|
||||
new DanhengListener.ConnectionCreatedHandler((conversation, remote) =>
|
||||
new Connection(conversation, remote));
|
||||
DanhengListener.CreateConnection = handler;
|
||||
DanhengListener.StartListener();
|
||||
}
|
||||
|
||||
@@ -35,15 +35,13 @@ public class DispatchRoutes
|
||||
});
|
||||
|
||||
foreach (var region in Config.ServerOption.ServerConfig.Regions)
|
||||
{
|
||||
data.RegionList.Add(new RegionInfo
|
||||
{
|
||||
Name = region.GameServerId,
|
||||
DisplayName = region.GameServerName,
|
||||
EnvType = region.EnvType.ToString(),
|
||||
DispatchUrl = region.GateWayAddress,
|
||||
DispatchUrl = region.GateWayAddress
|
||||
});
|
||||
}
|
||||
|
||||
Logger.Info("Client request: query_dispatch");
|
||||
return Convert.ToBase64String(data.ToByteArray());
|
||||
|
||||
Reference in New Issue
Block a user