mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
Build Structure for Divergent Universe
This commit is contained in:
@@ -34,8 +34,8 @@ public class RogueBuffGroupExcel : ExcelResource
|
||||
{
|
||||
if (IsLoaded) return;
|
||||
var count = 0;
|
||||
foreach (var buffID in BuffTagList)
|
||||
if (GameData.RogueBuffData.FirstOrDefault(x => x.Value.RogueBuffTag == buffID).Value is RogueBuffExcel buff)
|
||||
foreach (var buffId in BuffTagList)
|
||||
if (GameData.RogueBuffData.FirstOrDefault(x => x.Value.RogueBuffTag == buffId).Value is RogueBuffExcel buff)
|
||||
{
|
||||
BuffList.SafeAdd(buff);
|
||||
count++;
|
||||
@@ -43,12 +43,10 @@ public class RogueBuffGroupExcel : ExcelResource
|
||||
else
|
||||
{
|
||||
// might is group id
|
||||
if (GameData.RogueBuffGroupData.TryGetValue(buffID, out var group))
|
||||
{
|
||||
group.LoadBuff();
|
||||
BuffList.SafeAddRange(group.BuffList);
|
||||
count++;
|
||||
}
|
||||
if (!GameData.RogueBuffGroupData.TryGetValue(buffId, out var group)) continue;
|
||||
group.LoadBuff();
|
||||
BuffList.SafeAddRange(group.BuffList);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == BuffTagList.Count) IsLoaded = true;
|
||||
|
||||
39
Common/Data/Excel/RogueTournAreaExcel.cs
Normal file
39
Common/Data/Excel/RogueTournAreaExcel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using EggLink.DanhengServer.Enums.TournRogue;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournArea.json")]
|
||||
public class RogueTournAreaExcel : ExcelResource
|
||||
{
|
||||
public List<int> MonsterDisplayItemList { get; set; } = [];
|
||||
public List<int> LayerIDList { get; set; } = [];
|
||||
public List<int> DifficultyIDList { get; set; } = [];
|
||||
public int WorldLevelLimit { get; set; }
|
||||
public int FirstReward { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueTournDifficultyTypeEnum Difficulty { get; set; }
|
||||
public int ExpScoreID { get; set; }
|
||||
public int UnlockID { get; set; }
|
||||
public int AreaID { get; set; }
|
||||
public HashName AreaNameID { get; set; } = new();
|
||||
public bool IsHard { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueTournModeEnum TournMode { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueTournAreaGroupIDEnum AreaGroupID { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return AreaID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournAreaData.TryAdd(AreaID, this);
|
||||
}
|
||||
}
|
||||
28
Common/Data/Excel/RogueTournBuffExcel.cs
Normal file
28
Common/Data/Excel/RogueTournBuffExcel.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using EggLink.DanhengServer.Enums.Rogue;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournBuff.json")]
|
||||
public class RogueTournBuffExcel : ExcelResource
|
||||
{
|
||||
public int MazeBuffID { get; set; }
|
||||
public int MazeBuffLevel { get; set; }
|
||||
public int RogueBuffType { get; set; }
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueBuffCategoryEnum RogueBuffCategory { get; set; }
|
||||
public int RogueBuffTag { get; set; }
|
||||
|
||||
public bool IsInHandbook { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return MazeBuffID * 100 + MazeBuffLevel;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournBuffData.TryAdd(GetId(), this);
|
||||
}
|
||||
}
|
||||
53
Common/Data/Excel/RogueTournBuffGroupExcel.cs
Normal file
53
Common/Data/Excel/RogueTournBuffGroupExcel.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using EggLink.DanhengServer.Util;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournBuffGroup.json")]
|
||||
public class RogueTournBuffGroupExcel : ExcelResource
|
||||
{
|
||||
public int RogueBuffGroupID { get; set; }
|
||||
public List<int> RogueBuffDrop { get; set; } = [];
|
||||
|
||||
[JsonIgnore] public List<RogueTournBuffExcel> BuffList { get; set; } = [];
|
||||
[JsonIgnore] public bool IsLoaded { get; set; }
|
||||
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return RogueBuffGroupID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournBuffGroupData.Add(GetId(), this);
|
||||
LoadBuff();
|
||||
}
|
||||
|
||||
public override void AfterAllDone()
|
||||
{
|
||||
LoadBuff();
|
||||
}
|
||||
|
||||
public void LoadBuff()
|
||||
{
|
||||
if (IsLoaded) return;
|
||||
var count = 0;
|
||||
foreach (var buffId in RogueBuffDrop)
|
||||
if (GameData.RogueTournBuffData.FirstOrDefault(x => x.Value.RogueBuffTag == buffId).Value is { } buff)
|
||||
{
|
||||
BuffList.SafeAdd(buff);
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// might is group id
|
||||
if (!GameData.RogueTournBuffGroupData.TryGetValue(buffId, out var group)) continue;
|
||||
group.LoadBuff();
|
||||
BuffList.SafeAddRange(group.BuffList);
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count == RogueBuffDrop.Count) IsLoaded = true;
|
||||
}
|
||||
}
|
||||
18
Common/Data/Excel/RogueTournDifficultyCompExcel.cs
Normal file
18
Common/Data/Excel/RogueTournDifficultyCompExcel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournDifficultyComp.json")]
|
||||
public class RogueTournDifficultyCompExcel : ExcelResource
|
||||
{
|
||||
public int DifficultyCompID { get; set; }
|
||||
public int Level { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return DifficultyCompID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournDifficultyCompData.TryAdd(DifficultyCompID, this);
|
||||
}
|
||||
}
|
||||
39
Common/Data/Excel/RogueTournFormulaExcel.cs
Normal file
39
Common/Data/Excel/RogueTournFormulaExcel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using EggLink.DanhengServer.Enums.TournRogue;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournFormula.json")]
|
||||
public class RogueTournFormulaExcel : ExcelResource
|
||||
{
|
||||
public string FormulaIcon{ get; set; }
|
||||
public string UltraFormulaIcon { get; set; }
|
||||
public string FormulaSubIcon { get; set; }
|
||||
public string FormulaStoryJson { get; set; }
|
||||
public int MazeBuffID { get; set; }
|
||||
public int SubBuffNum { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueTournModeEnum TournMode { get; set; }
|
||||
public int UnlockDisplayID { get; set; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public RogueFormulaCategoryEnum FormulaCategory { get; set; }
|
||||
public bool IsInHandbook { get; set; }
|
||||
public int MainBuffTypeID { get; set; }
|
||||
public int FormulaDisplayID { get; set; }
|
||||
public int FormulaID { get; set; }
|
||||
public int MainBuffNum { get; set; }
|
||||
public int SubBuffTypeID { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return FormulaID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournFormulaData.TryAdd(GetId(), this);
|
||||
}
|
||||
}
|
||||
17
Common/Data/Excel/RogueTournHandBookEventExcel.cs
Normal file
17
Common/Data/Excel/RogueTournHandBookEventExcel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournHandBookEvent.json")]
|
||||
public class RogueTournHandBookEventExcel : ExcelResource
|
||||
{
|
||||
public int EventHandbookID { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return EventHandbookID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournHandBookEventData.TryAdd(GetId(), this);
|
||||
}
|
||||
}
|
||||
18
Common/Data/Excel/RogueTournHandbookMiracleExcel.cs
Normal file
18
Common/Data/Excel/RogueTournHandbookMiracleExcel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournHandbookMiracle.json")]
|
||||
public class RogueTournHandbookMiracleExcel : ExcelResource
|
||||
{
|
||||
public int HandbookMiracleID { get; set; }
|
||||
public int MiracleDisplayID { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return HandbookMiracleID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournHandbookMiracleData.TryAdd(GetId(), this);
|
||||
}
|
||||
}
|
||||
17
Common/Data/Excel/RogueTournHexAvatarBaseTypeExcel.cs
Normal file
17
Common/Data/Excel/RogueTournHexAvatarBaseTypeExcel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournHexAvatarBaseType.json")]
|
||||
public class RogueTournHexAvatarBaseTypeExcel : ExcelResource
|
||||
{
|
||||
public int MiracleID { get; set; }
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return MiracleID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournHexAvatarBaseTypeData.TryAdd(MiracleID, this);
|
||||
}
|
||||
}
|
||||
18
Common/Data/Excel/RogueTournPermanentTalentExcel.cs
Normal file
18
Common/Data/Excel/RogueTournPermanentTalentExcel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace EggLink.DanhengServer.Data.Excel;
|
||||
|
||||
[ResourceEntity("RogueTournPermanentTalent.json")]
|
||||
public class RogueTournPermanentTalentExcel : ExcelResource
|
||||
{
|
||||
public int TalentID { get; set; }
|
||||
public List<int> NextTalentIDList { get; set; } = [];
|
||||
|
||||
public override int GetId()
|
||||
{
|
||||
return TalentID;
|
||||
}
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.RogueTournPermanentTalentData.TryAdd(TalentID, this);
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,20 @@ public static class GameData
|
||||
|
||||
#endregion
|
||||
|
||||
#region TournRogue
|
||||
|
||||
public static Dictionary<int, RogueTournAreaExcel> RogueTournAreaData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournBuffExcel> RogueTournBuffData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournFormulaExcel> RogueTournFormulaData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournBuffGroupExcel> RogueTournBuffGroupData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournHexAvatarBaseTypeExcel> RogueTournHexAvatarBaseTypeData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournHandBookEventExcel> RogueTournHandBookEventData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournHandbookMiracleExcel> RogueTournHandbookMiracleData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournDifficultyCompExcel> RogueTournDifficultyCompData { get; private set; } = [];
|
||||
public static Dictionary<int, RogueTournPermanentTalentExcel> RogueTournPermanentTalentData { get; private set; } = [];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Actions
|
||||
|
||||
public static void GetFloorInfo(int planeId, int floorId, out FloorInfo outer)
|
||||
|
||||
@@ -43,29 +43,30 @@ public class ResourceManager
|
||||
var resList = new List<ExcelResource>();
|
||||
foreach (var cls in classes)
|
||||
{
|
||||
var attribute = (ResourceEntity)Attribute.GetCustomAttribute(cls, typeof(ResourceEntity))!;
|
||||
var attribute = (ResourceEntity?)Attribute.GetCustomAttribute(cls, typeof(ResourceEntity));
|
||||
|
||||
if (attribute != null)
|
||||
{
|
||||
var resource = (ExcelResource)Activator.CreateInstance(cls)!;
|
||||
var count = 0;
|
||||
foreach (var fileName in attribute.FileName)
|
||||
try
|
||||
if (attribute == null) continue;
|
||||
var resource = (ExcelResource)Activator.CreateInstance(cls)!;
|
||||
var count = 0;
|
||||
foreach (var fileName in attribute.FileName)
|
||||
try
|
||||
{
|
||||
var path = ConfigManager.Config.Path.ResourcePath + "/ExcelOutput/" + fileName;
|
||||
var file = new FileInfo(path);
|
||||
if (!file.Exists)
|
||||
{
|
||||
var path = ConfigManager.Config.Path.ResourcePath + "/ExcelOutput/" + fileName;
|
||||
var file = new FileInfo(path);
|
||||
if (!file.Exists)
|
||||
{
|
||||
Logger.Error(I18nManager.Translate("Server.ServerInfo.FailedToReadItem", fileName,
|
||||
I18nManager.Translate("Word.NotFound")));
|
||||
continue;
|
||||
}
|
||||
Logger.Error(I18nManager.Translate("Server.ServerInfo.FailedToReadItem", fileName,
|
||||
I18nManager.Translate("Word.NotFound")));
|
||||
continue;
|
||||
}
|
||||
|
||||
var json = file.OpenText().ReadToEnd();
|
||||
using (var reader = new JsonTextReader(new StringReader(json)))
|
||||
var json = file.OpenText().ReadToEnd();
|
||||
using (var reader = new JsonTextReader(new StringReader(json)))
|
||||
{
|
||||
reader.Read();
|
||||
switch (reader.TokenType)
|
||||
{
|
||||
reader.Read();
|
||||
if (reader.TokenType == JsonToken.StartArray)
|
||||
case JsonToken.StartArray:
|
||||
{
|
||||
// array
|
||||
var jArray = JArray.Parse(json);
|
||||
@@ -76,15 +77,15 @@ public class ResourceManager
|
||||
((ExcelResource?)res)?.Loaded();
|
||||
count++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (reader.TokenType == JsonToken.StartObject)
|
||||
case JsonToken.StartObject:
|
||||
{
|
||||
// dictionary
|
||||
var jObject = JObject.Parse(json);
|
||||
foreach (var item in jObject)
|
||||
foreach (var (_, obj) in jObject)
|
||||
{
|
||||
var id = int.Parse(item.Key);
|
||||
var obj = item.Value;
|
||||
var instance = JsonConvert.DeserializeObject(obj!.ToString(), cls);
|
||||
|
||||
if (((ExcelResource?)instance)?.GetId() == 0 || (ExcelResource?)instance == null)
|
||||
@@ -103,26 +104,28 @@ public class ResourceManager
|
||||
}
|
||||
else
|
||||
{
|
||||
resList.Add((ExcelResource)instance!);
|
||||
resList.Add((ExcelResource)instance);
|
||||
((ExcelResource)instance).Loaded();
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
resource.Finalized();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(
|
||||
I18nManager.Translate("Server.ServerInfo.FailedToReadItem", fileName,
|
||||
I18nManager.Translate("Word.Error")), ex);
|
||||
}
|
||||
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", count.ToString(), cls.Name));
|
||||
}
|
||||
resource.Finalized();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(
|
||||
I18nManager.Translate("Server.ServerInfo.FailedToReadItem", fileName,
|
||||
I18nManager.Translate("Word.Error")), ex);
|
||||
}
|
||||
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", count.ToString(), cls.Name));
|
||||
}
|
||||
|
||||
foreach (var cls in resList) cls.AfterAllDone();
|
||||
@@ -189,11 +192,8 @@ public class ResourceManager
|
||||
using StreamReader graphReader2 = new(graphReader);
|
||||
var graphText = graphReader2.ReadToEnd().Replace("$type", "Type");
|
||||
var graphObj = JObject.Parse(graphText);
|
||||
if (graphObj != null)
|
||||
{
|
||||
var graphInfo = LevelGraphConfigInfo.LoadFromJsonObject(graphObj);
|
||||
group.LevelGraphConfig = graphInfo;
|
||||
}
|
||||
var graphInfo = LevelGraphConfigInfo.LoadFromJsonObject(graphObj);
|
||||
group.LevelGraphConfig = graphInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,16 +250,6 @@ public class ResourceManager
|
||||
if (missionInfo != null)
|
||||
{
|
||||
GameData.MainMissionData[missionExcel.Key].MissionInfo = missionInfo;
|
||||
foreach (var subMission in missionInfo.SubMissionList)
|
||||
{
|
||||
// load mission json
|
||||
var missionJsonPath = ConfigManager.Config.Path.ResourcePath + "/" + subMission.MissionJsonPath;
|
||||
if (File.Exists(missionJsonPath))
|
||||
{
|
||||
var missionJson = File.ReadAllText(missionJsonPath).Replace("$type", "Type");
|
||||
}
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
else
|
||||
@@ -302,19 +292,28 @@ public class ResourceManager
|
||||
Logger.Error("Error in reading " + file.Name, ex);
|
||||
}
|
||||
|
||||
if (customFile is Dictionary<int, int> d)
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", d.Count.ToString(), filetype));
|
||||
else if (customFile is Dictionary<int, List<int>> di)
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", di.Count.ToString(), filetype));
|
||||
else if (customFile is BannersConfig c)
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", c.Banners.Count.ToString(), filetype));
|
||||
else if (customFile is RogueMiracleEffectConfig r)
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", r.Miracles.Count.ToString(), filetype));
|
||||
else if (customFile is ActivityConfig a)
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", a.ScheduleData.Count.ToString(),
|
||||
filetype));
|
||||
else
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItem", filetype));
|
||||
switch (customFile)
|
||||
{
|
||||
case Dictionary<int, int> d:
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", d.Count.ToString(), filetype));
|
||||
break;
|
||||
case Dictionary<int, List<int>> di:
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", di.Count.ToString(), filetype));
|
||||
break;
|
||||
case BannersConfig c:
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", c.Banners.Count.ToString(), filetype));
|
||||
break;
|
||||
case RogueMiracleEffectConfig r:
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", r.Miracles.Count.ToString(), filetype));
|
||||
break;
|
||||
case ActivityConfig a:
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItems", a.ScheduleData.Count.ToString(),
|
||||
filetype));
|
||||
break;
|
||||
default:
|
||||
Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadedItem", filetype));
|
||||
break;
|
||||
}
|
||||
|
||||
return customFile;
|
||||
}
|
||||
@@ -421,12 +420,9 @@ public class ResourceManager
|
||||
using StreamReader reader2 = new(reader);
|
||||
var text = reader2.ReadToEnd().Replace("$type", "Type");
|
||||
var obj = JObject.Parse(text);
|
||||
if (obj != null)
|
||||
{
|
||||
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
performance.ActInfo = info;
|
||||
count++;
|
||||
}
|
||||
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
performance.ActInfo = info;
|
||||
count++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -453,12 +449,9 @@ public class ResourceManager
|
||||
using StreamReader reader2 = new(reader);
|
||||
var text = reader2.ReadToEnd().Replace("$type", "Type");
|
||||
var obj = JObject.Parse(text);
|
||||
if (obj != null)
|
||||
{
|
||||
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
performance.ActInfo = info;
|
||||
count++;
|
||||
}
|
||||
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
performance.ActInfo = info;
|
||||
count++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -496,12 +489,9 @@ public class ResourceManager
|
||||
using StreamReader reader2 = new(reader);
|
||||
var text = reader2.ReadToEnd().Replace("$type", "Type");
|
||||
var obj = JObject.Parse(text);
|
||||
if (obj != null)
|
||||
{
|
||||
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
subMission.SubMissionTaskInfo = info;
|
||||
count++;
|
||||
}
|
||||
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
|
||||
subMission.SubMissionTaskInfo = info;
|
||||
count++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -599,39 +589,37 @@ public class ResourceManager
|
||||
customFile = json;
|
||||
|
||||
foreach (var room in customFile!)
|
||||
if (room.BlockType == RogueDLCBlockTypeEnum.MonsterNormal)
|
||||
switch (room.BlockType)
|
||||
{
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterNormal, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterSwarm, room);
|
||||
count += 2;
|
||||
}
|
||||
else if (room.BlockType == RogueDLCBlockTypeEnum.MonsterBoss)
|
||||
{
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterBoss, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterNousBoss, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterSwarmBoss, room);
|
||||
count += 3;
|
||||
}
|
||||
else if (room.BlockType == RogueDLCBlockTypeEnum.Event)
|
||||
{
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Event, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Reward, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Adventure, room); // adventure is not this type
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.NousSpecialEvent, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.SwarmEvent, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.NousEvent, room);
|
||||
count += 6;
|
||||
}
|
||||
else if (room.BlockType == RogueDLCBlockTypeEnum.Trade)
|
||||
{
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Trade, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.BlackMarket, room);
|
||||
count += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRoomToGameData(room.BlockType, room);
|
||||
count++;
|
||||
case RogueDLCBlockTypeEnum.MonsterNormal:
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterNormal, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterSwarm, room);
|
||||
count += 2;
|
||||
break;
|
||||
case RogueDLCBlockTypeEnum.MonsterBoss:
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterBoss, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterNousBoss, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.MonsterSwarmBoss, room);
|
||||
count += 3;
|
||||
break;
|
||||
case RogueDLCBlockTypeEnum.Event:
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Event, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Reward, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Adventure, room); // adventure is not this type
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.NousSpecialEvent, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.SwarmEvent, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.NousEvent, room);
|
||||
count += 6;
|
||||
break;
|
||||
case RogueDLCBlockTypeEnum.Trade:
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.Trade, room);
|
||||
AddRoomToGameData(RogueDLCBlockTypeEnum.BlackMarket, room);
|
||||
count += 2;
|
||||
break;
|
||||
default:
|
||||
AddRoomToGameData(room.BlockType, room);
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
10
Common/Enums/TournRogue/RogueFormulaCategoryEnum.cs
Normal file
10
Common/Enums/TournRogue/RogueFormulaCategoryEnum.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace EggLink.DanhengServer.Enums.TournRogue;
|
||||
|
||||
public enum RogueFormulaCategoryEnum
|
||||
{
|
||||
Common = 1,
|
||||
Rare = 2,
|
||||
Epic = 3,
|
||||
Legendary = 4,
|
||||
PathEcho = 5
|
||||
}
|
||||
9
Common/Enums/TournRogue/RogueTournAreaGroupIDEnum.cs
Normal file
9
Common/Enums/TournRogue/RogueTournAreaGroupIDEnum.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace EggLink.DanhengServer.Enums.TournRogue;
|
||||
|
||||
public enum RogueTournAreaGroupIDEnum
|
||||
{
|
||||
None = 0,
|
||||
Guide = 1,
|
||||
Formal = 2,
|
||||
WeekChallenge = 3
|
||||
}
|
||||
11
Common/Enums/TournRogue/RogueTournDifficultyTypeEnum.cs
Normal file
11
Common/Enums/TournRogue/RogueTournDifficultyTypeEnum.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace EggLink.DanhengServer.Enums.TournRogue;
|
||||
|
||||
public enum RogueTournDifficultyTypeEnum
|
||||
{
|
||||
None = 0,
|
||||
Difficulty_1 = 1,
|
||||
Difficulty_2 = 2,
|
||||
Difficulty_3 = 3,
|
||||
Difficulty_4 = 4,
|
||||
Difficulty_5 = 5
|
||||
}
|
||||
8
Common/Enums/TournRogue/RogueTournModeEnum.cs
Normal file
8
Common/Enums/TournRogue/RogueTournModeEnum.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace EggLink.DanhengServer.Enums.TournRogue;
|
||||
|
||||
public enum RogueTournModeEnum
|
||||
{
|
||||
Permanent = 0,
|
||||
Tourn1 = 1,
|
||||
Tourn2 = 2
|
||||
}
|
||||
@@ -31,57 +31,57 @@ public class ChallengeManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
return;
|
||||
}
|
||||
|
||||
var Excel = value;
|
||||
var excel = value;
|
||||
|
||||
// Sanity check lineups
|
||||
if (Excel.StageNum > 0)
|
||||
if (excel.StageNum > 0)
|
||||
{
|
||||
// Get lineup
|
||||
var Lineup = Player.LineupManager!.GetExtraLineup(ExtraLineupType.LineupChallenge)!;
|
||||
var lineup = Player.LineupManager!.GetExtraLineup(ExtraLineupType.LineupChallenge)!;
|
||||
|
||||
// Make sure this lineup has avatars set
|
||||
if (Lineup.AvatarData!.Avatars.Count == 0)
|
||||
if (lineup.AvatarData!.Avatars.Count == 0)
|
||||
{
|
||||
await Player.SendPacket(new PacketStartChallengeScRsp((uint)Retcode.RetChallengeLineupEmpty));
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset hp/sp
|
||||
foreach (var avatar in Lineup.AvatarData!.Avatars)
|
||||
foreach (var avatar in lineup.AvatarData!.Avatars)
|
||||
{
|
||||
avatar.SetCurHp(10000, true);
|
||||
avatar.SetCurSp(avatar.GetCurSp(true) / 2, true);
|
||||
avatar.SetCurSp(5000, true);
|
||||
}
|
||||
|
||||
// Set technique points to full
|
||||
Lineup.Mp = 5; // Max Mp
|
||||
lineup.Mp = 5; // Max Mp
|
||||
}
|
||||
|
||||
if (Excel.StageNum >= 2)
|
||||
if (excel.StageNum >= 2)
|
||||
{
|
||||
// Get lineup
|
||||
var Lineup = Player.LineupManager!.GetExtraLineup(ExtraLineupType.LineupChallenge2)!;
|
||||
var lineup = Player.LineupManager!.GetExtraLineup(ExtraLineupType.LineupChallenge2)!;
|
||||
|
||||
// Make sure this lineup has avatars set
|
||||
if (Lineup.AvatarData!.Avatars.Count == 0)
|
||||
if (lineup.AvatarData!.Avatars.Count == 0)
|
||||
{
|
||||
await Player.SendPacket(new PacketStartChallengeScRsp((uint)Retcode.RetChallengeLineupEmpty));
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset hp/sp
|
||||
foreach (var avatar in Lineup.AvatarData!.Avatars)
|
||||
foreach (var avatar in lineup.AvatarData!.Avatars)
|
||||
{
|
||||
avatar.SetCurHp(10000, true);
|
||||
avatar.SetCurSp(avatar.GetCurSp(true) / 2, true);
|
||||
avatar.SetCurSp(5000, true);
|
||||
}
|
||||
|
||||
// Set technique points to full
|
||||
Lineup.Mp = 5; // Max Mp
|
||||
lineup.Mp = 5; // Max Mp
|
||||
}
|
||||
|
||||
// Set challenge data for player
|
||||
ChallengeInstance instance = new(Player, Excel);
|
||||
ChallengeInstance instance = new(Player, excel);
|
||||
ChallengeInstance = instance;
|
||||
|
||||
// Set first lineup before we enter scenes
|
||||
@@ -90,7 +90,7 @@ public class ChallengeManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
// Enter scene
|
||||
try
|
||||
{
|
||||
await Player.EnterScene(Excel.MapEntranceID, 0, false);
|
||||
await Player.EnterScene(excel.MapEntranceID, 0, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -107,7 +107,7 @@ public class ChallengeManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
instance.StartRot = Player.Data.Rot!;
|
||||
instance.SavedMp = Player.LineupManager.GetCurLineup()!.Mp;
|
||||
|
||||
if (Excel.IsStory() && storyBuffs != null)
|
||||
if (excel.IsStory() && storyBuffs != null)
|
||||
{
|
||||
instance.StoryBuffs.Add((int)storyBuffs.BuffOne);
|
||||
instance.StoryBuffs.Add((int)storyBuffs.BuffTwo);
|
||||
|
||||
@@ -23,6 +23,7 @@ using EggLink.DanhengServer.GameServer.Game.Mission;
|
||||
using EggLink.DanhengServer.GameServer.Game.Quest;
|
||||
using EggLink.DanhengServer.GameServer.Game.Raid;
|
||||
using EggLink.DanhengServer.GameServer.Game.Rogue;
|
||||
using EggLink.DanhengServer.GameServer.Game.RogueTourn;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene;
|
||||
using EggLink.DanhengServer.GameServer.Game.Scene.Entity;
|
||||
using EggLink.DanhengServer.GameServer.Game.Shop;
|
||||
@@ -61,6 +62,7 @@ public class PlayerInstance(PlayerData data)
|
||||
public FriendManager? FriendManager { get; private set; }
|
||||
public RogueManager? RogueManager { get; private set; }
|
||||
public ChessRogueManager? ChessRogueManager { get; private set; }
|
||||
public RogueTournManager? RogueTournManager { get; private set; }
|
||||
public ShopService? ShopService { get; private set; }
|
||||
public ChallengeManager? ChallengeManager { get; private set; }
|
||||
|
||||
@@ -138,6 +140,7 @@ public class PlayerInstance(PlayerData data)
|
||||
RogueManager = new RogueManager(this);
|
||||
ShopService = new ShopService(this);
|
||||
ChessRogueManager = new ChessRogueManager(this);
|
||||
RogueTournManager = new RogueTournManager(this);
|
||||
ChallengeManager = new ChallengeManager(this);
|
||||
TaskManager = new TaskManager(this);
|
||||
RaidManager = new RaidManager(this);
|
||||
|
||||
131
GameServer/Game/RogueTourn/RogueTournManager.cs
Normal file
131
GameServer/Game/RogueTourn/RogueTournManager.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using EggLink.DanhengServer.Data;
|
||||
using EggLink.DanhengServer.Enums.TournRogue;
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.GameServer.Game.Rogue;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Game.RogueTourn;
|
||||
|
||||
public class RogueTournManager(PlayerInstance player) : BasePlayerManager(player)
|
||||
{
|
||||
#region Serialization
|
||||
|
||||
public RogueTournInfo ToProto()
|
||||
{
|
||||
var proto = new RogueTournInfo
|
||||
{
|
||||
ExtraScoreInfo = ToExtraScoreProto(),
|
||||
InspirationCircuit = ToInspirationCircuitProto(),
|
||||
RogueSeasonInfo = ToSeasonProto(),
|
||||
RogueTournAreaInfo = { ToAreaProtoList() },
|
||||
RogueTournDifficultyInfo = { ToDifficultyProtoList() },
|
||||
RogueTournExpInfo = ToExpProto(),
|
||||
RogueTournHandbook = ToHandbookProto(),
|
||||
RogueTournSaveList =
|
||||
{
|
||||
Capacity = 0
|
||||
}
|
||||
};
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
public ExtraScoreInfo ToExtraScoreProto()
|
||||
{
|
||||
return new ExtraScoreInfo
|
||||
{
|
||||
EndTime = RogueManager.GetCurrentRogueTime().Item2,
|
||||
Week = 1
|
||||
};
|
||||
}
|
||||
|
||||
public InspirationCircuitInfo ToInspirationCircuitProto()
|
||||
{
|
||||
return new InspirationCircuitInfo
|
||||
{
|
||||
TalentInfoList = new RogueTalentInfoList
|
||||
{
|
||||
TalentInfo = { GameData.RogueTournPermanentTalentData.Values.Select(x => new RogueTalentInfo
|
||||
{
|
||||
TalentId = (uint)x.TalentID,
|
||||
Status = RogueTalentStatus.Enable
|
||||
}) }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public RogueTournSeasonInfo ToSeasonProto()
|
||||
{
|
||||
return new RogueTournSeasonInfo
|
||||
{
|
||||
SubTournId = 1,
|
||||
MainTournId = 1
|
||||
};
|
||||
}
|
||||
|
||||
public List<RogueTournAreaInfo> ToAreaProtoList()
|
||||
{
|
||||
return (from areaExcel in GameData.RogueTournAreaData
|
||||
where areaExcel.Value.AreaGroupID != RogueTournAreaGroupIDEnum.WeekChallenge
|
||||
select new RogueTournAreaInfo
|
||||
{ AreaId = (uint)areaExcel.Value.AreaID, IsFinish = true, IsTakenReward = true, IsUnlock = true })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<RogueTournDifficultyInfo> ToDifficultyProtoList()
|
||||
{
|
||||
return (from difficultyExcel in GameData.RogueTournDifficultyCompData.Values
|
||||
select new RogueTournDifficultyInfo
|
||||
{ DifficultyId = (uint)difficultyExcel.DifficultyCompID, IsUnlock = true }).ToList();
|
||||
}
|
||||
|
||||
public RogueTournExpInfo ToExpProto()
|
||||
{
|
||||
return new RogueTournExpInfo
|
||||
{
|
||||
Exp = 0,
|
||||
TakenLevelRewards =
|
||||
{
|
||||
Capacity = 0
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public RogueTournHandbookInfo ToHandbookProto()
|
||||
{
|
||||
var proto = new RogueTournHandbookInfo
|
||||
{
|
||||
ONPBIAFFJJK = 1
|
||||
};
|
||||
|
||||
foreach (var hexAvatar in GameData.RogueTournHexAvatarBaseTypeData.Keys)
|
||||
{
|
||||
proto.HandbookAvatarBaseList.Add((uint)hexAvatar);
|
||||
}
|
||||
|
||||
foreach (var buff in GameData.RogueTournBuffData.Values)
|
||||
{
|
||||
if (buff.IsInHandbook)
|
||||
proto.HandbookBuffList.Add((uint)buff.MazeBuffID);
|
||||
}
|
||||
|
||||
foreach (var formulaId in GameData.RogueTournFormulaData.Keys)
|
||||
{
|
||||
proto.HandbookFormulaList.Add((uint)formulaId);
|
||||
}
|
||||
|
||||
foreach (var miracleId in GameData.RogueTournHandbookMiracleData.Keys)
|
||||
{
|
||||
proto.HandbookMiracleList.Add((uint)miracleId);
|
||||
}
|
||||
|
||||
foreach (var eventId in GameData.RogueTournHandBookEventData.Keys)
|
||||
{
|
||||
proto.TakeHandbookRewardList.Add((uint)eventId); // should be HandbookEventList
|
||||
}
|
||||
|
||||
return proto;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.RogueTourn;
|
||||
|
||||
[Opcode(CmdIds.GetRogueCollectionCsReq)]
|
||||
public class HandlerGetRogueCollectionCsReq : Handler
|
||||
{
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
await connection.SendPacket(CmdIds.GetRogueCollectionScRsp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.RogueTourn;
|
||||
|
||||
[Opcode(CmdIds.RogueTournGetArchiveRepositoryCsReq)]
|
||||
public class HandlerRogueTournGetArchiveRepositoryCsReq : Handler
|
||||
{
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
await connection.SendPacket(CmdIds.RogueTournGetArchiveRepositoryScRsp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueTourn;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.RogueTourn;
|
||||
|
||||
[Opcode(CmdIds.RogueTournGetPermanentTalentInfoCsReq)]
|
||||
public class HandlerRogueTournGetPermanentTalentInfoCsReq : Handler
|
||||
{
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
await connection.SendPacket(new PacketRogueTournGetPermanentTalentInfoScRsp(connection.Player!));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueTourn;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.RogueTourn;
|
||||
|
||||
[Opcode(CmdIds.RogueTournQueryCsReq)]
|
||||
public class HandlerRogueTournQueryCsReq : Handler
|
||||
{
|
||||
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
|
||||
{
|
||||
await connection.SendPacket(new PacketRogueTournQueryScRsp(connection.Player!));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueTourn;
|
||||
|
||||
public class PacketRogueTournGetPermanentTalentInfoScRsp : BasePacket
|
||||
{
|
||||
public PacketRogueTournGetPermanentTalentInfoScRsp(PlayerInstance player) : base(
|
||||
CmdIds.RogueTournGetPermanentTalentInfoScRsp)
|
||||
{
|
||||
var proto = new RogueTournGetPermanentTalentInfoScRsp
|
||||
{
|
||||
InspirationCircuit = player.RogueTournManager!.ToInspirationCircuitProto()
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using EggLink.DanhengServer.GameServer.Game.Player;
|
||||
using EggLink.DanhengServer.Kcp;
|
||||
using EggLink.DanhengServer.Proto;
|
||||
|
||||
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.RogueTourn;
|
||||
|
||||
public class PacketRogueTournQueryScRsp : BasePacket
|
||||
{
|
||||
public PacketRogueTournQueryScRsp(PlayerInstance player) : base(CmdIds.RogueTournQueryScRsp)
|
||||
{
|
||||
var proto = new RogueTournQueryScRsp
|
||||
{
|
||||
RogueGetInfo = player.RogueTournManager!.ToProto()
|
||||
};
|
||||
|
||||
SetData(proto);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user