feat: port SK test branch (2026.10.18.24) onto sk
Squash of test/hotbuild-2026-10-16 as merged onto aelrynth main 2026.10.17.1, matching the 2026.10.18.24 test installer. The test branch wins where both changed the same lines; sk-only changes kept; duplicate features cut to the test branch's copy. RynthAi HandWrittenVersion stays 0.5.0-legacy-ui on sk. Highlights: RynthOracle 0.6.0 (Legendary, Markers, Dynamic Stamps and Temple guardians merged into the Quests list, RynthNav Go to), RynthILT 0.2.20 (ub-IT auto-chunk rules, rating level, RynthILT.Data v3), RynthAi ub-IT /ub and VT/MT meta compatibility and the loot attribute checklist, RynthNav destination alternatives. Changelog/2026-10-18-sk-port-test-branch-2026.10.18.24.md.
This commit is contained in:
parent
23efcfee87
commit
7797901d69
287 changed files with 22602 additions and 1090 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