mirror of
https://github.com/kwsch/NHSE.git
synced 2026-09-09 11:45:30 -05:00
Add localization for forgery, none, and manual insertion of internal indexes
This commit is contained in:
@@ -8,9 +8,9 @@ namespace NHSE.Parsing
|
||||
{
|
||||
public static class GameMSBTDumper
|
||||
{
|
||||
public static string[] GetItemListResource(string msgPath)
|
||||
public static string[] GetItemListResource(string msgPath, string language)
|
||||
{
|
||||
var list = GetItemList(msgPath);
|
||||
var list = GetItemList(msgPath, language);
|
||||
var max = list.Max(z => z.Key);
|
||||
var result = new string?[max + 1];
|
||||
|
||||
@@ -19,11 +19,18 @@ public static string[] GetItemListResource(string msgPath)
|
||||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] ??= string.Empty;
|
||||
|
||||
result[0] = "(None)";
|
||||
result[5794] = "DIY recipe";
|
||||
FinalizeItemList(language, result!);
|
||||
return result!;
|
||||
}
|
||||
|
||||
private static void FinalizeItemList(string language, string[] result)
|
||||
{
|
||||
result[0] = $"({GetNoneName(language)})";
|
||||
result[5794] = $"({GetDIYRecipeName(language)})";
|
||||
foreach (var internalItem in InternalItemList)
|
||||
result[internalItem.Key] = internalItem.Value;
|
||||
}
|
||||
|
||||
public static string[] GetArtList(string msgPath)
|
||||
{
|
||||
var file = Path.Combine(msgPath, "Item", "STR_ItemName_01_Art.msbt");
|
||||
@@ -57,19 +64,21 @@ public static string[] GetVillagerListResource(string msgPath)
|
||||
return normal.Concat(special).ToArray();
|
||||
}
|
||||
|
||||
public static Dictionary<ushort, string> GetItemList(string msgPath)
|
||||
public static Dictionary<ushort, string> GetItemList(string msgPath, string language)
|
||||
{
|
||||
var result = new Dictionary<ushort, string>();
|
||||
AddRegularItems(result, msgPath);
|
||||
AddRegularItems(result, msgPath, language);
|
||||
AddColoredItems(result, msgPath);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void AddRegularItems(IDictionary<ushort, string> result, string msgPath)
|
||||
private static void AddRegularItems(IDictionary<ushort, string> result, string msgPath, string language)
|
||||
{
|
||||
var pitem = Path.Combine(msgPath, "Item");
|
||||
var fitem = Directory.EnumerateFiles(pitem);
|
||||
var regularItemList = GetLabelList(fitem); // (itemID, itemName)
|
||||
|
||||
var forgery = GetForgerySuffix(language);
|
||||
foreach (var (label, text) in regularItemList)
|
||||
{
|
||||
if (label.EndsWith("_pl"))
|
||||
@@ -81,12 +90,65 @@ private static void AddRegularItems(IDictionary<ushort, string> result, string m
|
||||
|
||||
var itemText = text;
|
||||
if (label.StartsWith("PictureFake") || label.StartsWith("SculptureFake"))
|
||||
itemText = $"{itemText} (forgery)";
|
||||
itemText = $"{itemText} ({forgery})";
|
||||
|
||||
result.Add(itemID, itemText);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetNoneName(string language)
|
||||
{
|
||||
return language switch
|
||||
{
|
||||
"de" => "Leer",
|
||||
"es" => "Ningun",
|
||||
"fr" => "Aucun",
|
||||
"it" => "Nessuna",
|
||||
"ko" => "없음",
|
||||
"ja" => "無し",
|
||||
"chs" => "没有",
|
||||
"cht" => "沒有",
|
||||
_ => "None",
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetDIYRecipeName(string language)
|
||||
{
|
||||
return language switch
|
||||
{
|
||||
"de" => "Leer",
|
||||
"es" => "Ningun",
|
||||
"fr" => "Aucun",
|
||||
"it" => "Nessuna",
|
||||
"ko" => "없음",
|
||||
"ja" => "無し",
|
||||
"chs" => "没有",
|
||||
"cht" => "沒有",
|
||||
_ => "DIY recipe",
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetForgerySuffix(string language)
|
||||
{
|
||||
return language switch
|
||||
{
|
||||
"de" => "fälschung",
|
||||
"es" => "falsificación",
|
||||
"fr" => "falsification",
|
||||
"it" => "falsificazione",
|
||||
"ko" => "위조",
|
||||
"ja" => "偽造",
|
||||
"chs" => "伪造",
|
||||
"cht" => "偽造",
|
||||
_ => "forgery",
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly Dictionary<int, string> InternalItemList = new Dictionary<int, string>
|
||||
{
|
||||
{4200, "k.k. slider's guitar (internal)"},
|
||||
};
|
||||
|
||||
private static void AddColoredItems(IDictionary<ushort, string> result, string msgPath)
|
||||
{
|
||||
var pgname = Path.Combine(msgPath, "Outfit", "GroupName"); // (baseItemName, groupID)
|
||||
|
||||
@@ -59,7 +59,7 @@ private static void DumpItem(string corePath, string langID, string msbtFolder,
|
||||
{
|
||||
var dest = Path.Combine(corePath, langID, $"text_item_{langID}.txt");
|
||||
var file = string.Format(msbtFolder, langFolderCode);
|
||||
var items = GameMSBTDumper.GetItemListResource(file);
|
||||
var items = GameMSBTDumper.GetItemListResource(file, langID);
|
||||
File.WriteAllLines(dest, items);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user