Add automatic artifact set name generation

This commit is contained in:
2026-05-28 16:19:39 +08:00
parent b9e2ded194
commit 717acc800f
4 changed files with 99 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
[ResourceType("EquipAffixExcelConfigData.json")]
internal class EquipAffixData
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("level")]
public int Level { get; set; }
[JsonProperty("nameTextMapHash")]
public long NameTextMapHash { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
/**
* Grasscutter Tools
* Copyright (C) 2023 jie65535
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
**/
using System.Collections.Generic;
using Newtonsoft.Json;
namespace GrasscutterTools.Game.Data.Excels
{
[ResourceType("ReliquarySetExcelConfigData.json")]
internal class ReliquarySetData
{
[JsonProperty("setId")]
public int SetId { get; set; }
[JsonProperty("equipAffixId")]
public int EquipAffixId { get; set; }
[JsonProperty("containsList")]
public List<int> ContainsList { get; set; }
}
}

View File

@@ -61,6 +61,10 @@ namespace GrasscutterTools.Game.Data
public Dictionary<int, ReliquaryData> ReliquaryData { get; set; } public Dictionary<int, ReliquaryData> ReliquaryData { get; set; }
public List<ReliquarySetData> ReliquarySetData { get; set; }
public List<EquipAffixData> EquipAffixData { get; set; }
public Dictionary<int, SceneData> SceneData { get; set; } public Dictionary<int, SceneData> SceneData { get; set; }
public List<SceneTagData> SceneTagData { get; set; } public List<SceneTagData> SceneTagData { get; set; }
@@ -200,6 +204,25 @@ namespace GrasscutterTools.Game.Data
ReliquaryData.Values.OrderBy(it => it.Id).Select(it => $"{it.Id}:{TextMapData.GetText(it.NameTextMapHash.ToString())}"), ReliquaryData.Values.OrderBy(it => it.Id).Select(it => $"{it.Id}:{TextMapData.GetText(it.NameTextMapHash.ToString())}"),
Encoding.UTF8); Encoding.UTF8);
// ArtifactCat (套装)
var affixNameMap = EquipAffixData
.Where(a => a.Level == 0 && a.NameTextMapHash != 0)
.ToDictionary(a => a.Id, a => a.NameTextMapHash);
sb.Clear();
foreach (var set in ReliquarySetData.Where(s => s.ContainsList != null && s.ContainsList.Count > 0))
{
var derivedId = set.ContainsList[0] / 1000;
string name = null;
if (set.EquipAffixId != 0 && affixNameMap.TryGetValue(set.EquipAffixId, out var nameHash))
name = TextMapData.GetText(nameHash.ToString());
if (name == null || name.StartsWith("[N/A]"))
name = GameData.ArtifactCats[derivedId];
if (name == ItemMap.EmptyName)
continue;
sb.AppendFormat("{0}:{1}", derivedId, name).AppendLine();
}
File.WriteAllText(Path.Combine(dir, "ArtifactCat.txt"), sb.ToString(), Encoding.UTF8);
#endregion Artifact #endregion Artifact
#region Avatar #region Avatar

View File

@@ -162,6 +162,8 @@
<Compile Include="Game\Data\Excels\MainQuestData.cs" /> <Compile Include="Game\Data\Excels\MainQuestData.cs" />
<Compile Include="Game\Data\Excels\QuestData.cs" /> <Compile Include="Game\Data\Excels\QuestData.cs" />
<Compile Include="Game\Data\Excels\ReliquaryData.cs" /> <Compile Include="Game\Data\Excels\ReliquaryData.cs" />
<Compile Include="Game\Data\Excels\ReliquarySetData.cs" />
<Compile Include="Game\Data\Excels\EquipAffixData.cs" />
<Compile Include="Game\Data\Excels\MonsterData.cs" /> <Compile Include="Game\Data\Excels\MonsterData.cs" />
<Compile Include="Game\Data\Excels\SceneData.cs" /> <Compile Include="Game\Data\Excels\SceneData.cs" />
<Compile Include="Game\Data\Excels\SceneTagData.cs" /> <Compile Include="Game\Data\Excels\SceneTagData.cs" />