Skip to content

Commit

Permalink
Update Repo (#879730c)
Browse files Browse the repository at this point in the history
- Fix Public Issue #10
- Fix Rogue Event
- Correct Technique Point Sync & Better Gacha chance
  • Loading branch information
StopWuyu committed Aug 17, 2024
1 parent bd1f7f3 commit fc0d12a
Show file tree
Hide file tree
Showing 106 changed files with 1,445 additions and 501 deletions.
16 changes: 11 additions & 5 deletions Common/Configuration/ConfigContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ public class ConfigContainer

public class HttpServerConfig
{
public string BindAddress { get; set; } = "0.0.0.0";
public string PublicAddress { get; set; } = "127.0.0.1";
public int PublicPort { get; set; } = 443;
public int Port { get; set; } = 443;
public bool UseSSL { get; set; } = true;

public string GetDisplayAddress()
{
return (UseSSL ? "https" : "http") + "://" + PublicAddress + ":" + PublicPort;
return (UseSSL ? "https" : "http") + "://" + PublicAddress + ":" + Port;
}

public string GetBindDisplayAddress()
{
return (UseSSL ? "https" : "http") + "://" + BindAddress + ":" + Port;
}
}

Expand All @@ -32,16 +38,16 @@ public class KeyStoreConfig

public class GameServerConfig
{
public string BindAddress { get; set; } = "0.0.0.0";
public string PublicAddress { get; set; } = "127.0.0.1";
public uint PublicPort { get; set; } = 23301;
public uint Port { get; set; } = 23301;
public string GameServerId { get; set; } = "dan_heng";
public string GameServerName { get; set; } = "DanhengServer";
public string GameServerDescription { get; set; } = "A re-implementation of StarRail server";
public int KcpInterval { get; set; } = 40;

public string GetDisplayAddress()
{
return PublicAddress + ":" + PublicPort;
return PublicAddress + ":" + Port;
}
}

Expand Down
5 changes: 0 additions & 5 deletions Common/Data/Config/AnchorInfo.cs

This file was deleted.

62 changes: 62 additions & 0 deletions Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using EggLink.DanhengServer.Internationalization;
using EggLink.DanhengServer.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace EggLink.DanhengServer.Data.Config.Rogue;

public class RogueDialogueBaseConfigInfo
{
public string OptionPath { get; set; } = string.Empty;
public string DialoguePath { get; set; } = string.Empty;

public LevelGraphConfigInfo? DialogueInfo { get; set; }
public RogueDialogueEventConfigInfo? OptionInfo { get; set; }

public void Loaded()
{
var logger = Logger.GetByClassName();
if (!string.IsNullOrEmpty(OptionPath))
{
var path = ConfigManager.Config.Path.ResourcePath + "/" + OptionPath;
var file = new FileInfo(path);
if (!file.Exists) return;
try
{
using var reader = file.OpenRead();
using StreamReader reader2 = new(reader);
var text = reader2.ReadToEnd();
var info = JsonConvert.DeserializeObject<RogueDialogueEventConfigInfo>(text);
OptionInfo = info;
}
catch (Exception ex)
{
logger.Error(
I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name,
I18nManager.Translate("Word.Error")), ex);
}
}

if (!string.IsNullOrEmpty(DialoguePath))
{
var path = ConfigManager.Config.Path.ResourcePath + "/" + DialoguePath;
var file = new FileInfo(path);
if (!file.Exists) return;
try
{
using var reader = file.OpenRead();
using StreamReader reader2 = new(reader);
var text = reader2.ReadToEnd().Replace("$type", "Type");
var obj = JObject.Parse(text);
var info = LevelGraphConfigInfo.LoadFromJsonObject(obj);
DialogueInfo = info;
}
catch (Exception ex)
{
logger.Error(
I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name,
I18nManager.Translate("Word.Error")), ex);
}
}
}
}
6 changes: 6 additions & 0 deletions Common/Data/Config/Rogue/RogueDialogueEventConfigInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace EggLink.DanhengServer.Data.Config.Rogue;

public class RogueDialogueEventConfigInfo
{
public List<RogueDialogueEventOptionConfigInfo> OptionList { get; set; } = [];
}
13 changes: 13 additions & 0 deletions Common/Data/Config/Rogue/RogueDialogueEventOptionConfigInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace EggLink.DanhengServer.Data.Config.Rogue;

