From ae6de5304ef65923b1b5745084763d333054a545 Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Fri, 16 Oct 2026 12:34:13 -0400 Subject: [PATCH] feat(engine): inventory bar declutter, in-world hotreload hold, chat combat filters, Enl planner Inventory: Item Count / GInv / RSort off the bar (Inventory + Mini Remote), Mini Remote under Inventory. Hotreload: hold FileWatcher and ERl while in-world (MayHotReload / ReloadInWorldGate) to stop CoreCLR AV on gen2. Chat: UB-IT combat standard filters (melee/missile/magic, reckless/sneak, vitals). Skills Progression: Enl calculator UI (levels, materials, sigil chain) from ILT JSON. --- ...16-bar-hide-itemcount-ginv-2026.10.16.6.md | 13 ++ ...t-combat-standard-filters-2026.10.16.10.md | 28 ++++ ...6-chat-filters-ubit-parity-2026.10.16.2.md | 31 ++++ ...16-hotreload-no-erl-bypass-2026.10.16.5.md | 35 ++++ ...ory-itemcount-ginv-buttons-2026.10.16.4.md | 24 +++ ...ventory-miniremote-off-bar-2026.10.16.8.md | 15 ++ ...-16-inventory-rsort-button-2026.10.16.7.md | 14 ++ ...-16-inworld-hotreload-hold-2026.10.16.3.md | 33 ++++ ...-10-16-oracle-skills-embed-2026.10.16.1.md | 31 ++++ ...16-progress-enl-calculator-2026.10.16.9.md | 18 ++ .../previous-release/last-built-version.txt | 2 +- .../previous-release/previous-version.txt | 2 +- native/Loader/Loader.c | 62 ++++++- native/Loader/Loader.h | 2 +- .../Compatibility/RynthCoreChatCommands.cs | 54 +++++- src/RynthCore.Engine/EntryPoint.cs | 105 +++++++++++- src/RynthCore.Engine/Hotkeys/HotkeyService.cs | 5 +- src/RynthCore.Engine/ImGui/ImGuiBar.cs | 12 +- .../ImGui/Panels/InventoryFace.Classic.cs | 39 ++++- .../ImGui/Panels/InventoryFace.cs | 78 ++++++++- .../ImGui/Panels/OracleSkillsEmbed.cs | 32 ++++ .../ImGui/Panels/RynthAiFace.cs | 24 ++- .../ImGui/Panels/ScriptWindowFace.cs | 16 +- .../ImGui/Panels/SkillsFace.Progression.cs | 102 +++++++++++- .../ImGui/Panels/SkillsFace.cs | 80 ++++++++- src/RynthCore.Engine/ImGui/RynthCoreShell.cs | 8 +- .../Plugins/EngineSettings.cs | 23 ++- src/RynthCore.Engine/ReloadInWorldGate.cs | 101 ++++++++++++ src/RynthCore.Engine/UI/AvaloniaOverlay.cs | 4 +- .../UI/Data/ChatFilterPresets.cs | 115 ++++++++++++- .../UI/Data/ProgressionData.cs | 38 +++++ src/RynthCore.Engine/UI/Data/SettingsData.cs | 2 +- .../UI/Dcomp/DcompOverlayWindow.cs | 2 +- .../UI/Panels/RynthChatPresets.cs | 154 ++++++++++++++++-- tools/EngineSettingsTests/Program.cs | 1 + tools/ReloadInWorldGateTests/Program.cs | 95 +++++++++++ .../ReloadInWorldGateTests.csproj | 23 +++ 37 files changed, 1343 insertions(+), 80 deletions(-) create mode 100644 Changelog/2026-10-16-bar-hide-itemcount-ginv-2026.10.16.6.md create mode 100644 Changelog/2026-10-16-chat-combat-standard-filters-2026.10.16.10.md create mode 100644 Changelog/2026-10-16-chat-filters-ubit-parity-2026.10.16.2.md create mode 100644 Changelog/2026-10-16-hotreload-no-erl-bypass-2026.10.16.5.md create mode 100644 Changelog/2026-10-16-inventory-itemcount-ginv-buttons-2026.10.16.4.md create mode 100644 Changelog/2026-10-16-inventory-miniremote-off-bar-2026.10.16.8.md create mode 100644 Changelog/2026-10-16-inventory-rsort-button-2026.10.16.7.md create mode 100644 Changelog/2026-10-16-inworld-hotreload-hold-2026.10.16.3.md create mode 100644 Changelog/2026-10-16-oracle-skills-embed-2026.10.16.1.md create mode 100644 Changelog/2026-10-16-progress-enl-calculator-2026.10.16.9.md create mode 100644 src/RynthCore.Engine/ImGui/Panels/OracleSkillsEmbed.cs create mode 100644 src/RynthCore.Engine/ReloadInWorldGate.cs create mode 100644 tools/ReloadInWorldGateTests/Program.cs create mode 100644 tools/ReloadInWorldGateTests/ReloadInWorldGateTests.csproj diff --git a/Changelog/2026-10-16-bar-hide-itemcount-ginv-2026.10.16.6.md b/Changelog/2026-10-16-bar-hide-itemcount-ginv-2026.10.16.6.md new file mode 100644 index 0000000..aa9b714 --- /dev/null +++ b/Changelog/2026-10-16-bar-hide-itemcount-ginv-2026.10.16.6.md @@ -0,0 +1,13 @@ +# 2026.10.16.6 - Bar: hide Item Count (opens from Inventory) + +Previous: 2026.10.16.5. + +## Change + +Item Count no longer gets its own ImGui bar icon. Open it from Inventory's Count +button (or `/rc itemcount` / Character menu). Global Inventory's bar button is +cleared in RynthInventory 0.1.2 (Scripts menu + Inventory GInv / `/ginv` remain). + +## Files + +- ImGui/ImGuiBar.cs diff --git a/Changelog/2026-10-16-chat-combat-standard-filters-2026.10.16.10.md b/Changelog/2026-10-16-chat-combat-standard-filters-2026.10.16.10.md new file mode 100644 index 0000000..d7e0461 --- /dev/null +++ b/Changelog/2026-10-16-chat-combat-standard-filters-2026.10.16.10.md @@ -0,0 +1,28 @@ +# 2026.10.16.10 - Chat standard filters: combat response breakdown + +Previous: 2026.10.16.9. + +## What + +Standard filters (Chat Filters panel) can now hide combat responses by kind, +matching UB ChatHandler's melee / magic split plus the common prefixes: + +- Melee / missile damage you deal or take (`… points of … damage`) +- Magic damage you deal or take (`… points with SpellName`) +- Recklessness / Sneak Attack / Critical prefixes (filter alone or with the rest) +- Periodic healing ticks (also under Combat, not only Items) +- Stamina / mana / health restore-or-spend lines +- Umbrella "All damage you deal / take" still covers both `of` and `with` forms + (the old patterns only caught `of`, so war magic hits slipped through) + +Missile hits share the melee text form in AC; environment misses stay on their +own filter. + +## Files + +- `UI/Panels/RynthChatPresets.cs` +- `UI/Data/ChatFilterPresets.cs` + +## Deploy + +`Publish-EngineCoreClr.ps1 -EngineOnly -AllowBehind -MsBuildArgs @('-p:Version=2026.10.16.10')` diff --git a/Changelog/2026-10-16-chat-filters-ubit-parity-2026.10.16.2.md b/Changelog/2026-10-16-chat-filters-ubit-parity-2026.10.16.2.md new file mode 100644 index 0000000..0dcdec6 --- /dev/null +++ b/Changelog/2026-10-16-chat-filters-ubit-parity-2026.10.16.2.md @@ -0,0 +1,31 @@ +# 2026.10.16.2 - Chat standard filters: UB-IT parity + +Previous: 2026.10.16.1. + +## What + +Standard filters (`RynthChatPresets`, Chat Filters panel) now cover the rest of +UB-IT `ChatFilterTool` / classic `ChatHandler` options that can be matched from +line text alone: + +- Kill-task **progress** (ACECustom / UB-IT) +- Master Arbitrator **spam** (selective) vs **all** +- Missile environment miss, periodic damage, fail-to-affect +- Give/take vitals, heal-self casts, healed-by-other, consumables +- Aetheria surge, cloak procs, banked luminance +- You're too busy / Casting status (when those lines hit chat) + +Still not text-presets (need Decal WorldFilter / StatusTextIntercept): vendor +tells, monster tells, NPC chatter, StatusTextAll. + +The "add as rule" picker (`ChatFilterPresets`) gained matching extras for the +same common spam lines. + +## Files + +- `UI/Panels/RynthChatPresets.cs` +- `UI/Data/ChatFilterPresets.cs` + +## Deploy + +`Publish-EngineCoreClr.ps1 -EngineOnly -AllowBehind -MsBuildArgs @('-p:Version=2026.10.16.2')` diff --git a/Changelog/2026-10-16-hotreload-no-erl-bypass-2026.10.16.5.md b/Changelog/2026-10-16-hotreload-no-erl-bypass-2026.10.16.5.md new file mode 100644 index 0000000..637c339 --- /dev/null +++ b/Changelog/2026-10-16-hotreload-no-erl-bypass-2026.10.16.5.md @@ -0,0 +1,35 @@ +# 2026.10.16.5 - Hot reload: ERl no longer bypasses the in-world hold + +Previous: 2026.10.16.4. + +## Why + +Automatic FileWatcher hold (16.3) worked — clients logged +`holding reload - engine says not safe yet (in-world)`. Pressing ERl / RL / +`/rc rl` while still in-world set the manual bypass, `MayHotReload` returned 1, +Shutdown skipped the world gate, and CoreCLR re-init AVed (e.g. pid 37684 at +10:25:42, `clr_37684_*.dmp`, gen 2 init then native crash in coreclr). + +## What + +- `RynthCoreMayHotReload` no longer treats a recent ERl as "safe now". +- `ReloadInWorldGate.ShouldHold` holds for manual as well as automatic reloads + (unless `AllowInWorldAutoHotReload`). +- Shutdown's world gate always runs while in-world; ERl only skips the combat / + plugin blocker wait once out of the world. +- ERl / RL / `/rc rl` / hotkey go through `RequestManualReload`: signal still + fires (applies on logout), chat warns once while in-world. + +## Deploy + +Logout / character select once so clients on 16.3–16.4 pick this up (do not ERl +in-world on those builds). Then: + +`Publish-EngineCoreClr.ps1 -AllowBehind -MsBuildArgs @('-p:Version=2026.10.16.5')` + +## Files + +- `ReloadInWorldGate.cs`, `EntryPoint.cs`, `EngineSettings.cs` +- `RynthCoreShell.cs`, `ImGuiBar.cs`, `HotkeyService.cs`, `RynthCoreChatCommands.cs` +- `AvaloniaOverlay.cs`, `DcompOverlayWindow.cs`, `Loader.c` +- `tools/ReloadInWorldGateTests` diff --git a/Changelog/2026-10-16-inventory-itemcount-ginv-buttons-2026.10.16.4.md b/Changelog/2026-10-16-inventory-itemcount-ginv-buttons-2026.10.16.4.md new file mode 100644 index 0000000..b6d5b0b --- /dev/null +++ b/Changelog/2026-10-16-inventory-itemcount-ginv-buttons-2026.10.16.4.md @@ -0,0 +1,24 @@ +# 2026.10.16.4 - Inventory: Item Count and Global Inventory buttons + +Previous: 2026.10.16.3. + +## Change + +Inventory opens the related windows from its own chrome instead of hunting through +menus: + +- Modern header: Bag (Item Count) and Globe (Global Inventory) next to Classic / Close. +- Classic title bar: Count and GInv text buttons (with Vault / size / tools). +- Character menu: Global Inventory line (`RynthInventory/Main`, same as `/ginv`). +- Settings > Inventory Management > Floating HUDs tooltip clarifies the floating + pack item count HUD (`/ra huds`) is not the Item Count panel (`/rc itemcount`). + +Item Count toggles via `PanelRouter` (`/rc itemcount`). Global Inventory toggles the +RynthInventory script window, or runs `/ginv` when the plugin is not loaded yet. + +## Files + +- ImGui/Panels/InventoryFace.cs +- ImGui/Panels/InventoryFace.Classic.cs +- ImGui/Panels/RynthAiFace.cs +- UI/Data/SettingsData.cs diff --git a/Changelog/2026-10-16-inventory-miniremote-off-bar-2026.10.16.8.md b/Changelog/2026-10-16-inventory-miniremote-off-bar-2026.10.16.8.md new file mode 100644 index 0000000..9d12ae8 --- /dev/null +++ b/Changelog/2026-10-16-inventory-miniremote-off-bar-2026.10.16.8.md @@ -0,0 +1,15 @@ +# 2026.10.16.8 - Inventory: Mini Remote button (off the top bar) + +Previous: 2026.10.16.7. + +## Change + +Mini Remote no longer gets its own ImGui bar icon (the 2×2 grid next to +Inventory). Open it from Inventory's Remote / SquaresFour button, Character +menu, or `/rc miniremote`. + +## Files + +- ImGui/ImGuiBar.cs +- ImGui/Panels/InventoryFace.cs +- ImGui/Panels/InventoryFace.Classic.cs diff --git a/Changelog/2026-10-16-inventory-rsort-button-2026.10.16.7.md b/Changelog/2026-10-16-inventory-rsort-button-2026.10.16.7.md new file mode 100644 index 0000000..7d21733 --- /dev/null +++ b/Changelog/2026-10-16-inventory-rsort-button-2026.10.16.7.md @@ -0,0 +1,14 @@ +# 2026.10.16.7 - Inventory: RynthSort button (off the top bar) + +Previous: 2026.10.16.6. + +## Change + +Inventory's header (Modern icons / Classic "Sort") opens RynthSort, same as +`/rsort`. RynthSort no longer gets its own bar button (plugin 0.3.2): use +Inventory, the Scripts menu, or `/rsort`. + +## Files + +- ImGui/Panels/InventoryFace.cs +- ImGui/Panels/InventoryFace.Classic.cs diff --git a/Changelog/2026-10-16-inworld-hotreload-hold-2026.10.16.3.md b/Changelog/2026-10-16-inworld-hotreload-hold-2026.10.16.3.md new file mode 100644 index 0000000..cfe37cb --- /dev/null +++ b/Changelog/2026-10-16-inworld-hotreload-hold-2026.10.16.3.md @@ -0,0 +1,33 @@ +# 2026.10.16.3 - Hold automatic hot reloads while in-world + +Previous: 2026.10.16.2. + +## Why + +Stacked FileWatcher hot publishes while logged in were crashing clients: the +loader shut the engine down, then CoreCLR re-init failed mid-flight (no +`Reload: complete`, large CLR dumps). Combat deferral only waits for plugin +blockers; a quiet in-world unload still tore everything down. + +## What + +- Automatic FileWatcher reloads wait until logout / character select (or ERl / + `/rc rl`). No force-timeout while still in the world. +- New engine export `RynthCoreMayHotReload` (loader 2.2+ polls before Shutdown). +- Old loaders still safe: `RynthCoreShutdown` runs the same in-world gate. +- `engine.json` `AllowInWorldAutoHotReload` (default false) restores the old + mid-session auto-reload behaviour if set true by hand. + +## Files + +- `ReloadInWorldGate.cs`, `EntryPoint.cs`, `Plugins/EngineSettings.cs` +- `native/Loader/Loader.c`, `Loader.h` (LOADER_VERSION 2.2) +- `tools/ReloadInWorldGateTests` + +## Deploy + +`Publish-EngineCoreClr.ps1 -AllowBehind -MsBuildArgs @('-p:Version=2026.10.16.3')` + +EngineOnly is enough for the Shutdown gate on running clients. Full publish +stages loader 2.2; running clients keep the old loader until restart (engine +gate still holds). diff --git a/Changelog/2026-10-16-oracle-skills-embed-2026.10.16.1.md b/Changelog/2026-10-16-oracle-skills-embed-2026.10.16.1.md new file mode 100644 index 0000000..0a6d855 --- /dev/null +++ b/Changelog/2026-10-16-oracle-skills-embed-2026.10.16.1.md @@ -0,0 +1,31 @@ +# 2026.10.16.1 - Skills under Oracle; buffing prots/banes UI removed + +Previous: 2026.10.15.9. Major feature (new Oracle surface). + +## Skills → Oracle + +The standalone Skills panel body (raise / train / attributes / ILT progression) +now embeds inside RynthOracle as three tabs: + +- **Skills** — raise and train (`/ro skills`, `/rc skills`) +- **Attributes** — attributes and vitals (`/ro attrs`) +- **Progress** — ILT progression planners (`/ro progress`, `/rc progression`) + +Engine bridge: `OracleSkillsEmbed` + `ScriptWindowFace` draws `SkillsFace` after +the Oracle tab strip when `/rc oracle-skills <0|1|2|off>` is set. The Skills bar +button is removed; Character / Mini Remote menus open Oracle instead. Standalone +Skills remains as a fallback when Oracle is not loaded. + +## Files (Core) + +- `ImGui/Panels/OracleSkillsEmbed.cs` (new) +- `ImGui/Panels/SkillsFace.cs` — `DrawEmbedded` / hosted body +- `ImGui/Panels/ScriptWindowFace.cs` — Oracle embed draw + clear on hide +- `ImGui/ImGuiBar.cs` — drop Skills bar button +- `ImGui/Panels/RynthAiFace.cs` — Character menu → `/ro skills|attrs|progress` +- `Compatibility/RynthCoreChatCommands.cs` — `/rc oracle-skills`, retarget skills/progression + +## Deploy + +`Publish-EngineCoreClr.ps1 -EngineOnly -AllowBehind -MsBuildArgs @('-p:Version=2026.10.16.1')` +→ `C:\Games\RynthCore\Runtime\`. Matching Suite plugins stamp the same calver. diff --git a/Changelog/2026-10-16-progress-enl-calculator-2026.10.16.9.md b/Changelog/2026-10-16-progress-enl-calculator-2026.10.16.9.md new file mode 100644 index 0000000..dbe857b --- /dev/null +++ b/Changelog/2026-10-16-progress-enl-calculator-2026.10.16.9.md @@ -0,0 +1,18 @@ +# 2026.10.16.9 - Skills Progression: Enl calculator UI + +Previous: 2026.10.16.8. + +## Change + +Enlightenment on the Skills Progression tab now draws the ILT Enl calculator: +per-level cost rows (green while pack + character luminance cover the step), +still-need / have materials, and the 301–325 sigil craft chain. DTOs match +RynthILT's `AppendEnlCalculatorJson` (`levels`, `materials`, `chain`, ecoins). + +Augmentations already show character AvailableLuminance (not banked) via ILT's +`banked` summary line; this build only wires the Enl planner UI. + +## Files + +- UI/Data/ProgressionData.cs +- ImGui/Panels/SkillsFace.Progression.cs diff --git a/installer/previous-release/last-built-version.txt b/installer/previous-release/last-built-version.txt index c1a5c58..7fc3205 100644 --- a/installer/previous-release/last-built-version.txt +++ b/installer/previous-release/last-built-version.txt @@ -1 +1 @@ -2026.10.15.9 +2026.10.16.10 diff --git a/installer/previous-release/previous-version.txt b/installer/previous-release/previous-version.txt index 96ffdfe..9e0dc2d 100644 --- a/installer/previous-release/previous-version.txt +++ b/installer/previous-release/previous-version.txt @@ -1 +1 @@ -2026.10.15.8 +2026.10.16.9 diff --git a/native/Loader/Loader.c b/native/Loader/Loader.c index 396d25c..fcf3344 100644 --- a/native/Loader/Loader.c +++ b/native/Loader/Loader.c @@ -13,9 +13,10 @@ // reload, so a reload gives its memory back. // // Either way the loader owns the reload event, the file watcher, the address-space -// guard, the reload cap (MaxHotReloads per client) and a MinHook facade (Hooks.c): -// every hook is installed once, through a permanent stub, and a reload only re-points -// the stub. For the managed engine it also sets up CoreCLR's crash dumps (Logs\dumps). +// guard, the reload cap (MaxHotReloads per client), the in-world MayHotReload hold +// (2.2+), and a MinHook facade (Hooks.c): every hook is installed once, through a +// permanent stub, and a reload only re-points the stub. For the managed engine it +// also sets up CoreCLR's crash dumps (Logs\dumps). // ============================================================================ #include "Loader.h" @@ -30,6 +31,9 @@ #define ENGINE_REFUSED_EXPORT "RynthCoreReloadRefused" #define ENGINE_MAXRELOADS_EXPORT "RynthCoreMaxHotReloads" #define ENGINE_CAPPED_EXPORT "RynthCoreReloadCapped" +// 1 = reload now, 0 = wait (in-world). Missing export = old engine, proceed. +#define ENGINE_MAYRELOAD_EXPORT "RynthCoreMayHotReload" +#define MAY_RELOAD_POLL_MS 2000 #ifndef LOG_DIR // the offline tests (tools\Loader*Tests) log into their own folder #define LOG_DIR "C:\\Games\\RynthCore\\Logs" #define LOG_PARENT "C:\\Games\\RynthCore" @@ -64,6 +68,7 @@ typedef unsigned int (__stdcall *engine_u32_fn)(void* param); typedef unsigned int (__stdcall *engine_refused_fn)(int freeMb); typedef int (__stdcall *engine_max_reloads_fn)(void); typedef unsigned int (__stdcall *engine_capped_fn)(int reloads, int cap); +typedef int (__stdcall *engine_may_reload_fn)(void); static volatile LONG g_initialized; static char g_loaderDir[MAX_PATH]; @@ -534,13 +539,58 @@ static DWORD WINAPI ReloadWatcher(LPVOID unused) LoaderLog("INF", "ReloadWatcher: reload already in flight; coalesced."); continue; } + + // Hold before Shutdown while the engine says the player is still in the world + // (RynthCoreMayHotReload). The game keeps running on this generation; FileWatcher + // signals coalesce on the auto-reset event until we finish. Missing export = go now + // (old engines); their Shutdown path also waits in-world since 2026-10-16. + { + engine_may_reload_fn may = (engine_may_reload_fn)EngineExport(ENGINE_MAYRELOAD_EXPORT); + int loggedHold = 0; + while (may && may() == 0) { + if (!loggedHold) { + LoaderLog("INF", "ReloadWatcher: holding reload - engine says not safe yet (in-world); " + "will retry every %d ms until logout / character select.", MAY_RELOAD_POLL_MS); + loggedHold = 1; + } + Sleep(MAY_RELOAD_POLL_MS); + // Cap / address space can change while we wait; refuse rather than tear down late. + reloadsDone = g_initCount - 1; + cap = CurrentReloadCap(); + if (ReloadCapReached(reloadsDone, cap)) { + LoaderLog("WRN", "ReloadWatcher: reload REFUSED while holding for the world - hot reload " + "cap reached (%d of %d). Staying on gen %d.", reloadsDone, cap, g_initCount); + engine_capped_fn capped = (engine_capped_fn)EngineExport(ENGINE_CAPPED_EXPORT); + if (capped) capped(reloadsDone, cap); + InterlockedExchange(&g_reloadInFlight, 0); + goto next_signal; + } + freeMb = LoaderFreeAddressSpaceMb(&largestMb); + shortOf = ReloadSpaceShort(g_engineIsManaged, freeMb, largestMb); + if (shortOf) { + LoaderLog("WRN", "ReloadWatcher: reload REFUSED while holding for the world - address space " + "short (free %ld MB, largest %ld MB).", freeMb, largestMb); + engine_refused_fn refused = (engine_refused_fn)EngineExport(ENGINE_REFUSED_EXPORT); + if (refused) refused((int)(shortOf == 1 ? freeMb : largestMb)); + InterlockedExchange(&g_reloadInFlight, 0); + goto next_signal; + } + } + if (loggedHold) + LoaderLog("INF", "ReloadWatcher: engine says reload is safe now; proceeding."); + } + Reload(); g_lastReloadDone = GetTickCount64(); InterlockedExchange(&g_reloadInFlight, 0); - int drained = 0; - while (WaitForSingleObject(g_reloadEvent, 0) == WAIT_OBJECT_0) drained++; - if (drained) LoaderLog("INF", "ReloadWatcher: drained %d signal(s) received during the reload.", drained); + { + int drained = 0; + while (WaitForSingleObject(g_reloadEvent, 0) == WAIT_OBJECT_0) drained++; + if (drained) LoaderLog("INF", "ReloadWatcher: drained %d signal(s) received during the reload.", drained); + } + next_signal: + ; } } diff --git a/native/Loader/Loader.h b/native/Loader/Loader.h index 18e1622..7e62493 100644 --- a/native/Loader/Loader.h +++ b/native/Loader/Loader.h @@ -2,7 +2,7 @@ #define WIN32_LEAN_AND_MEAN #include -#define LOADER_VERSION "2.1" +#define LOADER_VERSION "2.2" // Loader.c void LoaderLog(const char* level, const char* fmt, ...); diff --git a/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs b/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs index 456d94a..00102d3 100644 --- a/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs +++ b/src/RynthCore.Engine/Compatibility/RynthCoreChatCommands.cs @@ -398,21 +398,59 @@ internal static class RynthCoreChatCommands return true; } - // /rc skills [show|hide|toggle] : the ImGui Skills panel; /rc progression opens it on its - // Progression tab (ILT worlds; the tab shows once RynthILT reports ILT features). + // /rc oracle-skills <0|1|2|off> : Oracle sets which SkillsFace body to embed (engine bridge). + if (IsVerb(sub, "oracle-skills", out string oracleSkillsArgs)) + { + string a = oracleSkillsArgs.Trim().ToLowerInvariant(); + if (a is "off" or "clear" or "none" or "-1") + ImGuiBackend.Panels.OracleSkillsEmbed.Clear(); + else if (a is "0" or "skills" or "skill") + ImGuiBackend.Panels.OracleSkillsEmbed.SetActiveTab(0); + else if (a is "1" or "attrs" or "attributes" or "vitals") + ImGuiBackend.Panels.OracleSkillsEmbed.SetActiveTab(1); + else if (a is "2" or "progress" or "progression") + ImGuiBackend.Panels.OracleSkillsEmbed.SetActiveTab(2); + else + Reply("Usage: /rc oracle-skills "); + return true; + } + + // /rc skills [show|hide|toggle] : opens RynthOracle on Skills (raise/train live there now). + // Falls back to the standalone Skills panel when Oracle isn't loaded. if (IsVerb(sub, "skills", out string skillsArgs)) { + if (!TryPanelMode(skillsArgs, out bool? show)) + { + Reply("Usage: /rc skills [show|hide|toggle]"); + return true; + } + const string oracleKey = "RynthOracle/Oracle"; + if (UI.ScriptWindows.ScriptWindowRegistry.Has(oracleKey)) + { + if (show == false) + { + ImGuiBackend.Panels.OracleSkillsEmbed.Clear(); + if (UI.ScriptWindows.ScriptWindowRegistry.IsOpen(oracleKey)) + UI.ScriptWindows.ScriptWindowRegistry.PlayerSetVisible(oracleKey, false); + } + else if (show == true || !UI.ScriptWindows.ScriptWindowRegistry.IsOpen(oracleKey) + || ImGuiBackend.Panels.OracleSkillsEmbed.ActiveTab != 0) + UI.ServerMenus.Run("/ro skills"); + return true; + } if (!ImGuiBackend.ImGuiPanelHost.HasFace(ImGuiBackend.Panels.SkillsFace.Title)) Reply("The Skills panel isn't available (the ImGui layer is off?)."); - else if (!TryPanelMode(skillsArgs, out bool? show)) - Reply("Usage: /rc skills [show|hide|toggle]"); else SetPanelOpen(ImGuiBackend.Panels.SkillsFace.Title, show); return true; } - if (sub.Equals("progression", StringComparison.OrdinalIgnoreCase)) + // /rc progression : Oracle Progress tab (ILT planners); fallback = standalone Skills Progression. + if (sub.Equals("progression", StringComparison.OrdinalIgnoreCase) + || sub.Equals("progress", StringComparison.OrdinalIgnoreCase)) { - if (!ImGuiBackend.ImGuiPanelHost.HasFace(ImGuiBackend.Panels.SkillsFace.Title)) + if (UI.ScriptWindows.ScriptWindowRegistry.Has("RynthOracle/Oracle")) + UI.ServerMenus.Run("/ro progress"); + else if (!ImGuiBackend.ImGuiPanelHost.HasFace(ImGuiBackend.Panels.SkillsFace.Title)) Reply("The Skills panel isn't available (the ImGui layer is off?)."); else ImGuiBackend.Panels.SkillsFace.ShowProgression(); @@ -478,8 +516,8 @@ internal static class RynthCoreChatCommands // loader's reload shuts this engine down, and this handler runs // inside AC's outgoing-chat hook. RynthLog.Compat("RynthCoreChatCommands: /rc rl — engine reload requested."); - EntryPoint.NoteManualReload(); // by hand: not held for combat (EntryPoint.DeferReloadWhilePluginsObject) - System.Threading.ThreadPool.UnsafeQueueUserWorkItem(static _ => EngineLifecycle.SignalReload(), null); + // In-world: loader holds until logout; skips combat deferral once out of world. + System.Threading.ThreadPool.UnsafeQueueUserWorkItem(static _ => EntryPoint.RequestManualReload("/rc rl"), null); return true; case "inv": diff --git a/src/RynthCore.Engine/EntryPoint.cs b/src/RynthCore.Engine/EntryPoint.cs index d50a398..f75762c 100644 --- a/src/RynthCore.Engine/EntryPoint.cs +++ b/src/RynthCore.Engine/EntryPoint.cs @@ -136,12 +136,31 @@ public static class EntryPoint return 0; } + /// + /// Loader asks before tearing the engine down (loader 2.2+): 1 = reload now, 0 = wait + /// (still in the world; poll again). Missing export = old engines, loader proceeds. + /// AllowInWorldAutoHotReload returns 1. Manual ERl does not bypass — mid-session CoreCLR + /// re-init still AVs (2026-10-16.5). Loader thread; never throws. + /// + [UnmanagedCallersOnly(EntryPoint = "RynthCoreMayHotReload")] + public static int MayHotReload() + { + try + { + if (EngineSettings.AllowInWorldAutoHotReload) return 1; + return IsInWorldForAutoReloadDeferral() ? 0 : 1; + } + catch { return 1; } // fail open so a gate bug cannot wedge the loader forever + } + [UnmanagedCallersOnly(EntryPoint = "RynthCoreShutdown")] public static uint Shutdown(IntPtr lpParam) { // Only the loader's hot reload calls this export (process exit and the engine's own // teardowns call EngineLifecycle.Shutdown directly), on its reload thread: wait here, // with the game running on this engine, while a plugin says a reload now would hurt. + // Also holds automatic reloads while in-world (ReloadInWorldGate) so old loaders that + // never call MayHotReload still avoid mid-session CoreCLR re-init crashes. try { DeferReloadWhilePluginsObject(); } catch { } try { @@ -165,20 +184,72 @@ public static class EntryPoint private const long ManualReloadWindowMs = 10_000; internal static void NoteManualReload() => Interlocked.Exchange(ref _manualReloadAtMs, Environment.TickCount64); + /// True when ERl / /rc rl marked a hand reload within the window (does not clear it). + private static bool IsRecentManualReload() + { + long manualAt = Volatile.Read(ref _manualReloadAtMs); + return manualAt != 0 && Environment.TickCount64 - manualAt < ManualReloadWindowMs; + } + /// - /// Reload deferral (2026-10-05, see ReloadDeferral.cs): asks the plugins - /// (RynthPluginReloadBlocker) and waits up to ReloadDeferral.DefaultCap while one objects, - /// e.g. "engine reload waiting: RynthAi in combat (a monster engaged, ...)". Says so in chat - /// once. Never throws; a query that fails counts as "nothing objects". + /// In the world after a successful login, and not yet logged out: automatic FileWatcher + /// reloads wait. Character select / disconnected / never logged in are safe to reload. + /// + private static bool IsInWorldForAutoReloadDeferral() + { + try + { + if (!Compatibility.LoginLifecycleHooks.HasObservedLoginComplete) return false; + if (Compatibility.LogoutLifecycleHooks.HasObservedLogout) return false; + int mode = Compatibility.UiFlowHooks.CurrentMode; + // Explicit non-world screens: safe for automatic reload. + if (mode == Compatibility.UiFlowHooks.ModeCharacterManagement + || mode == Compatibility.UiFlowHooks.ModeDisconnected + || mode == Compatibility.UiFlowHooks.ModeIntro + || mode == Compatibility.UiFlowHooks.ModeCharGen + || mode == Compatibility.UiFlowHooks.ModeCredits + || mode == Compatibility.UiFlowHooks.ModeDataPatch + || mode == Compatibility.UiFlowHooks.ModeEpilogue) + return false; + // ModeGamePlay, or ModeNone before the first mode sample after login: hold. + return true; + } + catch { return false; } + } + + /// + /// Reload deferral (2026-10-05 / 2026-10-16.5): first holds every reload while in-world + /// (ReloadInWorldGate; no force-timeout; ERl does not bypass — CoreCLR re-init still AVs), + /// then asks the plugins (RynthPluginReloadBlocker) and waits up to ReloadDeferral.DefaultCap + /// while one objects (ERl skips that combat hold once out of the world). Says so in chat once. + /// Never throws; a query that fails counts as "nothing objects". /// private static void DeferReloadWhilePluginsObject() { long manualAt = Interlocked.Exchange(ref _manualReloadAtMs, 0); - if (manualAt != 0 && Environment.TickCount64 - manualAt < ManualReloadWindowMs) + bool byHand = manualAt != 0 && Environment.TickCount64 - manualAt < ManualReloadWindowMs; + + // Wait until out of the world (or AllowInWorldAutoHotReload). Manual ERl used to skip + // this and crash mid-session (pid 37684 @ 2026-10-16 10:25 after ERl while held). + if (ReloadInWorldGate.ShouldHold(byHand, EngineSettings.AllowInWorldAutoHotReload, IsInWorldForAutoReloadDeferral())) { - RynthLog.Info("engine reload: asked for by hand (ERl), so it isn't deferred for the plugins."); + var world = ReloadInWorldGate.Run( + stillHold: () => ReloadInWorldGate.ShouldHold(false, EngineSettings.AllowInWorldAutoHotReload, IsInWorldForAutoReloadDeferral()), + log: msg => RynthLog.Info(msg), + notify: why => Compatibility.AcMainThreadQueue.EnqueueWriteToChat( + $"[RynthCore] A new RynthCore build is ready. It loads when you leave the world ({why}).", 1), + waited: out TimeSpan worldWaited); + if (world != ReloadInWorldGate.Outcome.Clear) + RynthLog.Info($"engine reload: in-world gate {world} after {worldWaited.TotalSeconds:0.0} s."); + } + + // By hand: skip the combat / plugin blocker wait once the world gate has cleared. + if (byHand) + { + RynthLog.Info("engine reload: asked for by hand (ERl); not deferred for the plugins."); return; } + var deferral = new ReloadDeferral { Query = PluginManager.QueryReloadBlockers, @@ -191,6 +262,28 @@ public static class EntryPoint RynthLog.Info($"engine reload: deferral {outcome} after {waited.TotalSeconds:0.0} s."); } + /// + /// Player asked for an engine reload (ERl / /rc rl / hotkey). While in-world the loader + /// keeps holding; we still signal so it applies on logout, and say so in chat once. + /// + internal static void RequestManualReload(string source) + { + NoteManualReload(); + if (!EngineSettings.AllowInWorldAutoHotReload && IsInWorldForAutoReloadDeferral()) + { + RynthLog.Info($"{source}: in-world — signaling reload; loader holds until logout / character select."); + try + { + Compatibility.AcMainThreadQueue.EnqueueWriteToChat( + "[RynthCore] Engine reload will apply when you leave the world (logout / character select). Mid-session hot reload crashes the client.", 1); + } + catch { /* chat must not block the signal */ } + } + else + RynthLog.Info($"{source}: signaling reload."); + EngineLifecycle.SignalReload(); + } + private static uint InitializeCore(IntPtr lpParam) { if (Interlocked.CompareExchange(ref _initialized, 1, 0) != 0) diff --git a/src/RynthCore.Engine/Hotkeys/HotkeyService.cs b/src/RynthCore.Engine/Hotkeys/HotkeyService.cs index d728a4e..d75cf5e 100644 --- a/src/RynthCore.Engine/Hotkeys/HotkeyService.cs +++ b/src/RynthCore.Engine/Hotkeys/HotkeyService.cs @@ -391,10 +391,9 @@ internal static class HotkeyService case "patrol": UI.Data.RynthAiCommands.SendNavCommand("{\"Cmd\":\"dunPatrol\"}", refreshPatrol: true); break; case "autosort": UI.Data.RynthSortCommands.ToggleAuto(); break; case "reload": - // As /rc rl and the bar's RL: signalled from a pool thread (the reload shuts this engine down). + // As /rc rl and the bar's RL: in-world holds until logout (mid-session CoreCLR re-init AVs). RynthLog.Compat("Hotkeys: engine reload requested."); - EntryPoint.NoteManualReload(); - ThreadPool.UnsafeQueueUserWorkItem(static _ => EngineLifecycle.SignalReload(), null); + ThreadPool.UnsafeQueueUserWorkItem(static _ => EntryPoint.RequestManualReload("hotkey reload"), null); break; default: Reply($"Hotkey {b.Combo}: '{a.Name}' isn't wired up in this engine."); diff --git a/src/RynthCore.Engine/ImGui/ImGuiBar.cs b/src/RynthCore.Engine/ImGui/ImGuiBar.cs index 4acd3c7..16df8d7 100644 --- a/src/RynthCore.Engine/ImGui/ImGuiBar.cs +++ b/src/RynthCore.Engine/ImGui/ImGuiBar.cs @@ -67,9 +67,10 @@ internal static class ImGuiBar ScriptWindow? Window = null); // Engine panels with an ImGui face only (no OverlayHost entry) that get a bar button. + // Skills moved under RynthOracle (Skills / Attributes / Progress tabs); open via /ro skills. + // Item Count / Mini Remote: under Inventory since 2026-10-16 (no bar icons of their own). private static readonly string[] ImGuiOnlyBarPanels = - { Panels.InventoryFace.Title, Panels.SkillsFace.Title, Panels.SenseFace.Title, Panels.ItemCountFace.Title, Panels.MiniRemoteFace.Title, - Panels.CharactersFace.Title }; + { Panels.InventoryFace.Title, Panels.SenseFace.Title, Panels.CharactersFace.Title }; // The ILT section: ImGui-only Infinite Leaftide panels (Bounties and Guardian, both RynthILT's). // They never get buttons of their own; one ILT button stands for them, shown only on Infinite @@ -519,11 +520,10 @@ internal static class ImGuiBar ImGuiNET.ImGui.SameLine(0, 6 * s); if (IconButton("##reload", iconFont, PhosphorIcons.ArrowsClockwise, square, RynthTheme.ReloadLabel)) { - // By hand: not held while a plugin objects (combat, looting); the player chose the moment. - EntryPoint.NoteManualReload(); - ThreadPool.UnsafeQueueUserWorkItem(static _ => EngineLifecycle.SignalReload(), null); + // In-world: loader holds until logout; skips combat deferral once out of world. + ThreadPool.UnsafeQueueUserWorkItem(static _ => EntryPoint.RequestManualReload("RL"), null); } - ImGuiNET.ImGui.SetItemTooltip("Engine reload (RL) — shut down, FreeLibrary, reload from disk, re-init."); + ImGuiNET.ImGui.SetItemTooltip("Engine reload (RL). While in-world it waits until logout / character select."); // The bar draws only as the ImGui face (ResolveFace), so it pops out as itself. ImGuiNET.ImGui.SameLine(); diff --git a/src/RynthCore.Engine/ImGui/Panels/InventoryFace.Classic.cs b/src/RynthCore.Engine/ImGui/Panels/InventoryFace.Classic.cs index 8b60e2d..12431fc 100644 --- a/src/RynthCore.Engine/ImGui/Panels/InventoryFace.Classic.cs +++ b/src/RynthCore.Engine/ImGui/Panels/InventoryFace.Classic.cs @@ -16,7 +16,8 @@ // 25 px title band isn't stretched) follow AcClientReborn's InventoryGeometry. // Credit: OpenAC (Tom's project) for the layout and sprite research. // -// title retail title bar "Inventory of ", tool toggles, close +// title retail title bar "Inventory of ", Remote / Sort / Count / +// GInv / Vault / size / tools / Modern toggles, close // tools search, sort, category chips (toggle, the funnel in the title) // paperdoll the 24 equip slots at their retail places (the 3D figure isn't // drawn, so the retail "Slots" view is always on) @@ -41,6 +42,7 @@ using ImGuiNET; using RynthCore.Engine.Compatibility; using RynthCore.Engine.Net; using RynthCore.Engine.UI; +using RynthCore.Engine.UI.ScriptWindows; using static RynthCore.Engine.ImGuiBackend.Panels.FaceKit; namespace RynthCore.Engine.ImGuiBackend.Panels; @@ -253,12 +255,43 @@ internal sealed partial class InventoryFace InventorySettingsStore.SetClassic(false); ImGuiNET.ImGui.SetItemTooltip("Modern look"); - // Vault (Aelrynth only): the contents area shows the account vault instead of the open pack. + // Related panels + Vault sit left of the size / tools toggles. float leftmost = bMinus.X; + bool remoteOpen = ImGuiPanelHost.IsOpen(MiniRemoteFace.Title); + bool sortOpen = ScriptWindowRegistry.IsOpen(RynthSortKey); + bool ginvOpen = ScriptWindowRegistry.IsOpen(GlobalInventoryKey); + bool countOpen = ImGuiPanelHost.IsOpen(ItemCountFace.Title); + var gsz = new Vector2(MathF.Round(42 * s), btn); + var csz = new Vector2(MathF.Round(40 * s), btn); + var ssz = new Vector2(MathF.Round(36 * s), btn); + var rsz = new Vector2(MathF.Round(48 * s), btn); + var bGinv = new Vector2(leftmost - gsz.X - 6 * s, b2.Y); + var bCount = new Vector2(bGinv.X - csz.X - 4 * s, b2.Y); + var bSort = new Vector2(bCount.X - ssz.X - 4 * s, b2.Y); + var bRemote = new Vector2(bSort.X - rsz.X - 4 * s, b2.Y); + if (TitleTextToggle("##inv_ginv", "GInv", bGinv, gsz, ginvOpen)) + ToggleGlobalInventory(); + ImGuiNET.ImGui.SetItemTooltip(ScriptWindowRegistry.Has(GlobalInventoryKey) + ? "Global Inventory (/ginv): every character's saved packs and storage" + : "Global Inventory (/ginv) — needs the RynthInventory plugin"); + if (TitleTextToggle("##inv_itemcount", "Count", bCount, csz, countOpen)) + ToggleItemCount(); + ImGuiNET.ImGui.SetItemTooltip("Item Count (/rc itemcount): how many of each named item you carry"); + if (TitleTextToggle("##inv_rsort", "Sort", bSort, ssz, sortOpen)) + ToggleRynthSort(); + ImGuiNET.ImGui.SetItemTooltip(ScriptWindowRegistry.Has(RynthSortKey) + ? "RynthSort (/rsort): pack sort rules and auto-sort" + : "RynthSort (/rsort) — needs the RynthSort plugin"); + if (TitleTextToggle("##inv_miniremote", "Remote", bRemote, rsz, remoteOpen)) + ToggleMiniRemote(); + ImGuiNET.ImGui.SetItemTooltip("Mini Remote (/rc miniremote): remote, sections and HUDs"); + leftmost = bRemote.X; + + // Vault (Aelrynth only): the contents area shows the account vault instead of the open pack. if (VaultFeed.Available) { var vsz = new Vector2(MathF.Round(38 * s), btn); - var bV = new Vector2(bMinus.X - vsz.X - 8 * s, b2.Y); + var bV = new Vector2(leftmost - vsz.X - 8 * s, b2.Y); if (TitleTextToggle("##inv_vault", "Vault", bV, vsz, _vaultOpen)) { _vaultOpen = !_vaultOpen; diff --git a/src/RynthCore.Engine/ImGui/Panels/InventoryFace.cs b/src/RynthCore.Engine/ImGui/Panels/InventoryFace.cs index 6e0ebec..e65fc2c 100644 --- a/src/RynthCore.Engine/ImGui/Panels/InventoryFace.cs +++ b/src/RynthCore.Engine/ImGui/Panels/InventoryFace.cs @@ -6,7 +6,9 @@ // pictures (InventoryFace.Classic.cs; Phase 2) // Modern the Phase 1 layout, below // -// header burden (percent of capacity) and pyreals; item count +// header burden (percent of capacity) and pyreals; item count; buttons for +// Mini Remote, RynthSort (/rsort), Item Count (/rc itemcount) and +// Global Inventory (/ginv) // tools search box, attribute filter (InventoryFace.AttrFilter.cs), sort // picker; category chips // packs All, Main pack, each side pack (its icon and fill), Worn @@ -36,6 +38,7 @@ using System.Globalization; using System.Numerics; using ImGuiNET; using RynthCore.Engine.Compatibility; +using RynthCore.Engine.UI; using RynthCore.Engine.UI.ScriptWindows; using static RynthCore.Engine.ImGuiBackend.Panels.FaceKit; @@ -207,6 +210,45 @@ internal sealed partial class InventoryFace : IImGuiPanel StatusRow(w); } + /// RynthInventory's Global Inventory script window key (UiWindow "RynthInventory/Main"). + private const string GlobalInventoryKey = "RynthInventory/Main"; + /// RynthSort's script window key (UiWindow "RynthSort/Main"). + private const string RynthSortKey = "RynthSort/Main"; + + /// Opens or closes the Item Count panel (same as /rc itemcount). + private static void ToggleItemCount() + { + if (!ImGuiPanelHost.HasFace(ItemCountFace.Title)) return; + PanelRouter.Toggle(ItemCountFace.Title); + } + + /// Opens or closes the Mini Remote (same as /rc miniremote). + private static void ToggleMiniRemote() + { + if (!ImGuiPanelHost.HasFace(MiniRemoteFace.Title)) return; + PanelRouter.Toggle(MiniRemoteFace.Title); + } + + /// + /// Opens or closes a plugin script window by key, or runs + /// when the plugin hasn't submitted it yet. + /// + private static void ToggleScriptWindow(string key, string fallbackCmd) + { + if (ScriptWindowRegistry.Has(key)) + { + ScriptWindowRegistry.PlayerSetVisible(key, !ScriptWindowRegistry.IsOpen(key)); + return; + } + ServerMenus.Run(fallbackCmd); + } + + /// Opens or closes RynthInventory's Global Inventory (same as /ginv). + private static void ToggleGlobalInventory() => ToggleScriptWindow(GlobalInventoryKey, "/ginv"); + + /// Opens or closes RynthSort (same as /rsort). + private static void ToggleRynthSort() => ToggleScriptWindow(RynthSortKey, "/rsort"); + // ── Header: burden, pyreals, count ────────────────────────────────── private void Header(InventoryView view, float w) @@ -239,11 +281,41 @@ internal sealed partial class InventoryFace : IImGuiPanel InventorySettingsStore.SetClassic(true); ImGuiNET.ImGui.SetItemTooltip("Classic look (the retail inventory window)"); + // Related (off the top bar): Mini Remote, RynthSort, Item Count, Global Inventory. + bool remoteOpen = ImGuiPanelHost.IsOpen(MiniRemoteFace.Title); + bool sortOpen = ScriptWindowRegistry.IsOpen(RynthSortKey); + bool ginvOpen = ScriptWindowRegistry.IsOpen(GlobalInventoryKey); + bool countOpen = ImGuiPanelHost.IsOpen(ItemCountFace.Title); + var bGinv = new Vector2(tb.X - 24, p.Y + 1); + var bCount = new Vector2(bGinv.X - 24, p.Y + 1); + var bSort = new Vector2(bCount.X - 24, p.Y + 1); + var bRemote = new Vector2(bSort.X - 24, p.Y + 1); + if (IconButton("##inv_ginv", PhosphorIcons.GlobeHemisphereWest, bGinv, new Vector2(22, 22), + ginvOpen ? Teal : Amber, BtnFill, font: UiFont.Ui11)) + ToggleGlobalInventory(); + ImGuiNET.ImGui.SetItemTooltip(ScriptWindowRegistry.Has(GlobalInventoryKey) + ? "Global Inventory (/ginv): every character's saved packs and storage" + : "Global Inventory (/ginv) — needs the RynthInventory plugin"); + if (IconButton("##inv_itemcount", PhosphorIcons.Bag, bCount, new Vector2(22, 22), + countOpen ? Teal : Amber, BtnFill, font: UiFont.Ui11)) + ToggleItemCount(); + ImGuiNET.ImGui.SetItemTooltip("Item Count (/rc itemcount): how many of each named item you carry"); + if (IconButton("##inv_rsort", PhosphorIcons.SortAscending, bSort, new Vector2(22, 22), + sortOpen ? Teal : Amber, BtnFill, font: UiFont.Ui11)) + ToggleRynthSort(); + ImGuiNET.ImGui.SetItemTooltip(ScriptWindowRegistry.Has(RynthSortKey) + ? "RynthSort (/rsort): pack sort rules and auto-sort" + : "RynthSort (/rsort) — needs the RynthSort plugin"); + if (IconButton("##inv_miniremote", PhosphorIcons.SquaresFour, bRemote, new Vector2(22, 22), + remoteOpen ? Teal : Amber, BtnFill, font: UiFont.Ui11)) + ToggleMiniRemote(); + ImGuiNET.ImGui.SetItemTooltip("Mini Remote (/rc miniremote): remote, sections and HUDs"); + float cw = ImGuiNET.ImGui.CalcTextSize(_countText).X; - dl.AddText(new Vector2(tb.X - cw - 6, ty), Mute, _countText); + dl.AddText(new Vector2(bRemote.X - cw - 6, ty), Mute, _countText); // Drag surface: the empty part of the header, between the pyreals and the count. - float dragFrom = x + 20 + ImGuiNET.ImGui.CalcTextSize(view.PyrealText).X + 6, dragTo = tb.X - cw - 10; + float dragFrom = x + 20 + ImGuiNET.ImGui.CalcTextSize(view.PyrealText).X + 6, dragTo = bRemote.X - cw - 10; if (dragTo > dragFrom) { ImGuiNET.ImGui.SetCursorScreenPos(new Vector2(dragFrom, p.Y)); diff --git a/src/RynthCore.Engine/ImGui/Panels/OracleSkillsEmbed.cs b/src/RynthCore.Engine/ImGui/Panels/OracleSkillsEmbed.cs new file mode 100644 index 0000000..157e0c8 --- /dev/null +++ b/src/RynthCore.Engine/ImGui/Panels/OracleSkillsEmbed.cs @@ -0,0 +1,32 @@ +// ============================================================================ +// RynthCore.Engine - ImGui/Panels/OracleSkillsEmbed.cs +// Bridges RynthOracle's Skills / Attributes / Progress tabs to the engine +// SkillsFace body so raise/train/progression stay in one place under Oracle. +// Oracle sets ActiveTab while those tabs are selected; ScriptWindowFace for +// the Oracle window draws the embed after the script tab strip. +// ============================================================================ + +using System.Threading; + +namespace RynthCore.Engine.ImGuiBackend.Panels; + +/// Which SkillsFace body Oracle wants drawn inside its window (-1 = none). +internal static class OracleSkillsEmbed +{ + /// 0 = Skills, 1 = Attributes, 2 = Progress (ILT Progression). -1 = off. + private static int _activeTab = -1; + + /// Oracle panel key prefix used by ScriptWindowRegistry ("script:…"). + public const string OraclePanelKeyFragment = "RynthOracle/Oracle"; + + public static int ActiveTab => Volatile.Read(ref _activeTab); + + /// Called from the Oracle plugin (pump/render) when a Skills-family tab is shown. + public static void SetActiveTab(int tab) => Volatile.Write(ref _activeTab, tab); + + /// Clears the embed when Oracle leaves Skills / Attributes / Progress. + public static void Clear() => Volatile.Write(ref _activeTab, -1); + + public static bool IsOraclePanel(string panelKey) => + panelKey.Contains(OraclePanelKeyFragment, System.StringComparison.OrdinalIgnoreCase); +} diff --git a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs index f732aff..480fda5 100644 --- a/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs +++ b/src/RynthCore.Engine/ImGui/Panels/RynthAiFace.cs @@ -1074,9 +1074,31 @@ internal sealed partial class RynthAiFace : IImGuiPanel SafeImGui.SetItemTooltip(hasOracle ? "RynthOracle's Fellowship tab: members, leader, open / locked, XP sharing and (Infinite Leaftide) the /fship commands." : "RynthOracle's Fellowship tab (RynthOracle isn't loaded)."); - PanelMenuItem(SkillsFace.Title, "/rc skills"); + // Skills / Attributes / Progress live under RynthOracle (raise/train + ILT planners). + if (ImGuiNET.ImGui.MenuItem("Skills", "/ro skills", false, hasOracle)) UI.ServerMenus.Run("/ro skills"); + SafeImGui.SetItemTooltip(hasOracle + ? "RynthOracle's Skills tab: raise and train skills (was the Skills panel)." + : "RynthOracle's Skills tab (RynthOracle isn't loaded)."); + if (ImGuiNET.ImGui.MenuItem("Attributes", "/ro attrs", false, hasOracle)) UI.ServerMenus.Run("/ro attrs"); + SafeImGui.SetItemTooltip(hasOracle + ? "RynthOracle's Attributes tab: attributes and vitals." + : "RynthOracle's Attributes tab (RynthOracle isn't loaded)."); + if (ImGuiNET.ImGui.MenuItem("Progress", "/ro progress", false, hasOracle)) UI.ServerMenus.Run("/ro progress"); + SafeImGui.SetItemTooltip(hasOracle + ? "RynthOracle's Progress tab: ILT progression planners." + : "RynthOracle's Progress tab (RynthOracle isn't loaded)."); PanelMenuItem(InventoryFace.Title, "/rc inventory"); PanelMenuItem(ItemCountFace.Title, "/rc itemcount"); + // RynthInventory's script window (same as /ginv / Inventory's GInv button). + const string ginvKey = "RynthInventory/Main"; + bool hasGinv = UI.ScriptWindows.ScriptWindowRegistry.Has(ginvKey); + if (ImGuiNET.ImGui.MenuItem("Global Inventory", "/ginv", + hasGinv && UI.ScriptWindows.ScriptWindowRegistry.IsOpen(ginvKey), hasGinv)) + UI.ScriptWindows.ScriptWindowRegistry.PlayerSetVisible(ginvKey, + !UI.ScriptWindows.ScriptWindowRegistry.IsOpen(ginvKey)); + SafeImGui.SetItemTooltip(hasGinv + ? "Every character's saved packs and storage (RynthInventory)." + : "Global Inventory (RynthInventory isn't loaded)."); PanelMenuItem(CharactersFace.Title, "/rc characters"); UI.ServerMenus.DrawImGuiMenu(separatorFirst: true); diff --git a/src/RynthCore.Engine/ImGui/Panels/ScriptWindowFace.cs b/src/RynthCore.Engine/ImGui/Panels/ScriptWindowFace.cs index bf9535a..a5ff945 100644 --- a/src/RynthCore.Engine/ImGui/Panels/ScriptWindowFace.cs +++ b/src/RynthCore.Engine/ImGui/Panels/ScriptWindowFace.cs @@ -36,7 +36,14 @@ internal sealed unsafe class ScriptWindowFace : IImGuiPanel public void OnShown() => NoteVisibility(visible: true); /// Closed: as OnShown; a close the owner didn't ask for is the player's X unless the bar said otherwise. - public void OnHidden() => NoteVisibility(visible: false); + public void OnHidden() + { + // Leaving Oracle clears the Skills embed so a later non-Oracle script window + // never inherits ActiveTab and paints SkillsFace by mistake. + if (OracleSkillsEmbed.IsOraclePanel(_window.PanelKey)) + OracleSkillsEmbed.Clear(); + NoteVisibility(visible: false); + } private void NoteVisibility(bool visible) { @@ -60,6 +67,13 @@ internal sealed unsafe class ScriptWindowFace : IImGuiPanel ScriptWindowMetrics.Refresh(); ReportGeometry(); ScriptWindowReplay.Draw(_window); + // Oracle Skills / Attributes / Progress: after the script tab strip, draw the + // engine SkillsFace body (raise/train/progression) into the remaining space. + if (OracleSkillsEmbed.IsOraclePanel(_window.PanelKey)) + { + int tab = OracleSkillsEmbed.ActiveTab; + if (tab >= 0) SkillsFace.DrawEmbedded(tab); + } } finally { diff --git a/src/RynthCore.Engine/ImGui/Panels/SkillsFace.Progression.cs b/src/RynthCore.Engine/ImGui/Panels/SkillsFace.Progression.cs index d4461dc..e84c9bc 100644 --- a/src/RynthCore.Engine/ImGui/Panels/SkillsFace.Progression.cs +++ b/src/RynthCore.Engine/ImGui/Panels/SkillsFace.Progression.cs @@ -589,17 +589,28 @@ internal sealed partial class SkillsFace Label(e.Header, Text); Label(e.Next, Teal); + // Plan-to-target: calculator uses character AvailableLuminance + pack mats. int target = e.Target; ImGuiNET.ImGui.SetNextItemWidth(100); - if (ImGuiNET.ImGui.InputInt("Plan to level##prog_enlt", ref target)) + if (ImGuiNET.ImGui.InputInt("Plan to enl##prog_enlt", ref target)) SendProg("enltarget " + Math.Max(e.Level + 1, target).ToString(CultureInfo.InvariantCulture)); - foreach (string line in e.Plan) SafeImGui.BulletText(line); + ImGuiNET.ImGui.SetItemTooltip("Target enlightenment level. The calculator below shows each step and what you still need."); + + if (e.Plan.Length > 0) + { + Label("Totals to plan:", Dim); + foreach (string line in e.Plan) SafeImGui.BulletText(line); + } + + DrawEnlCalculator(e, w); int coinsPerToken = e.CoinsPerToken; ImGuiNET.ImGui.SetNextItemWidth(100); if (ImGuiNET.ImGui.InputInt("Coins per token (shop price)##prog_cpt", ref coinsPerToken)) SendProg("coinspertoken " + Math.Max(0, coinsPerToken).ToString(CultureInfo.InvariantCulture)); if (e.TokensShort.Length > 0) Label(e.TokensShort, Dim); + if (e.Ecoins.Length > 0) Label(e.Ecoins, Text); + if (e.EcoinsLum.Length > 0) Label(e.EcoinsLum, Dim); ImGuiNET.ImGui.Separator(); if (e.Blockers.Length == 0) Label("Client-side checks pass.", Green); @@ -649,6 +660,93 @@ internal sealed partial class SkillsFace } } + /// + /// Per-level cost table (green while simulated stock covers the step), material still-need / + /// have, and the 301–325 sigil craft chain. Data from RynthILT AppendEnlCalculatorJson. + /// + private void DrawEnlCalculator(EnlPlanner e, float w) + { + if (e.Levels.Length == 0 && e.Materials.Length == 0) return; + + ImGuiNET.ImGui.Dummy(new Vector2(0, 2)); + if (!ImGuiNET.ImGui.CollapsingHeader("Enl calculator##prog_enl_calc", ImGuiTreeNodeFlags.DefaultOpen)) + return; + + if (e.Levels.Length > 0 + && ImGuiNET.ImGui.BeginTable("##enl_levels", 4, + ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingStretchProp, + new Vector2(w - 16, 0))) + { + ImGuiNET.ImGui.TableSetupColumn("Enl", ImGuiTableColumnFlags.WidthFixed, 44); + ImGuiNET.ImGui.TableSetupColumn("Item", ImGuiTableColumnFlags.WidthFixed, 90); + ImGuiNET.ImGui.TableSetupColumn("Qty", ImGuiTableColumnFlags.WidthFixed, 40); + ImGuiNET.ImGui.TableSetupColumn("Lum"); + ImGuiNET.ImGui.TableHeadersRow(); + foreach (EnlLevelRow row in e.Levels) + { + uint c = row.Ok ? Green : Amber; + ImGuiNET.ImGui.TableNextRow(); + ImGuiNET.ImGui.TableNextColumn(); Label(row.Level.ToString(CultureInfo.InvariantCulture), c); + ImGuiNET.ImGui.TableNextColumn(); Label(row.Item, c); + ImGuiNET.ImGui.TableNextColumn(); Label(row.Count > 0 ? row.Count.ToString(CultureInfo.InvariantCulture) : "-", c); + ImGuiNET.ImGui.TableNextColumn(); Label(row.Lum, c); + } + ImGuiNET.ImGui.EndTable(); + Label("Green = pack + character lum still cover that step (simulated in order).", Dim); + } + + if (e.Materials.Length > 0) + { + ImGuiNET.ImGui.Dummy(new Vector2(0, 4)); + Label("Still need / have", Text); + if (ImGuiNET.ImGui.BeginTable("##enl_mats", 3, + ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingStretchProp, + new Vector2(w - 16, 0))) + { + ImGuiNET.ImGui.TableSetupColumn("Material"); + ImGuiNET.ImGui.TableSetupColumn("Still need", ImGuiTableColumnFlags.WidthFixed, 90); + ImGuiNET.ImGui.TableSetupColumn("Have", ImGuiTableColumnFlags.WidthFixed, 90); + ImGuiNET.ImGui.TableHeadersRow(); + foreach (EnlMaterialRow m in e.Materials) + { + uint c = m.Ok ? Green : Amber; + ImGuiNET.ImGui.TableNextRow(); + ImGuiNET.ImGui.TableNextColumn(); Label(m.Label, c); + ImGuiNET.ImGui.TableNextColumn(); Label(m.Need, c); + ImGuiNET.ImGui.TableNextColumn(); Label(m.Have, c); + } + ImGuiNET.ImGui.EndTable(); + } + } + + if (e.Chain.Length > 0) + { + ImGuiNET.ImGui.Dummy(new Vector2(0, 4)); + Label("Sigil craft chain (301–325)", Text); + if (e.ChainNote.Length > 0) Label(e.ChainNote, Dim); + if (ImGuiNET.ImGui.BeginTable("##enl_chain", 4, + ImGuiTableFlags.RowBg | ImGuiTableFlags.BordersInnerV | ImGuiTableFlags.SizingStretchProp, + new Vector2(w - 16, 0))) + { + ImGuiNET.ImGui.TableSetupColumn("Item"); + ImGuiNET.ImGui.TableSetupColumn("Need", ImGuiTableColumnFlags.WidthFixed, 70); + ImGuiNET.ImGui.TableSetupColumn("Have", ImGuiTableColumnFlags.WidthFixed, 70); + ImGuiNET.ImGui.TableSetupColumn("", ImGuiTableColumnFlags.WidthFixed, 56); + ImGuiNET.ImGui.TableHeadersRow(); + foreach (EnlChainRow r in e.Chain) + { + uint c = r.Ok ? Green : Amber; + ImGuiNET.ImGui.TableNextRow(); + ImGuiNET.ImGui.TableNextColumn(); Label(r.Label, c); + ImGuiNET.ImGui.TableNextColumn(); Label(r.Need.ToString("N0", CultureInfo.InvariantCulture), c); + ImGuiNET.ImGui.TableNextColumn(); Label(r.Have.ToString("N0", CultureInfo.InvariantCulture), c); + ImGuiNET.ImGui.TableNextColumn(); Label(r.Craft ? "craft" : "", Dim); + } + ImGuiNET.ImGui.EndTable(); + } + } + } + // ── Confirm ───────────────────────────────────────────────────────── /// The Progression tab's Yes/No popup (outside the body child, like DrawConfirm). diff --git a/src/RynthCore.Engine/ImGui/Panels/SkillsFace.cs b/src/RynthCore.Engine/ImGui/Panels/SkillsFace.cs index 8ca7790..06f96ee 100644 --- a/src/RynthCore.Engine/ImGui/Panels/SkillsFace.cs +++ b/src/RynthCore.Engine/ImGui/Panels/SkillsFace.cs @@ -37,6 +37,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Numerics; +using System.Threading; using ImGuiNET; using RynthCore.Engine.Compatibility; using RynthCore.Engine.ImGuiBackend.Hud; @@ -53,9 +54,31 @@ internal sealed partial class SkillsFace : IImGuiPanel new PanelSpec(new Vector2(480, 640), new Vector2(380, 320), EdgeToEdge: true, GripInBody: true), () => new SkillsFace()); + /// Shared instance for drawing inside Oracle (no separate Skills window). + private static SkillsFace? _embed; + /// Numbers change on raises, buffs and XP: 4 Hz idle when popped out. public int PopOutIdleHz => 4; + /// + /// Draws the Skills / Attributes / Progress body into the current ImGui window + /// (Oracle embed). No outer panel chrome or Skills tab bar — Oracle owns those. + /// + public static void DrawEmbedded(int tab) + { + _embed ??= new SkillsFace(); + _embed.DrawHosted(tab); + } + + /// Selects Skills (0), Attributes (1) or Progress (2) on the next standalone Draw. + public static void RequestTab(int tab) + { + tab = tab < 0 ? 0 : tab > 2 ? 2 : tab; + Volatile.Write(ref _requestedTab, tab); + } + + private static int _requestedTab = -1; + // ── Palette (FaceKit's, plus the vitals') ──────────────────────────── private static readonly uint Mana = RynthTheme.Argb(0xFF4DA6FF), Dim = RynthTheme.Argb(0xFF7F8FA0), GroupBg = RynthTheme.Argb(0xFF0F1A24), MasteryColor = RynthTheme.Argb(0xFFC9A2FF); @@ -200,18 +223,65 @@ internal sealed partial class SkillsFace : IImGuiPanel public void Draw() { + // Standalone Skills window is retired under Oracle; keep Draw for hotkeys/compat + // that still open the panel, but prefer Oracle embed when active. + int req = Interlocked.Exchange(ref _requestedTab, -1); + if (req >= 0) _tab = req; PlayerProgressHooks.Want(); Refresh(); ApplyProgressionRequest(); if (_tab == 2 && !ProgressionTabVisible) _tab = 0; float w = Begin(out Vector2 origin, out Vector2 size); + DrawBody(w, origin, size, showOwnTabs: true); + End(origin, size); + + _picker.Draw(); + DrawMulti(); + DrawConfirm(); + DrawProgressionConfirm(); + } + + /// Oracle-hosted body (same content as the old Skills panel tabs). + private void DrawHosted(int tab) + { + _tab = tab < 0 ? 0 : tab > 2 ? 2 : tab; + // First embed frame (and after a long gap) warms the same hooks as OnShown. + long now = Environment.TickCount64; + if (now - _embedShownMs > 2000) + { + _embedShownMs = now; + OnShown(); + } + PlayerProgressHooks.Want(); + Refresh(); + ApplyProgressionRequest(); + if (_tab == 2 && !ProgressionTabVisible) + { + // Progress tab with no ILT: keep the tab selected and explain below. + } + + Vector2 avail = ImGuiNET.ImGui.GetContentRegionAvail(); + float w = Math.Max(40f, avail.X); + Vector2 origin = ImGuiNET.ImGui.GetCursorScreenPos(); + DrawBody(w, origin, new Vector2(w, Math.Max(120f, avail.Y)), showOwnTabs: false); + + _picker.Draw(); + DrawMulti(); + DrawConfirm(); + DrawProgressionConfirm(); + } + + private long _embedShownMs; + + private void DrawBody(float w, Vector2 origin, Vector2 size, bool showOwnTabs) + { DrawSummary(w); - DrawTabs(w); + if (showOwnTabs) DrawTabs(w); if (_tab == 0) DrawToolbar(w); if (_tab != 2) DrawColumnHeader(w, _tab == 0 ? "Skill" : "Attribute"); - float bodyH = Math.Max(60, Remaining(origin, size) - GripOverlap()); + float bodyH = Math.Max(60, showOwnTabs ? Remaining(origin, size) - GripOverlap() : size.Y - (ImGuiNET.ImGui.GetCursorScreenPos().Y - origin.Y)); ImGuiNET.ImGui.PushStyleColor(ImGuiCol.ChildBg, PanelBg); ImGuiNET.ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0)); ImGuiNET.ImGui.BeginChild("##skills_body", new Vector2(w, bodyH)); @@ -230,12 +300,6 @@ internal sealed partial class SkillsFace : IImGuiPanel ImGuiNET.ImGui.EndChild(); ImGuiNET.ImGui.PopStyleVar(); ImGuiNET.ImGui.PopStyleColor(); - End(origin, size); - - _picker.Draw(); - DrawMulti(); - DrawConfirm(); - DrawProgressionConfirm(); } // ── Data ──────────────────────────────────────────────────────────── diff --git a/src/RynthCore.Engine/ImGui/RynthCoreShell.cs b/src/RynthCore.Engine/ImGui/RynthCoreShell.cs index f9d185d..5482528 100644 --- a/src/RynthCore.Engine/ImGui/RynthCoreShell.cs +++ b/src/RynthCore.Engine/ImGui/RynthCoreShell.cs @@ -369,14 +369,12 @@ internal static class RynthCoreShell new System.Threading.Thread(() => { System.Threading.Thread.Sleep(120); - // Asked for by hand: the reload deferral (EntryPoint.Shutdown) doesn't hold it. - EntryPoint.NoteManualReload(); - bool ok = EngineLifecycle.SignalReload(); - RynthLog.Info($"ERl: SignalReload returned {ok}."); + // In-world: loader holds until logout (mid-session CoreCLR re-init AVs). + EntryPoint.RequestManualReload("ERl"); }) { IsBackground = true, Name = "RynthCore.ERl" }.Start(); } - ShowTooltip("Engine reload: shut down, FreeLibrary, reload from disk, re-init. Picks up new engine builds without restarting AC."); + ShowTooltip("Engine reload: picks up a new build. While in-world it waits until logout / character select (mid-session hot reload crashes)."); ImGui.End(); ImGui.PopStyleVar(3); diff --git a/src/RynthCore.Engine/Plugins/EngineSettings.cs b/src/RynthCore.Engine/Plugins/EngineSettings.cs index 99a9ec1..a967bfc 100644 --- a/src/RynthCore.Engine/Plugins/EngineSettings.cs +++ b/src/RynthCore.Engine/Plugins/EngineSettings.cs @@ -49,6 +49,8 @@ internal static class EngineSettings private static bool _loadAllServerPlugins; // Read-only, like EnableLargeAddressAlignmentFix: only a hand-set value is written back. private static int _maxHotReloads = ReloadCapNotice.DefaultMaxHotReloads; + // Automatic FileWatcher hot reload while logged into the world (default off since 2026-10-16). + private static bool _allowInWorldAutoHotReload; // "IltServerNames" / "IltHosts": what counts as Infinite Leaftide (Compatibility/IltInfo.cs). // null = not in the file: IltDetect's defaults. private static List? _iltServerNames; @@ -474,6 +476,19 @@ internal static class EngineSettings } } + /// "AllowInWorldAutoHotReload" in engine.json (default false since 2026-10-16): when + /// false, every engine reload (FileWatcher and ERl / /rc rl) waits until the player leaves + /// the world (logout / character select). Mid-session CoreCLR re-init still AVs. True + /// restores the old mid-session reload behaviour (risky). Edited in the file. + public static bool AllowInWorldAutoHotReload + { + get + { + EnsureLoaded(); + return _allowInWorldAutoHotReload; + } + } + /// "ReportEndpoint" in engine.json: a test URL for "Report a problem" instead of the /// built-in https://aelrynth.com/rynth/report (ProblemReportCore.ResolveEndpoint accepts https, /// or http to this PC; anything else is ignored). Null when the file has none. Edited in the file. @@ -719,6 +734,10 @@ internal static class EngineSettings mhrEl.TryGetInt32(out int mhr)) _maxHotReloads = mhr; + if (doc.RootElement.TryGetProperty("AllowInWorldAutoHotReload", out var aiwEl) && + (aiwEl.ValueKind == JsonValueKind.True || aiwEl.ValueKind == JsonValueKind.False)) + _allowInWorldAutoHotReload = aiwEl.GetBoolean(); + if (doc.RootElement.TryGetProperty("ReportEndpoint", out var repEl) && repEl.ValueKind == JsonValueKind.String && repEl.GetString() is { Length: > 0 } rep) @@ -797,7 +816,7 @@ internal static class EngineSettings "DecalInGameImGui", "DecalStandDown", "DisabledUiHooks", "ServerMessageStream", "FlightRecorder", "InsertReleasesUi", "BorderlessWindowed", "RememberWindowLayout", "IltServerNames", "IltHosts", "EnableLargeAddressAlignmentFix", - "MaxHotReloads", "ReportEndpoint", "CloseOnServerDisconnect", "AutoIdMode", "EnablePluginOverlayWindows", "LoggingLevel", + "MaxHotReloads", "AllowInWorldAutoHotReload", "ReportEndpoint", "CloseOnServerDisconnect", "AutoIdMode", "EnablePluginOverlayWindows", "LoggingLevel", "LoadAllServerPlugins", }; @@ -860,6 +879,8 @@ internal static class EngineSettings w.WriteBoolean("LoadAllServerPlugins", true); if (_maxHotReloads != ReloadCapNotice.DefaultMaxHotReloads) // only a hand-set value is written w.WriteNumber("MaxHotReloads", _maxHotReloads); + if (_allowInWorldAutoHotReload) // default false: only a hand-set true is written + w.WriteBoolean("AllowInWorldAutoHotReload", true); if (_reportEndpoint != null) // only a hand-set value is written w.WriteString("ReportEndpoint", _reportEndpoint); WriteStringList(w, "IltServerNames", _iltServerNames); // null (not in the file): left out diff --git a/src/RynthCore.Engine/ReloadInWorldGate.cs b/src/RynthCore.Engine/ReloadInWorldGate.cs new file mode 100644 index 0000000..7cf95fe --- /dev/null +++ b/src/RynthCore.Engine/ReloadInWorldGate.cs @@ -0,0 +1,101 @@ +// ============================================================================ +// RynthCore.Engine - ReloadInWorldGate.cs +// Holds an automatic hot reload while the player is in the world (2026-10-16). +// +// Stacked FileWatcher reloads mid-session were killing clients: Shutdown returned, then +// CoreCLR re-init AVed / never logged "Reload: complete" (e.g. gen 4 after 15.8→…→16.2). +// Combat deferral (ReloadDeferral) only waits for plugin blockers; it does not stop a +// quiet in-world unload. This gate waits with the old engine still mapped until the +// player is out of the world (or asked for the reload by hand). No force-timeout: going +// ahead while still in-world is what we are trying to avoid. +// +// Pure: the "still hold?" query, clock, sleep and log are injected so tools\ReloadInWorldGateTests +// can run offline. EntryPoint wires it from MayHotReload / DeferReloadWhilePluginsObject. +// ============================================================================ + +using System; +using System.Threading; + +namespace RynthCore.Engine; + +internal static class ReloadInWorldGate +{ + /// How often we ask again while holding for the world. + public static readonly TimeSpan DefaultPoll = TimeSpan.FromSeconds(2); + /// While waiting, the "still holding" line repeats this often (first line at once). + public static readonly TimeSpan DefaultLogEvery = TimeSpan.FromSeconds(30); + + public enum Outcome + { + /// Not in the world (or allowed to proceed): reload at once. + Clear, + /// Was in the world, then left; reload now. + ClearedAfterWait, + } + + /// + /// True when a reload should wait: in-world auto reloads are not allowed, and the client + /// is in the world. Manual ERl / /rc rl no longer bypass this — mid-session CoreCLR + /// re-init still AVs (2026-10-16.5). + /// + public static bool ShouldHold(bool byHand, bool allowInWorldAuto, bool inWorld) + { + _ = byHand; // kept for call-site clarity; never clears an in-world hold + return !allowInWorldAuto && inWorld; + } + + /// + /// Polls until it is false. Never times out into a reload + /// while still holding: that would re-create the crash path this gate exists to stop. + /// + public static Outcome Run( + Func stillHold, + Action log, + Action? notify, + out TimeSpan waited, + Func? clock = null, + Action? sleep = null, + TimeSpan? poll = null, + TimeSpan? logEvery = null) + { + clock ??= static () => DateTime.UtcNow; + sleep ??= static t => Thread.Sleep(t); + TimeSpan pollSpan = poll ?? DefaultPoll; + TimeSpan logSpan = logEvery ?? DefaultLogEvery; + + waited = TimeSpan.Zero; + if (!SafeHold(stillHold)) return Outcome.Clear; + + DateTime start = clock(); + log("engine reload waiting: player is in the world (automatic hot reload loads after logout / character select)."); + try + { + notify?.Invoke("player is in the world"); + } + catch { /* chat must not abort the wait */ } + DateTime lastLog = start; + + while (true) + { + sleep(pollSpan); + DateTime now = clock(); + waited = now - start; + if (!SafeHold(stillHold)) + { + log($"engine reload: left the world after {waited.TotalSeconds:0.0} s; reloading now."); + return Outcome.ClearedAfterWait; + } + if (now - lastLog >= logSpan) + { + lastLog = now; + log($"engine reload waiting: still in the world ({waited.TotalSeconds:0} s so far; loads after logout / character select)."); + } + } + } + + private static bool SafeHold(Func stillHold) + { + try { return stillHold(); } + catch { return false; } // fail open: a broken query must not wedge the client forever + } +} diff --git a/src/RynthCore.Engine/UI/AvaloniaOverlay.cs b/src/RynthCore.Engine/UI/AvaloniaOverlay.cs index f0e0eb6..0572dfb 100644 --- a/src/RynthCore.Engine/UI/AvaloniaOverlay.cs +++ b/src/RynthCore.Engine/UI/AvaloniaOverlay.cs @@ -1439,8 +1439,8 @@ internal class RynthOverlayWindow : Window Foreground = Brushes.Khaki, Margin = new Thickness(8, 0, 0, 0), }); - ToolTip.SetTip(reloadBtn, "Engine reload — shut down, FreeLibrary, reload from disk, re-init."); - reloadBtn.Click += (_, _) => EngineLifecycle.SignalReload(); + ToolTip.SetTip(reloadBtn, "Engine reload. While in-world it waits until logout / character select."); + reloadBtn.Click += (_, _) => EntryPoint.RequestManualReload("Avalonia RL"); stack.Children.Add(reloadBtn); // Register under a special key so RefreshHitTestSnapshot publishes // its rect to Win32Backend — without this, clicks over RL fall diff --git a/src/RynthCore.Engine/UI/Data/ChatFilterPresets.cs b/src/RynthCore.Engine/UI/Data/ChatFilterPresets.cs index 5cdf759..f6fdd3a 100644 --- a/src/RynthCore.Engine/UI/Data/ChatFilterPresets.cs +++ b/src/RynthCore.Engine/UI/Data/ChatFilterPresets.cs @@ -134,14 +134,62 @@ internal static class ChatFilterPresets ChatMatchMode.EndsWith, " evaded your attack.", "chan:Combat", new[] { L("Drudge Slinker evaded your attack.", "Combat", 22) }, new[] { L("Bob says, \"it evaded your attack.\"", "Chat", Say) }), - new("combat.damage_taken", "Combat", "Damage you take", - "Tusker Guard grazes your foot for 4 points of bludgeoning damage! (critical hits too)", - ChatMatchMode.Regex, @"^(?:Critical hit! )?(?!You )\S.* (?:you|your [a-z ]+) for \d+ points? of ", "type:21", + new("combat.melee_dealt", "Combat", "Melee / missile damage you deal", + "You slash … for N points of … damage!", + ChatMatchMode.Regex, @"^(?:(?:Critical [Hh]it|Sneak Attack|Recklessness)!\s+)*You \S+ .+ for \d+ points? of .+ damage", "chan:Combat", + new[] { L("You slash Drudge Slinker for 54 points of slashing damage!", "Combat", 22), + L("Recklessness! You slash Drudge for 80 points of slashing damage!", "Combat", 22) }, + new[] { L("Bob says, \"You slash for fun\"", "Chat", Say) }), + new("combat.magic_dealt", "Combat", "Magic damage you deal", + "You … for N points with SpellName.", + ChatMatchMode.Regex, @"^(?:(?:Critical [Hh]it|Sneak Attack|Recklessness)!\s+)*You \S+ .+ for \d+ points? with ", "chan:Combat", + new[] { L("You freeze Drudge Slinker for 120 points with Frost Bolt VI.", "Combat", Magic) }, + new[] { L("Bob says, \"points with Frost Bolt\"", "Chat", Say) }), + new("combat.melee_taken", "Combat", "Melee / missile damage you take", + "… your foot for N points of … damage!", + ChatMatchMode.Regex, @"^(?:(?:Critical [Hh]it|Sneak Attack|Recklessness)!\s+)*(?!You ).+ your [a-z ]+ for \d+ points? of .+ damage", "type:21", + new[] { L("Tusker Guard grazes your foot for 4 points of bludgeoning damage!", "Combat", EnemyCombat), + L("Critical hit! Olthoi Swarm Nymph nicks your head for 21 points of piercing damage!", "Combat", EnemyCombat) }, + new[] { L("Bob says, \"your foot for 5 points\"", "Chat", Say) }), + new("combat.magic_taken", "Combat", "Magic damage you take", + "… you for N points with SpellName.", + ChatMatchMode.Regex, @"^(?:(?:Critical [Hh]it|Sneak Attack|Recklessness)!\s+)*(?!You ).+ you for \d+ points? with ", "chan:Combat", + new[] { L("Drudge Sorcerer scorches you for 40 points with Flame Bolt III.", "Combat", Magic) }, + new[] { L("Bob says, \"you for 40 points with\"", "Chat", Say) }), + new("combat.recklessness", "Combat", "Recklessness hits", + "Recklessness! …", + ChatMatchMode.Contains, "Recklessness!", "chan:Combat", + new[] { L("Recklessness! You slash Drudge for 80 points of slashing damage!", "Combat", 22) }, + new[] { L("Bob says, \"Recklessness!\"", "Chat", Say) }), + new("combat.sneak_attack", "Combat", "Sneak Attack hits", + "Sneak Attack! …", + ChatMatchMode.Contains, "Sneak Attack!", "chan:Combat", + new[] { L("Sneak Attack! You slash Drudge for 54 points of slashing damage!", "Combat", 22) }, + new[] { L("Bob says, \"Sneak Attack!\"", "Chat", Say) }), + new("combat.damage_taken", "Combat", "All damage you take", + "Body-part melee and spell \"with\" forms (critical prefixes too).", + ChatMatchMode.Regex, @"^(?:(?:Critical [Hh]it|Sneak Attack|Recklessness)!\s+)*(?!You )\S.* (?:you|your [a-z ]+) for \d+ points? (?:of|with) ", "chan:Combat", new[] { L("Tusker Guard grazes your foot for 4 points of bludgeoning damage!", "Combat", EnemyCombat), L("Critical hit! Olthoi Swarm Nymph nicks your head for 21 points of piercing damage!", "Combat", EnemyCombat), - L("Olthoi Swarm Gardener blisters your lower leg for 1 point of acid damage!", "Combat", EnemyCombat) }, + L("Olthoi Swarm Gardener blisters your lower leg for 1 point of acid damage!", "Combat", EnemyCombat), + L("Drudge Sorcerer scorches you for 40 points with Flame Bolt III.", "Combat", Magic) }, new[] { L("You evaded Tusker Guard!", "Combat", EnemyCombat), L("Bob says, \"it hit your head for 5 points of damage\"", "Chat", Say) }), + new("combat.periodic_healing", "Combat", "Periodic healing ticks", + "You receive N points of periodic healing.", + ChatMatchMode.Regex, @"^You receive \d+ points of periodic healing", "", + new[] { L("You receive 12 points of periodic healing.", "Other", Notice) }, + new[] { L("Bob says, \"periodic healing\"", "Chat", Say) }), + new("combat.stamina", "Combat", "Stamina restore / spend", + "Restore / lose / gain stamina lines (Combat channel).", + ChatMatchMode.Regex, @"(?:restore|restores|regain|lose|loses) \d+ points? of (?:your )?stamina\b", "chan:Combat", + new[] { L("You cast Revitalize Self V and restore 40 points of your stamina.", "Combat", Magic) }, + new[] { L("Bob says, \"restore 40 points of your stamina\"", "Chat", Say) }), + new("combat.mana", "Combat", "Mana restore / spend", + "Restore / gain / lose mana lines (Combat channel).", + ChatMatchMode.Regex, @"(?:restore|restores|regain|gain|gains|lose|loses) \d+ points? of (?:your )?mana\b|and also gain \d+ points of mana", "chan:Combat", + new[] { L("You cast Stamina to Mana Self V on yourself and lose 17 points of stamina and also gain 23 points of mana", "Combat", Magic) }, + new[] { L("Bob says, \"gain 23 points of mana\"", "Chat", Say) }), // ── Notices ───────────────────────────────────────────────────── new("notice.busy", "Notices", "You're too busy", @@ -179,6 +227,65 @@ internal static class ChatFilterPresets ChatMatchMode.StartsWith, "[LFG]", "", new[] { L("[LFG] Bob says, \"LF tank for the Graveyard\"", "Other", ServerChannel) }, Array.Empty<(string, string, int)>()), + + // ── Combat extras (UB-IT ChatFilterTool / classic ChatHandler) ──── + new("combat.attack_resists", "Combat", "Your spells resisted", + "A target resists one of your spells.", + ChatMatchMode.Contains, " resists your spell", "chan:Combat", + new[] { L("Drudge Slinker resists your spell", "Combat", EnemyCombat) }, + new[] { L("Bob says, \"it resists your spell\"", "Chat", Say) }), + new("combat.defense_resists", "Combat", "You resist spells", + "You resist a spell cast by a monster.", + ChatMatchMode.StartsWith, "You resist the spell cast by ", "chan:Combat", + new[] { L("You resist the spell cast by Drudge Sorcerer", "Combat", EnemyCombat) }, + new[] { L("Bob says, \"You resist the spell cast by him\"", "Chat", Say) }), + new("combat.dirty_fighting", "Combat", "Dirty Fighting procs", + "Dirty Fighting assault announcements.", + ChatMatchMode.StartsWith, "Dirty Fighting! ", "", + new[] { L("Dirty Fighting! Bob delivers a Traumatic Assault to Drudge!", "Combat", EnemyCombat) }, + new[] { L("Bob says, \"Dirty Fighting!\"", "Chat", Say) }), + new("combat.missile_miss", "Combat", "Missile hit the environment", + "Your missile attack hit the environment.", + ChatMatchMode.StartsWith, "Your missile attack hit the environment", "", + new[] { L("Your missile attack hit the environment.", "Combat", EnemyCombat) }, + Array.Empty<(string, string, int)>()), + + // ── Items / misc (UB-IT) ─────────────────────────────────────────── + new("item.heal_ok", "Items", "Healing kit success", + "You heal yourself for N Health points…", + ChatMatchMode.Contains, " heal yourself for ", "", + new[] { L("You heal yourself for 80 Health points. Your Treated Healing Kit has 16 uses left.", "Other", Notice) }, + new[] { L("Bob says, \"heal yourself for fun\"", "Chat", Say) }), + new("item.salvage", "Items", "Salvage results", + "You obtain … using your knowledge of …", + ChatMatchMode.Regex, @"^You obtain .+ using your knowledge of ", "", + new[] { L("You obtain 12 Steel (ws 7.00) using your knowledge of Weapon Tinkering.", "Other", Notice) }, + Array.Empty<(string, string, int)>()), + new("item.aetheria_surge", "Items", "Aetheria surges", + "Aetheria surges on…", + ChatMatchMode.StartsWith, "Aetheria surges on", "", + new[] { L("Aetheria surges on Bob, increasing his damage.", "Other", Notice) }, + Array.Empty<(string, string, int)>()), + new("item.banked_lum", "Items", "Banked luminance", + "You've banked N Luminance.", + ChatMatchMode.StartsWith, "You've banked ", "", + new[] { L("You've banked 1,250 Luminance.", "Other", Notice) }, + Array.Empty<(string, string, int)>()), + new("social.kill_task", "Social", "Kill task complete", + "You have killed N Xs! Your task is complete!", + ChatMatchMode.Regex, @"^You have killed \d+ .+Your task is complete!", "", + new[] { L("You have killed 50 Drudges! Your task is complete!", "Other", Notice) }, + Array.Empty<(string, string, int)>()), + new("social.kill_task_progress", "Social", "Kill task progress", + "You have killed N Xs! You must kill M to complete your task.", + ChatMatchMode.Regex, @"^You have killed \d+ .+! You must kill \d+ to complete your task\.", "", + new[] { L("You have killed 12 Drudges! You must kill 50 to complete your task.", "Other", Notice) }, + Array.Empty<(string, string, int)>()), + new("cast.expires", "Casting", "Spell expiry", + "… has expired. (does not spare rares — use Standard filters for that).", + ChatMatchMode.Contains, "has expired.", "type:7", + new[] { L("Strength Self VII has expired.", "Combat", Magic) }, + new[] { L("Bob tells you, \"has expired.\"", "Chat", Tell) }), }; public static ChatFilterPreset? Get(string id) diff --git a/src/RynthCore.Engine/UI/Data/ProgressionData.cs b/src/RynthCore.Engine/UI/Data/ProgressionData.cs index 43e700d..9d37480 100644 --- a/src/RynthCore.Engine/UI/Data/ProgressionData.cs +++ b/src/RynthCore.Engine/UI/Data/ProgressionData.cs @@ -171,6 +171,44 @@ internal sealed class EnlPlanner [JsonPropertyName("spendFirst")] public bool SpendFirst { get; set; } [JsonPropertyName("checkEvery")] public int CheckEvery { get; set; } [JsonPropertyName("status")] public string Status { get; set; } = ""; + + // Calculator (RynthILT AppendEnlCalculatorJson): per-level rows, materials have/need, sigil chain. + [JsonPropertyName("levels")] public EnlLevelRow[] Levels { get; set; } = Array.Empty(); + [JsonPropertyName("materials")] public EnlMaterialRow[] Materials { get; set; } = Array.Empty(); + [JsonPropertyName("chain")] public EnlChainRow[] Chain { get; set; } = Array.Empty(); + [JsonPropertyName("chainNote")] public string ChainNote { get; set; } = ""; + [JsonPropertyName("ecoins")] public string Ecoins { get; set; } = ""; + [JsonPropertyName("ecoinsLum")] public string EcoinsLum { get; set; } = ""; +} + +/// One enlightenment step in the plan-to-target calculator. +internal sealed class EnlLevelRow +{ + [JsonPropertyName("t")] public int Level { get; set; } + [JsonPropertyName("item")] public string Item { get; set; } = "-"; + [JsonPropertyName("count")] public int Count { get; set; } + [JsonPropertyName("lum")] public string Lum { get; set; } = "-"; + /// True while simulated stock (pack + character lum) still covers this step. + [JsonPropertyName("ok")] public bool Ok { get; set; } +} + +/// Still-need vs have for one material (or character luminance). +internal sealed class EnlMaterialRow +{ + [JsonPropertyName("label")] public string Label { get; set; } = ""; + [JsonPropertyName("need")] public string Need { get; set; } = "0"; + [JsonPropertyName("have")] public string Have { get; set; } = "0"; + [JsonPropertyName("ok")] public bool Ok { get; set; } +} + +/// One row of the 301–325 sigil craft chain. +internal sealed class EnlChainRow +{ + [JsonPropertyName("label")] public string Label { get; set; } = ""; + [JsonPropertyName("need")] public long Need { get; set; } + [JsonPropertyName("have")] public long Have { get; set; } + [JsonPropertyName("ok")] public bool Ok { get; set; } + [JsonPropertyName("craft")] public bool Craft { get; set; } } [JsonSerializable(typeof(ProgressionInfo))] diff --git a/src/RynthCore.Engine/UI/Data/SettingsData.cs b/src/RynthCore.Engine/UI/Data/SettingsData.cs index dec1910..4d05d45 100644 --- a/src/RynthCore.Engine/UI/Data/SettingsData.cs +++ b/src/RynthCore.Engine/UI/Data/SettingsData.cs @@ -1224,7 +1224,7 @@ internal static class SettingsSchema Bool("Combine Bags During Salvage", s => s.CombineBagsDuringSalvage, (s, v) => s.CombineBagsDuringSalvage = v, "When salvaging an item, also add any under-full salvage bag of the same material to the salvage panel."), Button("Floating HUDs", "Inventory HUDs...", () => RynthAiCommands.ApplyRemoteCommand("huds", "show"), - "Opens the item count HUD / Mini Remote setup window (/ra huds)."), + "Opens the floating pack item count HUD / Mini Remote setup (/ra huds).\nThe Item Count panel is separate (/rc itemcount; Inventory's Count button)."), Bool("Salvage Without The Panel", s => s.SalvageWithoutPanel, (s, v) => s.SalvageWithoutPanel = v, "Salvage (and combine bags) by sending the salvage request to the server directly:\nAC's salvage panel never opens. When a request changes nothing, that batch is tried once\nthrough the panel. Needs an engine with plugin API v82; otherwise the panel is used."), Spacer(), diff --git a/src/RynthCore.Engine/UI/Dcomp/DcompOverlayWindow.cs b/src/RynthCore.Engine/UI/Dcomp/DcompOverlayWindow.cs index 48e241e..b7679b4 100644 --- a/src/RynthCore.Engine/UI/Dcomp/DcompOverlayWindow.cs +++ b/src/RynthCore.Engine/UI/Dcomp/DcompOverlayWindow.cs @@ -136,7 +136,7 @@ internal sealed class DcompOverlayWindow : Window var reloadBtn = MakeButton("RL"); reloadBtn.Foreground = Brushes.Khaki; - reloadBtn.Click += (_, _) => EngineLifecycle.SignalReload(); + reloadBtn.Click += (_, _) => EntryPoint.RequestManualReload("Dcomp RL"); var barStack = new StackPanel { diff --git a/src/RynthCore.Engine/UI/Panels/RynthChatPresets.cs b/src/RynthCore.Engine/UI/Panels/RynthChatPresets.cs index 0df795c..eac179a 100644 --- a/src/RynthCore.Engine/UI/Panels/RynthChatPresets.cs +++ b/src/RynthCore.Engine/UI/Panels/RynthChatPresets.cs @@ -1,14 +1,19 @@ // ============================================================================ // RynthCore.Engine — UI/Panels/RynthChatPresets.cs // Canned ("standard") RynthChat filters, modelled on UtilityBelt-IT's -// ChatFilter / Mag ChatFilter categories. Each preset is a tick-box in the -// ChatFilters panel that hides its lines or moves them to a tab. +// ChatFilterTool (Mag ChatFilter parity) plus the classic ChatFilter / +// ChatHandler categories. Each preset is a tick-box in the ChatFilters +// panel that hides its lines or moves them to a tab. // // Presets match the raw line text (no timestamp / sender prefix). Most are // limited to non-chat channels so a player typing the same words in Local or // a channel is never eaten. ChatRouter evaluates them on the plugin pump // (after the custom rules); editors change Enabled / Tab from any thread and // then call ChatModel.FiltersChanged so every kept line is routed again. +// +// Not ported as text presets (need Decal WorldFilter / StatusTextIntercept): +// VendorTells, MonsterTell, NpcChatter, StatusTextAll. Use custom rules if +// you want a blunt "tells you" / "says," filter. // ============================================================================ using System; @@ -87,24 +92,70 @@ internal static class RynthChatPresets @"|Your killing blow nearly turns .+ inside-out!|The thunder of crushing .+ is followed by the deafening silence of death!" + @"|Your attack stops .+ cold!)"; - // Optional combat prefixes such as "Critical hit! " / "Sneak Attack! ". - private const string HitPrefix = @"^(?:[A-Z][\w ]{2,20}! )*"; + // Optional combat prefixes: "Critical hit! ", "Sneak Attack! ", "Recklessness! ". + private const string HitPrefix = @"^(?:(?:Critical [Hh]it|Sneak Attack|Recklessness)!\s+)*"; + + // Outgoing physical (melee / missile): "... for N points of X damage!" + private const string DealtMelee = + HitPrefix + @"You \S+ .+ for \d+ points? of .+ damage"; + // Outgoing war / void magic: "... for N points with SpellName." + private const string DealtMagic = + HitPrefix + @"You \S+ .+ for \d+ points? with "; + // Incoming melee / missile: body-part hits ("... your foot for N points of ..."). + private const string TakenMelee = + HitPrefix + @"(?!You ).+ your [a-z ]+ for \d+ points? of .+ damage"; + // Incoming spell damage: "... you for N points with SpellName." + private const string TakenMagic = + HitPrefix + @"(?!You ).+ you for \d+ points? with "; private static readonly Preset[] _all = { - // ── Combat ──────────────────────────────────────────────────────── + // ── Combat (specific before umbrella: FirstMatch order) ─────────── new("combat.attack_evades", "Combat", "Your attacks evaded", "A monster evades your melee or missile attack.", "Drudge Slinker evaded your attack.", Scope.NotPlayerChat, @" evaded your attack\.\s*$"), new("combat.defense_evades", "Combat", "You evade attacks", "You evade a monster's attack.", "You evaded Drudge Slinker!", Scope.NotPlayerChat, @"^You evaded "), - new("combat.damage_dealt", "Combat", "Damage you deal", - "Your melee, missile and war-spell hits (including critical / sneak attack prefixes).", - "You slash Drudge Slinker for 54 points of slashing damage!", Scope.NotPlayerChat, HitPrefix + @"You .+ for \d+ points? of "), - new("combat.damage_taken", "Combat", "Damage you take", - "Monster hits and spell damage landing on you.", - "Drudge Slinker slashes you for 12 points of slashing damage!", Scope.NotPlayerChat, HitPrefix + @"(?!You ).+ you (?:with .+ )?for \d+ points? of "), + + // Prefix-tagged hits (can filter these alone without hiding every swing). + new("combat.recklessness", "Combat", "Recklessness hits", + "Lines prefixed with \"Recklessness!\" (your reckless swings).", + "Recklessness! You slash Drudge Slinker for 54 points of slashing damage!", Scope.NotPlayerChat, + @"^((?:Critical [Hh]it!|Sneak Attack!)\s+)*Recklessness!"), + new("combat.sneak_attack", "Combat", "Sneak Attack hits", + "Lines prefixed with \"Sneak Attack!\" (your sneak swings / shots).", + "Sneak Attack! You slash Drudge Slinker for 54 points of slashing damage!", Scope.NotPlayerChat, + @"^((?:Critical [Hh]it!|Recklessness!)\s+)*Sneak Attack!"), + new("combat.critical", "Combat", "Critical hits", + "Lines prefixed with \"Critical hit!\" / \"Critical Hit!\".", + "Critical hit! You slash Drudge Slinker for 100 points of slashing damage!", Scope.NotPlayerChat, + @"^Critical [Hh]it!"), + + // Melee / missile vs magic (UB ChatHandler DamageMelee / DamageSpell / DamageOnTarget). + new("combat.melee_dealt", "Combat", "Melee / missile damage you deal", + "Your weapon hits: \"You slash … for N points of … damage!\" (missile uses the same form).", + "You slash Drudge Slinker for 54 points of slashing damage!", Scope.NotPlayerChat, DealtMelee), + new("combat.magic_dealt", "Combat", "Magic damage you deal", + "Your war / void hits: \"You … for N points with SpellName.\"", + "You freeze Drudge Slinker for 120 points with Frost Bolt VI.", Scope.NotPlayerChat, DealtMagic), + new("combat.melee_taken", "Combat", "Melee / missile damage you take", + "Monster weapon hits on a body part (\"… grazes your foot for N points of …\").", + "Drudge Slinker grazes your foot for 12 points of slashing damage!", Scope.NotPlayerChat, TakenMelee), + new("combat.magic_taken", "Combat", "Magic damage you take", + "Spell damage on you: \"… you for N points with SpellName.\"", + "Drudge Sorcerer scorches you for 40 points with Flame Bolt III.", Scope.NotPlayerChat, TakenMagic), + + // Umbrella damage (both of/with forms). Keep for players who want one switch. + new("combat.damage_dealt", "Combat", "All damage you deal", + "Every hit you land (melee, missile, magic), including critical / sneak / recklessness prefixes.", + "You slash Drudge Slinker for 54 points of slashing damage!", Scope.NotPlayerChat, + HitPrefix + @"You \S+ .+ for \d+ points? (?:of|with) "), + new("combat.damage_taken", "Combat", "All damage you take", + "Every hit that lands on you (melee / missile body-part and spell \"with\" forms).", + "Drudge Slinker grazes your foot for 12 points of slashing damage!", Scope.NotPlayerChat, + HitPrefix + @"(?!You ).+ (?:you|your [a-z ]+) for \d+ points? (?:of|with) "), + new("combat.attack_resists", "Combat", "Your spells resisted", "A target resists one of your spells.", "Drudge Slinker resists your spell", Scope.NotPlayerChat, @" resists your spell"), @@ -122,6 +173,38 @@ internal static class RynthChatPresets new("combat.monster_deaths", "Combat", "Monster death messages", "Kill flavour text (\"You flatten…\", \"…is reduced to cinders!\").", "Drudge Slinker is reduced to cinders!", Scope.NotPlayerChat, KillPattern), + new("combat.missile_miss", "Combat", "Missile hit the environment", + "\"Your missile attack hit the environment.\" (classic UB ChatFilter).", + "Your missile attack hit the environment.", Scope.NotPlayerChat, + @"^Your missile attack hit the environment\.\s*$"), + new("combat.periodic_damage", "Combat", "Periodic damage ticks", + "\"You receive N points of periodic … damage.\" DoTs on you.", + "You receive 8 points of periodic acid damage.", Scope.NotPlayerChat, + @"^You receive \d+ points of periodic .+damage"), + new("combat.periodic_healing", "Combat", "Periodic healing ticks", + "\"You receive N points of periodic healing.\" (same line as Items → Periodic healing).", + "You receive 12 points of periodic healing.", Scope.NotPlayerChat, + @"^You receive \d+ points of periodic healing"), + new("combat.stamina", "Combat", "Stamina restore / spend", + "Lines that restore or spend stamina (kits, consumables, S2H/S2M, Heal Self).", + "You cast Revitalize Self V and restore 40 points of your stamina.", Scope.NotPlayerChat, + @"(?:restore|restores|regain|regains|lose|loses) \d+ points? of (?:your )?stamina\b|and lose \d+ points of stamina"), + new("combat.mana", "Combat", "Mana restore / spend", + "Lines that restore or spend mana (consumables, S2M, mana stones' give line is under Items).", + "You cast Stamina to Mana Self V on yourself and lose 17 points of stamina and also gain 23 points of mana", Scope.NotPlayerChat, + @"(?:restore|restores|regain|regains|gain|gains|lose|loses) \d+ points? of (?:your )?mana\b|and also gain \d+ points of mana"), + new("combat.health", "Combat", "Health restore", + "Lines that restore health points (kits, heals, consumables) — not damage taken.", + "You heal yourself for 80 Health points.", Scope.NotPlayerChat, + @"(?:heal yourself for \d+|restore|restores|regain|regains) \d+ points? of (?:your )?health\b|heal yourself for \d+ Health"), + new("combat.fail_affect_you", "Combat", "Fails to affect you", + "\"… fails to affect you…\" (broader than the NPK-only filter).", + "Bob fails to affect you because he is not a player killer!", Scope.NotPlayerChat, + @" fails to affect you"), + new("combat.you_fail_affect", "Combat", "You fail to affect", + "\"You failed to affect…\" / \"You fail to affect…\" (non-PK and other).", + "You fail to affect Bob because you are not a player killer!", Scope.NotPlayerChat, + @"^You fail(?:ed)? to affect "), // ── Casting ─────────────────────────────────────────────────────── new("cast.mine", "Casting", "Your spell words", @@ -145,6 +228,14 @@ internal static class RynthChatPresets new("cast.expires", "Casting", "Spell expiry", "\"… has expired.\" — rares (Brilliance / Prodigal / Spectral) are kept.", "Strength Self VII has expired.", Scope.NotPlayerChat, @"^(?!.*(?:Brilliance|Prodigal|Spectral)).*\b(?:has|have) expired\."), + new("cast.give_take", "Casting", "Stamina / health / mana transfers", + "Self casts that spend one vital and restore another (S2M, S2H, …).", + "You cast Stamina to Mana Self V on yourself and lose 17 points of stamina and also gain 23 points of mana", Scope.NotPlayerChat, + @"^You cast .+ on yourself and lose \d+ points of .+ and also gain \d+ points of "), + new("cast.heal_self", "Casting", "Your heal / restore casts", + "\"You cast … and restore N points of your …\" (spell heals, not kits).", + "You cast Revitalize Self V and restore 40 points of your stamina.", Scope.NotPlayerChat, + @"^You cast .+ and restore \d+ points of your "), // ── Items & utility ─────────────────────────────────────────────── new("item.heal_ok", "Items", "Healing kit success", @@ -153,6 +244,14 @@ internal static class RynthChatPresets new("item.heal_fail", "Items", "Healing kit failure", "\"You fail to heal yourself.\"", "You fail to heal yourself. ", Scope.NotPlayerChat, @"^You fail to heal yourself\."), + new("item.healed_by_other", "Items", "Healed by another", + "\"X casts Y and restores N points of your …\"", + "Bob casts Heal Other VI and restores 80 points of your health.", Scope.NotPlayerChat, + @"^.+ casts .+ and restores \d+ points of your "), + new("item.consumable", "Items", "Food / potion restores", + "\"The X restores N points of your …\"", + "The Health Tonic restores 50 points of your health.", Scope.NotPlayerChat, + @"^The .+ restores \d+ points of your "), new("item.salvage", "Items", "Salvage results", "\"You obtain … using your knowledge of …\"", "You obtain 12 Steel (ws 7.00) using your knowledge of Weapon Tinkering.", Scope.NotPlayerChat, @"^You obtain .+ using your knowledge of "), @@ -167,8 +266,17 @@ internal static class RynthChatPresets "The Mana Stone gives 4,500 points of mana to the following items:", Scope.NotPlayerChat, @"^The Mana Stone (?:gives|drains) |^You need .+ more mana to fully charge your items\.\s*$|^The .+ is destroyed\.\s*$"), new("item.regen", "Items", "Periodic healing ticks", - "\"You receive N points of periodic healing.\"", - "You receive 12 points of periodic healing.", Scope.NotPlayerChat, @"^You receive .+ points of periodic healing"), + "Same as Combat → Periodic healing (kept here for the Items group).", + "You receive 12 points of periodic healing.", Scope.NotPlayerChat, @"^You receive \d+ points of periodic healing"), + new("item.aetheria_surge", "Items", "Aetheria surges", + "\"Aetheria surges on…\" (classic UB Misc filter).", + "Aetheria surges on Bob, increasing his damage.", Scope.NotPlayerChat, @"^Aetheria surges on"), + new("item.cloak", "Items", "Cloak procs", + "\"The cloak of…\" cloak cast lines (classic UB Misc filter).", + "The cloak of Bob weaves a protective spell.", Scope.NotPlayerChat, @"^The cloak of"), + new("item.banked_lum", "Items", "Banked luminance", + "\"You've banked N Luminance.\" (classic UB Misc filter).", + "You've banked 1,250 Luminance.", Scope.NotPlayerChat, @"^You've banked [\d,]+ Luminance\.\s*$"), // ── Social & trade ──────────────────────────────────────────────── new("social.bot_spam", "Social", "Trade / buff bot spam", @@ -180,6 +288,16 @@ internal static class RynthChatPresets new("social.kill_task", "Social", "Kill task complete", "\"You have killed N Xs! Your task is complete!\"", "You have killed 50 Drudges! Your task is complete!", Scope.NotPlayerChat, @"^You have killed \d+ .+Your task is complete!\s*$"), + new("social.kill_task_progress", "Social", "Kill task progress", + "\"You have killed N Xs! You must kill M to complete your task.\" (ACECustom / UB-IT).", + "You have killed 12 Drudges! You must kill 50 to complete your task.", Scope.NotPlayerChat, + @"^You have killed \d+ .+! You must kill \d+ to complete your task\.\s*$"), + new("social.too_busy", "Social", "You're too busy", + "\"You're too busy!\" (also Mag StatusTextYoureTooBusy when it lands in chat).", + "You're too busy!", Scope.NotPlayerChat, @"^You're too busy!\s*$"), + new("social.casting_status", "Social", "Casting status text", + "\"Casting …\" overlay lines when they appear in chat (Mag StatusTextCasting).", + "Casting Focus Self VII", Scope.NotPlayerChat, @"^Casting "), new("social.general", "Social", "General channel", "Everything said on General.", "[General] Bob says, \"hi\"", Scope.ChannelsOnly, @"^\[General\]|says on the General channel"), @@ -197,10 +315,14 @@ internal static class RynthChatPresets "[Society] Bob says, \"…\"", Scope.ChannelsOnly, @"^\[(?:Society|Celestial Hand|Eldrytch Web|Radiant Blood)\]|says on the (?:Society|Celestial Hand|Eldrytch Web|Radiant Blood) channel"), // ── NPCs ────────────────────────────────────────────────────────── - new("npc.arbitrator", "NPCs", "Master Arbitrator (Colosseum)", - "All Master Arbitrator speech and the fellowship-lock notice.", + new("npc.arbitrator_spam", "NPCs", "Master Arbitrator spam", + "Selected Colosseum spam (title / key / arena instructions); keeps \"Well done!\" / \"Good Luck!\".", "Master Arbitrator tells you, \"You shall be known…\"", Scope.Any, - @"^Master Arbitrator (?:says|tells you)|^Your fellowship is now locked\..*you have 15 minutes to be recruited"), + @"(?:^Master Arbitrator tells you,.+(?:""You shall be known|""Take this knowledge|""Use the the key)|(?:\[Fellowship\] )?Master Arbitrator says,.+(?:""Your fellowship|""Use one of the|""Don't forget))"), + new("npc.arbitrator", "NPCs", "All Master Arbitrator chat", + "Every Master Arbitrator line plus the fellowship-lock notice (Mag AllMasterArbitratorChat).", + "Master Arbitrator tells you, \"You shall be known…\"", Scope.Any, + @"^Master Arbitrator (?:says|tells you)|^\[Fellowship\] Master Arbitrator |^Your fellowship is now locked\..*you have 15 minutes to be recruited"), // ── Pets (ACE custom combat pets) ───────────────────────────────── new("pet.hit", "Pets", "Pet hits", diff --git a/tools/EngineSettingsTests/Program.cs b/tools/EngineSettingsTests/Program.cs index 7449ca4..688a347 100644 --- a/tools/EngineSettingsTests/Program.cs +++ b/tools/EngineSettingsTests/Program.cs @@ -99,6 +99,7 @@ namespace EngineSettingsTests Console.WriteLine("ImGuiBackend=" + EngineSettings.EnableImGuiBackend); Console.WriteLine("ServerMessageStream=" + EngineSettings.ServerMessageStream); Console.WriteLine("MaxHotReloads=" + EngineSettings.MaxHotReloads); + Console.WriteLine("AllowInWorldAutoHotReload=" + EngineSettings.AllowInWorldAutoHotReload); Console.WriteLine("CloseOnServerDisconnect=" + EngineSettings.CloseOnServerDisconnect); Console.WriteLine("IltServerNames=" + (EngineSettings.IltServerNames is { } n ? string.Join("|", n) : "(none)")); break; diff --git a/tools/ReloadInWorldGateTests/Program.cs b/tools/ReloadInWorldGateTests/Program.cs new file mode 100644 index 0000000..3c4b63f --- /dev/null +++ b/tools/ReloadInWorldGateTests/Program.cs @@ -0,0 +1,95 @@ +using RynthCore.Engine; + +namespace ReloadInWorldGateTests; + +/// +/// Offline checks for ReloadInWorldGate (automatic hot reload must not tear the engine +/// down mid-session). See the csproj comment for the cases. +/// +internal static class Program +{ + private static int _checks, _failed; + private static string _case = ""; + + private static int Main() + { + ShouldHoldRules(); + ClearWhenNotInWorld(); + WaitsUntilLeftWorld(); + ThrowingHoldNeverWedges(); + + Console.WriteLine($"{_checks} check(s), {_failed} failed."); + return _failed == 0 ? 0 : 1; + } + + private static void Check(bool ok, string what) + { + _checks++; + if (ok) return; + _failed++; + Console.WriteLine($"[FAIL] {_case}: {what}"); + } + + private static void ShouldHoldRules() + { + _case = "ShouldHold"; + Check(ReloadInWorldGate.ShouldHold(byHand: true, allowInWorldAuto: false, inWorld: true), "by hand + in world: still hold (ERl must not bypass)"); + Check(!ReloadInWorldGate.ShouldHold(byHand: false, allowInWorldAuto: true, inWorld: true), "allow in-world auto: never hold"); + Check(!ReloadInWorldGate.ShouldHold(byHand: false, allowInWorldAuto: false, inWorld: false), "out of world: never hold"); + Check(ReloadInWorldGate.ShouldHold(byHand: false, allowInWorldAuto: false, inWorld: true), "auto + in world: hold"); + } + + private static void ClearWhenNotInWorld() + { + _case = "clear"; + var logs = new List(); + var outcome = ReloadInWorldGate.Run( + stillHold: () => false, + log: logs.Add, + notify: null, + waited: out TimeSpan waited, + clock: () => new DateTime(2026, 10, 16, 9, 0, 0, DateTimeKind.Utc), + sleep: _ => { }); + Check(outcome == ReloadInWorldGate.Outcome.Clear, $"Clear (got {outcome})"); + Check(waited == TimeSpan.Zero, "no wait"); + Check(logs.Count == 0, "nothing logged"); + } + + private static void WaitsUntilLeftWorld() + { + _case = "wait then clear"; + var now = new DateTime(2026, 10, 16, 9, 0, 0, DateTimeKind.Utc); + int polls = 0; + var logs = new List(); + var notes = new List(); + var outcome = ReloadInWorldGate.Run( + stillHold: () => ++polls <= 5, // hold for 5 polls, then clear + log: logs.Add, + notify: notes.Add, + waited: out TimeSpan waited, + clock: () => now, + sleep: t => now += t, + poll: TimeSpan.FromSeconds(2), + logEvery: TimeSpan.FromSeconds(30)); + Check(outcome == ReloadInWorldGate.Outcome.ClearedAfterWait, $"ClearedAfterWait (got {outcome})"); + Check(Math.Abs(waited.TotalSeconds - 10) < 0.01, $"waited 10 s (got {waited.TotalSeconds})"); + Check(logs.Count >= 2 && logs[0].Contains("player is in the world", StringComparison.Ordinal), + $"first log names the world: {logs.FirstOrDefault()}"); + Check(logs[^1].Contains("left the world", StringComparison.Ordinal), $"last log: {logs[^1]}"); + Check(notes.Count == 1 && notes[0].Contains("in the world", StringComparison.Ordinal), "chat notify once"); + } + + private static void ThrowingHoldNeverWedges() + { + _case = "throwing stillHold"; + var outcome = ReloadInWorldGate.Run( + stillHold: () => throw new InvalidOperationException("boom"), + log: _ => { }, + notify: null, + waited: out TimeSpan waited, + clock: () => DateTime.UtcNow, + sleep: _ => { }); + Check(outcome == ReloadInWorldGate.Outcome.Clear, "throwing query fails open to Clear"); + Check(waited == TimeSpan.Zero, "no wait on throw"); + } +} diff --git a/tools/ReloadInWorldGateTests/ReloadInWorldGateTests.csproj b/tools/ReloadInWorldGateTests/ReloadInWorldGateTests.csproj new file mode 100644 index 0000000..0bda3f0 --- /dev/null +++ b/tools/ReloadInWorldGateTests/ReloadInWorldGateTests.csproj @@ -0,0 +1,23 @@ + + + + + Exe + net10.0 + enable + enable + true + ReloadInWorldGateTests + + + + + + +