feat: SK backlog from test through 2026.11.22.48 (Trade Shop, Oracle, quests, loot, nav)
Squash of test/main-merge-2026-10-25 onto aelrynth main 2026.11.19.1 for the standing sk PR. Includes Trade Shop, Oracle wiki/ILT tracker, quest runs, loot checklist, RynthNav, VTank import. HandWrittenVersion remains 0.5.0-legacy-ui. See Changelog/2026-11-22-sk-backlog-test-merge.md.
This commit is contained in:
parent
660e6b5b1c
commit
dc08e1abba
521 changed files with 47247 additions and 795 deletions
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace RynthCore.Plugin.UbRythai;
|
||||
|
||||
/// <summary>Loads and saves <see cref="UbRythaiSettings"/> per character under Documents\RynthSuite\ub-Rythai\.</summary>
|
||||
internal static class UbRythaiSettingsStore
|
||||
{
|
||||
private static readonly string RootDir = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
|
||||
"RynthSuite",
|
||||
"ub-Rythai");
|
||||
|
||||
/// <summary>Returns the on-disk path for the settings file, or null if <paramref name="charName"/> is empty.</summary>
|
||||
public static string? GetSettingsFilePath(string? charName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(charName))
|
||||
return null;
|
||||
|
||||
string safe = SanitizeFileName(charName.Trim());
|
||||
string dir = Path.Combine(RootDir, safe);
|
||||
return Path.Combine(dir, "UbRythai-settings.json");
|
||||
}
|
||||
|
||||
public static UbRythaiSettings LoadOrDefault(string? charName)
|
||||
{
|
||||
string? path = GetSettingsFilePath(charName);
|
||||
if (path == null || !File.Exists(path))
|
||||
return new UbRythaiSettings();
|
||||
|
||||
try
|
||||
{
|
||||
string json = File.ReadAllText(path, Encoding.UTF8);
|
||||
UbRythaiSettings? loaded = JsonSerializer.Deserialize(json, UbRythaiJsonContext.Default.UbRythaiSettings);
|
||||
return loaded ?? new UbRythaiSettings();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new UbRythaiSettings();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Save(string? charName, UbRythaiSettings settings)
|
||||
{
|
||||
string? path = GetSettingsFilePath(charName);
|
||||
if (path == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
string dir = Path.GetDirectoryName(path)!;
|
||||
Directory.CreateDirectory(dir);
|
||||
string json = JsonSerializer.Serialize(settings, UbRythaiJsonContext.Default.UbRythaiSettings);
|
||||
File.WriteAllText(path, json, Encoding.UTF8);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// best-effort persistence
|
||||
}
|
||||
}
|
||||
|
||||
private static string SanitizeFileName(string name)
|
||||
{
|
||||
var sb = new StringBuilder(name.Length);
|
||||
foreach (char c in name)
|
||||
sb.Append(char.IsLetterOrDigit(c) || c == '\'' || c == '-' ? c : '_');
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue