From ccecedc8ba05cd1dd872ded9ea53ba92a1680043 Mon Sep 17 00:00:00 2001 From: Wrathen Date: Wed, 11 Nov 2026 01:36:35 +0300 Subject: [PATCH] feat: give crafted items through the Waypoint Tools mod, on releases too The item crafter now works the same on a source copy and a release: Give item goes through LocalExile-Mods' waypoint-tools mod (a request file in data/waypoint-tools/), never through Frida or the client control bridge. When the mod is missing, the crafter offers to install it from the official mod source. - Read whether a Gateway has the crafter from its assembly's metadata (the ItemCrafter type), since /item_give moved to the gm-commands mod. - Drop the release note, "Get the item crafter" and the setup's Give item choice; Tools shows the crafter on releases. - Count LocalExile's modules as met dependencies in Mods, so a mod that depends on Game is no longer "Dependency blocked". - Move the source setup's tested commit to v0.4.2-beta, the first where mods reach the Game module. Co-Authored-By: Claude Opus 5.5 --- README.md | 7 +- docs/launcher.md | 65 +++++----- src/Launcher.Core/GameSystems.cs | 2 +- src/Launcher.Core/ModCatalog.cs | 28 ++++- src/Launcher.Core/Resources/Strings.resx | 94 +++++++------- src/Launcher.Core/Resources/Strings.ru.resx | 94 +++++++------- .../Resources/Strings.zh-CN.resx | 94 +++++++------- src/Launcher.Core/SwitchToSource.cs | 16 ++- src/Launcher.Core/WaypointToolsMod.cs | 118 ++++++++++++++++++ src/Waypoint.Linux/MainWindow.axaml.cs | 6 - .../Views/FolderPicker.axaml.cs | 2 +- src/Waypoint.Linux/Views/SetupWizard.axaml | 5 - src/Waypoint.Linux/Views/SetupWizard.axaml.cs | 12 +- src/Waypoint.Linux/Views/ToolsTab.axaml | 4 - src/Waypoint.Linux/Views/ToolsTab.axaml.cs | 9 -- src/Waypoint/CrafterCatalog.cs | 31 ++++- src/Waypoint/FolderPicker.xaml.cs | 2 +- src/Waypoint/ItemCrafterWindow.xaml | 2 +- src/Waypoint/ItemCrafterWindow.xaml.cs | 62 +++++++-- src/Waypoint/MainWindow.xaml.cs | 6 - src/Waypoint/SetupChecks.cs | 2 +- src/Waypoint/SetupWizard.xaml | 10 +- src/Waypoint/SetupWizard.xaml.cs | 5 +- src/Waypoint/ToolsTab.xaml | 4 - src/Waypoint/ToolsTab.xaml.cs | 10 +- tests/Launcher.Checks/ModChecks.cs | 9 ++ tests/Waypoint.Tests/CrafterCatalogTests.cs | 36 +++++- tests/Waypoint.Tests/SwitchToSourceTests.cs | 9 +- tests/Waypoint.Tests/WaypointToolsModTests.cs | 92 ++++++++++++++ 29 files changed, 561 insertions(+), 275 deletions(-) create mode 100644 src/Launcher.Core/WaypointToolsMod.cs create mode 100644 tests/Waypoint.Tests/WaypointToolsModTests.cs diff --git a/README.md b/README.md index 6cf6c4c..bcd0246 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,8 @@ offers two ways to get LocalExile: | [Node.js](https://nodejs.org/en/download) | The bundle-decompression dependency | | Your own standalone PoE **3.29.3c** client | A separate copy in the checkout's `Client` folder; Steam layout and other builds are unsupported | -Frida (`pip install frida`) is optional: it is needed for walk maps, the console, live mod control and the item crafter's Give -item, not for ordinary play. The crafter offers to install it. +Frida (`pip install frida`) is optional: it is needed for walk maps, the console and live mod control, not for ordinary play. +The item crafter's Give item uses the Waypoint Tools mod instead, which it offers to install. 1. Download `Waypoint.exe` from the latest release on this repository's **Releases** page. 2. Put it anywhere and start it. @@ -72,8 +72,7 @@ them), the item crafter, the tray and the appearance editor. On a release install some sections do less, because a release has no source, Frida or per-service control: **Console** copies commands for you to paste into the game's chat, **Mods** installs a mod's release but cannot build one from source, **Control** starts and stops -everything together, and **Tools** needs a source checkout: **Get the item crafter…** sets one up beside your release and can bring -your characters. When a newer LocalExile release is out, a green card offers to install it. +everything together, and the item crafter's **Give item** goes through the Waypoint Tools mod, which it offers to install. When a newer LocalExile release is out, a green card offers to install it. Nothing changes until you accept and the game is closed. Your saves are copied first, and `data\` and `Client\` are kept. **Settings → Keep LocalExile up to date** turns the prompt off. diff --git a/docs/launcher.md b/docs/launcher.md index 88cf927..fc5ab23 100644 --- a/docs/launcher.md +++ b/docs/launcher.md @@ -102,9 +102,9 @@ work from, beside a source checkout. It has no `live.ps1`, source or git, so `Re enabled or disabled while the game is closed. - **Console** lists the release Gateway's commands and copies a line to paste into the game's chat, because a release has no client control bridge or Frida. Nothing can read the replies. -- **Tools** explains why it is unavailable. v0.1.0-beta's Gateway has no `crafter` mode, and asking a Gateway for a mode it lacks - starts it serving, so a release's is never asked. Giving an item would need the bridge as well. **Get the item crafter…** starts - the move to a source copy ([below](#from-a-release-to-a-source-copy)). +- **Tools** offers the item crafter as on a source copy. Its window reads the release Gateway's assembly before asking it for + the `crafter` mode ([below](#tools-the-item-crafter)), so a release older than the hook says so instead of starting a server. + **Give item** goes through the Waypoint Tools mod, as on a source copy. Waypoint drives it only through `LocalExile.exe --json` (`LocalExileTool`), one JSON event per line: @@ -166,8 +166,7 @@ chosen new or empty folder and sets it up; on a release the list has it only wit ### From a release to a source copy -A source copy has what no release has yet, such as the item crafter. **Tools → Get the item crafter…**, or **Set up a new copy…** on a -release, opens the guide's source route with one more page, **Your characters**, after the client (`SwitchToSource.cs`). The release's +A source copy has what no release has yet. **Set up a new copy…** on a release opens the guide's source route with one more page, **Your characters**, after the client (`SwitchToSource.cs`). The release's client comes first in the list, and is shared rather than copied when its keys fit. **Browse…** on this route refuses a release, which has no source to build, and turns to the download instead. @@ -188,11 +187,10 @@ has no source to build, and turns to the download instead. are on one drive, and deletes the release's program files. Its `data` and `Mods` stay, and so does anything a release does not ship. **Keep it** drops the question and leaves the release as it is. - **Updates**, for a download: **Keep an older version that does not change** puts the copy on its own branch `waypoint-tested` at - `SwitchToSource.TestedCommit` (LocalExile v0.2.0-beta, e28909f6). **Get the newest changes** leaves it on `main`. Nothing moves + `SwitchToSource.TestedCommit` (LocalExile v0.4.2-beta, a6e3b6a2). **Get the newest changes** leaves it on `main`. Nothing moves either by itself: its user updates the copy, or moves it from the older version to the newest changes, from Versions. Changing - the commit means testing it again: a release's database opened on it, and an item given. -- **Giving items**: **Set up Give item** installs Frida into the copy's `.venv`, which git ignores. Left out, the crafter offers it - again the first time **Give item** is pressed. + the commit means testing it again: a release's database opened on it, and an item given through the Waypoint Tools mod + (v0.4.0-beta or later). The Run page lists what these choices will do instead of its steps until **Start setup**. The last page says where everything is: the copy plays from Control, and **Change…** there is the way back to the release. @@ -408,8 +406,8 @@ source copy is where they can come along. The list replaced the **Release | Late Developer Mode on, and asks what that switch asked on the way to a source copy; on the way to a release the offer waits on the release's Play page instead of being a question. **Set up a new copy…** in the list of a release, which sets up a copy from source, still shows only with Developer Mode on (`Editions.Offered`): a source copy needs .NET, Git, Python and Node -and is LocalExile's newest, less tested code, which is not what someone who came to play wants. **Run setup guide…** and -**Tools → Get the item crafter…** stay for everyone. +and is LocalExile's newest, less tested code, which is not what someone who came to play wants. **Run setup guide…** stays for +everyone. - **Between two source copies, or two releases**: nothing is asked beyond what runs. - **Release → source copy** (`Editions.BringAlongAsync`): bring your characters? The question says first that Latest has @@ -418,8 +416,7 @@ and is LocalExile's newest, less tested code, which is not what someone who came **Keep Latest's own** leaves both as they are; **Cancel** stays on the release. The saves of the release are backed up first while automatic backups are on (Backups), and the question says so. It is asked once nothing runs, after **Stop and switch**; with **Switch without stopping** nothing is asked and nothing is brought, since saves in use are - not copied. **Tools → Get the item crafter…** asks the same on its way to the source copy Waypoint remembers - (`LatestFolder`). + not copied. - **Source copy → release**, by whatever way: the release keeps its own characters, and the copy's stay in their folder. Waypoint notes that folder (`Editions.LeftFor`, `Settings.BringFrom`), and the release's Play page then shows a card while that folder is still a source copy with saves (`Editions.BringFrom`): "Your characters are still in {folder}", @@ -449,9 +446,6 @@ and is LocalExile's newest, less tested code, which is not what someone who came - When they fit, Waypoint asks, then copies them with the adapter's `ImportSaves`: the source copy is only read, the release's own saves are backed up (with **Automatic backups** off too) and set aside first, and the release keeps its own mod choices. -- On a release, **Tools → Get the item crafter…** switches to the source copy Waypoint remembers, with the same question, and - otherwise opens the guide as before, with the older version chosen (`waypoint-tested`). Either way that copy is then shown - in Advanced mode, and is moved to newer code only from Versions, by its user. A link to a section Simple mode's list lacks (a log, from a failure) shows that section without selecting anything. @@ -470,7 +464,7 @@ A link to a section Simple mode's list lacks (a log, from a failure) shows that | Logs | every server's `logs\live-*.log` with its `.err`, the walk-map recorder, the dev host, the client's `Client\logs\Client.txt`, the launcher's own lines, and "All errors" from all of them | follows each file twice a second; a file `live.ps1` recreates starts over; a large file from its last 512 KB | | Accounts | the accounts and their characters, searchable; registering an account; creating a character; creating, duplicating, renaming, setting a password and deleting with everything stopped | the list and those changes are the adapter's (`QueryAccounts`, `Register`, `ManageAccount`, `AccountData.py`; [account-management.md](account-management.md)); Register and Create go through the server's dev account service (`GameServer.Host`, its `Agents/docs/dev-server.md`): `register`, `create_character`; Waypoint builds and starts it when needed | | Console | the Gateway's chat commands for the character in game, with suggestions, usages, pinned lines and history | the server's client control bridge (`scripts/dev/client_control.py --stdio`); the lists come from the built Gateway (`GameServer.Gateway commands` and `values`) | -| Tools | tools for the game itself, each in its own window: the map viewer, the item crafter, the lab layout | the server's item crafter hook (its `Agents/docs/dev/item-crafter.md`): `GameServer.Gateway crafter` and `/item_give` through the client control bridge; the Gateway's `labyrinth ` mode for the lab layout | +| Tools | tools for the game itself, each in its own window: the map viewer, the item crafter, the lab layout | the server's item crafter hook (its `Agents/docs/dev/item-crafter.md`): `GameServer.Gateway crafter`, and items given through the Waypoint Tools mod; the Gateway's `labyrinth ` mode for the lab layout | | Settings | the appearance, the language, what closing the window does, updates, the checkout and its local launch profile (Advanced mode only) | saved as chosen; `Settings.cs` | ### No longer reached @@ -782,7 +776,7 @@ missing from the client copy and keeps what exists (keys, `Game.patched.exe`), a instructions first. The **Python** requirement runs the Python the extraction would use (the checkout's `.venv`, else the one on PATH) and wants a 3.9 or newer, so the Microsoft Store's python shortcut does not count. -Frida is optional for ordinary play. On Windows, direct console commands and game status, Give item, walk maps, live mod +Frida is optional for ordinary play. On Windows, direct console commands and game status, walk maps, live mod controls and game-data reload offer **Install Frida** when their Python cannot load it. Declining leaves the requested action unstarted; Console keeps the unsent text. A queued mod build ends when preparation is declined or fails; only a busy workspace is retried, so **Not now** does not reopen the prompt. Installation uses the checkout's `.venv`, shows output in @@ -821,7 +815,10 @@ not assumed **Up to date** without repository evidence. **Open folder**, Refresh **My Mods** lists the installed mods (from the manifests under `Mods/Binaries` and `Mods/Source`, script mods included: loose `.cs` files in `Mods/Binaries//`) with their client -versions and author; the Action column says what it needs (Update, Build, Reinstall) or that it is up to date. A row's check box turns the mod on or off at once: Waypoint rewrites +versions and author; the Action column says what it needs (Update, Build, Reinstall) or that it is up to date. A mod whose +`depends` names something that is neither another usable mod nor one of the checkout's modules (`Modules/**/module.json`, +by its exact id, as the Gateway resolves it) is **Dependency blocked**, with what it needs; `"Game"`, the Game module, +counts as there (`ModCatalog.ModuleIds`). A row's check box turns the mod on or off at once: Waypoint rewrites the server's `mod-state.txt` (no backup, no client), which a stopped Gateway reads at its next start and a running one applies within a second (LocalExile since 2026-11-07; an older Gateway applies it at its next start). While Gateway runs, Windows and Linux show a restart notice when the checkout's source does not identify the live-choice hook; release installs @@ -1199,11 +1196,20 @@ write and gives it to the character in game. the values are the ones that give the line's numbers (outside the tier's range only when no tier gives them). Enchantments and lines no modifier words are left out. Uniques are refused: the crafter makes normal, magic and rare items. `ItemImport.cs`, `ItemImportWindow`. -- **Give item** sends `/item_give ` through the client control bridge, as the Console does, so the - character must be in game; the item goes into the main inventory and the Gateway's reply shows in the status line. - When Frida is missing, it offers to install it into the checkout's `.venv` before sending. The copy button puts that command - on the clipboard, but the game's chat box stops at 175 characters and a rare's command is about 530, so it says so when the command is too long: the - bridge sends the same message without that limit. +- **Give item** gives the item to the character in game, into the main inventory, through the Waypoint Tools mod + (LocalExile-Mods' `waypoint-tools`, `WaypointToolsMod.cs`), the same on a source copy and a release; it needs no other + mod and no Frida. The mod counts as loaded when its `data/waypoint-tools/loaded.json` names a Gateway process that still + runs and lists `item_give`. Waypoint writes `data/waypoint-tools/requests/.json` (as `.tmp`, then renamed) with the + item and no character, and the mod gives it to the one character in game on that connection's next tick, then answers + in `replies/.json`, which Waypoint reads and deletes; the answer shows in the status line. Nothing goes over the + network and nothing limits the item's length. An answer not there in 35 seconds (the mod waits 30 for a character in + game) takes the request back, so a Gateway started later does not give it. With several characters in game the mod + answers that it needs a name. + Without the mod loaded: when it is installed, the status line says to play, turn it on in Mods and enter an area; when + it is not, Waypoint offers to install it from the official mods, as Browse would: its release, or on a source copy its + source, which `live.ps1` builds before the Gateway starts (or **Build mod** in Mods). The copy button puts + `/item_give ` (the `gm-commands` mod's command) on the clipboard, but the game's chat box stops at 175 + characters and a rare's command is about 530, so it says so when the command is too long. - **Reset** starts over as the window opens: an empty item, every search and filter cleared, the Base page. It asks first when the item on screen has changes no save holds; saved items stay. @@ -1211,9 +1217,12 @@ The data is the Gateway's own (`GameServer.Gateway crafter`, read once per Gatew can have (the server's own rolling rules), their stat descriptions in English (the checkout's `data/stat-descriptions.txt`) and the name words. `CrafterCatalog.cs` reads it and words the modifiers. -A Gateway built before the hook does not know `crafter` and would start for real, so Waypoint first asks `commands`, -which is safe, and goes on only if that lists `/item_give`, which came with the hook. If not, the window says the -checkout needs updating and building; nothing starts. +A Gateway built before the hook does not know `crafter` and would start for real, so Waypoint first reads the Gateway's +assembly (`GameServer.Gateway.dll`, beside a release's `app\GameServer.Gateway.exe`) without running it, and goes on only +if it defines `ItemCrafter`, which came with the hook (`CrafterCatalog.HasCrafter`). `/item_give`, which came with it too, +moved to the `gm-commands` mod in v0.4.0-beta, so the `commands` list no longer tells. If not, the window says the +checkout needs updating and building; nothing starts. A release has the hook from v0.2.2-beta; its modifier wording comes +from `client.db` from v0.4.0-beta. ### Tools: the lab layout @@ -1278,7 +1287,7 @@ adapter does not know can be browsed but not changed. | `AppearanceDialog.cs`, `ColorPickerDialog.cs`, `AccountActionDialog.cs`, `WindowBehaviorChoices.cs` | the appearance, an account change, the close choices | | `Workspace.cs`, `OutputPanel.xaml` | the app's side of the adapter: the last inspection, the operations and their output | | `SetupTab`, `ModsTab`, `BackupsTab`, `SettingsTab` | those sections | -| `ToolsTab`, `ItemCrafterWindow`, `CrafterCatalog.cs`, `CraftedItems.cs`, `ItemImport.cs`, `ItemImportWindow` | the Tools section; the item crafter, the Gateway's crafter data and the game's wording of modifiers, the saved items, importing an item copied from Path of Building or the game | +| `ToolsTab`, `ItemCrafterWindow`, `CrafterCatalog.cs`, `CraftedItems.cs`, `ItemImport.cs`, `ItemImportWindow`, `src/Launcher.Core/WaypointToolsMod.cs` | the Tools section; the item crafter, the Gateway's crafter data and the game's wording of modifiers, the saved items, importing an item copied from Path of Building or the game, giving it through the Waypoint Tools mod | | `Loc.cs`, `src/Launcher.Core/Localization.cs`, `src/Launcher.Core/Resources/` | interface text in XAML and code, the languages (`L.Languages`) and their catalogs | | `src/Launcher.Core/` | the adapter's client (`RuntimeClient.cs`, `BridgeScripts.cs`), the mods, backups, accounts, setup guidance, checkout discovery, diagnostics, the single instance | | `scripts/` | the adapter: `RuntimeBridge.ps1` and its parts, `SaveBackup.py`, `AccountData.py` | diff --git a/src/Launcher.Core/GameSystems.cs b/src/Launcher.Core/GameSystems.cs index 43fbd03..a395f94 100644 --- a/src/Launcher.Core/GameSystems.cs +++ b/src/Launcher.Core/GameSystems.cs @@ -54,7 +54,7 @@ static string Normal(string path) return value; } static string Id(string path) => Normal(path).Split('/')[^1]; - static IEnumerable Manifests(string folder, string manifest) + internal static IEnumerable Manifests(string folder, string manifest) { if (!Directory.Exists(folder)) yield break; var pending = new Stack<(string Folder, int Depth)>(); pending.Push((folder, 0)); int count = 0; diff --git a/src/Launcher.Core/ModCatalog.cs b/src/Launcher.Core/ModCatalog.cs index 6547ab9..8f04bf1 100644 --- a/src/Launcher.Core/ModCatalog.cs +++ b/src/Launcher.Core/ModCatalog.cs @@ -102,6 +102,28 @@ string Text(string name, string fallback) => Field(name).ValueKind == JsonValueK return new(id, Text("version", "0"), kind, dependencies, assembly, enabled.ValueKind != JsonValueKind.False, Text("name", ""), Text("description", ""), Text("author", ""), ClientCompatibility.Read(Field(ClientCompatibility.Field))); } + /// The ids of the checkout's modules (Modules/**/module.json, as Game Systems reads them), which a mod may + /// depend on beside other mods. None when they cannot be read. + internal static HashSet ModuleIds(string root) + { + var ids = new HashSet(StringComparer.Ordinal); + try + { + foreach (string file in GameSystems.Manifests(Path.Combine(root, "Modules"), "module.json")) + { + try + { + using var json = JsonDocument.Parse(File.ReadAllText(file)); + ids.Add(json.RootElement.TryGetProperty("id", out var id) && id.ValueKind == JsonValueKind.String + ? id.GetString()! : Path.GetFileName(Path.GetDirectoryName(file)!)); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or JsonException) { } + } + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + return ids; + } + public static ModEntry[] Read(RuntimeSnapshot snapshot) { var environment = snapshot.ModEnvironment; @@ -162,11 +184,15 @@ public static ModEntry[] Read(RuntimeSnapshot snapshot) } } var runtime = ParseRuntimeReport(environment.RuntimeReport); + var modules = ModuleIds(snapshot.Root); foreach (var original in entries.Values.ToArray()) { var entry = original with { Enabled = choices.GetValueOrDefault(original.Id, original.Enabled) }; if (entry.Status.StartsWith("Invalid", StringComparison.Ordinal) || entry.Status == "Missing DLL") continue; - string[] missing = entry.Depends.Where(id => !entries.TryGetValue(id, out var dep) || !dep.Enabled || dep.Status is "Missing DLL" or "Not built" || dep.Status.StartsWith("Invalid", StringComparison.Ordinal)).ToArray(); + // A dependency is another mod or, as the Gateway's ModHost.Dependency has it, one of the modules (the Game module). + string[] missing = entry.Depends.Where(id => entries.TryGetValue(id, out var dep) + ? !dep.Enabled || dep.Status is "Missing DLL" or "Not built" || dep.Status.StartsWith("Invalid", StringComparison.Ordinal) + : !modules.Contains(id)).ToArray(); string status = !environment.Enabled ? "Mods disabled globally" : !entry.Enabled ? "Disabled" : entry.Status == "Not built" ? "Not built" : missing.Length > 0 ? "Dependency blocked" : snapshot.Services.Any(s => s.Name == "Gateway" && s.IsRunning) ? "Not checked" : "Gateway stopped"; string detail = missing.Length > 0 ? "Needs: " + string.Join(", ", missing) : entry.Detail; diff --git a/src/Launcher.Core/Resources/Strings.resx b/src/Launcher.Core/Resources/Strings.resx index cb07d84..94a61c5 100644 --- a/src/Launcher.Core/Resources/Strings.resx +++ b/src/Launcher.Core/Resources/Strings.resx @@ -174,6 +174,9 @@ This is not the 3.29.3c build LocalExile needs, so preparing it will probably fail. You can still try, but check the version first: the copy is large. + + The official mods could not be read: {0} + Colors to edit @@ -303,9 +306,6 @@ Elemental orbs - - Giving items - Client archive @@ -561,6 +561,9 @@ Set up a new copy… + + Put the item into the inventory of the character in game (the Waypoint Tools mod) + LocalExile is installed. Run this guide again when you have your game client: Play → Finish setup. @@ -1622,8 +1625,8 @@ Change location above to choose somewhere else. Runtime status has not been confirmed. - - Installs Frida, a tool that talks to the running game. It takes about 180 MB, and some antivirus programs flag it. The game's chat box is too short for most items, so Give item needs it. + + Waypoint offers to install it when you use direct console commands, live mod controls or walk maps. Secondary text @@ -1667,6 +1670,9 @@ Change location above to choose somewhere else. Full copy + + Install Waypoint Tools? + Base: {0} @@ -2149,9 +2155,6 @@ This checkout has modified tracked files. Encounters and challenges - - LocalExile from 1 November, which the item crafter is known to work with. You can move to the newest changes later from Versions. - Optional module for this mode. @@ -2182,6 +2185,9 @@ This checkout has modified tracked files. In the Standard league; the game's own creation screen offers the other leagues + + Sets up a second LocalExile from its source code, which you can change and build yourself. You can bring your characters. + The current saves are backed up and moved aside, never deleted; this applies to one switch @@ -2227,9 +2233,6 @@ This checkout has modified tracked files. Restore stashed changes - - Setup installs a new copy of LocalExile that has the item crafter. What should happen to the one you have now? - Bench @@ -2308,9 +2311,6 @@ This checkout has modified tracked files. Language saved. - - The item crafter is in Tools. - Rules @@ -2581,9 +2581,6 @@ This checkout has modified tracked files. Enable choices apply at the next Gateway start. Build selected compiles this mod’s source. - - Give item needs Frida. - Unavailable in this checkout @@ -2974,6 +2971,9 @@ This checkout has modified tracked files. Gives LocalExile its own settings and saved login, so your normal game keeps its own + + Waypoint Tools did not answer. Is the game running, with a character in an area? + Give LocalExile its own game settings, so your normal game keeps its own. @@ -3298,9 +3298,6 @@ Search limits reached; other checkouts may exist. Browse to any location. No update - - Sets up a second LocalExile from its source code, which has the item crafter. You can bring your characters. - Waiting… @@ -4092,9 +4089,6 @@ Switching to it builds and runs that code on this computer with your rights, liv Create account - - Set up Give item - Copy map details @@ -4365,6 +4359,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Copy the chat command that gives this item + + LocalExile v0.4.2-beta, which this Waypoint is known to work with. You can move to the newest changes later from Versions. + Done: {0} ({1:0} s). @@ -4593,9 +4590,6 @@ Switching to it builds and runs that code on this computer with your rights, liv Adds a Simple | Advanced switch to the sidebar. On a release install, Advanced adds the status strip, performance and server timings; the other sections need a source checkout. - - Waypoint offers to install it when you use direct console commands, Give item, live mod controls or walk maps. - Double-click a command to put it in the line. @@ -4927,6 +4921,9 @@ Switching to it builds and runs that code on this computer with your rights, liv Waiting for the game window to close without force termination. + + Waypoint Tools was not installed: Logs has why. + Checking the client executables and retaining existing login keys. @@ -5114,6 +5111,9 @@ Dependencies: {3} Latest {0} + + Give item needs the Waypoint Tools mod: it gives the item to the character in game. Install it from the official mods? + LocalExile {0} is out; you have {1}. Your characters, keys and game client are kept. @@ -5153,6 +5153,9 @@ Dependencies: {3} Resolve the workspace conflict + + Give item uses the Waypoint Tools mod, and no running game has it loaded. Play, turn it on in Mods if it is off, enter an area with a character, then give the item again. + Deleted {0} saved items @@ -5406,9 +5409,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Not shown - - Leave out Frida. Waypoint offers it again when you press Give item. - the bridge needs Python with frida, which is not installed: the Setup section in Advanced mode shows how @@ -5673,6 +5673,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Enter a name and a password. + + Give item needs the Waypoint Tools mod. + The port is still in use. When you have looked at it, press Continue: Waypoint will ask again. @@ -5799,9 +5802,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Showing the first 1,000 open PRs. Enter a PR number to fetch another. - - The game is not running: start it, enter an area with a character, then give the item again. - Waypoint could not read the version of the copy in {0}. @@ -5838,9 +5838,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys Restart completed. - - Your version of LocalExile does not have the item crafter yet. A new copy of LocalExile does, and you can bring your characters with you. - Select a mod to view its dependencies and controls. @@ -5916,6 +5913,9 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys On your fork (origin), not on LocalExile + + Waypoint Tools is installed. A running game loads it within a second: enter an area with a character, then give the item again. + Alliance @@ -6462,9 +6462,6 @@ Owned servers will stop. Automatic backup is {2}. Source, client and login keys LocalExile has no release to download yet. - - Put the item into the inventory of the character in game (the client control bridge) - Back to My Mods @@ -6705,6 +6702,9 @@ Steam layout and a newer official client are unsupported. The launcher does not Gateway started a new process under the same watcher. Sign in again if the game returned to login. + + The official mods do not list Waypoint Tools yet. + This copy leaves the tested version for LocalExile's newest changes, and Play then updates it each day. Newer changes are not tested and can break. Your saves are backed up first. @@ -6753,6 +6753,9 @@ Steam layout and a newer official client are unsupported. The launcher does not {0} could not be downloaded from GitHub; try again later. + + Setup installs a new copy of LocalExile from its source code. What should happen to the one you have now? + Unavailable @@ -6884,9 +6887,6 @@ Client: {2} Up to date - - Get the item crafter… - Generating map … @@ -7593,6 +7593,9 @@ Dependencies: {2} Getting the latest update + + Waypoint Tools is installed from source: it is built when the servers start next, or with Build mod in Mods. Then enter an area with a character and give the item again. + live.ps1 -Stop and the dev host: the game, the walk-map recorder, the servers and the account service @@ -7713,9 +7716,6 @@ Dependencies: {2} Switch to the release? - - Set up Give item (recommended) - Refresh mod details @@ -8377,9 +8377,6 @@ Mods at backup: Open Waypoint's data folder - - Install Frida, so that Give item works. - Seed: {0} @@ -8527,6 +8524,9 @@ Mods at backup: The release has its own characters. Yours stay here in Latest for when you switch back. + + Installing Waypoint Tools … + Server checkout diff --git a/src/Launcher.Core/Resources/Strings.ru.resx b/src/Launcher.Core/Resources/Strings.ru.resx index 4d5336b..bc1331a 100644 --- a/src/Launcher.Core/Resources/Strings.ru.resx +++ b/src/Launcher.Core/Resources/Strings.ru.resx @@ -174,6 +174,9 @@ Это не сборка 3.29.3c, нужная LocalExile, поэтому подготовка, скорее всего, не удастся. Можно попробовать, но сначала проверьте версию: копия большая. + + Не удалось прочитать официальные моды: {0} + Какие цвета изменять @@ -303,9 +306,6 @@ Стихийные сферы - - Выдача предметов - Архив клиента @@ -561,6 +561,9 @@ Настроить новую копию… + + Положить предмет в инвентарь персонажа в игре (через мод Waypoint Tools) + LocalExile установлен. Когда у вас будет клиент игры, запустите этот мастер снова: «Играть» → «Завершить настройку». @@ -1622,8 +1625,8 @@ Состояние в игре не подтверждено. - - Устанавливает Frida — инструмент, который взаимодействует с запущенной игрой. Она занимает около 180 МБ, а некоторые антивирусы на неё реагируют. Чат игры слишком короткий для большинства предметов, поэтому без неё выдача не работает. + + Waypoint предложит установить её при отправке команд из консоли, управлении модами в игре или записи карт проходимости. Вспомогательный текст @@ -1667,6 +1670,9 @@ Полная копия + + Установить Waypoint Tools? + База: {0} @@ -2149,9 +2155,6 @@ Встречи и испытания - - LocalExile от 1 ноября, с которым точно работает конструктор предметов. Перейти на последние изменения можно позже в разделе «Версии». - Необязательный модуль для этого режима. @@ -2182,6 +2185,9 @@ В лиге «Стандарт»; другие лиги доступны на экране создания персонажа в игре + + Настраивает второй LocalExile из исходного кода, который можно менять и собирать самому. Вы можете перенести своих персонажей. + Текущие сохранения копируются и убираются в сторону, но не удаляются; действует на одно переключение @@ -2227,9 +2233,6 @@ Вернуть отложенные изменения - - Настройка установит новую копию LocalExile с конструктором предметов. Что сделать с той, что есть сейчас? - Верстак @@ -2308,9 +2311,6 @@ Язык сохранён. - - Конструктор предметов находится в разделе «Инструменты». - Правила @@ -2581,9 +2581,6 @@ Выбор модов применяется при следующем запуске Gateway. «Собрать выбранный» компилирует исходники мода. - - Для выдачи предметов нужна Frida. - Недоступно в этой копии @@ -2974,6 +2971,9 @@ Даёт LocalExile собственные настройки и сохранённый вход, а у вашей обычной игры остаются свои + + Waypoint Tools не ответил. Игра запущена, а персонаж находится в локации? + Дать LocalExile собственные настройки игры, а у вашей обычной игры останутся свои. @@ -3298,9 +3298,6 @@ Обновлений нет - - Настраивает второй LocalExile из исходного кода, в котором есть конструктор предметов. Вы можете перенести своих персонажей. - Ожидание… @@ -4092,9 +4089,6 @@ Создать аккаунт - - Настройка выдачи предметов - Копировать сведения о карте @@ -4365,6 +4359,9 @@ Скопировать чат-команду, которая выдаёт этот предмет + + LocalExile v0.4.2-beta, с которым точно работает этот Waypoint. Перейти на последние изменения можно позже в разделе «Версии». + Готово: {0} ({1:0} с). @@ -4593,9 +4590,6 @@ Добавляет на боковую панель переключатель «Простой | Расширенный». В установленном выпуске расширенный режим добавляет строку состояния, производительность и время работы сервера; остальным разделам нужен исходный код. - - Waypoint предложит установить её при отправке команд из консоли, выдаче предметов, управлении модами в игре или записи карт проходимости. - Дважды щёлкните команду, чтобы подставить её в строку. @@ -4927,6 +4921,9 @@ Ожидание закрытия окна игры без принудительного завершения. + + Waypoint Tools не установлен: причина в разделе «Журналы». + Проверка исполняемых файлов клиента с сохранением текущих ключей входа. @@ -5114,6 +5111,9 @@ Последняя {0} + + Для «Выдать предмет» нужен мод Waypoint Tools: он выдаёт предмет персонажу в игре. Установить его из официальных модов? + Вышел LocalExile {0}; у вас {1}. Персонажи, ключи и клиент игры сохранятся. @@ -5153,6 +5153,9 @@ Устраните конфликт рабочей папки + + «Выдать предмет» работает через мод Waypoint Tools, а ни одна запущенная игра его не загрузила. Нажмите «Играть», включите мод в разделе «Моды», если он выключен, войдите в локацию персонажем и выдайте предмет снова. + Удалено сохранённых предметов: {0} @@ -5406,9 +5409,6 @@ Не отображается - - Не устанавливать Frida. Waypoint снова предложит её при нажатии «Выдать предмет». - мосту нужен Python с frida, а он не установлен: как установить, показано в разделе «Подготовка» в расширенном режиме @@ -5673,6 +5673,9 @@ Введите имя и пароль. + + Для «Выдать предмет» нужен мод Waypoint Tools. + Порт всё ещё занят. Когда разберётесь, нажмите «Продолжить»: Waypoint спросит снова. @@ -5799,9 +5802,6 @@ Показаны первые 1000 открытых PR. Введите номер другого PR, чтобы получить его. - - Игра не запущена: запустите её, войдите персонажем в локацию и выдайте предмет снова. - Waypoint не удалось прочитать версию копии в {0}. @@ -5838,9 +5838,6 @@ Перезапуск завершён. - - В вашей версии LocalExile пока нет конструктора предметов. Он есть в новой копии LocalExile, и вы можете перенести туда своих персонажей. - Выберите мод, чтобы увидеть зависимости и доступные действия. @@ -5916,6 +5913,9 @@ В вашем форке (origin), но не в LocalExile + + Waypoint Tools установлен. Запущенная игра загрузит его за секунду: войдите в локацию персонажем и выдайте предмет снова. + Союз @@ -6462,9 +6462,6 @@ У LocalExile пока нет выпуска для загрузки. - - Положить предмет в инвентарь персонажа в игре (через мост управления клиентом) - Назад к моим модам @@ -6705,6 +6702,9 @@ Gateway запустил новый процесс в том же сеансе отслеживания. Войдите повторно, если игра вернулась на экран входа. + + В официальных модах пока нет Waypoint Tools. + Эта копия уйдёт с проверенной версии на последние изменения LocalExile, и «Играть» будет обновлять её каждый день. Новые изменения не проверены, и что-то может сломаться. Сначала будет создана резервная копия ваших сохранений. @@ -6753,6 +6753,9 @@ Не удалось скачать {0} с GitHub; попробуйте позже. + + Настройка установит новую копию LocalExile из исходного кода. Что сделать с той, что есть сейчас? + Недоступно @@ -6884,9 +6887,6 @@ Актуальна - - Получить конструктор предметов… - Создание карты … @@ -7593,6 +7593,9 @@ Получение последнего обновления + + Waypoint Tools установлен из исходного кода: он соберётся при следующем запуске серверов или командой «Собрать мод» в разделе «Моды». Затем войдите в локацию персонажем и выдайте предмет снова. + live.ps1 -Stop и dev host: игра, запись планировок, серверы и служба аккаунтов @@ -7713,9 +7716,6 @@ Переключиться на релиз? - - Настроить выдачу предметов (рекомендуется) - Обновить сведения о моде @@ -8377,9 +8377,6 @@ Открыть папку данных Waypoint - - Установить Frida, чтобы работала кнопка «Выдать предмет». - Сид: {0} @@ -8527,6 +8524,9 @@ У релиза свои персонажи. Ваши останутся здесь, в «Новейшей», до вашего возвращения. + + Установка Waypoint Tools … + Репозиторий сервера diff --git a/src/Launcher.Core/Resources/Strings.zh-CN.resx b/src/Launcher.Core/Resources/Strings.zh-CN.resx index 3415673..28007dc 100644 --- a/src/Launcher.Core/Resources/Strings.zh-CN.resx +++ b/src/Launcher.Core/Resources/Strings.zh-CN.resx @@ -174,6 +174,9 @@ 这不是 LocalExile 所需的 3.29.3c 版本,因此准备很可能会失败。你仍然可以尝试,但请先检查版本:要复制的数据量很大。 + + 无法读取官方模组:{0} + 要编辑的颜色 @@ -303,9 +306,6 @@ 元素球 - - 发放物品 - 客户端资源包 @@ -561,6 +561,9 @@ 设置新副本… + + 将物品放入游戏中角色的背包(通过 Waypoint Tools 模组) + LocalExile 已安装。有了游戏客户端后,请再次运行此向导:开始游戏 → 完成安装。 @@ -1622,8 +1625,8 @@ 尚未确认运行状态。 - - 安装 Frida,一个与运行中的游戏通信的工具。它约占 180 MB,某些杀毒软件会将其标记为可疑。游戏的聊天框对大多数物品来说太短,因此“发放物品”需要它。 + + 使用直接发送控制台命令、实时模组控制或行走地图功能时,Waypoint 会提示安装。 次要文本 @@ -1667,6 +1670,9 @@ 完整复制 + + 安装 Waypoint Tools? + 基础类型:{0} @@ -2149,9 +2155,6 @@ 遭遇与挑战 - - 11 月 1 日的 LocalExile,已知物品制作器可以正常使用。之后可以在“版本”部分改用最新更改。 - 此模式的可选模块。 @@ -2182,6 +2185,9 @@ 在标准联盟中创建;其他联盟可在游戏自带的角色创建界面中选择 + + 从源码设置第二个 LocalExile,你可以自行修改和构建它。你可以带上你的角色。 + 当前存档会先备份再移到一旁,绝不会删除;仅对一次切换有效 @@ -2227,9 +2233,6 @@ 恢复贮藏的更改 - - 安装向导会新装一份带有物品制作器的 LocalExile。你现有的那份要如何处理? - 工艺台 @@ -2308,9 +2311,6 @@ 语言已保存。 - - 物品制作器位于“工具”中。 - 规则 @@ -2581,9 +2581,6 @@ 启用设置将在下次启动 Gateway 时生效。“构建所选”会编译此模组的源码。 - - “发放物品”需要 Frida。 - 此源码副本中不可用 @@ -2974,6 +2971,9 @@ 为 LocalExile 提供独立的设置和已保存的登录信息,让你平常的游戏保留自己的设置 + + Waypoint Tools 没有回应。游戏是否在运行,且有角色在区域中? + 为 LocalExile 提供独立的游戏设置,你平时的游戏保留自己的设置。 @@ -3298,9 +3298,6 @@ 没有更新 - - 从源码设置第二个 LocalExile,它带有物品制作器。你可以带上你的角色。 - 等待中… @@ -4092,9 +4089,6 @@ 创建账号 - - 配置“发放物品” - 复制地图详情 @@ -4365,6 +4359,9 @@ 复制发放此物品的聊天命令 + + LocalExile v0.4.2-beta,已知可与此 Waypoint 正常配合。之后可以在“版本”部分改用最新更改。 + 完成:{0}({1:0} 秒)。 @@ -4593,9 +4590,6 @@ 在侧边栏添加“简易 | 高级”切换开关。在发行版安装中,高级模式会增加状态条、性能和服务器耗时;其他版块需要源码副本。 - - 使用直接发送控制台命令、发放物品、实时模组控制或行走地图功能时,Waypoint 会提示安装。 - 双击命令可将其填入输入行。 @@ -4927,6 +4921,9 @@ 正在等待游戏窗口关闭,不会强制终止。 + + Waypoint Tools 未安装:原因见“日志”。 + 正在检查客户端可执行文件并保留现有登录密钥。 @@ -5114,6 +5111,9 @@ 最新 {0} + + “发放物品”需要 Waypoint Tools 模组:它把物品交给游戏中的角色。要从官方模组安装它吗? + LocalExile {0} 已发布;当前为 {1}。你的角色、密钥和游戏客户端都会保留。 @@ -5153,6 +5153,9 @@ 解决工作区冲突 + + “发放物品”通过 Waypoint Tools 模组完成,但没有正在运行的游戏加载了它。请开始游戏,如果它已关闭,请在“模组”中开启它,用角色进入一个区域,然后再次发放物品。 + 已删除 {0} 个已保存的物品 @@ -5406,9 +5409,6 @@ 不显示 - - 不安装 Frida。当你点击“发放物品”时,Waypoint 会再次提供安装。 - 桥接程序需要安装了 frida 的 Python,但尚未安装:高级模式下的“安装”部分介绍了安装方法 @@ -5673,6 +5673,9 @@ 请输入名称和密码。 + + “发放物品”需要 Waypoint Tools 模组。 + 端口仍被占用。检查完后请点击“继续”:Waypoint 会再次询问。 @@ -5799,9 +5802,6 @@ 显示前 1000 个打开的 PR。输入 PR 编号以获取其他 PR。 - - 游戏未运行:请启动游戏,用角色进入一个区域,然后再次发放物品。 - Waypoint 无法读取 {0} 中副本的版本。 @@ -5838,9 +5838,6 @@ 重启完成。 - - 你的 LocalExile 版本还没有物品制作器。新的 LocalExile 副本中有,而且你可以把角色一起迁移过去。 - 选择一个模组以查看其依赖项和操作。 @@ -5916,6 +5913,9 @@ 在你的复刻(origin)上,不在 LocalExile 上 + + Waypoint Tools 已安装。正在运行的游戏会在一秒内加载它:用角色进入一个区域,然后再次发放物品。 + 联盟 @@ -6462,9 +6462,6 @@ LocalExile 暂无可下载的发行版。 - - 将物品放入游戏中角色的背包(通过客户端控制桥接程序) - 返回我的模组 @@ -6705,6 +6702,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 Gateway 在同一监视进程下启动了新进程。如果游戏回到了登录界面,请重新登录。 + + 官方模组中还没有 Waypoint Tools。 + 这个副本将从经过测试的版本改为 LocalExile 的最新更改,之后“开始游戏”会每天更新它。较新的更改未经测试,可能会出现问题。会先备份你的存档。 @@ -6753,6 +6753,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 无法从 GitHub 下载 {0};请稍后重试。 + + 安装向导会从源码新装一份 LocalExile。你现有的那份要如何处理? + 不可用 @@ -6884,9 +6887,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 已是最新 - - 获取物品制作器… - 正在生成地图 … @@ -7593,6 +7593,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 正在获取最新更新 + + Waypoint Tools 已从源代码安装:它会在下次启动服务器时构建,或在“模组”中使用“构建模组”。然后用角色进入一个区域,再次发放物品。 + live.ps1 -Stop 和 dev host:游戏、行走地图记录器、服务器和账号服务 @@ -7713,9 +7716,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 切换到发布版? - - 配置“发放物品”(推荐) - 刷新模组详情 @@ -8377,9 +8377,6 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 打开 Waypoint 的数据文件夹 - - 安装 Frida,以便使用“发放物品”。 - 种子:{0} @@ -8527,6 +8524,9 @@ Gateway 最近报告的事件。打开 Gateway 输出查看详情。 发布版有自己的角色。你的角色留在最新版中,等你切换回来。 + + 正在安装 Waypoint Tools … + 服务器源码副本 diff --git a/src/Launcher.Core/SwitchToSource.cs b/src/Launcher.Core/SwitchToSource.cs index 9b99c6e..d0582fe 100644 --- a/src/Launcher.Core/SwitchToSource.cs +++ b/src/Launcher.Core/SwitchToSource.cs @@ -4,7 +4,7 @@ namespace Launcher.Core; /// The accounts found in the release, negative when they could not be read; the same. /// The size of a client copy still to make; 0 when none is. public sealed record SwitchChoices(string Copy, string Old, bool Download, bool BringCharacters, int Accounts, int Characters, - bool KeepOld, bool TestedVersion, bool GiveItem, bool SharesClient, double CopyClientGb, bool CopyHasSaves, bool OwnSettings = false); + bool KeepOld, bool TestedVersion, bool SharesClient, double CopyClientGb, bool CopyHasSaves, bool OwnSettings = false); /// A line of "What will happen". public sealed record SwitchLine(string Text, bool Attention = false); @@ -16,18 +16,19 @@ public sealed record ReleaseToRemove(string Old, string Copy, bool Played = fals public sealed record RemovedRelease(bool ClientMoved); /// -/// Moving from a release to a source copy, which has what no release has yet (the item crafter, for one). The release is only +/// Moving from a release to a source copy, which has LocalExile's source to change and build. The release is only /// read until the player, having played on the copy, asks for it to be removed (Control's question). The saves are copied by the adapter /// (ImportSaves); never one database for both, because a newer server may write saves an older release cannot read. /// public static class SwitchToSource { - /// The LocalExile commit this Waypoint was tested with: a release's database opened on it, and an item was given. - public const string TestedCommit = "e28909f68b5ada849c568310e4c702f47c7ca910"; + /// The LocalExile commit this Waypoint was tested with (v0.4.2-beta): a release's database opened on it, and an + /// item was given through the Waypoint Tools mod, which needs v0.4.0-beta or later (mods reaching what modules reach). + public const string TestedCommit = "a6e3b6a26b752ea53d0f3e94ac1f0d7883fa6637"; /// A branch of the copy's own at that commit, apart from the default branch its user updates from Versions. public const string TestedBranch = "waypoint-tested"; - /// What the game's chat box takes, measured: the rest of a longer line is lost. The client control bridge sends - /// the same message without it, so Give item needs Frida for all but the smallest items. + /// What the game's chat box takes, measured: the rest of a longer line is lost, so the item crafter's copied + /// command is too long for most items, and Give item goes through the Waypoint Tools mod instead. public const int ChatBoxLimit = 175; /// What a release holds besides the player's data, client and mods. Anything else stays. @@ -112,8 +113,6 @@ public static IReadOnlyList Describe(SwitchChoices c) if (c.CopyHasSaves) lines.Add(new(L.Text("The characters already in {0} are backed up and set aside.", c.Copy), true)); } else lines.Add(new(L.Text("Start with no accounts or characters. You create an account at the end."))); - lines.Add(c.GiveItem ? new(L.Text("Install Frida, so that Give item works.")) - : new(L.Text("Leave out Frida. Waypoint offers it again when you press Give item."), true)); if (c.Download) lines.Add(c.TestedVersion ? new(L.Text("Keep the older version; it won't update.")) : new(L.Text("Start on the newest changes. You update the copy yourself from Versions."), true)); if (c.KeepOld) lines.Add(new(L.Text("Leave your current LocalExile as it is. Each copy keeps its own progress."))); else @@ -129,7 +128,6 @@ public static string Done(SwitchChoices c) { var text = new List { L.Text("Your new copy is in {0}. Press Play in Waypoint to start it.", c.Copy) }; if (c.BringCharacters) text.Add(L.Text("Your characters came with you, so log in as usual. Mods you added yourself did not: they are still in your old folder.")); - text.Add(L.Text("The item crafter is in Tools.")); text.Add(c.KeepOld ? L.Text("To go back to your other LocalExile, use Change… on Control and choose {0}.", c.Old) : L.Text("Your old LocalExile is still in {0}. After you have played, Control asks whether to delete it.", c.Old)); if (c.SharesClient) text.Add(L.Text("The new copy uses the game files in {0}, so do not delete that folder yourself.", c.Old)); diff --git a/src/Launcher.Core/WaypointToolsMod.cs b/src/Launcher.Core/WaypointToolsMod.cs new file mode 100644 index 0000000..9dc1b51 --- /dev/null +++ b/src/Launcher.Core/WaypointToolsMod.cs @@ -0,0 +1,118 @@ +using System.Diagnostics; +using System.Text.Json; +using System.Text.Json.Nodes; + +namespace Launcher.Core; + +/// The answer to one request: whether it was carried out, and the mod's words for it. +public sealed record ToolsReply(bool Ok, string Message); + +/// +/// Waypoint's side of the Waypoint Tools mod (LocalExile-Mods' mods/waypoint-tools): the way the item crafter gives an +/// item without the client control bridge, so it works on a release too. Through files in the LocalExile folder, never the +/// network: the mod writes data/waypoint-tools/loaded.json while a Gateway has it loaded, a request goes into +/// requests/<id>.json, and its answer comes back in replies/<id>.json. The paths are relative to +/// , the checkout or install. +/// +public static class WaypointToolsMod +{ + /// The mod's id in LocalExile-Mods, its folder under Mods/Binaries/. + public const string Id = "waypoint-tools"; + + /// The version of the request and reply files this Waypoint writes and reads. + public const int Protocol = 1; + + static string Root(string root) => Path.Combine(root, "data", Id); + + /// Whether the mod is installed in this folder (it may still be turned off, or no Gateway runs). + public static bool Installed(string root) => File.Exists(Path.Combine(root, "Mods", "Binaries", Id, "mod.json")); + + /// Whether a running Gateway has the mod loaded with this action: its loaded.json is of this protocol, + /// lists the action, and names a process that still runs (one left by a Gateway that stopped does not count). + public static bool Loaded(string root, string action, Func? running = null) + { + try + { + string file = Path.Combine(Root(root), "loaded.json"); + if (!File.Exists(file) || JsonNode.Parse(File.ReadAllText(file)) is not JsonObject json) return false; + return (int?)json["protocol"] == Protocol + && json["actions"] is JsonArray actions && actions.Any(a => (string?)a == action) + && (int?)json["pid"] is int pid && (running ?? Running)(pid); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or JsonException or FormatException or InvalidOperationException) + { + return false; + } + } + + static bool Running(int pid) + { + try + { + using var process = Process.GetProcessById(pid); + return !process.HasExited; + } + catch (Exception e) when (e is ArgumentException or InvalidOperationException or System.ComponentModel.Win32Exception) + { + return false; + } + } + + /// Gives an item (: what /item_give takes, one JSON object or an array) to + /// , or with null to the one character in game. Waits for the mod's answer; when none comes + /// in time, takes the request back if the mod has not read it yet and answers that nothing came. + public static async Task GiveItemAsync(string root, string item, string? character, TimeSpan timeout, CancellationToken stop = default) + { + var request = new JsonObject { ["action"] = "item_give", ["item"] = JsonNode.Parse(item) }; + if (!string.IsNullOrEmpty(character)) request["character"] = character; + return await AskAsync(root, request, timeout, stop); + } + + /// Writes one request (beside, then moved into place, so the mod never reads half of it) and waits for its reply. + internal static async Task AskAsync(string root, JsonObject request, TimeSpan timeout, CancellationToken stop) + { + string requests = Path.Combine(Root(root), "requests"), replies = Path.Combine(Root(root), "replies"); + Directory.CreateDirectory(requests); + string id = Guid.NewGuid().ToString("D"); + string file = Path.Combine(requests, id + ".json"), reply = Path.Combine(replies, id + ".json"); + await File.WriteAllTextAsync(Path.Combine(requests, id + ".tmp"), request.ToJsonString(), stop); + File.Move(Path.Combine(requests, id + ".tmp"), file); + var deadline = Stopwatch.StartNew(); + try + { + while (deadline.Elapsed < timeout) + { + if (Read(reply) is { } answer) + { + TryDelete(reply); + return answer; + } + await Task.Delay(100, stop); + } + } + catch (OperationCanceledException) { TryDelete(file); throw; } + // The mod may be giving it right now: an answer written meanwhile still counts. + TryDelete(file); + if (Read(reply) is { } late) { TryDelete(reply); return late; } + return new(false, L.Text("Waypoint Tools did not answer. Is the game running, with a character in an area?")); + } + + /// A reply file, or null while it is not there or not readable yet. + internal static ToolsReply? Read(string file) + { + try + { + if (!File.Exists(file) || JsonNode.Parse(File.ReadAllText(file)) is not JsonObject json) return null; + return new((bool?)json["ok"] == true, (string?)json["message"] ?? ""); + } + catch (Exception e) when (e is IOException or UnauthorizedAccessException or JsonException or FormatException or InvalidOperationException) + { + return null; + } + } + + static void TryDelete(string file) + { + try { File.Delete(file); } catch (Exception e) when (e is IOException or UnauthorizedAccessException) { } + } +} diff --git a/src/Waypoint.Linux/MainWindow.axaml.cs b/src/Waypoint.Linux/MainWindow.axaml.cs index e60a403..d5643cf 100644 --- a/src/Waypoint.Linux/MainWindow.axaml.cs +++ b/src/Waypoint.Linux/MainWindow.axaml.cs @@ -152,12 +152,6 @@ public MainWindow() PlayView.ReleaseRequested += () => GoTo(release: true); ReleasesView.NewCopyRequested += Setup.SetUpNewCopy; Control.NewCopyRequested += Setup.SetUpNewCopy; - // The crafter needs a source copy: the Latest one Waypoint knows, or a new one through the guide (its tested version). - ToolsView.NewCopyRequested += () => - { - if (Editions.Folder(_shared.Settings, release: false) is null) Setup.SetUpNewCopy(); - else GoTo(release: false); - }; ReleasesView.CheckRequested += () => _ = CheckLocalExile(manual: true); SettingsView.CheckUpdatesRequested += () => _ = CheckLocalExile(manual: true); SettingsView.DeveloperModeChanged += ShowMode; diff --git a/src/Waypoint.Linux/Views/FolderPicker.axaml.cs b/src/Waypoint.Linux/Views/FolderPicker.axaml.cs index 21652ff..2b68472 100644 --- a/src/Waypoint.Linux/Views/FolderPicker.axaml.cs +++ b/src/Waypoint.Linux/Views/FolderPicker.axaml.cs @@ -81,7 +81,7 @@ async void OpenList(object? sender, RoutedEventArgs e) // Developer Mode on a release, or a source copy, whose Control has the same button. NewCopy.IsVisible = !Repo.IsInstall || Editions.Offered(_shared.Settings); ToolTip.SetTip(NewCopy, Repo.IsInstall - ? L.Text("Sets up a second LocalExile from its source code, which has the item crafter. You can bring your characters.") + ? L.Text("Sets up a second LocalExile from its source code, which you can change and build yourself. You can bring your characters.") : L.Text("Clones LocalExile with git into a folder you choose and sets it up, for branches and pull requests")); Current.Classes.Add("open"); List.IsOpen = true; diff --git a/src/Waypoint.Linux/Views/SetupWizard.axaml b/src/Waypoint.Linux/Views/SetupWizard.axaml index c223b2e..cd1cb82 100644 --- a/src/Waypoint.Linux/Views/SetupWizard.axaml +++ b/src/Waypoint.Linux/Views/SetupWizard.axaml @@ -186,11 +186,6 @@ - - - - - diff --git a/src/Waypoint.Linux/Views/SetupWizard.axaml.cs b/src/Waypoint.Linux/Views/SetupWizard.axaml.cs index 9665687..f5dc001 100644 --- a/src/Waypoint.Linux/Views/SetupWizard.axaml.cs +++ b/src/Waypoint.Linux/Views/SetupWizard.axaml.cs @@ -187,19 +187,16 @@ void ShowText() NewCharacters.Content = L.Text("Start with a new database"); NewNote.Text = L.Text("No accounts or characters yet. You create an account at the end."); OldTitle.Text = L.Text("Your current LocalExile"); - OldText.Text = L.Text("Setup installs a new copy of LocalExile that has the item crafter. What should happen to the one you have now?"); + OldText.Text = L.Text("Setup installs a new copy of LocalExile from its source code. What should happen to the one you have now?"); KeepBoth.Content = L.Text("Keep both (recommended)"); KeepNote.Text = L.Text("You can go back to your current one at any time. Each has its own characters and progress."); RemoveOldLater.Content = L.Text("Remove the old one later"); RemoveNote.Text = L.Text("Once the new copy has worked for you, Waypoint will ask before deleting the old one."); UpdatesTitle.Text = L.Text("Updates"); TestedVersion.Content = L.Text("Keep an older version that does not change"); - TestedNote.Text = L.Text("LocalExile from 1 November, which the item crafter is known to work with. You can move to the newest changes later from Versions."); + TestedNote.Text = L.Text("LocalExile v0.4.2-beta, which this Waypoint is known to work with. You can move to the newest changes later from Versions."); NewestVersion.Content = L.Text("Get the newest changes"); NewestNote.Text = L.Text("LocalExile's newest changes; things can break. You update it yourself from Versions."); - GiveItemTitle.Text = L.Text("Giving items"); - GiveItem.Content = L.Text("Set up Give item (recommended)"); - GiveItemNote.Text = L.Text("Installs Frida, a tool that talks to the running game. It takes about 180 MB, and some antivirus programs flag it. The game's chat box is too short for most items, so Give item needs it."); AccountTitle.Text = L.Text("Your local account"); AccountText.Text = L.Text("You log in to the game with this. It stays on this PC, so do not reuse a real password."); AccountNameLabel.Text = L.Text("Account name"); @@ -748,7 +745,6 @@ void ShowSwitch() CharactersChoice.IsVisible = saves; if (!saves) NewCharacters.IsChecked = true; UpdatesChoice.IsVisible = DownloadChoice.IsChecked == true; - GiveItemChoice.IsVisible = !SwitchToSource.HasFrida(ChosenCheckout() ?? ""); if (saves && !_oldRead) _ = ReadOldCharactersAsync(old); } @@ -774,7 +770,7 @@ SwitchChoices Choices() bool copying = NoClient.IsChecked != true && !HasClient(copy) && !Sharing; double gigabytes = copying && ClientList.SelectedItem is FoundClient client ? client.Bytes / 1e9 : 0; return new(copy, SwitchFrom ?? "", DownloadChoice.IsChecked == true, BringCharacters.IsChecked == true, _oldAccounts, _oldCharacters, - KeepBoth.IsChecked == true, TestedVersion.IsChecked == true, GiveItem.IsChecked == true || SwitchToSource.HasFrida(copy), Sharing, gigabytes, + KeepBoth.IsChecked == true, TestedVersion.IsChecked == true, Sharing, gigabytes, LocalExileReleases.HasSaves(copy) && !SwitchToSource.SavesBrought(copy)); } @@ -813,8 +809,6 @@ async Task Bridge(string action, Action detail, CancellationToken stop, tasks.Add(new(L.Text("Build LocalExile"), null, (detail, stop) => Bridge("Build", detail, stop))); if (prepare) tasks.Add(new(L.Text("Extract the game data"), null, (detail, stop) => SetupSequence.ExtractAsync(checkout, line => { Write(line); detail(line); }, stop))); - if (switching is { GiveItem: true }) - tasks.Add(new(L.Text("Set up Give item"), () => SwitchToSource.HasFrida(checkout), (detail, stop) => SwitchToSource.InstallFridaAsync(checkout, line => { Write(line); detail(line); }, stop))); if (switching is { BringCharacters: true }) tasks.Add(new(L.Text("Bring your characters"), () => SwitchToSource.SavesBrought(checkout), (detail, stop) => Bridge("ImportSaves", detail, stop, switching.Old))); return tasks; diff --git a/src/Waypoint.Linux/Views/ToolsTab.axaml b/src/Waypoint.Linux/Views/ToolsTab.axaml index ae39cb2..225b433 100644 --- a/src/Waypoint.Linux/Views/ToolsTab.axaml +++ b/src/Waypoint.Linux/Views/ToolsTab.axaml @@ -4,10 +4,6 @@ - - -