Skip to content

Give plugins silver, gold and location, and add a Silver tracker plugin - #37

Merged
CodySimonds65 merged 9 commits into
mainfrom
feature/silver-tracker
Oct 5, 2026
Merged

CodySimonds65 merged 9 commits into
mainfrom
feature/silver-tracker

Conversation

@CodySimonds65

Copy link
Copy Markdown
Owner

Plugins can now read an account's silver, gold, location, player id and equipment (plugin API version 2), and there is a new plugin that uses it: a silver/hr tracker at samples/silver-tracker, meant for the plugin hub.

Merging this releases the client as v1.1.29, because it changes src/.

Client: plugin API version 2

  • The profile page the client already downloads for XP (once a minute per open account) also carries silver, gold and location. The parser now reads them. A missing or changed strip gives null and never throws, so XP tracking and the leaderboard can't be broken by it.
  • New call fourfold.profile.get(accountId) returns { silver, gold, location, playerId, updatedAt, isStale }.
  • fourfold.stats.get gains equipment: { armor, helmet, hair, weapon }.
  • The supported apiVersion is now 2. Version 1 plugins run as before. An older FourFold meeting a version 2 plugin shows the existing "Update FourFold to use this plugin."
  • playerId and inGameName are given only when the last profile read was made under the account's Ranking username. Without that, the id would lead a plugin to a public page showing the saved login's name. This also closes a gap inGameName already had: for one read after a Ranking username was saved, it returned the login's profile name.
  • Location and equipment text from the game is trimmed, cut to 64 characters, and dropped if it contains control or invisible formatting characters.
  • Silver, gold and location do not reach the leaderboard server; it stores class XP fields only.

Plugin: Silver tracker

One block per open account: silver/hr (earned only, over a rolling hour, the XP tracker's rate window ported to JavaScript), session earned and net, balance, a silver goal with time to goal, and a Reset button. One overlay card per account. Sessions are in memory only; goals are saved.

Also

  • PLUGIN_AUTHORS.md documents the new API and the new sample.
  • samples/** joins the release ignore list, so a later plugin-only change doesn't release the client.

What was run

  • Release build: 0 warnings, 0 errors.
  • FourFoldAccountManager.Core.Tests: 310 passed. FourFoldAccountManager.Desktop.Tests: 29 passed.
  • node samples/silver-tracker/.check/rate.check.mjs: passed.
  • The hub tool's check, run locally against this branch: accepted, with app.js, index.html, plugin.json, rate.mjs and style.css in the package and the .check folder left out.
  • The plugin's page in a browser against a stand-in for window.fourfold: baseline, rate, spending, goal entry, an invalid goal, "Reached", Reset, a read arriving while a goal box has focus, and card text lengths all behaved. No console errors.
  • One fresh-context review of the whole branch. It found two issues, both fixed here with a failing test first: the player id gap above, and the plugin showing "Tracking" over silver it could no longer read.

What was not run

  • The plugin has not run inside FourFold. It is also the first plugin to use a module script. The checks below need a signed-in game account.
  • No screenshot of the panel: the capture timed out, so the look was checked through computed styles only.
  • The leaderboard tests that need Docker. The two that use the profile parser were run and pass.

To check by hand

Copy samples/silver-tracker into %LOCALAPPDATA%\FourFoldAccountManager\dev-plugins, switch on Developer mode, and run this branch's build.

  • Silver, gold and location match the account's profile page on the game's site.
  • Silver/hr appears after the second read and matches a hand calculation.
  • Spending lowers net and leaves earned alone.
  • A goal survives a restart; the time to goal and "Reached" behave.
  • The card shows over the game, and clears when the account closes.
  • An account with no Ranking username still tracks silver, and in the plugin's developer tools (right-click, Inspect) (await fourfold.profile.get(id)).playerId is null for it.
  • Goal tracker (an API version 1 plugin) still works.

Known limits

  • Silver earned and spent between two reads is seen as one net change, so that minute's earnings are undercounted.
  • Silver moved in from another account counts as earned.
  • An empty equipment slot comes through as the page's own word (Empty), not null.
  • If an open account is pointed at a different character mid-session, net keeps the old starting balance until Reset.

The hub listing is a separate pull request in the hub repository, after this one is merged and released.

…ing name is saved

The tracker still holds what it read for the saved login until its next read. The id and the profile's name are now given to plugins only when the last profile read was made under the ranking name. The name rule had the same gap before this branch.
… be read

The status followed the read's stale flag only, so a read that succeeded without a silver value left old numbers under "Tracking".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant