feat: add handbook

This commit is contained in:
Naruse
2025-06-17 20:56:35 +08:00
parent 6fbeb1d34d
commit 8d4c1f028f
5 changed files with 71 additions and 3 deletions

View File

@@ -10,8 +10,8 @@ public class AvatarDataExcel : ExcelResource
[JsonPropertyName("initialWeapon")] public int InitialWeapon { get; set; }
[JsonPropertyName("skillList")] public List<int> SkillList { get; set; } = [];
public string FaceAnimationGroupName { get; set; } = "";
public int DefaultDressId { get; set; }
[JsonPropertyName("fullName")] public HashName FullName { get; set; } = new();
public override int GetId()
{
@@ -27,3 +27,8 @@ public class AvatarDataExcel : ExcelResource
}
}
public class HashName
{
public long hash { get; set; } = 0;
}

View File

@@ -8,6 +8,7 @@ public class ElfAstraMateDataExcel : ExcelResource
public int ElfID { get; set; }
public int MaxLevel { get; set; }
public int MaxRarity { get; set; }
public HashName FullName { get; set; } = new();
[JsonIgnore] public List<ElfSkillDataExcel> SkillList = [];

View File

@@ -13,6 +13,7 @@ public class StigmataDataExcel : ExcelResource
[JsonPropertyName("quality")] public int Quality { get; set; }
[JsonPropertyName("isSecurityProtect")] public bool IsSecurityProtect { get; set; }
[JsonPropertyName("protect")] public bool Protect { get; set; }
[JsonPropertyName("displayTitle")] public HashName DisplayTitle { get; set; } = new();
public override int GetId()
{

View File

@@ -12,6 +12,7 @@ public class WeaponDataExcel : ExcelResource
[JsonPropertyName("maxRarity")] public int MaxRarity { get; set; }
[JsonPropertyName("evoID")] public int EvoID { get; set; }
[JsonPropertyName("protect")] public bool Protect { get; set; }
[JsonPropertyName("displayTitle")] public HashName DisplayTitle { get; set; } = new();
public override int GetId()
{

View File

@@ -49,15 +49,19 @@ public static class HandbookGenerator
return;
}
List<TextMapEntry> textMap = JsonConvert.DeserializeObject<List<TextMapEntry>>(File.ReadAllText(textMapPath))!;
List<TextMapEntry> textMapList = JsonConvert.DeserializeObject<List<TextMapEntry>>(File.ReadAllText(textMapPath))!;
if (textMap == null)
if (textMapList == null)
{
Logger.GetByClassName().Error(I18NManager.Translate("Server.ServerInfo.FailedToReadItem", textMapPath,
I18NManager.Translate("Word.Error")));
return;
}
Dictionary<long, string> textMap = [];
foreach (var map in textMapList) textMap.Add(map.Value!.Hash, map.Text!);
var builder = new StringBuilder();
builder.AppendLine("#Handbook generated in " + DateTime.Now.ToString("yyyy/MM/dd HH:mm"));
builder.AppendLine();
@@ -65,6 +69,26 @@ public static class HandbookGenerator
builder.AppendLine();
GenerateCmd(builder, lang);
builder.AppendLine();
builder.AppendLine("#Valkyrie");
builder.AppendLine();
GenerateValk(builder, textMap);
builder.AppendLine();
builder.AppendLine("#Elf");
builder.AppendLine();
GenerateElf(builder, textMap);
builder.AppendLine();
builder.AppendLine("#Stigmata");
builder.AppendLine();
GenerateStigmata(builder, textMap);
builder.AppendLine();
builder.AppendLine("#Weapon");
builder.AppendLine();
GenerateWeapon(builder, textMap);
builder.AppendLine();
WriteToFile(lang, builder.ToString());
}
@@ -83,6 +107,42 @@ public static class HandbookGenerator
{
File.WriteAllText($"{ConfigManager.Config.Path.HandbookPath}/Handbook{lang}.txt", content);
}
public static void GenerateValk(StringBuilder builder, Dictionary<long, string> map)
{
foreach (var avatar in GameData.AvatarData.Values)
{
var name = map.TryGetValue(avatar.FullName.hash, out var value) ? value : $"[{avatar.FullName.hash}]";
builder.AppendLine(avatar.AvatarID + ": " + name);
}
}
public static void GenerateElf(StringBuilder builder, Dictionary<long, string> map)
{
foreach (var elf in GameData.ElfAstraMateData.Values)
{
var name = map.TryGetValue(elf.FullName.hash, out var value) ? value : $"[{elf.FullName.hash}]";
builder.AppendLine(elf.ElfID + ": " + name);
}
}
public static void GenerateStigmata(StringBuilder builder, Dictionary<long, string> map)
{
foreach (var stigmata in GameData.StigmataData.Values)
{
var name = map.TryGetValue(stigmata.DisplayTitle.hash, out var value) ? value : $"[{stigmata.DisplayTitle.hash}]";
builder.AppendLine(stigmata.ID + ": " + name);
}
}
public static void GenerateWeapon(StringBuilder builder, Dictionary<long, string> map)
{
foreach (var weapon in GameData.WeaponData.Values)
{
var name = map.TryGetValue(weapon.DisplayTitle.hash, out var value) ? value : $"[{weapon.DisplayTitle.hash}]";
builder.AppendLine(weapon.ID + ": " + name);
}
}
}
public class TextMapEntry