public class RogueDialogueEventOptionConfigInfo
{
public int OptionID { get; set; }
public int DisplayID { get; set; }
public int SpecialOptionID { get; set; }
public Dictionary<int, RogueDialogueEventOptionDynamicConfigInfo> DynamicMap { get; set; } = [];
public int DescValue { get; set; }
public int DescValue2 { get; set; }
public int DescValue3 { get; set; }
public int DescValue4 { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace EggLink.DanhengServer.Data.Config.Rogue;

public class RogueDialogueEventOptionDynamicConfigInfo
{
public int DisplayID { get; set; }
public int DisplayID2 { get; set; }
}
20 changes: 20 additions & 0 deletions Common/Data/Config/Rogue/RogueNPCConfigInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using EggLink.DanhengServer.Enums.Rogue;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace EggLink.DanhengServer.Data.Config.Rogue;

public class RogueNPCConfigInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public RogueDialogueTypeEnum DialogueType { get; set; }

public List<RogueNPCDialogueConfigInfo> DialogueList { get; set; } = [];

public void Loaded()
{
if (DialogueList.Count == 0) return;

foreach (var info in DialogueList) info.Loaded();
}
}
8 changes: 8 additions & 0 deletions Common/Data/Config/Rogue/RogueNPCDialogueConfigInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace EggLink.DanhengServer.Data.Config.Rogue;

public class RogueNPCDialogueConfigInfo : RogueDialogueBaseConfigInfo
{
public int DialogueProgress { get; set; }
public int UnlockID { get; set; }
public int TalkNameID { get; set; }
}
5 changes: 5 additions & 0 deletions Common/Data/Config/Scene/AnchorInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace EggLink.DanhengServer.Data.Config.Scene;

public class AnchorInfo : PositionInfo
{
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using EggLink.DanhengServer.Enums.Scene;
using Newtonsoft.Json;

namespace EggLink.DanhengServer.Data.Config;
namespace EggLink.DanhengServer.Data.Config.Scene;

public class FloorInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace EggLink.DanhengServer.Data.Config;
namespace EggLink.DanhengServer.Data.Config.Scene;

public class GroupInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace EggLink.DanhengServer.Data.Config;
namespace EggLink.DanhengServer.Data.Config.Scene;

public class MonsterInfo : PositionInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace EggLink.DanhengServer.Data.Config;
namespace EggLink.DanhengServer.Data.Config.Scene;

public class NpcInfo : PositionInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using EggLink.DanhengServer.Util;

namespace EggLink.DanhengServer.Data.Config;
namespace EggLink.DanhengServer.Data.Config.Scene;

public class PositionInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;

namespace EggLink.DanhengServer.Data.Config;
namespace EggLink.DanhengServer.Data.Config.Scene;

public class PropInfo : PositionInfo
{
Expand Down
14 changes: 6 additions & 8 deletions Common/Data/Excel/RogueBuffGroupExcel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,19 @@ public void LoadBuff()
{
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++;
}
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;
Expand Down
10 changes: 4 additions & 6 deletions Common/Data/Excel/RogueDLCAreaExcel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using EggLink.DanhengServer.Enums.Rogue;
using Newtonsoft.Json;

namespace EggLink.DanhengServer.Data.Excel;

Expand All @@ -13,7 +14,7 @@ public class RogueDLCAreaExcel : ExcelResource

public List<RogueDLCAreaScoreMap> AreaScoreMap { get; set; } = [];

[JsonIgnore] public int RogueVersionId { get; set; }
[JsonIgnore] public RogueSubModeEnum RogueVersionId { get; set; }

public override int GetId()
{
Expand All @@ -24,10 +25,7 @@ public override void Loaded()
{
GameData.RogueDLCAreaData[AreaID] = this;

if (SubType.Contains("Nous"))
RogueVersionId = 202;
else
RogueVersionId = 201;
RogueVersionId = SubType.Contains("Nous") ? RogueSubModeEnum.ChessRogueNous : RogueSubModeEnum.ChessRogue;
}
}

Expand Down
31 changes: 0 additions & 31 deletions Common/Data/Excel/RogueNPCDialogueExcel.cs

This file was deleted.

27 changes: 27 additions & 0 deletions Common/Data/Excel/RogueNPCExcel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using EggLink.DanhengServer.Data.Config.Rogue;

namespace EggLink.DanhengServer.Data.Excel;

[ResourceEntity("RogueNPC.json")]
public class RogueNPCExcel : ExcelResource
{
public int RogueNPCID { get; set; }
public string NPCJsonPath { get; set; } = string.Empty;

public RogueNPCConfigInfo? RogueNpcConfig { get; set; }

public override int GetId()
{
return RogueNPCID;
}

public override void Loaded()
{
GameData.RogueNPCData.TryAdd(RogueNPCID, this);
}

public bool CanUseInVer(int version)
{
return RogueNpcConfig != null;
}
}
39 changes: 39 additions & 0 deletions Common/Data/Excel/RogueTournAreaExcel.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading

0 comments on commit fc0d12a

Please sign in to comment.