Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
slotthhy committed Mar 18, 2024
2 parents 64c0804 + 741798f commit 8f192fd
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Orchestrion/OrchestrionPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ private void OnCommand(string command, string args)
case "ddmode":
BGMManager.StartDeepDungeonMode();
break;
case "check":
Util.CheckSongData();
break;
}
break;
case 2:
Expand Down
71 changes: 71 additions & 0 deletions Orchestrion/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;
using System.Numerics;
using Dalamud;
using System.Reflection;
using Dalamud.Interface;
using ImGuiNET;
using Orchestrion.Persistence;
Expand Down Expand Up @@ -71,4 +72,74 @@ public static string Lang()
{
return Configuration.Instance.UserInterfaceLanguageCode;
}

public static void CheckSongData()
{
var uiLang = Lang();
const string uiLangFallback = "en";

var songs = SongList.Instance.GetSongs();
var errors = 0;
var fallbacks = 0;

foreach (var (songId, song) in songs) {
foreach (var titleLang in AvailableTitleLanguages) {
if (!song.Strings.TryGetValue(titleLang, out var strings)) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing string table for title language [{titleLang}]");
errors++;
}
else {
if (strings.Name == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing Name for title language [{titleLang}]");
errors++;
}
if (strings.AlternateName == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing AlternateName for title language [{titleLang}]");
errors++;
}
if (strings.SpecialModeName == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing SpecialModeName for title language [{titleLang}]");
errors++;
}
}
}

if (!song.Strings.TryGetValue(uiLang, out var strings2)) {
DalamudApi.PluginLog.Info($"Song ID {songId} is missing title info for UI language [{uiLang}], using fallback [{uiLangFallback}]");
fallbacks++;
}
else {
if (strings2.Locations == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing Locations for UI language [{uiLang}]");
errors++;
}
if (strings2.AdditionalInfo == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing AdditionalInfo for UI language [{uiLang}]");
errors++;
}
continue;
}

if (!song.Strings.TryGetValue(uiLangFallback, out strings2)) {
DalamudApi.PluginLog.Info($"Song ID {songId} is missing title info for UI fallback language [{uiLangFallback}]");
errors++;
}
else {
if (strings2.Locations == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing Locations for UI fallback language [{uiLangFallback}]");
errors++;
}

if (strings2.AdditionalInfo == null) {
DalamudApi.PluginLog.Warning($"Song ID {songId} is missing AdditionalInfo for UI fallback language [{uiLangFallback}]");
errors++;
}
}
}

var version = Assembly.GetExecutingAssembly().GetName().Version;
var msg = $"Checked {songs.Count} songs with {errors} errors and {fallbacks} fallbacks found (lang {DalamudApi.PluginInterface.UiLanguage}/{uiLang}, version {(version != null ? version : "unknown")}).";
DalamudApi.PluginLog.Info(msg);
DalamudApi.ChatGui.Print(msg);
}
}

0 comments on commit 8f192fd

Please sign in to comment.