mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
style: cleanup code
This commit is contained in:
@@ -258,7 +258,7 @@ public class CommandGiveall : ICommand
|
||||
player.TrainPartyManager!.Data.Areas.Clear();
|
||||
|
||||
foreach (var excel in GameData.TrainPartyAreaConfigData.Where(excel =>
|
||||
!player.TrainPartyManager!.Data.Areas.ContainsKey(excel.Key)))
|
||||
!player.TrainPartyManager!.Data.Areas.ContainsKey(excel.Key)))
|
||||
player.TrainPartyManager!.Data.Areas[excel.Key] = new TrainAreaInfo
|
||||
{
|
||||
AreaId = excel.Key,
|
||||
@@ -266,24 +266,22 @@ public class CommandGiveall : ICommand
|
||||
};
|
||||
|
||||
foreach (var area in player.TrainPartyManager!.Data.Areas)
|
||||
foreach (var step in GameData.TrainPartyStepConfigData.Values.Where(stepExcel =>
|
||||
GameData.TrainPartyAreaGoalConfigData.FirstOrDefault(x =>
|
||||
x.Value.AreaID == area.Value.AreaId).Value.StepGroupList.Contains(stepExcel.GroupID)))
|
||||
area.Value.StepList.Add(step.ID);
|
||||
foreach (var step in GameData.TrainPartyStepConfigData.Values.Where(stepExcel =>
|
||||
GameData.TrainPartyAreaGoalConfigData.FirstOrDefault(x =>
|
||||
x.Value.AreaID == area.Value.AreaId).Value.StepGroupList.Contains(stepExcel.GroupID)))
|
||||
area.Value.StepList.Add(step.ID);
|
||||
|
||||
foreach (var floorInfo in GameData.FloorInfoData.Values)
|
||||
{
|
||||
var savedData = new Dictionary<string, int>();
|
||||
|
||||
foreach (var floorSavedValue in floorInfo.FloorSavedValue)
|
||||
{
|
||||
if (floorSavedValue.Name.StartsWith("Build_") || floorSavedValue.Name == "Onboarded")
|
||||
savedData[floorSavedValue.Name] = 1;
|
||||
else if (floorSavedValue.Name.StartsWith("Progress_"))
|
||||
savedData[floorSavedValue.Name] = 100;
|
||||
else if (floorSavedValue.Name.StartsWith("Connection_") || floorSavedValue.Name.StartsWith("Utility_"))
|
||||
savedData[floorSavedValue.Name] = 0;
|
||||
}
|
||||
|
||||
if (savedData.Count > 0)
|
||||
player.SceneData!.FloorSavedData[floorInfo.FloorID] = savedData;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Text;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Mission;
|
||||
using EggLink.DanhengServer.Internationalization;
|
||||
@@ -59,8 +58,8 @@ public class CommandMission : ICommand
|
||||
return;
|
||||
}
|
||||
|
||||
MissionManager mission = arg.Target!.Player!.MissionManager!;
|
||||
List<SubMissionInfo> runningMissions = mission.GetRunningSubMissionList();
|
||||
var mission = arg.Target!.Player!.MissionManager!;
|
||||
var runningMissions = mission.GetRunningSubMissionList();
|
||||
if (runningMissions.Count == 0)
|
||||
{
|
||||
await arg.SendMsg(I18NManager.Translate("Game.Command.Mission.NoRunningMissions"));
|
||||
@@ -81,7 +80,7 @@ public class CommandMission : ICommand
|
||||
|
||||
value.Add(m.ID);
|
||||
}
|
||||
|
||||
|
||||
if ((arg.BasicArgs.Count == 1 && arg.BasicArgs[0] == "-all") || mission.Data.TrackingMainMissionId == 0)
|
||||
{
|
||||
//Show all the missions
|
||||
@@ -94,10 +93,12 @@ public class CommandMission : ICommand
|
||||
runningMissionMap[mission.Data.TrackingMainMissionId] = missionMap[mission.Data.TrackingMainMissionId];
|
||||
await ShowMissionList(mission, runningMissionMap, arg);
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async ValueTask ShowMissionList(MissionManager mission, Dictionary<int, List<int>> missionMap, CommandArg arg)
|
||||
public async ValueTask ShowMissionList(MissionManager mission, Dictionary<int, List<int>> missionMap,
|
||||
CommandArg arg)
|
||||
{
|
||||
var possibleStuckIds = new List<int>();
|
||||
var morePossibleStuckIds = new List<int>();
|
||||
|
||||
@@ -52,12 +52,13 @@ public class CommandRelic : ICommand
|
||||
await arg.SendMsg(I18NManager.Translate("Game.Command.Notice.InvalidArguments"));
|
||||
return;
|
||||
}
|
||||
|
||||
subAffixes.Add((subId, subLevel));
|
||||
}
|
||||
|
||||
for (var i = 0; i < amount; i++)
|
||||
{
|
||||
(var ret, var _) = await player.InventoryManager!.HandleRelic(
|
||||
var (ret, _) = await player.InventoryManager!.HandleRelic(
|
||||
int.Parse(arg.BasicArgs[0]), ++player.InventoryManager!.Data.NextUniqueId,
|
||||
level, mainAffixId, subAffixes);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class CommandArg
|
||||
{
|
||||
if (string.IsNullOrEmpty(arg)) continue;
|
||||
var character = arg[0];
|
||||
if (!int.TryParse(character.ToString(), out var _) && character != '-')
|
||||
if (!int.TryParse(character.ToString(), out _) && character != '-')
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -85,12 +85,12 @@ public class ServerOption
|
||||
public bool AutoCreateUser { get; set; } = true;
|
||||
public bool SavePersonalDebugFile { get; set; } = false;
|
||||
public int FarmingDropRate { get; set; } = 1;
|
||||
public bool UseCache { get; set; } = true;
|
||||
|
||||
public int ValidFarmingDropRate()
|
||||
{
|
||||
return Math.Max(Math.Min(FarmingDropRate, 999), 1);
|
||||
}
|
||||
public bool UseCache { get; set; } = true;
|
||||
}
|
||||
|
||||
public class ServerAnnounce
|
||||
|
||||
@@ -8,6 +8,7 @@ public class HotfixContainer
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public BaseRegionEnum Region { get; set; } = BaseRegionEnum.None;
|
||||
|
||||
public Dictionary<string, DownloadUrlConfig> HotfixData { get; set; } = [];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class AdventureAbilityConfigListInfo
|
||||
public static AdventureAbilityConfigListInfo LoadFromJsonObject(JObject obj)
|
||||
{
|
||||
AdventureAbilityConfigListInfo info = new();
|
||||
|
||||
|
||||
if (obj.ContainsKey(nameof(AbilityList)))
|
||||
info.AbilityList = obj[nameof(AbilityList)]
|
||||
?.Select(x => AdventureAbilityConfigInfo.LoadFromJsonObject((x as JObject)!)).ToList() ?? [];
|
||||
|
||||
@@ -8,27 +8,30 @@ namespace EggLink.DanhengServer.Data.Config.Scene;
|
||||
|
||||
public class FloorInfo
|
||||
{
|
||||
public int FloorID { get; set; }
|
||||
public int StartGroupIndex { get; set; }
|
||||
public int StartAnchorID { get; set; }
|
||||
public string NavmapConfigPath { get; set; } = "";
|
||||
public List<FloorGroupInfo> GroupInstanceList { get; set; } = [];
|
||||
public List<FloorDimensionInfo> DimensionList { get; set; } = [];
|
||||
[JsonProperty(ItemConverterType = typeof(StringEnumConverter))] public List<LevelFeatureTypeEnum> LevelFeatureModules { get; set; } = [];
|
||||
|
||||
[JsonConverter(typeof(ConcurrentBagConverter<int>))]
|
||||
public ConcurrentBag<int> MapSections = [];
|
||||
|
||||
[JsonConverter(typeof(ConcurrentDictionaryConverter<int, PropInfo>))]
|
||||
public ConcurrentDictionary<int, PropInfo> CachedTeleports = [];
|
||||
|
||||
[JsonConverter(typeof(ConcurrentDictionaryConverter<int, GroupInfo>))]
|
||||
public ConcurrentDictionary<int, GroupInfo> Groups = [];
|
||||
|
||||
[JsonIgnore] public bool Loaded;
|
||||
|
||||
[JsonConverter(typeof(ConcurrentBagConverter<int>))]
|
||||
public ConcurrentBag<int> MapSections = [];
|
||||
|
||||
[JsonConverter(typeof(ConcurrentBagConverter<PropInfo>))]
|
||||
public ConcurrentBag<PropInfo> UnlockedCheckpoints = [];
|
||||
|
||||
[JsonIgnore] public bool Loaded;
|
||||
public int FloorID { get; set; }
|
||||
public int StartGroupIndex { get; set; }
|
||||
public int StartAnchorID { get; set; }
|
||||
public string NavmapConfigPath { get; set; } = "";
|
||||
public List<FloorGroupInfo> GroupInstanceList { get; set; } = [];
|
||||
public List<FloorDimensionInfo> DimensionList { get; set; } = [];
|
||||
|
||||
[JsonProperty(ItemConverterType = typeof(StringEnumConverter))]
|
||||
public List<LevelFeatureTypeEnum> LevelFeatureModules { get; set; } = [];
|
||||
|
||||
[JsonIgnore] public int StartGroupID { get; set; }
|
||||
[JsonIgnore] public List<FloorSavedValueInfo> FloorSavedValue { get; set; } = [];
|
||||
|
||||
@@ -51,37 +54,35 @@ public class FloorInfo
|
||||
|
||||
// Cache anchors
|
||||
foreach (var group in Groups.Values)
|
||||
{
|
||||
foreach (var prop in group.PropList)
|
||||
// Check if prop can be teleported to
|
||||
if (prop.AnchorID > 0)
|
||||
foreach (var prop in group.PropList)
|
||||
// Check if prop can be teleported to
|
||||
if (prop.AnchorID > 0)
|
||||
{
|
||||
// Put inside cached teleport list to send to client when they request map info
|
||||
CachedTeleports.TryAdd(prop.MappingInfoID, prop);
|
||||
UnlockedCheckpoints.Add(prop);
|
||||
|
||||
// Force prop to be in the unlocked state
|
||||
prop.State = PropStateEnum.CheckPointEnable;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(prop.InitLevelGraph))
|
||||
{
|
||||
var json = prop.InitLevelGraph;
|
||||
|
||||
// Hacky way to setup prop triggers
|
||||
if (json.Contains("Maze_GroupProp_OpenTreasure_WhenMonsterDie"))
|
||||
{
|
||||
// Put inside cached teleport list to send to client when they request map info
|
||||
CachedTeleports.TryAdd(prop.MappingInfoID, prop);
|
||||
UnlockedCheckpoints.Add(prop);
|
||||
|
||||
// Force prop to be in the unlocked state
|
||||
prop.State = PropStateEnum.CheckPointEnable;
|
||||
//prop.Trigger = new TriggerOpenTreasureWhenMonsterDie(group.Id);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(prop.InitLevelGraph))
|
||||
else if (json.Contains("Common_Console"))
|
||||
{
|
||||
var json = prop.InitLevelGraph;
|
||||
|
||||
// Hacky way to setup prop triggers
|
||||
if (json.Contains("Maze_GroupProp_OpenTreasure_WhenMonsterDie"))
|
||||
{
|
||||
//prop.Trigger = new TriggerOpenTreasureWhenMonsterDie(group.Id);
|
||||
}
|
||||
else if (json.Contains("Common_Console"))
|
||||
{
|
||||
prop.CommonConsole = true;
|
||||
}
|
||||
|
||||
// Clear for garbage collection
|
||||
prop.ValueSource = null;
|
||||
prop.InitLevelGraph = null;
|
||||
prop.CommonConsole = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Clear for garbage collection
|
||||
prop.ValueSource = null;
|
||||
prop.InitLevelGraph = null;
|
||||
}
|
||||
|
||||
Loaded = true;
|
||||
}
|
||||
@@ -113,14 +114,12 @@ public class FloorDimensionInfo
|
||||
public void OnLoad(FloorInfo floor)
|
||||
{
|
||||
foreach (var data in SavedValues)
|
||||
{
|
||||
floor.FloorSavedValue.Add(new FloorSavedValueInfo
|
||||
{
|
||||
ID = data.ID,
|
||||
Name = data.Name,
|
||||
DefaultValue = data.MaxValue
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var index in GroupIndexList) GroupIDList.Add(floor.GroupInstanceList[index].ID);
|
||||
}
|
||||
|
||||
@@ -52,17 +52,18 @@ public class PropInfo : PositionInfo
|
||||
list = [];
|
||||
info.PropTriggerCustomString.Add(value.ToString(), list);
|
||||
}
|
||||
|
||||
list.Add(ID);
|
||||
}
|
||||
else if (key.ToString().Contains("Door") ||
|
||||
key.ToString().Contains("Bridge") ||
|
||||
key.ToString().Contains("UnlockTarget") ||
|
||||
key.ToString().Contains("Rootcontamination") ||
|
||||
key.ToString().Contains("Portal"))
|
||||
key.ToString().Contains("Bridge") ||
|
||||
key.ToString().Contains("UnlockTarget") ||
|
||||
key.ToString().Contains("Rootcontamination") ||
|
||||
key.ToString().Contains("Portal"))
|
||||
{
|
||||
var parts = value.ToString().Split(',');
|
||||
if (parts.Length >= 2 &&
|
||||
int.TryParse(parts[0], out var keyId) &&
|
||||
if (parts.Length >= 2 &&
|
||||
int.TryParse(parts[0], out var keyId) &&
|
||||
int.TryParse(parts[1], out var valueId))
|
||||
{
|
||||
if (!UnlockDoorID.ContainsKey(keyId))
|
||||
@@ -73,8 +74,8 @@ public class PropInfo : PositionInfo
|
||||
else if (key.ToString().Contains("Controller"))
|
||||
{
|
||||
var parts = value.ToString().Split(',');
|
||||
if (parts.Length >= 2 &&
|
||||
int.TryParse(parts[0], out var keyId) &&
|
||||
if (parts.Length >= 2 &&
|
||||
int.TryParse(parts[0], out var keyId) &&
|
||||
int.TryParse(parts[1], out var valueId))
|
||||
{
|
||||
if (!UnlockControllerID.ContainsKey(keyId))
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.CodeDom.Compiler;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Config.Task;
|
||||
|
||||
public class AdventureFireProjectile : TaskConfigInfo
|
||||
{
|
||||
public TargetEvaluator TargetType { get; set; } = new();
|
||||
|
||||
//public ProjectileData Projectile { get; set; }
|
||||
public List<TaskConfigInfo> OnProjectileHit { get; set; } = [];
|
||||
public List<TaskConfigInfo> OnProjectileLifetimeFinish { get; set; } = [];
|
||||
@@ -34,10 +34,12 @@ public class AdventureFireProjectile : TaskConfigInfo
|
||||
info.OnProjectileHit.Add(item);
|
||||
|
||||
foreach (var item in
|
||||
obj[nameof(OnProjectileLifetimeFinish)]?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)) ?? [])
|
||||
obj[nameof(OnProjectileLifetimeFinish)]
|
||||
?.Select(x => TaskConfigInfo.LoadFromJsonObject((x as JObject)!)) ?? [])
|
||||
info.OnProjectileLifetimeFinish.Add(item);
|
||||
|
||||
if (obj.TryGetValue(nameof(WaitProjectileFinish), out value)) info.WaitProjectileFinish = value.ToObject<bool>();
|
||||
if (obj.TryGetValue(nameof(WaitProjectileFinish), out value))
|
||||
info.WaitProjectileFinish = value.ToObject<bool>();
|
||||
|
||||
if (obj.TryGetValue(nameof(MutexName), out value)) info.MutexName = value.ToObject<string>()!;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Task;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
@@ -7,7 +6,6 @@ namespace EggLink.DanhengServer.Data.Config.Task;
|
||||
|
||||
public class ByCharacterDamageType : PredicateConfigInfo
|
||||
{
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public DamageTypeEnum DamageType { get; set; } = DamageTypeEnum.Fire;
|
||||
}
|
||||
@@ -15,10 +15,7 @@ public class PredicateConfigInfo : TaskConfigInfo
|
||||
var typeStr = info.Type.Replace("RPG.GameCore.", "");
|
||||
var className = "EggLink.DanhengServer.Data.Config.Task." + typeStr;
|
||||
|
||||
if (typeStr == "ByIsContainAdventureModifier")
|
||||
{
|
||||
return ByIsContainAdventureModifier.LoadFromJsonObject(obj);
|
||||
}
|
||||
if (typeStr == "ByIsContainAdventureModifier") return ByIsContainAdventureModifier.LoadFromJsonObject(obj);
|
||||
|
||||
var typeClass = System.Type.GetType(className);
|
||||
if (typeClass != null)
|
||||
|
||||
@@ -131,14 +131,12 @@ public class BannerConfig
|
||||
}
|
||||
|
||||
if (GachaType == GachaTypeEnum.AvatarUp)
|
||||
{
|
||||
info.DecideItemInfo = new DecideItemInfo
|
||||
{
|
||||
DecideItemOrder = { decideOrder.Select(x => (uint)x) },
|
||||
CHDOIBFEHLP = 1,
|
||||
JIGONEALCPC = { 11 }
|
||||
};
|
||||
}
|
||||
|
||||
if (GachaId == 1001)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Item;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class MappingInfoExcel : ExcelResource
|
||||
if (relicExcel == null) break;
|
||||
|
||||
|
||||
if (!relicDrop.TryGetValue(baseRarity, out var _))
|
||||
if (!relicDrop.TryGetValue(baseRarity, out _))
|
||||
{
|
||||
var value = new List<int>();
|
||||
relicDrop[baseRarity] = value;
|
||||
@@ -240,15 +240,11 @@ public class MappingInfoExcel : ExcelResource
|
||||
private void AddRelicToMap(MappingInfoItem relic, int rarity, Dictionary<int, List<MappingInfoItem>> relicsMap)
|
||||
{
|
||||
if (relicsMap.TryGetValue(rarity, out var value))
|
||||
{
|
||||
value.Add(relic);
|
||||
}
|
||||
else
|
||||
{
|
||||
relicsMap.Add(rarity, [relic]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int GetRelicCountByWorldLevel(int rarity)
|
||||
{
|
||||
return WorldLevel switch
|
||||
@@ -304,7 +300,7 @@ public class MappingInfoExcel : ExcelResource
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private int LuckyRelicDropped()
|
||||
{
|
||||
return Random.Shared.Next(100) < 25 ? 1 : 0;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("MazeBuff.json,AvatarMazeBuff.json", isMultifile:true)]
|
||||
[ResourceEntity("MazeBuff.json,AvatarMazeBuff.json", true)]
|
||||
public class MazeBuffExcel : ExcelResource
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
@@ -9,6 +9,7 @@ public class RogueTournTitanTypeExcel : ExcelResource
|
||||
{
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueTitanTypeEnum RogueTitanType { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueTitanCategoryEnum RogueTitanCategory { get; set; }
|
||||
|
||||
|
||||
@@ -40,13 +40,16 @@ public static class GameData
|
||||
#region Avatar
|
||||
|
||||
public static Dictionary<int, AvatarConfigExcel> AvatarConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, AdventureAbilityConfigListInfo> AdventureAbilityConfigListData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<int, AdventureAbilityConfigListInfo> AdventureAbilityConfigListData { get; private set; } =
|
||||
[];
|
||||
|
||||
public static Dictionary<int, AvatarPromotionConfigExcel> AvatarPromotionConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarExpItemConfigExcel> AvatarExpItemConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, AvatarSkillTreeConfigExcel> AvatarSkillTreeConfigData { 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; } =
|
||||
[];
|
||||
@@ -112,7 +115,7 @@ public static class GameData
|
||||
|
||||
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; } = [];
|
||||
@@ -123,14 +126,19 @@ public static class GameData
|
||||
#region Offering
|
||||
|
||||
public static Dictionary<int, OfferingTypeConfigExcel> OfferingTypeConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, Dictionary<int, OfferingLevelConfigExcel>> OfferingLevelConfigData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<int, Dictionary<int, OfferingLevelConfigExcel>> OfferingLevelConfigData
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = [];
|
||||
|
||||
#endregion
|
||||
|
||||
#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; } = [];
|
||||
@@ -173,7 +181,7 @@ public static class GameData
|
||||
public static Dictionary<int, ItemConfigExcel> ItemConfigData { get; private set; } = [];
|
||||
public static Dictionary<int, ItemUseBuffDataExcel> ItemUseBuffDataData { 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; } =
|
||||
@@ -280,8 +288,11 @@ public static class GameData
|
||||
public static Dictionary<int, RogueTournWorkbenchFuncExcel> RogueTournWorkbenchFuncData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournFormulaExcel> RogueTournFormulaData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournTitanTalentExcel> RogueTournTitanTalentData { get; private set; } = [];
|
||||
public static Dictionary<RogueTitanTypeEnum, RogueTournTitanTypeExcel> RogueTournTitanTypeData { get; private set; } =
|
||||
|
||||
public static Dictionary<RogueTitanTypeEnum, RogueTournTitanTypeExcel>
|
||||
RogueTournTitanTypeData { get; private set; } =
|
||||
[];
|
||||
|
||||
public static Dictionary<int, RogueTournTitanBlessExcel> RogueTournTitanBlessData { get; private set; } = [];
|
||||
|
||||
public static Dictionary<int, RogueTournHexAvatarBaseTypeExcel> RogueTournHexAvatarBaseTypeData
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.IO.Compression;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using EggLink.DanhengServer.Data.Config.Scene;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using EggLink.DanhengServer.Internationalization;
|
||||
using System.IO.MemoryMappedFiles;
|
||||
using System.IO.Compression;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace EggLink.DanhengServer.Data;
|
||||
|
||||
@@ -33,6 +33,7 @@ public static class CompressionHelper
|
||||
{
|
||||
compressor.Write(data, 0, data.Length);
|
||||
}
|
||||
|
||||
return output.ToArray();
|
||||
}
|
||||
catch
|
||||
@@ -88,10 +89,6 @@ public class IgnoreJsonIgnoreContractResolver : DefaultContractResolver
|
||||
|
||||
public class ResourceCache
|
||||
{
|
||||
public static Logger Logger { get; } = new("ResourceCache");
|
||||
public static string CachePath { get; } = ConfigManager.Config.Path.ConfigPath + "/Resource.cache";
|
||||
public static bool IsComplete { get; set; } = true; // Custom in errors to ignore some error
|
||||
|
||||
public static readonly JsonSerializerSettings Serializer = new()
|
||||
{
|
||||
ContractResolver = new IgnoreJsonIgnoreContractResolver(),
|
||||
@@ -103,6 +100,10 @@ public class ResourceCache
|
||||
}
|
||||
};
|
||||
|
||||
public static Logger Logger { get; } = new("ResourceCache");
|
||||
public static string CachePath { get; } = ConfigManager.Config.Path.ConfigPath + "/Resource.cache";
|
||||
public static bool IsComplete { get; set; } = true; // Custom in errors to ignore some error
|
||||
|
||||
public static Task SaveCache()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
@@ -123,7 +124,7 @@ public class ResourceCache
|
||||
};
|
||||
|
||||
File.WriteAllText(CachePath, JsonConvert.SerializeObject(cacheData));
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.GeneratedItem",
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.GeneratedItem",
|
||||
I18NManager.Translate("Word.Cache")));
|
||||
});
|
||||
}
|
||||
@@ -139,17 +140,18 @@ public class ResourceCache
|
||||
|
||||
Parallel.ForEach(
|
||||
typeof(GameData).GetProperties(BindingFlags.Public | BindingFlags.Static),
|
||||
prop => {
|
||||
prop =>
|
||||
{
|
||||
if (cacheData.GameDataValues.TryGetValue(prop.Name, out var valueBytes))
|
||||
prop.SetValue(null, JsonConvert.DeserializeObject(
|
||||
Encoding.UTF8.GetString(
|
||||
CompressionHelper.Decompress(valueBytes)), prop.PropertyType, Serializer
|
||||
Encoding.UTF8.GetString(
|
||||
CompressionHelper.Decompress(valueBytes)), prop.PropertyType, Serializer
|
||||
)
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadedItem",
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadedItem",
|
||||
I18NManager.Translate("Word.Cache")));
|
||||
|
||||
return true;
|
||||
@@ -165,8 +167,10 @@ public class ResourceCache
|
||||
var emptyValue = propType.IsGenericType && propType.GetGenericTypeDefinition() == typeof(Dictionary<,>)
|
||||
? Activator.CreateInstance(propType)
|
||||
: propType.IsGenericType && propType.GetGenericTypeDefinition() == typeof(List<>)
|
||||
? Activator.CreateInstance(propType) : propType.IsClass
|
||||
? Activator.CreateInstance(propType) : null;
|
||||
? Activator.CreateInstance(propType)
|
||||
: propType.IsClass
|
||||
? Activator.CreateInstance(propType)
|
||||
: null;
|
||||
|
||||
prop.SetValue(null, emptyValue);
|
||||
}
|
||||
|
||||
@@ -56,12 +56,8 @@ public class ResourceManager
|
||||
|
||||
// copy modifiers
|
||||
foreach (var value in GameData.AdventureAbilityConfigListData.Values)
|
||||
{
|
||||
foreach (var adventureModifierConfig in value.GlobalModifiers ?? [])
|
||||
{
|
||||
GameData.AdventureModifierData.Add(adventureModifierConfig.Key, adventureModifierConfig.Value);
|
||||
}
|
||||
}
|
||||
foreach (var adventureModifierConfig in value.GlobalModifiers ?? [])
|
||||
GameData.AdventureModifierData.Add(adventureModifierConfig.Key, adventureModifierConfig.Value);
|
||||
}
|
||||
|
||||
public static void LoadExcel()
|
||||
@@ -208,7 +204,6 @@ public class ResourceManager
|
||||
// Load navmap infos
|
||||
FileInfo navmapFile = new(ConfigManager.Config.Path.ResourcePath + "/" + info.NavmapConfigPath);
|
||||
if (navmapFile.Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var navmapReader = navmapFile.OpenRead();
|
||||
@@ -217,8 +212,8 @@ public class ResourceManager
|
||||
var navmap = JsonConvert.DeserializeObject<MapInfo>(navmapText);
|
||||
if (navmap != null)
|
||||
foreach (var area in navmap.AreaList)
|
||||
foreach (var section in area.MinimapVolume.Sections)
|
||||
info.MapSections.Add(section.ID);
|
||||
foreach (var section in area.MinimapVolume.Sections)
|
||||
info.MapSections.Add(section.ID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -227,7 +222,6 @@ public class ResourceManager
|
||||
I18NManager.Translate("Server.ServerInfo.FailedToReadItem", navmapFile.Name,
|
||||
I18NManager.Translate("Word.Error")), ex);
|
||||
}
|
||||
}
|
||||
|
||||
// Load group infos sequentially to maintain order
|
||||
foreach (var groupInfo in info.GroupInstanceList)
|
||||
@@ -443,15 +437,13 @@ public class ResourceManager
|
||||
|
||||
var res2 = Parallel.ForEach(GameData.NpcMonsterDataData.Values, adventure =>
|
||||
{
|
||||
var adventurePath = adventure.ConfigEntityPath.Replace("_Entity.json", "_Ability.json").Replace("_Config.json", "_Ability.json")
|
||||
var adventurePath = adventure.ConfigEntityPath.Replace("_Entity.json", "_Ability.json")
|
||||
.Replace("_Config.json", "_Ability.json")
|
||||
.Replace("ConfigEntity", "ConfigAdventureAbility");
|
||||
|
||||
var path = ConfigManager.Config.Path.ResourcePath + "/" + adventurePath;
|
||||
var file = new FileInfo(path);
|
||||
if (!file.Exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!file.Exists) return;
|
||||
try
|
||||
{
|
||||
using var reader = file.OpenRead();
|
||||
|
||||
@@ -40,6 +40,22 @@ public class ItemData
|
||||
|
||||
public int EquipAvatar { get; set; }
|
||||
|
||||
public int CalcTotalExpGained()
|
||||
{
|
||||
if (Level <= 0) return Exp;
|
||||
GameData.RelicConfigData.TryGetValue(ItemId, out var costExcel);
|
||||
if (costExcel == null) return 0;
|
||||
var exp = 0;
|
||||
for (var i = 0; i < Level; i++)
|
||||
{
|
||||
GameData.RelicExpTypeData.TryGetValue(costExcel.ExpType * 100 + i, out var typeExcel);
|
||||
if (typeExcel != null)
|
||||
exp += typeExcel.Exp;
|
||||
}
|
||||
|
||||
return exp + Exp;
|
||||
}
|
||||
|
||||
#region Action
|
||||
|
||||
public void AddRandomRelicMainAffix()
|
||||
@@ -141,7 +157,7 @@ public class ItemData
|
||||
|
||||
AddRandomRelicSubAffix(initSubAffixesCount);
|
||||
}
|
||||
|
||||
|
||||
public int LuckyRelicSubAffixCount()
|
||||
{
|
||||
return Random.Shared.Next(100) < 20 ? 1 : 0;
|
||||
@@ -149,22 +165,6 @@ public class ItemData
|
||||
|
||||
#endregion
|
||||
|
||||
public int CalcTotalExpGained()
|
||||
{
|
||||
if (Level <= 0) return Exp;
|
||||
GameData.RelicConfigData.TryGetValue(ItemId, out var costExcel);
|
||||
if (costExcel == null) return 0;
|
||||
var exp = 0;
|
||||
for (var i = 0; i < Level; i++)
|
||||
{
|
||||
GameData.RelicExpTypeData.TryGetValue(costExcel.ExpType * 100 + i, out var typeExcel);
|
||||
if (typeExcel != null)
|
||||
exp += typeExcel.Exp;
|
||||
}
|
||||
|
||||
return exp + Exp;
|
||||
}
|
||||
|
||||
#region Serialization
|
||||
|
||||
public Material ToMaterialProto()
|
||||
@@ -320,10 +320,6 @@ public class ItemData
|
||||
|
||||
public class ItemSubAffix
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Step { get; set; }
|
||||
|
||||
public ItemSubAffix()
|
||||
{
|
||||
}
|
||||
@@ -335,6 +331,10 @@ public class ItemSubAffix
|
||||
Step = Extensions.RandomInt(0, excel.StepNum * count + 1);
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int Step { get; set; }
|
||||
|
||||
public void IncreaseStep(int stepNum)
|
||||
{
|
||||
Count++;
|
||||
|
||||
@@ -22,7 +22,9 @@ public class OfferingTypeData
|
||||
|
||||
public OfferingInfo ToProto()
|
||||
{
|
||||
var totalExp = CurExp + Enumerable.Range(1, Level).Select(level => GameData.OfferingLevelConfigData.GetValueOrDefault(OfferingId)?.GetValueOrDefault(level)).OfType<OfferingLevelConfigExcel>().Sum(config => config.ItemCost);
|
||||
var totalExp = CurExp + Enumerable.Range(1, Level)
|
||||
.Select(level => GameData.OfferingLevelConfigData.GetValueOrDefault(OfferingId)?.GetValueOrDefault(level))
|
||||
.OfType<OfferingLevelConfigExcel>().Sum(config => config.ItemCost);
|
||||
|
||||
return new OfferingInfo
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ScenePropData
|
||||
public class ScenePropTimelineData
|
||||
{
|
||||
public bool BoolValue { get; set; }
|
||||
public string ByteValue { get; set; } = ""; // Base64
|
||||
public string ByteValue { get; set; } = ""; // Base64
|
||||
|
||||
public PropTimelineInfo ToProto()
|
||||
{
|
||||
|
||||
@@ -26,11 +26,14 @@ public class TrainAreaInfo
|
||||
StepIdList = { StepList.Select(x => (uint)x) },
|
||||
VerifyStepIdList = { StepList.Select(x => (uint)x) },
|
||||
Progress = 100,
|
||||
DynamicInfo = { DynamicInfo.Select(x => new AreaDynamicInfo
|
||||
DynamicInfo =
|
||||
{
|
||||
DiceSlotId = (uint)x.Key,
|
||||
DiyDynamicId = (uint)x.Value
|
||||
}) }
|
||||
DynamicInfo.Select(x => new AreaDynamicInfo
|
||||
{
|
||||
DiceSlotId = (uint)x.Key,
|
||||
DiyDynamicId = (uint)x.Value
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var step in StepList)
|
||||
|
||||
@@ -8,4 +8,4 @@ public enum MultiPathAvatarTypeEnum
|
||||
Memory = 8007,
|
||||
Mar_7thKnight = 1001,
|
||||
Mar_7thRogue = 1224
|
||||
}
|
||||
}
|
||||
@@ -2,27 +2,27 @@ namespace EggLink.DanhengServer.Enums;
|
||||
|
||||
public enum BaseRegionEnum
|
||||
{
|
||||
None = 0,
|
||||
None = 0,
|
||||
CN = 1,
|
||||
OS = 2
|
||||
}
|
||||
|
||||
public enum RegionEnum
|
||||
{
|
||||
PRODCN = 0,
|
||||
SANDBOXCN = 1,
|
||||
PRODOVERSEA = 2,
|
||||
SANDBOXOVERSEA = 3,
|
||||
PRODCNPRE = 4,
|
||||
PRODOVERSEAPRE = 5,
|
||||
TESTCN = 6,
|
||||
TESTOVERSEA = 7,
|
||||
PETCN = 8,
|
||||
BETACN = 9,
|
||||
BETACNPRE = 10,
|
||||
BETAOVERSEA = 11,
|
||||
PETOS = 12,
|
||||
HOTFIXCN = 19,
|
||||
HOTFIXOVERSEA = 20,
|
||||
UNKNOWN = 21
|
||||
PRODCN = 0,
|
||||
SANDBOXCN = 1,
|
||||
PRODOVERSEA = 2,
|
||||
SANDBOXOVERSEA = 3,
|
||||
PRODCNPRE = 4,
|
||||
PRODOVERSEAPRE = 5,
|
||||
TESTCN = 6,
|
||||
TESTOVERSEA = 7,
|
||||
PETCN = 8,
|
||||
BETACN = 9,
|
||||
BETACNPRE = 10,
|
||||
BETAOVERSEA = 11,
|
||||
PETOS = 12,
|
||||
HOTFIXCN = 19,
|
||||
HOTFIXOVERSEA = 20,
|
||||
UNKNOWN = 21
|
||||
}
|
||||
@@ -34,4 +34,4 @@ public enum PropTypeEnum
|
||||
PROP_TIMELINE_CONTROL = 29,
|
||||
PROP_MAZE_JIGSAW = 30,
|
||||
PROP_DYNAMIC_POSITION = 31
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,8 @@ public class GiveTextCHS
|
||||
/// </summary>
|
||||
public class GiveAllTextCHS
|
||||
{
|
||||
public string Desc => "给予玩家全部指定类型的物品\navatar意为角色,equipment意为光锥,relic意为遗器,unlock意为气泡、手机壁纸、头像,train意为开拓者房间内容,pet意为宠物,path意为多命途角色命途";
|
||||
public string Desc =>
|
||||
"给予玩家全部指定类型的物品\navatar意为角色,equipment意为光锥,relic意为遗器,unlock意为气泡、手机壁纸、头像,train意为开拓者房间内容,pet意为宠物,path意为多命途角色命途";
|
||||
|
||||
public string Usage =>
|
||||
"用法:/giveall avatar r<星魂> l<等级>\n\n" +
|
||||
|
||||
@@ -174,6 +174,7 @@ public class ServerInfoTextEN
|
||||
|
||||
public string MissionEnabled =>
|
||||
"Mission system enabled. This feature is still in development and may not work as expected. Please report any bugs to the developers.";
|
||||
|
||||
public string CacheLoadSkip => "Skipped cache loading.";
|
||||
|
||||
public string ConfigMissing => "{0} is missing. Please check your resource folder: {1}, {2} may not be available.";
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace EggLink.DanhengServer.Util;
|
||||
public static class ConfigManager
|
||||
{
|
||||
public static readonly Logger Logger = new("ConfigManager");
|
||||
public static ConfigContainer Config { get; private set; } = new();
|
||||
private static readonly string ConfigFilePath = "Config.json";
|
||||
public static HotfixContainer Hotfix { get; private set; } = new();
|
||||
private static readonly string HotfixFilePath = Config.Path.ConfigPath + "/Hotfix.json";
|
||||
public static ConfigContainer Config { get; private set; } = new();
|
||||
public static HotfixContainer Hotfix { get; private set; } = new();
|
||||
|
||||
public static void LoadConfig()
|
||||
{
|
||||
@@ -23,7 +23,7 @@ public static class ConfigManager
|
||||
var file = new FileInfo(ConfigFilePath);
|
||||
if (!file.Exists)
|
||||
{
|
||||
Config = new()
|
||||
Config = new ConfigContainer
|
||||
{
|
||||
MuipServer =
|
||||
{
|
||||
@@ -60,7 +60,7 @@ public static class ConfigManager
|
||||
foreach (var pre in prefix)
|
||||
if (GameConstants.GAME_VERSION[^1] == '5')
|
||||
for (var i = 1; i < 6; i++)
|
||||
verList.Add(pre + GameConstants.GAME_VERSION + i.ToString());
|
||||
verList.Add(pre + GameConstants.GAME_VERSION + i);
|
||||
else
|
||||
verList.Add(pre + GameConstants.GAME_VERSION);
|
||||
|
||||
@@ -79,8 +79,8 @@ public static class ConfigManager
|
||||
}
|
||||
|
||||
foreach (var version in verList)
|
||||
if (!Hotfix.HotfixData.TryGetValue(version, out var _))
|
||||
Hotfix.HotfixData[version] = new();
|
||||
if (!Hotfix.HotfixData.TryGetValue(version, out _))
|
||||
Hotfix.HotfixData[version] = new DownloadUrlConfig();
|
||||
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.CurrentVersion", GameConstants.GAME_VERSION));
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Concurrent;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EggLink.DanhengServer.Util;
|
||||
|
||||
@@ -12,37 +12,45 @@ public class ConcurrentBagConverter<T> : JsonConverter<ConcurrentBag<T>>
|
||||
writer.WriteNull();
|
||||
return;
|
||||
}
|
||||
|
||||
serializer.Serialize(writer, value.ToArray());
|
||||
}
|
||||
|
||||
public override ConcurrentBag<T>? ReadJson(JsonReader reader, Type objectType, ConcurrentBag<T>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
public override ConcurrentBag<T>? ReadJson(JsonReader reader, Type objectType, ConcurrentBag<T>? existingValue,
|
||||
bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
return null;
|
||||
|
||||
|
||||
var array = serializer.Deserialize<T[]>(reader);
|
||||
return array != null ? new ConcurrentBag<T>(array) : new ConcurrentBag<T>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ConcurrentDictionaryConverter<TKey, TValue> : JsonConverter<ConcurrentDictionary<TKey, TValue>> where TKey : notnull
|
||||
public class ConcurrentDictionaryConverter<TKey, TValue> : JsonConverter<ConcurrentDictionary<TKey, TValue>>
|
||||
where TKey : notnull
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, ConcurrentDictionary<TKey, TValue>? value, JsonSerializer serializer)
|
||||
public override void WriteJson(JsonWriter writer, ConcurrentDictionary<TKey, TValue>? value,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
writer.WriteNull();
|
||||
return;
|
||||
}
|
||||
|
||||
serializer.Serialize(writer, value.ToDictionary(kvp => kvp.Key, kvp => kvp.Value));
|
||||
}
|
||||
|
||||
public override ConcurrentDictionary<TKey, TValue>? ReadJson(JsonReader reader, Type objectType, ConcurrentDictionary<TKey, TValue>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
public override ConcurrentDictionary<TKey, TValue>? ReadJson(JsonReader reader, Type objectType,
|
||||
ConcurrentDictionary<TKey, TValue>? existingValue, bool hasExistingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
return null;
|
||||
|
||||
|
||||
var dictionary = serializer.Deserialize<Dictionary<TKey, TValue>>(reader);
|
||||
return dictionary != null ? new ConcurrentDictionary<TKey, TValue>(dictionary) : new ConcurrentDictionary<TKey, TValue>();
|
||||
return dictionary != null
|
||||
? new ConcurrentDictionary<TKey, TValue>(dictionary)
|
||||
: new ConcurrentDictionary<TKey, TValue>();
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ namespace EggLink.DanhengServer.Kcp;
|
||||
|
||||
public class CmdIds
|
||||
{
|
||||
// None
|
||||
public const int None = 0;
|
||||
// None
|
||||
public const int None = 0;
|
||||
|
||||
// Packets
|
||||
public const int AcceptActivityExpeditionCsReq = 2530;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class DanhengListener
|
||||
var convId = Connections.GetNextAvailableIndex();
|
||||
var convo = Multiplex?.CreateConversation(convId, rcv.RemoteEndPoint, ConvOpt);
|
||||
if (convo == null) return;
|
||||
var con = (DanhengConnection)Activator.CreateInstance(BaseConnection, [convo, rcv.RemoteEndPoint])!;
|
||||
var con = (DanhengConnection)Activator.CreateInstance(BaseConnection, convo, rcv.RemoteEndPoint)!;
|
||||
RegisterConnection(con);
|
||||
await SendHandshakeResponse(con, enet);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class AvatarManager : BasePlayerManager
|
||||
subAffix.Count = 1;
|
||||
subAffix.Step = 0;
|
||||
}
|
||||
|
||||
relic.IncreaseRandomRelicSubAffix(levelUpCnt);
|
||||
relic.ReforgeSubAffixes = relic.SubAffixes;
|
||||
relic.SubAffixes = subAffixesClone;
|
||||
@@ -133,9 +134,10 @@ public class AvatarManager : BasePlayerManager
|
||||
AvatarId = (uint)avatarId,
|
||||
UniqueId = (uint)plan.Key,
|
||||
OutsideRelicList = { plan.Value.OutsideRelic.Select(x => (uint)x) },
|
||||
InsideRelicList = { plan.Value.InsideRelic.Select(x => (uint)x) },
|
||||
InsideRelicList = { plan.Value.InsideRelic.Select(x => (uint)x) }
|
||||
});
|
||||
}
|
||||
|
||||
return planList;
|
||||
}
|
||||
|
||||
@@ -166,6 +168,6 @@ public class AvatarManager : BasePlayerManager
|
||||
|
||||
public void DeleteRelicPlan(int uniqueId)
|
||||
{
|
||||
Player.InventoryManager!.Data.RelicPlans[uniqueId] = new();
|
||||
Player.InventoryManager!.Data.RelicPlans[uniqueId] = new RelicPlanData();
|
||||
}
|
||||
}
|
||||
@@ -245,12 +245,8 @@ public class BattleInstance(PlayerInstance player, LineupInfo lineup, List<Stage
|
||||
}).Wait();
|
||||
|
||||
foreach (var buff in Buffs.Clone())
|
||||
{
|
||||
if (Enum.IsDefined(typeof(DamageTypeEnum), buff.BuffID))
|
||||
{
|
||||
Buffs.RemoveAll(x => x.BuffID == buff.BuffID && x.DynamicValues.Count == 0);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var eventInstance in BattleEvents.Values) proto.BattleEvent.Add(eventInstance.ToProto());
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
public StageConfigExcel? NextBattleStageConfig { get; set; }
|
||||
|
||||
public async ValueTask<BattleInstance?> StartBattle(IGameEntity attackEntity, List<IGameEntity> targetEntityList, bool isSkill)
|
||||
public async ValueTask<BattleInstance?> StartBattle(IGameEntity attackEntity, List<IGameEntity> targetEntityList,
|
||||
bool isSkill)
|
||||
{
|
||||
if (Player.BattleInstance != null) return Player.BattleInstance;
|
||||
var targetList = new List<EntityMonster>();
|
||||
@@ -29,7 +30,6 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
if (castAvatar != null)
|
||||
{
|
||||
foreach (var entity in targetEntityList)
|
||||
{
|
||||
switch (entity)
|
||||
{
|
||||
case EntityMonster monster:
|
||||
@@ -39,26 +39,19 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
propList.Add(prop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var isAmbushed =
|
||||
targetEntityList.Any(entity => Player.SceneInstance!.AvatarInfo.ContainsKey(entity.EntityID));
|
||||
|
||||
if (!isAmbushed)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!isAmbushed) return null;
|
||||
|
||||
var monsterEntity = Player.SceneInstance!.Entities[attackEntity.EntityID];
|
||||
if (monsterEntity is EntityMonster monster) targetList.Add(monster);
|
||||
}
|
||||
|
||||
if (targetList.Count == 0 && propList.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (targetList.Count == 0 && propList.Count == 0) return null;
|
||||
|
||||
foreach (var prop in propList)
|
||||
{
|
||||
@@ -84,10 +77,7 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
var triggerBattle = targetList.Any(target => target.IsAlive);
|
||||
|
||||
if (!triggerBattle)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!triggerBattle) return null;
|
||||
|
||||
var inst = Player.RogueManager!.GetRogueInstance();
|
||||
if (inst is RogueMagicInstance { CurLevel.CurRoom.AdventureInstance: not null } magic)
|
||||
@@ -106,10 +96,11 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
if (NextBattleStageConfig != null)
|
||||
{
|
||||
battleInstance = new BattleInstance(Player, Player.LineupManager!.GetCurLineup()!, [NextBattleStageConfig])
|
||||
{
|
||||
WorldLevel = Player.Data.WorldLevel,
|
||||
};
|
||||
battleInstance =
|
||||
new BattleInstance(Player, Player.LineupManager!.GetCurLineup()!, [NextBattleStageConfig])
|
||||
{
|
||||
WorldLevel = Player.Data.WorldLevel
|
||||
};
|
||||
NextBattleStageConfig = null;
|
||||
}
|
||||
|
||||
@@ -140,9 +131,7 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
}
|
||||
|
||||
if (mazeBuff != null && mazeBuff.BuffID != 0) // avoid adding a buff with ID 0
|
||||
{
|
||||
battleInstance.Buffs.Add(mazeBuff);
|
||||
}
|
||||
|
||||
battleInstance.AvatarInfo = avatarList;
|
||||
|
||||
@@ -216,18 +205,12 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
if (Player.BattleInstance != null) return null;
|
||||
|
||||
GameData.CocoonConfigData.TryGetValue(cocoonId * 100 + worldLevel, out var config);
|
||||
if (config == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (config == null) return null;
|
||||
|
||||
wave = Math.Min(Math.Max(wave, 1), config.MaxWave);
|
||||
|
||||
var cost = config.StaminaCost * wave;
|
||||
if (Player.Data.Stamina < cost)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (Player.Data.Stamina < cost) return null;
|
||||
|
||||
List<StageConfigExcel> stageConfigExcels = [];
|
||||
for (var i = 0; i < wave; i++)
|
||||
@@ -239,10 +222,7 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
stageConfigExcels.Add(stageConfig);
|
||||
}
|
||||
|
||||
if (stageConfigExcels.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (stageConfigExcels.Count == 0) return null;
|
||||
|
||||
BattleInstance battleInstance = new(Player, Player.LineupManager!.GetCurLineup()!, stageConfigExcels)
|
||||
{
|
||||
@@ -256,7 +236,7 @@ public class BattleManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
battleInstance = new BattleInstance(Player, Player.LineupManager!.GetCurLineup()!, [NextBattleStageConfig])
|
||||
{
|
||||
WorldLevel = Player.Data.WorldLevel,
|
||||
WorldLevel = Player.Data.WorldLevel
|
||||
};
|
||||
NextBattleStageConfig = null;
|
||||
}
|
||||
|
||||
@@ -12,28 +12,24 @@ public class SceneSkillManager(PlayerInstance player) : BasePlayerManager(player
|
||||
public async ValueTask<SkillResultData> OnCast(SceneCastSkillCsReq req)
|
||||
{
|
||||
// get entities
|
||||
List<IGameEntity> targetEntities = []; // enemy
|
||||
IGameEntity? attackEntity; // caster
|
||||
List<IGameEntity> targetEntities = []; // enemy
|
||||
IGameEntity? attackEntity; // caster
|
||||
List<int> addEntityIds = [];
|
||||
foreach (var id in req.AssistMonsterEntityIdList)
|
||||
{
|
||||
if (Player.SceneInstance!.Entities.TryGetValue((int)id, out var v))
|
||||
{
|
||||
targetEntities.Add(v);
|
||||
addEntityIds.Add((int)id);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var info in req.AssistMonsterEntityInfo)
|
||||
foreach (var id in info.EntityIdList)
|
||||
{
|
||||
foreach (var id in info.EntityIdList)
|
||||
if (addEntityIds.Contains((int)id)) continue;
|
||||
if (Player.SceneInstance!.Entities.TryGetValue((int)id, out var v))
|
||||
{
|
||||
if (addEntityIds.Contains((int)id)) continue;
|
||||
if (Player.SceneInstance!.Entities.TryGetValue((int)id, out var v))
|
||||
{
|
||||
targetEntities.Add(v);
|
||||
addEntityIds.Add((int)id);
|
||||
}
|
||||
targetEntities.Add(v);
|
||||
addEntityIds.Add((int)id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +40,8 @@ public class SceneSkillManager(PlayerInstance player) : BasePlayerManager(player
|
||||
if (abilities == null || abilities.AbilityList.Count < 1)
|
||||
return new SkillResultData(Retcode.RetMazeNoAbility);
|
||||
|
||||
var abilityName = !string.IsNullOrEmpty(req.MazeAbilityStr) ? req.MazeAbilityStr: req.SkillIndex == 0 ? "NormalAtk01" : "MazeSkill";
|
||||
var abilityName = !string.IsNullOrEmpty(req.MazeAbilityStr) ? req.MazeAbilityStr :
|
||||
req.SkillIndex == 0 ? "NormalAtk01" : "MazeSkill";
|
||||
var targetAbility = abilities.AbilityList.Find(x => x.Name.Contains(abilityName));
|
||||
if (targetAbility == null)
|
||||
{
|
||||
@@ -54,7 +51,8 @@ public class SceneSkillManager(PlayerInstance player) : BasePlayerManager(player
|
||||
}
|
||||
|
||||
// execute ability
|
||||
var res = await Player.TaskManager!.AbilityLevelTask.TriggerTasks(abilities, targetAbility.OnStart, attackEntity, targetEntities, req);
|
||||
var res = await Player.TaskManager!.AbilityLevelTask.TriggerTasks(abilities, targetAbility.OnStart,
|
||||
attackEntity, targetEntities, req);
|
||||
|
||||
return new SkillResultData(Retcode.RetSucc, res.Instance, res.BattleInfos);
|
||||
}
|
||||
@@ -62,17 +60,16 @@ public class SceneSkillManager(PlayerInstance player) : BasePlayerManager(player
|
||||
private AdventureAbilityConfigListInfo? GetAbilityConfig(IGameEntity entity)
|
||||
{
|
||||
if (entity is EntityMonster monster)
|
||||
{
|
||||
return GameData.AdventureAbilityConfigListData.GetValueOrDefault(monster.MonsterData.ID);
|
||||
}
|
||||
|
||||
|
||||
if (entity is AvatarSceneInfo avatar)
|
||||
{
|
||||
return GameData.AdventureAbilityConfigListData.GetValueOrDefault(avatar.AvatarInfo.GetAvatarId());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public record SkillResultData(Retcode RetCode, BattleInstance? Instance = null, List<HitMonsterInstance>? TriggerBattleInfos = null);
|
||||
public record SkillResultData(
|
||||
Retcode RetCode,
|
||||
BattleInstance? Instance = null,
|
||||
List<HitMonsterInstance>? TriggerBattleInfos = null);
|
||||
@@ -296,7 +296,8 @@ public class ChallengeInstance
|
||||
if (monsters == 0) await AdvanceStage(req);
|
||||
|
||||
// Calculate rounds left
|
||||
if (!(IsStory() && IsBoss())) RoundsLeft = (int)Math.Min(Math.Max(RoundsLeft - req.Stt.RoundCnt, 1), RoundsLeft);
|
||||
if (!(IsStory() && IsBoss()))
|
||||
RoundsLeft = (int)Math.Min(Math.Max(RoundsLeft - req.Stt.RoundCnt, 1), RoundsLeft);
|
||||
|
||||
// Set saved technique points (This will be restored if the player resets the challenge)
|
||||
SavedMp = Player.LineupManager!.GetCurLineup()!.Mp;
|
||||
|
||||
@@ -416,7 +416,8 @@ public class ChessRogueInstance : BaseRogueInstance
|
||||
CurCell = cell;
|
||||
cell.CellStatus = ChessRogueBoardCellStatus.Finish;
|
||||
|
||||
await Player.EnterSceneByEntranceId(cell.GetEntryId(), cell.RoomConfig!.AnchorGroup, cell.RoomConfig!.AnchorId,
|
||||
await Player.EnterSceneByEntranceId(cell.GetEntryId(), cell.RoomConfig!.AnchorGroup,
|
||||
cell.RoomConfig!.AnchorId,
|
||||
false);
|
||||
|
||||
HistoryCell.Add(cell);
|
||||
|
||||
@@ -13,8 +13,6 @@ namespace EggLink.DanhengServer.GameServer.Game.Gacha;
|
||||
|
||||
public class GachaManager : BasePlayerManager
|
||||
{
|
||||
public GachaData GachaData { get; }
|
||||
|
||||
public GachaManager(PlayerInstance player) : base(player)
|
||||
{
|
||||
GachaData = DatabaseHelper.Instance!.GetInstanceOrCreateNew<GachaData>(player.Uid);
|
||||
@@ -29,13 +27,16 @@ public class GachaManager : BasePlayerManager
|
||||
}
|
||||
}
|
||||
|
||||
public GachaData GachaData { get; }
|
||||
|
||||
public List<int> GetPurpleAvatars()
|
||||
{
|
||||
var purpleAvatars = new List<int>();
|
||||
foreach (var avatar in GameData.AvatarConfigData.Values)
|
||||
if (avatar.Rarity == RarityEnum.CombatPowerAvatarRarityType4 &&
|
||||
!(GameData.MultiplePathAvatarConfigData.ContainsKey(avatar.AvatarID) &&
|
||||
GameData.MultiplePathAvatarConfigData[avatar.AvatarID].BaseAvatarID != avatar.AvatarID) && avatar.MaxRank > 0)
|
||||
GameData.MultiplePathAvatarConfigData[avatar.AvatarID].BaseAvatarID != avatar.AvatarID) &&
|
||||
avatar.MaxRank > 0)
|
||||
purpleAvatars.Add(avatar.AvatarID);
|
||||
return purpleAvatars;
|
||||
}
|
||||
@@ -298,7 +299,8 @@ public class GachaManager : BasePlayerManager
|
||||
{
|
||||
GachaRandom = (uint)Random.Shared.Next(1000, 1999)
|
||||
};
|
||||
foreach (var banner in GameData.BannersConfig.Banners) proto.GachaInfoList.Add(banner.ToInfo(GachaData.GachaDecideOrder, GetGoldAvatars()));
|
||||
foreach (var banner in GameData.BannersConfig.Banners)
|
||||
proto.GachaInfoList.Add(banner.ToInfo(GachaData.GachaDecideOrder, GetGoldAvatars()));
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Google.Protobuf.Collections;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Inventory;
|
||||
|
||||
@@ -91,6 +90,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
value = [];
|
||||
Player.PlayerUnlockData.Skins[avatarId] = value;
|
||||
}
|
||||
|
||||
value.Add(itemId);
|
||||
await Player.SendPacket(new PacketUnlockAvatarSkinScNotify(itemId));
|
||||
break;
|
||||
@@ -484,7 +484,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
// Generate relics
|
||||
var relicDrops = mapping.GenerateRelicDrops();
|
||||
|
||||
|
||||
// Let AddItem notify relics count exceeding limit
|
||||
items.AddRange(Data.RelicItems.Count + relicDrops.Count - 1 > GameConstants.INVENTORY_MAX_RELIC
|
||||
? relicDrops[..(GameConstants.INVENTORY_MAX_RELIC - Data.RelicItems.Count + 1)]
|
||||
@@ -535,7 +535,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
var initSubCnt = new Random().Next(3, 5);
|
||||
relic.AddRandomRelicSubAffix(initSubCnt - subAffixes.Count);
|
||||
if (initSubCnt == 3 && level / 3 > 0) relic.AddRandomRelicSubAffix(1); // Random add init subAffixes
|
||||
if (initSubCnt == 3 && level / 3 > 0) relic.AddRandomRelicSubAffix(); // Random add init subAffixes
|
||||
|
||||
var remainUpCnt = level / 3 - (4 - initSubCnt) - subAffixes.Sum(x => x.Item2);
|
||||
relic.IncreaseRandomRelicSubAffix(remainUpCnt); // Level up
|
||||
@@ -582,7 +582,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
var relicId = (int)req.ComposeRelicId;
|
||||
GameData.RelicConfigData.TryGetValue(relicId, out var itemConfig);
|
||||
GameData.RelicSubAffixData.TryGetValue(itemConfig!.SubAffixGroup, out var subAffixConfig);
|
||||
|
||||
|
||||
// Add relic
|
||||
var mainAffix = (int)req.MainAffixId;
|
||||
var itemData = new ItemData
|
||||
@@ -596,7 +596,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
};
|
||||
if (mainAffix == 0) itemData.AddRandomRelicMainAffix();
|
||||
itemData.AddRandomRelicSubAffix(3 - itemData.SubAffixes.Count + itemData.LuckyRelicSubAffixCount());
|
||||
await AddItem(itemData, notify: false);
|
||||
await AddItem(itemData, false);
|
||||
|
||||
return itemData;
|
||||
}
|
||||
@@ -1276,9 +1276,11 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Mark
|
||||
public async ValueTask<bool> LockItems(RepeatedField<uint> ids, bool isLocked, ItemMainTypeEnum itemType = ItemMainTypeEnum.Unknown)
|
||||
|
||||
public async ValueTask<bool> LockItems(RepeatedField<uint> ids, bool isLocked,
|
||||
ItemMainTypeEnum itemType = ItemMainTypeEnum.Unknown)
|
||||
{
|
||||
List<ItemData> targetItems;
|
||||
switch (itemType)
|
||||
@@ -1300,6 +1302,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (targetItems.Count == 0) return false;
|
||||
var idPool = ids.ToList().ConvertAll(x => (int)x).ToFrozenSet();
|
||||
var items = new List<ItemData>();
|
||||
@@ -1315,7 +1318,8 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
return true;
|
||||
}
|
||||
|
||||
public async ValueTask<bool> DiscardItems(RepeatedField<uint> ids, bool discarded, ItemMainTypeEnum itemType = ItemMainTypeEnum.Unknown)
|
||||
public async ValueTask<bool> DiscardItems(RepeatedField<uint> ids, bool discarded,
|
||||
ItemMainTypeEnum itemType = ItemMainTypeEnum.Unknown)
|
||||
{
|
||||
List<ItemData> targetItems;
|
||||
switch (itemType)
|
||||
@@ -1337,6 +1341,7 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (targetItems.Count == 0) return false;
|
||||
var idPool = ids.ToList().ConvertAll(x => (int)x).ToFrozenSet();
|
||||
var items = new List<ItemData>();
|
||||
@@ -1346,10 +1351,11 @@ public class InventoryManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
x.Discarded = discarded;
|
||||
items.Add(x);
|
||||
}
|
||||
|
||||
|
||||
if (items.Count <= 0) return false;
|
||||
await Player.SendPacket(new PacketPlayerSyncScNotify(items));
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -14,12 +14,9 @@ public class OfferingManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
public OfferingTypeData? GetOfferingData(int offeringId)
|
||||
{
|
||||
if (Data.Offerings.TryGetValue(offeringId, out var offeringData))
|
||||
{
|
||||
return offeringData;
|
||||
}
|
||||
if (Data.Offerings.TryGetValue(offeringId, out var offeringData)) return offeringData;
|
||||
|
||||
var gameData = GameData.OfferingTypeConfigData.GetValueOrDefault(offeringId); // create a new one
|
||||
var gameData = GameData.OfferingTypeConfigData.GetValueOrDefault(offeringId); // create a new one
|
||||
if (gameData == null) return null;
|
||||
|
||||
var unlockId = gameData.UnlockID;
|
||||
@@ -29,10 +26,7 @@ public class OfferingManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
State = OfferingState.Lock
|
||||
};
|
||||
|
||||
if (Player.QuestManager!.UnlockHandler.GetUnlockStatus(unlockId))
|
||||
{
|
||||
data.State = OfferingState.Open;
|
||||
}
|
||||
if (Player.QuestManager!.UnlockHandler.GetUnlockStatus(unlockId)) data.State = OfferingState.Open;
|
||||
|
||||
Data.Offerings[offeringId] = data;
|
||||
|
||||
@@ -62,10 +56,7 @@ public class OfferingManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
syncData.Add(offering);
|
||||
}
|
||||
|
||||
foreach (var data in syncData)
|
||||
{
|
||||
await Player.SendPacket(new PacketOfferingInfoScNotify(data));
|
||||
}
|
||||
foreach (var data in syncData) await Player.SendPacket(new PacketOfferingInfoScNotify(data));
|
||||
}
|
||||
|
||||
public async ValueTask<(Retcode, OfferingTypeData? data)> SubmitOfferingItem(int offeringId)
|
||||
@@ -75,17 +66,18 @@ public class OfferingManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
|
||||
var gameData = GameData.OfferingTypeConfigData.GetValueOrDefault(offeringId);
|
||||
if (gameData == null) return (Retcode.RetOfferingNotUnlock, null);
|
||||
|
||||
|
||||
if (offering.Level >= gameData.MaxLevel) return (Retcode.RetOfferingReachMaxLevel, offering);
|
||||
|
||||
var item = Player.InventoryManager!.GetItem(gameData.ItemID);
|
||||
if (item is not { Count: >= 1 }) return (Retcode.RetOfferingItemNotEnough, offering);
|
||||
|
||||
|
||||
var exp = item.Count;
|
||||
while (true)
|
||||
{
|
||||
if (offering.Level >= gameData.MaxLevel) break;
|
||||
var config = GameData.OfferingLevelConfigData.GetValueOrDefault(offeringId)?.GetValueOrDefault(offering.Level + 1);
|
||||
var config = GameData.OfferingLevelConfigData.GetValueOrDefault(offeringId)
|
||||
?.GetValueOrDefault(offering.Level + 1);
|
||||
if (config == null) break;
|
||||
|
||||
if (exp + offering.CurExp < config.ItemCost)
|
||||
@@ -105,7 +97,8 @@ public class OfferingManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
return (Retcode.RetSucc, offering);
|
||||
}
|
||||
|
||||
public async ValueTask<(Retcode, OfferingTypeData? data, List<ItemData> reward)> TakeOfferingReward(int offeringId, List<int> takeList)
|
||||
public async ValueTask<(Retcode, OfferingTypeData? data, List<ItemData> reward)> TakeOfferingReward(int offeringId,
|
||||
List<int> takeList)
|
||||
{
|
||||
var offering = GetOfferingData(offeringId);
|
||||
if (offering is not { State: OfferingState.Open }) return (Retcode.RetOfferingNotUnlock, null, []);
|
||||
@@ -114,24 +107,16 @@ public class OfferingManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
if (gameData == null) return (Retcode.RetOfferingNotUnlock, offering, []);
|
||||
|
||||
List<int> rewardIdList = [];
|
||||
foreach (var excel in takeList.Select(take => GameData.OfferingLevelConfigData.GetValueOrDefault(offeringId)?.GetValueOrDefault(take)))
|
||||
{
|
||||
foreach (var excel in takeList.Select(take =>
|
||||
GameData.OfferingLevelConfigData.GetValueOrDefault(offeringId)?.GetValueOrDefault(take)))
|
||||
if (excel != null && excel.Level <= offering.Level && !offering.TakenReward.Contains(excel.Level))
|
||||
{
|
||||
rewardIdList.Add(excel.RewardID);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (Retcode.RetOfferingLevelNotUnlock, offering, []);
|
||||
}
|
||||
}
|
||||
|
||||
offering.TakenReward.AddRange(takeList);
|
||||
List<ItemData> reward = [];
|
||||
foreach (var id in rewardIdList)
|
||||
{
|
||||
reward.AddRange(await Player.InventoryManager!.HandleReward(id, sync:false));
|
||||
}
|
||||
foreach (var id in rewardIdList) reward.AddRange(await Player.InventoryManager!.HandleReward(id, sync: false));
|
||||
|
||||
await Player.SendPacket(new PacketPlayerSyncScNotify(reward));
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Mission.FinishType.Handler;
|
||||
|
||||
@@ -12,8 +11,8 @@ public class MissionHandlerMatchThreeFinishLevel : MissionFinishTypeHandler
|
||||
{
|
||||
public override async ValueTask HandleMissionFinishType(PlayerInstance player, SubMissionInfo info, object? arg)
|
||||
{
|
||||
if(arg is MatchThreeLevelEndCsReq req)
|
||||
if(req.LevelId == info.ParamInt1)
|
||||
if (arg is MatchThreeLevelEndCsReq req)
|
||||
if (req.LevelId == info.ParamInt1)
|
||||
await player.MissionManager!.FinishSubMission(info.ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using System.Text;
|
||||
using EggLink.DanhengServer.Data.Config;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using System.Text;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Mission.FinishType.Handler;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class MissionHandlerTimeLineSetState : MissionFinishTypeHandler
|
||||
var propId = info.ParamInt2;
|
||||
var value = info.ParamStr1;
|
||||
|
||||
var data = player.GetScenePropTimelineData(floorId, groupId, propId); // get data
|
||||
var data = player.GetScenePropTimelineData(floorId, groupId, propId); // get data
|
||||
|
||||
if (data == null) return;
|
||||
// compare
|
||||
@@ -25,14 +25,15 @@ public class MissionHandlerTimeLineSetState : 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)
|
||||
{
|
||||
var floorId = excel.MazeFloorID;
|
||||
var groupId = excel.ParamInt1;
|
||||
var propId = excel.ParamInt2;
|
||||
var value = excel.ParamStr1;
|
||||
|
||||
var data = player.GetScenePropTimelineData(floorId, groupId, propId); // get data
|
||||
var data = player.GetScenePropTimelineData(floorId, groupId, propId); // get data
|
||||
|
||||
if (data == null) return;
|
||||
// compare
|
||||
|
||||
@@ -14,7 +14,8 @@ public class MissionHandlerTimeLineSetStateCnt : MissionFinishTypeHandler
|
||||
await ValueTask.CompletedTask;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// TODO
|
||||
await ValueTask.CompletedTask;
|
||||
|
||||
@@ -504,7 +504,6 @@ public class PlayerInstance(PlayerData data)
|
||||
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);
|
||||
@@ -517,7 +516,6 @@ public class PlayerInstance(PlayerData data)
|
||||
{
|
||||
await p.SetState(PropStateEnum.Open);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -526,9 +524,7 @@ public class PlayerInstance(PlayerData data)
|
||||
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;
|
||||
}
|
||||
@@ -572,15 +568,11 @@ public class PlayerInstance(PlayerData data)
|
||||
.Where(p => p.PropInfo.Name.Contains("Piece")).All(p => p.State == PropStateEnum.Closed);
|
||||
|
||||
if (pieceDone)
|
||||
{
|
||||
// set JigsawSir to open
|
||||
foreach (var p in SceneInstance.GetEntitiesInGroup<EntityProp>(prop.GroupID)
|
||||
.Where(p => p.PropInfo.Name.Contains("JigsawSir") &&
|
||||
p.State != PropStateEnum.Closed))
|
||||
{
|
||||
await p.SetState(PropStateEnum.TriggerEnable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
EventManager = new RogueEventManager(player, this);
|
||||
|
||||
BaseRerollCount = 0;
|
||||
var t1 = RollTitanBless(1,true);
|
||||
var t1 = RollTitanBless(1, true);
|
||||
t1.AsTask().Wait();
|
||||
|
||||
var t = RollFormula(1, [RogueFormulaCategoryEnum.Epic]);
|
||||
@@ -126,9 +126,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
|
||||
// check if era flipper
|
||||
if (Player.SceneInstance!.FloorInfo!.LevelFeatureModules.Contains(LevelFeatureTypeEnum.EraFlipper))
|
||||
{
|
||||
await Player.SendPacket(new PacketEraFlipperDataChangeScNotify(Player.SceneInstance!.FloorId));
|
||||
}
|
||||
|
||||
// sync
|
||||
await Player.SendPacket(new PacketRogueTournLevelInfoUpdateScNotify(this, [CurLevel]));
|
||||
@@ -137,9 +135,8 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
await Player.SendPacket(new PacketRogueTournTitanUpdateTitanBlessProgressScNotify(this));
|
||||
|
||||
if (TitanProgress >= 4)
|
||||
{
|
||||
await RollTitanBless(1, RogueTitanBlessInstance.EnhanceBlessList.Count / 3 >= RogueTitanBlessInstance.BlessTypeExcel.Count);
|
||||
}
|
||||
await RollTitanBless(1,
|
||||
RogueTitanBlessInstance.EnhanceBlessList.Count / 3 >= RogueTitanBlessInstance.BlessTypeExcel.Count);
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +165,7 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
for (var i = 0; i < amount; i++)
|
||||
{
|
||||
var menu = new RogueTitanBlessSelectMenu(this);
|
||||
menu.RollTitanBless(typeSelect:selectType);
|
||||
menu.RollTitanBless(typeSelect: selectType);
|
||||
var action = menu.GetActionInstance();
|
||||
RogueActions.Add(action.QueuePosition, action);
|
||||
}
|
||||
@@ -187,7 +184,6 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
{
|
||||
var bless = action.RogueTitanBlessSelectMenu.Blesses.Find(x => x.TitanBlessID == blessId);
|
||||
if (bless != null) // check if bless is in the list
|
||||
{
|
||||
if (!RogueTitanBlessInstance.BlessTypeExcel.Exists(x =>
|
||||
x.TitanBlessID == blessId)) // check if bless already exists
|
||||
{
|
||||
@@ -206,12 +202,12 @@ public class RogueTournInstance : BaseRogueInstance
|
||||
await Player.SendPacket(new PacketSyncRogueCommonActionResultScNotify(RogueSubMode,
|
||||
bless.ToResultProto(RogueCommonActionResultSourceType.Select)));
|
||||
}
|
||||
}
|
||||
|
||||
RogueActions.Remove(action.QueuePosition);
|
||||
if (action.RogueTitanBlessSelectMenu.TypeSelect)
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location, selectTitanBlessType: true));
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location,
|
||||
selectTitanBlessType: true));
|
||||
else
|
||||
await Player.SendPacket(
|
||||
new PacketHandleRogueCommonPendingActionScRsp(action.QueuePosition, location,
|
||||
|
||||
@@ -12,19 +12,15 @@ public class RogueTitanBlessInstance
|
||||
public void OnBattleStart(BattleInstance inst)
|
||||
{
|
||||
foreach (var bless in BlessTypeExcel)
|
||||
{
|
||||
inst.Buffs.Add(new MazeBuff(bless.MazeBuffID, 1, -1)
|
||||
{
|
||||
WaveFlag = -1
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var bless in EnhanceBlessList)
|
||||
{
|
||||
inst.Buffs.Add(new MazeBuff(bless.MazeBuffID, 1, -1)
|
||||
{
|
||||
WaveFlag = -1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,10 @@ public class RogueTitanBlessSelectMenu(RogueTournInstance rogue)
|
||||
|
||||
public void RollTitanBless(int count = 3, bool typeSelect = false)
|
||||
{
|
||||
var list = GameData.RogueTournTitanBlessData.Values.Where(x => GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory == rogue.TitanCategory).ToList();
|
||||
var list = GameData.RogueTournTitanBlessData.Values.Where(x =>
|
||||
GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory ==
|
||||
rogue.TitanCategory)
|
||||
.ToList();
|
||||
|
||||
if (typeSelect)
|
||||
{
|
||||
@@ -24,37 +27,41 @@ public class RogueTitanBlessSelectMenu(RogueTournInstance rogue)
|
||||
// random 2 types
|
||||
if (rogue.TitanCategory != RogueTitanCategoryEnum.Night)
|
||||
{
|
||||
var night = GameData.RogueTournTitanBlessData.Values.Where(x => GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory == RogueTitanCategoryEnum.Night && x.TitanBlessLevel == 1).ToList().RandomElement();
|
||||
var night = GameData.RogueTournTitanBlessData.Values.Where(x =>
|
||||
GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory ==
|
||||
RogueTitanCategoryEnum.Night && x.TitanBlessLevel == 1).ToList().RandomElement();
|
||||
list.Add(night);
|
||||
}
|
||||
else if (rogue.TitanCategory == RogueTitanCategoryEnum.Day)
|
||||
{
|
||||
var bless = rogue.RogueTitanBlessInstance.BlessTypeExcel.LastOrDefault(x => GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory == RogueTitanCategoryEnum.Day);
|
||||
var bless = rogue.RogueTitanBlessInstance.BlessTypeExcel.LastOrDefault(x =>
|
||||
GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory ==
|
||||
RogueTitanCategoryEnum.Day);
|
||||
if (bless != null)
|
||||
{
|
||||
var targetBless = GameData.RogueTournTitanBlessData.Values.FirstOrDefault(x => x.TitanType == bless.TitanType && x.TitanBlessLevel == bless.TitanBlessLevel + 1);
|
||||
if (targetBless != null)
|
||||
{
|
||||
list.Add(targetBless);
|
||||
}
|
||||
var targetBless = GameData.RogueTournTitanBlessData.Values.FirstOrDefault(x =>
|
||||
x.TitanType == bless.TitanType && x.TitanBlessLevel == bless.TitanBlessLevel + 1);
|
||||
if (targetBless != null) list.Add(targetBless);
|
||||
}
|
||||
}
|
||||
|
||||
if (rogue.TitanCategory != RogueTitanCategoryEnum.Day)
|
||||
{
|
||||
var day = GameData.RogueTournTitanBlessData.Values.Where(x => GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory == RogueTitanCategoryEnum.Day && x.TitanBlessLevel == 1).ToList().RandomElement();
|
||||
var day = GameData.RogueTournTitanBlessData.Values.Where(x =>
|
||||
GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory ==
|
||||
RogueTitanCategoryEnum.Day && x.TitanBlessLevel == 1).ToList().RandomElement();
|
||||
list.Add(day);
|
||||
}
|
||||
else if (rogue.TitanCategory == RogueTitanCategoryEnum.Night)
|
||||
{
|
||||
var bless = rogue.RogueTitanBlessInstance.BlessTypeExcel.LastOrDefault(x => GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory == RogueTitanCategoryEnum.Night);
|
||||
var bless = rogue.RogueTitanBlessInstance.BlessTypeExcel.LastOrDefault(x =>
|
||||
GameData.RogueTournTitanTypeData.GetValueOrDefault(x.TitanType)?.RogueTitanCategory ==
|
||||
RogueTitanCategoryEnum.Night);
|
||||
if (bless != null)
|
||||
{
|
||||
var targetBless = GameData.RogueTournTitanBlessData.Values.FirstOrDefault(x => x.TitanType == bless.TitanType && x.TitanBlessLevel == bless.TitanBlessLevel + 1);
|
||||
if (targetBless != null)
|
||||
{
|
||||
list.Add(targetBless);
|
||||
}
|
||||
var targetBless = GameData.RogueTournTitanBlessData.Values.FirstOrDefault(x =>
|
||||
x.TitanType == bless.TitanType && x.TitanBlessLevel == bless.TitanBlessLevel + 1);
|
||||
if (targetBless != null) list.Add(targetBless);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +97,9 @@ public class RogueTitanBlessSelectMenu(RogueTournInstance rogue)
|
||||
{
|
||||
return new RogueTitanBlessSelectInfo
|
||||
{
|
||||
BlessSelectType = TypeSelect ? TitanBlessSelectType.KSelectTitanBlessType : TitanBlessSelectType.KSelectTitanBlessEnhance,
|
||||
BlessSelectType = TypeSelect
|
||||
? TitanBlessSelectType.KSelectTitanBlessType
|
||||
: TitanBlessSelectType.KSelectTitanBlessEnhance,
|
||||
TitanBlessIdList = { Blesses.Select(x => (uint)x.TitanBlessID) },
|
||||
SelectHintId = (uint)(TypeSelect ? 310001 : 310002)
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Config.Scene;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Database.Avatar;
|
||||
using EggLink.DanhengServer.Database.Inventory;
|
||||
using EggLink.DanhengServer.Enums.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Battle;
|
||||
@@ -9,7 +8,6 @@ using EggLink.DanhengServer.GameServer.Game.Scene.Component;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using System.Numerics;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
|
||||
@@ -106,6 +104,36 @@ 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;
|
||||
@@ -140,33 +168,4 @@ public class EntityMonster(
|
||||
await Scene.RemoveEntity(this);
|
||||
return dropItems;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,9 @@ public class EntityProp(SceneInstance scene, MazePropExcel excel, GroupInfo grou
|
||||
public MazePropExcel Excel { get; set; } = excel;
|
||||
public PropInfo PropInfo { get; set; } = prop;
|
||||
public GroupInfo Group { get; set; } = group;
|
||||
public ScenePropTimelineData? PropTimelineData { get; set; }
|
||||
public int EntityID { get; set; }
|
||||
public int GroupID { get; set; } = group.Id;
|
||||
public ScenePropTimelineData? PropTimelineData { get; set; }
|
||||
|
||||
public async ValueTask AddBuff(SceneBuff buff)
|
||||
{
|
||||
@@ -42,12 +42,10 @@ public class EntityProp(SceneInstance scene, MazePropExcel excel, GroupInfo grou
|
||||
};
|
||||
|
||||
if (PropTimelineData != null)
|
||||
{
|
||||
prop.ExtraInfo = new PropExtraInfo
|
||||
{
|
||||
TimelineInfo = PropTimelineData.ToProto()
|
||||
};
|
||||
}
|
||||
|
||||
return new SceneEntityInfo
|
||||
{
|
||||
|
||||
@@ -217,7 +217,8 @@ public class SceneEntityLoader(SceneInstance scene)
|
||||
|
||||
Scene.Groups.Remove(group.Id);
|
||||
|
||||
if (refreshed) await Scene.Player.SendPacket(new PacketSceneGroupRefreshScNotify(Scene.Player, removeEntity: removeList));
|
||||
if (refreshed)
|
||||
await Scene.Player.SendPacket(new PacketSceneGroupRefreshScNotify(Scene.Player, removeEntity: removeList));
|
||||
}
|
||||
|
||||
public virtual async ValueTask<EntityNpc?> LoadNpc(NpcInfo info, GroupInfo group, bool sendPacket = false)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Data.Config.Scene;
|
||||
using EggLink.DanhengServer.Data.Config.Task;
|
||||
using EggLink.DanhengServer.Data.Excel;
|
||||
using EggLink.DanhengServer.Database.Avatar;
|
||||
using EggLink.DanhengServer.Enums.Scene;
|
||||
@@ -15,7 +14,6 @@ using EggLink.DanhengServer.GameServer.Game.RogueMagic.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.RogueTourn.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Component;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Game.Task.AvatarTask;
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
using EggLink.DanhengServer.Util;
|
||||
@@ -127,7 +125,7 @@ public class SceneInstance
|
||||
sceneInfo.FloorSavedData[value.Name] = value.DefaultValue;
|
||||
|
||||
foreach (var value in floorData ?? [])
|
||||
sceneInfo.FloorSavedData[value.Key] = value.Value;
|
||||
sceneInfo.FloorSavedData[value.Key] = value.Value;
|
||||
|
||||
// mission
|
||||
Player.MissionManager!.OnLoadScene(sceneInfo);
|
||||
@@ -294,15 +292,9 @@ public class SceneInstance
|
||||
if (sendPacket && !notSendPacket)
|
||||
await Player.SendPacket(new PacketSceneGroupRefreshScNotify(Player, addAvatar, removeAvatar));
|
||||
|
||||
foreach (var avatar in removeAvatar)
|
||||
{
|
||||
Entities.Remove(avatar.EntityID);
|
||||
}
|
||||
foreach (var avatar in removeAvatar) Entities.Remove(avatar.EntityID);
|
||||
|
||||
foreach (var avatar in addAvatar)
|
||||
{
|
||||
Entities.Add(avatar.EntityID, avatar);
|
||||
}
|
||||
foreach (var avatar in addAvatar) Entities.Add(avatar.EntityID, avatar);
|
||||
}
|
||||
|
||||
public void SyncGroupInfo()
|
||||
@@ -483,7 +475,8 @@ public class SceneInstance
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class AvatarSceneInfo(AvatarInfo avatarInfo, AvatarType avatarType, PlayerInstance player) : IGameEntity, IGameModifier
|
||||
public class AvatarSceneInfo(AvatarInfo avatarInfo, AvatarType avatarType, PlayerInstance player)
|
||||
: IGameEntity, IGameModifier
|
||||
{
|
||||
public AvatarInfo AvatarInfo = avatarInfo;
|
||||
public AvatarType AvatarType = avatarType;
|
||||
@@ -535,7 +528,8 @@ public class AvatarSceneInfo(AvatarInfo avatarInfo, AvatarType avatarType, Playe
|
||||
|
||||
foreach (var sceneBuff in BuffList)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(sceneBuff.BuffId * 10 + sceneBuff.BuffLevel, out var buffExcel)) continue;
|
||||
if (!GameData.MazeBuffData.TryGetValue(sceneBuff.BuffId * 10 + sceneBuff.BuffLevel, out var buffExcel))
|
||||
continue;
|
||||
|
||||
await RemoveModifier(buffExcel.ModifierName);
|
||||
}
|
||||
@@ -548,19 +542,6 @@ public class AvatarSceneInfo(AvatarInfo avatarInfo, AvatarType avatarType, Playe
|
||||
return AvatarInfo.ToSceneEntityInfo(AvatarType);
|
||||
}
|
||||
|
||||
public async ValueTask RemoveBuff(int buffId)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(buffId * 10 + 1, out var buffExcel)) return;
|
||||
|
||||
var buff = BuffList.Find(x => x.BuffId == buffId);
|
||||
if (buff == null) return;
|
||||
|
||||
BuffList.Remove(buff);
|
||||
await player.SendPacket(new PacketSyncEntityBuffChangeListScNotify(this, [buff]));
|
||||
|
||||
await RemoveModifier(buffExcel.ModifierName);
|
||||
}
|
||||
|
||||
public List<string> Modifiers { get; set; } = [];
|
||||
|
||||
public async ValueTask AddModifier(string modifierName)
|
||||
@@ -595,6 +576,20 @@ public class AvatarSceneInfo(AvatarInfo avatarInfo, AvatarType avatarType, Playe
|
||||
await player.TaskManager!.AbilityLevelTask.TriggerTasks(avatarAbility, modifier.OnDestroy, this, [],
|
||||
new SceneCastSkillCsReq());
|
||||
|
||||
Modifiers.Remove(modifierName); ;
|
||||
Modifiers.Remove(modifierName);
|
||||
;
|
||||
}
|
||||
|
||||
public async ValueTask RemoveBuff(int buffId)
|
||||
{
|
||||
if (!GameData.MazeBuffData.TryGetValue(buffId * 10 + 1, out var buffExcel)) return;
|
||||
|
||||
var buff = BuffList.Find(x => x.BuffId == buffId);
|
||||
if (buff == null) return;
|
||||
|
||||
BuffList.Remove(buff);
|
||||
await player.SendPacket(new PacketSyncEntityBuffChangeListScNotify(this, [buff]));
|
||||
|
||||
await RemoveModifier(buffExcel.ModifierName);
|
||||
}
|
||||
}
|
||||
@@ -18,32 +18,46 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
{
|
||||
public PlayerInstance Player { get; set; } = player;
|
||||
|
||||
#region Selector
|
||||
|
||||
public List<IGameEntity> TargetAlias(TargetEvaluator selector, IGameEntity casterEntity,
|
||||
List<IGameEntity> targetEntities)
|
||||
{
|
||||
if (selector is TargetAlias target)
|
||||
{
|
||||
if (target.Alias == "AllEnemy") return targetEntities;
|
||||
|
||||
if (target.Alias == "Caster") return [casterEntity];
|
||||
|
||||
if (target.Alias == "AbilityTargetEntity") return targetEntities;
|
||||
|
||||
if (target.Alias == "ParamEntity") return targetEntities;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Manage
|
||||
|
||||
public async ValueTask<AbilityLevelResult> TriggerTasks(AdventureAbilityConfigListInfo abilities, List<TaskConfigInfo> tasks, IGameEntity casterEntity, List<IGameEntity> targetEntities, SceneCastSkillCsReq req)
|
||||
public async ValueTask<AbilityLevelResult> TriggerTasks(AdventureAbilityConfigListInfo abilities,
|
||||
List<TaskConfigInfo> tasks, IGameEntity casterEntity, List<IGameEntity> targetEntities, SceneCastSkillCsReq req)
|
||||
{
|
||||
BattleInstance? instance = null;
|
||||
List<HitMonsterInstance> battleInfos = [];
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
try
|
||||
{
|
||||
var res = await TriggerTask(new AbilityLevelParam(abilities, task, casterEntity, targetEntities, req));
|
||||
if (res.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(res.BattleInfos);
|
||||
}
|
||||
if (res.BattleInfos != null) battleInfos.AddRange(res.BattleInfos);
|
||||
|
||||
if (res.Instance != null)
|
||||
{
|
||||
instance = res.Instance;
|
||||
}
|
||||
if (res.Instance != null) instance = res.Instance;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.GetByClassName().Error("An error occured, ", e);
|
||||
}
|
||||
}
|
||||
|
||||
return new AbilityLevelResult(instance, battleInfos);
|
||||
}
|
||||
@@ -58,15 +72,9 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
if (method != null)
|
||||
{
|
||||
var res = method.Invoke(this, [param]);
|
||||
if (res is AbilityLevelResult result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (res is AbilityLevelResult result) return result;
|
||||
|
||||
if (res is ValueTask<AbilityLevelResult> valueTask)
|
||||
{
|
||||
return await valueTask;
|
||||
}
|
||||
if (res is ValueTask<AbilityLevelResult> valueTask) return await valueTask;
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -95,55 +103,34 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
{
|
||||
var resp = method.Invoke(this, [param with { Act = predicateTaskList.Predicate }]);
|
||||
if (resp is true)
|
||||
{
|
||||
foreach (var task in predicateTaskList.SuccessTaskList)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
|
||||
if (result.Instance != null)
|
||||
{
|
||||
instance = result.Instance;
|
||||
}
|
||||
if (result.Instance != null) instance = result.Instance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var task in predicateTaskList.FailedTaskList)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
|
||||
if (result.Instance != null)
|
||||
{
|
||||
instance = result.Instance;
|
||||
}
|
||||
if (result.Instance != null) instance = result.Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var task in predicateTaskList.FailedTaskList)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
|
||||
if (result.Instance != null)
|
||||
{
|
||||
instance = result.Instance;
|
||||
}
|
||||
if (result.Instance != null) instance = result.Instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new AbilityLevelResult(instance, battleInfos);
|
||||
}
|
||||
|
||||
@@ -158,16 +145,14 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
var method = GetType().GetMethod(methodName);
|
||||
if (method != null)
|
||||
{
|
||||
var resp = method.Invoke(this, [adventureTriggerAttack.AttackTargetType, param.CasterEntity, param.TargetEntities]);
|
||||
var resp = method.Invoke(this,
|
||||
[adventureTriggerAttack.AttackTargetType, param.CasterEntity, param.TargetEntities]);
|
||||
if (resp is List<IGameEntity> target)
|
||||
{
|
||||
foreach (var task in adventureTriggerAttack.OnAttack)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
|
||||
if (target.Count > 0 && adventureTriggerAttack.TriggerBattle)
|
||||
@@ -175,10 +160,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
foreach (var task in adventureTriggerAttack.OnBattle)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
|
||||
foreach (var entity in param.TargetEntities)
|
||||
@@ -190,7 +172,8 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
battleInfos.Add(new HitMonsterInstance(entity.EntityID, type));
|
||||
}
|
||||
|
||||
instance = await Player.BattleManager!.StartBattle(param.CasterEntity, param.TargetEntities, param.Request.SkillIndex == 1);
|
||||
instance = await Player.BattleManager!.StartBattle(param.CasterEntity, param.TargetEntities,
|
||||
param.Request.SkillIndex == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,13 +196,10 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
var resp = method.Invoke(this,
|
||||
[addMazeBuff.TargetType, param.CasterEntity, param.TargetEntities]);
|
||||
if (resp is List<IGameEntity> target)
|
||||
{
|
||||
foreach (var entity in target)
|
||||
{
|
||||
await entity.AddBuff(new SceneBuff(addMazeBuff.ID, 1, (param.CasterEntity as AvatarSceneInfo)?.AvatarInfo.GetAvatarId() ?? 0,
|
||||
await entity.AddBuff(new SceneBuff(addMazeBuff.ID, 1,
|
||||
(param.CasterEntity as AvatarSceneInfo)?.AvatarInfo.GetAvatarId() ?? 0,
|
||||
addMazeBuff.LifeTime.FixedValue.Value < -1 ? 20 : -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,10 +216,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
foreach (var task in adventureFireProjectile.OnProjectileHit)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
|
||||
if (result.Instance != null)
|
||||
instance = result.Instance;
|
||||
@@ -248,10 +225,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
foreach (var task in adventureFireProjectile.OnProjectileLifetimeFinish)
|
||||
{
|
||||
var result = await TriggerTask(param with { Act = task });
|
||||
if (result.BattleInfos != null)
|
||||
{
|
||||
battleInfos.AddRange(result.BattleInfos);
|
||||
}
|
||||
if (result.BattleInfos != null) battleInfos.AddRange(result.BattleInfos);
|
||||
|
||||
if (result.Instance != null)
|
||||
instance = result.Instance;
|
||||
@@ -288,10 +262,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
|
||||
public async ValueTask<AbilityLevelResult> DestroySummonUnit(AbilityLevelParam param)
|
||||
{
|
||||
if (param.Act is CreateSummonUnit createSummonUnit)
|
||||
{
|
||||
await Player.SceneInstance!.ClearSummonUnit(); // TODO
|
||||
}
|
||||
if (param.Act is CreateSummonUnit createSummonUnit) await Player.SceneInstance!.ClearSummonUnit(); // TODO
|
||||
|
||||
return new AbilityLevelResult();
|
||||
}
|
||||
@@ -303,10 +274,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
GameData.AdventureModifierData.TryGetValue(addAdventureModifier.ModifierName, out var modifier);
|
||||
if (modifier == null) return new AbilityLevelResult();
|
||||
|
||||
if (param.CasterEntity is IGameModifier mod)
|
||||
{
|
||||
await mod.AddModifier(addAdventureModifier.ModifierName);
|
||||
}
|
||||
if (param.CasterEntity is IGameModifier mod) await mod.AddModifier(addAdventureModifier.ModifierName);
|
||||
}
|
||||
|
||||
return new AbilityLevelResult();
|
||||
@@ -319,10 +287,7 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
GameData.AdventureModifierData.TryGetValue(removeAdventureModifier.ModifierName, out var modifier);
|
||||
if (modifier == null) return new AbilityLevelResult();
|
||||
|
||||
if (param.CasterEntity is IGameModifier mod)
|
||||
{
|
||||
await mod.RemoveModifier(removeAdventureModifier.ModifierName);
|
||||
}
|
||||
if (param.CasterEntity is IGameModifier mod) await mod.RemoveModifier(removeAdventureModifier.ModifierName);
|
||||
}
|
||||
|
||||
return new AbilityLevelResult();
|
||||
@@ -359,52 +324,14 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
|
||||
#endregion
|
||||
|
||||
#region Selector
|
||||
|
||||
public List<IGameEntity> TargetAlias(TargetEvaluator selector, IGameEntity casterEntity, List<IGameEntity> targetEntities)
|
||||
{
|
||||
if (selector is TargetAlias target)
|
||||
{
|
||||
if (target.Alias == "AllEnemy")
|
||||
{
|
||||
return targetEntities;
|
||||
}
|
||||
|
||||
if (target.Alias == "Caster")
|
||||
{
|
||||
return [casterEntity];
|
||||
}
|
||||
|
||||
if (target.Alias == "AbilityTargetEntity")
|
||||
{
|
||||
return targetEntities;
|
||||
}
|
||||
|
||||
if (target.Alias == "ParamEntity")
|
||||
{
|
||||
return targetEntities;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Predicate
|
||||
|
||||
public bool ByAllowInstantKill(AbilityLevelParam param)
|
||||
{
|
||||
foreach (var targetEntity in param.TargetEntities)
|
||||
{
|
||||
if (targetEntity is EntityMonster monster)
|
||||
{
|
||||
if (monster.MonsterData.Rank < MonsterRankEnum.Elite)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -423,7 +350,6 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
[byIsContain.TargetType, param.CasterEntity, param.TargetEntities]);
|
||||
|
||||
if (resp is List<IGameEntity> target)
|
||||
{
|
||||
foreach (var entity in target)
|
||||
{
|
||||
if (entity is not IGameModifier modifier) continue;
|
||||
@@ -433,11 +359,11 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -446,4 +372,9 @@ public class AbilityLevelTask(PlayerInstance player)
|
||||
|
||||
public record AbilityLevelResult(BattleInstance? Instance = null, List<HitMonsterInstance>? BattleInfos = null);
|
||||
|
||||
public record AbilityLevelParam(AdventureAbilityConfigListInfo AdventureAbility, TaskConfigInfo Act, IGameEntity CasterEntity, List<IGameEntity> TargetEntities, SceneCastSkillCsReq Request);
|
||||
public record AbilityLevelParam(
|
||||
AdventureAbilityConfigListInfo AdventureAbility,
|
||||
TaskConfigInfo Act,
|
||||
IGameEntity CasterEntity,
|
||||
List<IGameEntity> TargetEntities,
|
||||
SceneCastSkillCsReq Request);
|
||||
@@ -39,7 +39,7 @@ public class TrainPartyManager(PlayerInstance player) : BasePlayerManager(player
|
||||
EEBNAAPBKCN = 30,
|
||||
CurFund = (uint)Data.Fund,
|
||||
AreaList = { Data.Areas.Values.Select(x => x.ToProto()) },
|
||||
DynamicIdList = { GameData.TrainPartyDynamicConfigData.Select(x => (uint)x.Key) },
|
||||
DynamicIdList = { GameData.TrainPartyDynamicConfigData.Select(x => (uint)x.Key) }
|
||||
};
|
||||
|
||||
return proto;
|
||||
|
||||
@@ -106,10 +106,6 @@ public static class PluginEvent
|
||||
|
||||
#endregion
|
||||
|
||||
#region Common
|
||||
|
||||
#endregion
|
||||
|
||||
#region Event
|
||||
|
||||
public static event OnPlayerHeartBeatHandler? OnPlayerHeartBeat;
|
||||
|
||||
@@ -10,7 +10,9 @@ public class HandlerQuickStartCocoonStageCsReq : Handler
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
var req = QuickStartCocoonStageCsReq.Parser.ParseFrom(data);
|
||||
var battle = await connection.Player!.BattleManager!.StartCocoonStage((int)req.CocoonId, (int)req.Wave, (int)req.WorldLevel);
|
||||
var battle =
|
||||
await connection.Player!.BattleManager!.StartCocoonStage((int)req.CocoonId, (int)req.Wave,
|
||||
(int)req.WorldLevel);
|
||||
connection.Player.SceneInstance?.ClearSummonUnit();
|
||||
|
||||
if (battle != null)
|
||||
|
||||
@@ -11,8 +11,8 @@ public class HandlerChangeEraFlipperDataCsReq : Handler
|
||||
{
|
||||
var req = ChangeEraFlipperDataCsReq.Parser.ParseFrom(data);
|
||||
|
||||
int floorId = connection.Player!.SceneInstance!.FloorId;
|
||||
var floorId = connection.Player!.SceneInstance!.FloorId;
|
||||
await connection.SendPacket(new PacketChangeEraFlipperDataScRsp(req));
|
||||
await connection.SendPacket(new PacketEraFlipperDataChangeScNotify(req, floorId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,4 @@ public class HandlerGetEraFlipperDataCsReq : Handler
|
||||
|
||||
await connection.SendPacket(new PacketGetEraFlipperDataScRsp(connection.Player!));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,11 @@ public class HandlerComposeSelectedRelicCsReq : Handler
|
||||
var player = connection.Player!;
|
||||
if (player.InventoryManager!.Data.RelicItems.Count >= GameConstants.INVENTORY_MAX_RELIC)
|
||||
{
|
||||
await connection.SendPacket(new PacketComposeSelectedRelicScRsp(req.ComposeId, Retcode.RetRelicExceedLimit));
|
||||
await connection.SendPacket(
|
||||
new PacketComposeSelectedRelicScRsp(req.ComposeId, Retcode.RetRelicExceedLimit));
|
||||
return;
|
||||
}
|
||||
|
||||
var item = await player.InventoryManager.ComposeRelic(req);
|
||||
if (item == null)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@ public class HandlerUpdateMarkChestCsReq : Handler
|
||||
List<SceneMarkedChestData> markedChestData = [];
|
||||
|
||||
foreach (var markChestInfo in req.MarkChestInfoList)
|
||||
{
|
||||
markedChestData.Add(new SceneMarkedChestData
|
||||
{
|
||||
ConfigId = (int)markChestInfo.ConfigId,
|
||||
@@ -24,15 +23,13 @@ public class HandlerUpdateMarkChestCsReq : Handler
|
||||
GroupId = (int)markChestInfo.GroupId,
|
||||
PlaneId = (int)markChestInfo.PlaneId
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var chestData in (player.SceneData!.MarkedChestData.GetValueOrDefault((int)req.FuncId) ?? []).Where(chestData => markedChestData.All(x =>
|
||||
!(x.ConfigId == chestData.ConfigId && x.FloorId == chestData.FloorId &&
|
||||
x.GroupId == chestData.GroupId))))
|
||||
{
|
||||
foreach (var chestData in (player.SceneData!.MarkedChestData.GetValueOrDefault((int)req.FuncId) ?? []).Where(
|
||||
chestData => markedChestData.All(x =>
|
||||
!(x.ConfigId == chestData.ConfigId && x.FloorId == chestData.FloorId &&
|
||||
x.GroupId == chestData.GroupId))))
|
||||
// Add the existing marked chest data if it is not in the new marked chest data
|
||||
markedChestData.Add(chestData);
|
||||
}
|
||||
|
||||
player.SceneData!.MarkedChestData[(int)req.FuncId] = markedChestData;
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ public class HandlerGetOfferingInfoCsReq : Handler
|
||||
var req = GetOfferingInfoCsReq.Parser.ParseFrom(data);
|
||||
|
||||
List<OfferingTypeData> dataList = [];
|
||||
dataList.AddRange(req.OfferingIdList.Select(id => connection.Player!.OfferingManager!.GetOfferingData((int)id)).OfType<OfferingTypeData>());
|
||||
dataList.AddRange(req.OfferingIdList.Select(id => connection.Player!.OfferingManager!.GetOfferingData((int)id))
|
||||
.OfType<OfferingTypeData>());
|
||||
|
||||
await connection.SendPacket(new PacketGetOfferingInfoScRsp(dataList));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.Phone;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.Phone;
|
||||
|
||||
[Opcode(CmdIds.SetPersonalCardCsReq)]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.Player;
|
||||
[Opcode(CmdIds.ReserveStaminaExchangeCsReq)]
|
||||
public class HandlerReserveStaminaExchangeCsReq : Handler
|
||||
{
|
||||
public async override Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
var req = ReserveStaminaExchangeCsReq.Parser.ParseFrom(data);
|
||||
var player = connection.Player;
|
||||
|
||||
@@ -14,10 +14,8 @@ public class HandlerSceneCastSkillCsReq : Handler
|
||||
var player = connection.Player!;
|
||||
var res = await player.SceneSkillManager!.OnCast(req);
|
||||
|
||||
await connection.SendPacket(new PacketSceneCastSkillScRsp(res.RetCode, req.CastEntityId, res.Instance, res.TriggerBattleInfos ?? []));
|
||||
if (res.Instance != null)
|
||||
{
|
||||
await player.SceneInstance!.ClearSummonUnit();
|
||||
}
|
||||
await connection.SendPacket(new PacketSceneCastSkillScRsp(res.RetCode, req.CastEntityId, res.Instance,
|
||||
res.TriggerBattleInfos ?? []));
|
||||
if (res.Instance != null) await player.SceneInstance!.ClearSummonUnit();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,9 @@ public class HandlerStartCocoonStageCsReq : Handler
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
var req = StartCocoonStageCsReq.Parser.ParseFrom(data);
|
||||
var battle = await connection.Player!.BattleManager!.StartCocoonStage((int)req.CocoonId, (int)req.Wave, (int)req.WorldLevel);
|
||||
var battle =
|
||||
await connection.Player!.BattleManager!.StartCocoonStage((int)req.CocoonId, (int)req.Wave,
|
||||
(int)req.WorldLevel);
|
||||
connection.Player.SceneInstance?.ClearSummonUnit();
|
||||
|
||||
if (battle != null)
|
||||
|
||||
@@ -11,7 +11,7 @@ public class HandlerUnlockTutorialCsReq : Handler
|
||||
{
|
||||
var req = UnlockTutorialCsReq.Parser.ParseFrom(data);
|
||||
var player = connection.Player!;
|
||||
if (!player.TutorialData!.Tutorials.TryGetValue((int)req.TutorialId, out var _))
|
||||
if (!player.TutorialData!.Tutorials.TryGetValue((int)req.TutorialId, out _))
|
||||
player.TutorialData!.Tutorials.Add((int)req.TutorialId, TutorialStatus.TutorialUnlock);
|
||||
|
||||
await connection.SendPacket(new PacketUnlockTutorialScRsp(req.TutorialId));
|
||||
|
||||
@@ -11,7 +11,7 @@ public class HandlerUnlockTutorialGuideCsReq : Handler
|
||||
{
|
||||
var req = UnlockTutorialGuideCsReq.Parser.ParseFrom(data);
|
||||
var player = connection.Player!;
|
||||
if (!player.TutorialGuideData!.Tutorials.TryGetValue((int)req.GroupId, out var _))
|
||||
if (!player.TutorialGuideData!.Tutorials.TryGetValue((int)req.GroupId, out _))
|
||||
player.TutorialGuideData!.Tutorials.Add((int)req.GroupId, TutorialStatus.TutorialUnlock);
|
||||
|
||||
await connection.SendPacket(new PacketUnlockTutorialGuideScRsp(req.GroupId));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.EraFlipper;
|
||||
|
||||
public class PacketChangeEraFlipperDataScRsp : BasePacket
|
||||
{
|
||||
public PacketChangeEraFlipperDataScRsp(ChangeEraFlipperDataCsReq req) : base(CmdIds.ChangeEraFlipperDataScRsp)
|
||||
@@ -13,4 +14,4 @@ public class PacketChangeEraFlipperDataScRsp : BasePacket
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.EraFlipper;
|
||||
|
||||
public class PacketEraFlipperDataChangeScNotify : BasePacket
|
||||
{
|
||||
public PacketEraFlipperDataChangeScNotify(ChangeEraFlipperDataCsReq req, int floorId) : base(CmdIds.EraFlipperDataChangeScNotify)
|
||||
public PacketEraFlipperDataChangeScNotify(ChangeEraFlipperDataCsReq req, int floorId) : base(
|
||||
CmdIds.EraFlipperDataChangeScNotify)
|
||||
{
|
||||
var proto = new EraFlipperDataChangeScNotify
|
||||
{
|
||||
@@ -24,4 +26,4 @@ public class PacketEraFlipperDataChangeScNotify : BasePacket
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.EraFlipper;
|
||||
|
||||
public class PacketGetEraFlipperDataScRsp : BasePacket
|
||||
{
|
||||
public PacketGetEraFlipperDataScRsp(PlayerInstance player) : base(CmdIds.GetEraFlipperDataScRsp)
|
||||
@@ -11,4 +12,4 @@ public class PacketGetEraFlipperDataScRsp : BasePacket
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class PacketDiscardRelicScRsp : BasePacket
|
||||
|
||||
if (success) proto.IsDiscard = isDiscard;
|
||||
else proto.Retcode = (uint)Retcode.RetFail;
|
||||
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,9 @@ public class PacketLockRelicScRsp : BasePacket
|
||||
public PacketLockRelicScRsp(bool success) : base(CmdIds.LockRelicScRsp)
|
||||
{
|
||||
LockRelicScRsp proto = new();
|
||||
|
||||
|
||||
if (!success) proto.Retcode = (uint)Retcode.RetFail;
|
||||
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,7 @@ public class PacketSubmitOfferingItemScRsp : BasePacket
|
||||
Retcode = (uint)ret
|
||||
};
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
proto.OfferingInfo = data.ToProto();
|
||||
}
|
||||
if (data != null) proto.OfferingInfo = data.ToProto();
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Offering;
|
||||
|
||||
public class PacketTakeOfferingRewardScRsp : BasePacket
|
||||
{
|
||||
public PacketTakeOfferingRewardScRsp(Retcode ret, OfferingTypeData? data, List<ItemData> reward) : base(CmdIds.TakeOfferingRewardScRsp)
|
||||
public PacketTakeOfferingRewardScRsp(Retcode ret, OfferingTypeData? data, List<ItemData> reward) : base(
|
||||
CmdIds.TakeOfferingRewardScRsp)
|
||||
{
|
||||
var proto = new TakeOfferingRewardScRsp
|
||||
{
|
||||
Retcode = (uint)ret,
|
||||
Retcode = (uint)ret
|
||||
};
|
||||
|
||||
if (data != null)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
|
||||
@@ -11,13 +11,16 @@ public class PacketQueryProductInfoScRsp : BasePacket
|
||||
var proto = new QueryProductInfoScRsp
|
||||
{
|
||||
//PEKJLBINDGG = (ulong)Extensions.GetUnixSec() + 8640000, // 100 day
|
||||
ProductList = { GameData.RechargeConfigData.Values.Where(x => x.GiftType != 1).Select(x => new Product
|
||||
ProductList =
|
||||
{
|
||||
EndTime = uint.MaxValue,
|
||||
GiftType = (ProductGiftType)x.GiftType,
|
||||
PriceTier = x.TierID,
|
||||
ProductId = x.ProductID
|
||||
}) }
|
||||
GameData.RechargeConfigData.Values.Where(x => x.GiftType != 1).Select(x => new Product
|
||||
{
|
||||
EndTime = uint.MaxValue,
|
||||
GiftType = (ProductGiftType)x.GiftType,
|
||||
PriceTier = x.TierID,
|
||||
ProductId = x.ProductID
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
|
||||
@@ -8,7 +8,7 @@ public class PacketReserveStaminaExchangeScRsp : BasePacket
|
||||
public PacketReserveStaminaExchangeScRsp(uint amount) : base(CmdIds.ReserveStaminaExchangeScRsp)
|
||||
{
|
||||
var proto = new ReserveStaminaExchangeScRsp();
|
||||
|
||||
|
||||
if (amount > 0) proto.Num = amount;
|
||||
else proto.Retcode = (uint)Retcode.RetFail;
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ public class PacketServerAnnounceNotify : BasePacket
|
||||
BeginTime = Extensions.GetUnixSec(),
|
||||
EndTime = Extensions.GetUnixSec() + 3600,
|
||||
ConfigId = 1,
|
||||
BannerText = ConfigManager.Config.ServerOption.ServerAnnounce.AnnounceContent // TODO
|
||||
BannerText = ConfigManager.Config.ServerOption.ServerAnnounce.AnnounceContent // TODO
|
||||
});
|
||||
|
||||
if (ConfigManager.Config.ServerOption.ServerAnnounce.EnableAnnounce) SetData(proto);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,8 @@ public class PacketGetPlayerBoardDataScRsp : BasePacket
|
||||
CurrentHeadIconId = (uint)player.Data.HeadIcon,
|
||||
PersonalCardId = (uint)player.Data.PersonalCard,
|
||||
UnlockedPersonalCardList = { player.PlayerUnlockData!.PersonalCards.Select(x => (uint)x) },
|
||||
UnlockedHeadIconList = { player.PlayerUnlockData!.HeadIcons.Select(x => new HeadIconData { Id = (uint)x }) },
|
||||
UnlockedHeadIconList =
|
||||
{ player.PlayerUnlockData!.HeadIcons.Select(x => new HeadIconData { Id = (uint)x }) },
|
||||
AssistAvatarIdList = { player.AvatarManager!.AvatarData.AssistAvatars.Select(x => (uint)x) },
|
||||
DisplayAvatarVec = new DisplayAvatarVec()
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ public class PacketGetRechargeGiftInfoScRsp : BasePacket
|
||||
x.GiftIDList.Select(h => new RechargeGiftData
|
||||
{
|
||||
Status = RechargeGiftStatus.Received,
|
||||
Index = (uint)x.GiftIDList.IndexOf(h),
|
||||
Index = (uint)x.GiftIDList.IndexOf(h)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Recommend;
|
||||
public class PacketGetBigDataRecommendScRsp : BasePacket
|
||||
{
|
||||
public PacketGetBigDataRecommendScRsp(uint avatarId, BigDataRecommendType type)
|
||||
: base(CmdIds.GetBigDataRecommendScRsp)
|
||||
: base(CmdIds.GetBigDataRecommendScRsp)
|
||||
{
|
||||
var proto = new GetBigDataRecommendScRsp
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Recommend;
|
||||
public class PacketRelicSmartWearDeletePlanScRsp : BasePacket
|
||||
{
|
||||
public PacketRelicSmartWearDeletePlanScRsp(uint uniqueId)
|
||||
: base(CmdIds.RelicSmartWearDeletePlanScRsp)
|
||||
: base(CmdIds.RelicSmartWearDeletePlanScRsp)
|
||||
{
|
||||
var proto = new RelicSmartWearDeletePlanScRsp
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Recommend;
|
||||
public class PacketRelicSmartWearGetPlanScRsp : BasePacket
|
||||
{
|
||||
public PacketRelicSmartWearGetPlanScRsp(uint avatarId, List<RelicSmartWearPlan> relicPlan)
|
||||
: base(CmdIds.RelicSmartWearGetPlanScRsp)
|
||||
: base(CmdIds.RelicSmartWearGetPlanScRsp)
|
||||
{
|
||||
var proto = new RelicSmartWearGetPlanScRsp
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Recommend;
|
||||
public class PacketRelicSmartWearUpdatePlanScRsp : BasePacket
|
||||
{
|
||||
public PacketRelicSmartWearUpdatePlanScRsp(RelicSmartWearPlan relicPlan)
|
||||
: base(CmdIds.RelicSmartWearUpdatePlanScRsp)
|
||||
: base(CmdIds.RelicSmartWearUpdatePlanScRsp)
|
||||
{
|
||||
var proto = new RelicSmartWearUpdatePlanScRsp
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ public class PacketHandleRogueCommonPendingActionScRsp : BasePacket
|
||||
{
|
||||
public PacketHandleRogueCommonPendingActionScRsp(int queuePosition, int queueLocation, bool selectBuff = false,
|
||||
bool selectMiracle = false, bool selectBonus = false, bool selectFormula = false,
|
||||
bool reforgeBuff = false, bool selectMagicUnit = false, bool selectScepter = false, bool selectTitanBlessEnhance = false, bool selectTitanBlessType = false,
|
||||
bool reforgeBuff = false, bool selectMagicUnit = false, bool selectScepter = false,
|
||||
bool selectTitanBlessEnhance = false, bool selectTitanBlessType = false,
|
||||
RogueBuffSelectMenu? menu = null) : base(
|
||||
CmdIds.HandleRogueCommonPendingActionScRsp)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,9 @@ public class PacketGetSceneMapInfoScRsp : BasePacket
|
||||
foreach (var section in sections ?? []) mazeMap.LightenSectionList.Add((uint)section);
|
||||
}
|
||||
else
|
||||
{
|
||||
mazeMap.LightenSectionList.AddRange(floorInfo.MapSections.Select(x => (uint)x));
|
||||
}
|
||||
|
||||
rsp.SceneMapInfo.Add(mazeMap);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ public class PacketSceneCastSkillScRsp : BasePacket
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketSceneCastSkillScRsp(Retcode retCode, uint castEntityId, BattleInstance? battle, List<HitMonsterInstance> hitMonsters) :
|
||||
public PacketSceneCastSkillScRsp(Retcode retCode, uint castEntityId, BattleInstance? battle,
|
||||
List<HitMonsterInstance> hitMonsters) :
|
||||
base(CmdIds.SceneCastSkillScRsp)
|
||||
{
|
||||
var proto = new SceneCastSkillScRsp
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Scene;
|
||||
|
||||
public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
{
|
||||
public PacketSceneGroupRefreshScNotify(PlayerInstance player, List<IGameEntity>? addEntity = null, List<IGameEntity>? removeEntity = null)
|
||||
public PacketSceneGroupRefreshScNotify(PlayerInstance player, List<IGameEntity>? addEntity = null,
|
||||
List<IGameEntity>? removeEntity = null)
|
||||
: base(CmdIds.SceneGroupRefreshScNotify)
|
||||
{
|
||||
var proto = new SceneGroupRefreshScNotify
|
||||
@@ -59,7 +60,8 @@ public class PacketSceneGroupRefreshScNotify : BasePacket
|
||||
SetData(proto);
|
||||
}
|
||||
|
||||
public PacketSceneGroupRefreshScNotify(PlayerInstance player, IGameEntity? addEntity = null, IGameEntity? removeEntity = null) :
|
||||
public PacketSceneGroupRefreshScNotify(PlayerInstance player, IGameEntity? addEntity = null,
|
||||
IGameEntity? removeEntity = null) :
|
||||
this(player, addEntity == null ? [] : [addEntity], removeEntity == null ? [] : [removeEntity])
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class PacketTrainPartyBuildDiyScRsp : BasePacket
|
||||
}
|
||||
: new TrainPartyBuildDiyScRsp
|
||||
{
|
||||
AreaId = (uint)area.AreaId,
|
||||
AreaId = (uint)area.AreaId
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
|
||||
@@ -4,7 +4,6 @@ using EggLink.DanhengServer.Data.Custom;
|
||||
using EggLink.DanhengServer.Enums.TournRogue;
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
|
||||
namespace EggLink.DanhengServer.Program.Generator;
|
||||
|
||||
@@ -12,6 +11,7 @@ public static class TournRoomGenerator
|
||||
{
|
||||
public static List<int> AllowedFloorIdList { get; set; } = [80601001, 80602001, 80603001, 80604001];
|
||||
public static List<RogueTournRoomConfig> SavedRoomInstanceList { get; set; } = [];
|
||||
|
||||
public static void GenerateFile(string path)
|
||||
{
|
||||
// get floor info
|
||||
@@ -24,17 +24,16 @@ public static class TournRoomGenerator
|
||||
Dictionary<RogueTournRoomTypeEnum, List<int>> contentGroupId = [];
|
||||
|
||||
var info = GameData.FloorInfoData.Values.First(x => x.FloorID == floorId);
|
||||
foreach (var groupInfo in info.GroupInstanceList.Where(x => !x.IsDelete && x.Name.Contains("RogueModule_Tournament") && !x.Name.Contains("Tpl_")))
|
||||
foreach (var groupInfo in info.GroupInstanceList.Where(x =>
|
||||
!x.IsDelete && x.Name.Contains("RogueModule_Tournament") && !x.Name.Contains("Tpl_")))
|
||||
{
|
||||
if (groupInfo.Name.Contains("_Area"))
|
||||
{
|
||||
if (areaGroupId > 0 && baseModuleId > 0 && contentGroupId.Count > 0)
|
||||
{
|
||||
foreach (var group in contentGroupId)
|
||||
{
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, areaGroupId, baseModuleId, group.Value, group.Key);
|
||||
}
|
||||
}
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, areaGroupId,
|
||||
baseModuleId, group.Value, group.Key);
|
||||
|
||||
contentGroupId.Clear();
|
||||
|
||||
areaGroupId = groupInfo.ID;
|
||||
@@ -44,12 +43,10 @@ public static class TournRoomGenerator
|
||||
if (groupInfo.Name.Contains("_Base"))
|
||||
{
|
||||
if (areaGroupId > 0 && baseModuleId > 0 && contentGroupId.Count > 0)
|
||||
{
|
||||
foreach (var group in contentGroupId)
|
||||
{
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, areaGroupId, baseModuleId, group.Value, group.Key);
|
||||
}
|
||||
}
|
||||
FlushRoom(GameData.MapEntranceData.First(x => x.Value.FloorID == floorId).Key, areaGroupId,
|
||||
baseModuleId, group.Value, group.Key);
|
||||
|
||||
contentGroupId.Clear();
|
||||
|
||||
baseModuleId = groupInfo.ID;
|
||||
@@ -102,22 +99,24 @@ public static class TournRoomGenerator
|
||||
}
|
||||
|
||||
// save
|
||||
File.AppendAllText(path, JsonConvert.SerializeObject(SavedRoomInstanceList, Formatting.Indented), Encoding.UTF8);
|
||||
File.AppendAllText(path, JsonConvert.SerializeObject(SavedRoomInstanceList, Formatting.Indented),
|
||||
Encoding.UTF8);
|
||||
|
||||
// log
|
||||
Logger.GetByClassName().Info($"Generated in {path} Successfully!");
|
||||
}
|
||||
|
||||
public static void FlushRoom(int entranceId, int areaGroupId, int baseGroupId, List<int> contentGroupIds, RogueTournRoomTypeEnum type)
|
||||
public static void FlushRoom(int entranceId, int areaGroupId, int baseGroupId, List<int> contentGroupIds,
|
||||
RogueTournRoomTypeEnum type)
|
||||
{
|
||||
SavedRoomInstanceList.Add(new RogueTournRoomConfig
|
||||
{
|
||||
AnchorGroup = baseGroupId,
|
||||
AnchorId = 1,
|
||||
DefaultLoadBasicGroup = { areaGroupId, baseGroupId},
|
||||
DefaultLoadBasicGroup = { areaGroupId, baseGroupId },
|
||||
DefaultLoadGroup = contentGroupIds,
|
||||
EntranceId = entranceId,
|
||||
RoomType = type,
|
||||
RoomType = type
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,8 @@ public class EntryPoint
|
||||
if (File.Exists(ResourceCache.CachePath))
|
||||
if (ConfigManager.Config.ServerOption.UseCache)
|
||||
{
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadingItem", I18NManager.Translate("Word.Cache")));
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadingItem",
|
||||
I18NManager.Translate("Word.Cache")));
|
||||
isCache = ResourceCache.LoadCache();
|
||||
|
||||
// Clear all game data if cache loading fails
|
||||
@@ -152,13 +153,15 @@ public class EntryPoint
|
||||
|
||||
if (!isCache)
|
||||
{
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadingItem", I18NManager.Translate("Word.GameData")));
|
||||
Logger.Info(I18NManager.Translate("Server.ServerInfo.LoadingItem",
|
||||
I18NManager.Translate("Word.GameData")));
|
||||
ResourceManager.LoadGameData();
|
||||
|
||||
// Async process cache saving
|
||||
if (ConfigManager.Config.ServerOption.UseCache && ResourceCache.IsComplete)
|
||||
{
|
||||
Logger.Warn(I18NManager.Translate("Server.ServerInfo.WaitingItem", I18NManager.Translate("Word.Cache")));
|
||||
Logger.Warn(I18NManager.Translate("Server.ServerInfo.WaitingItem",
|
||||
I18NManager.Translate("Word.Cache")));
|
||||
_ = ResourceCache.SaveCache();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user