Skip to content

feat(petcurrency): add pet currency pickup into affinity stashes - #19

Draft
ou3051 wants to merge 1 commit into
LocalExile:mainfrom
ou3051:feat/petcurrency
Draft

ou3051 wants to merge 1 commit into
LocalExile:mainfrom
ou3051:feat/petcurrency

Conversation

@ou3051

@ou3051 ou3051 commented Nov 10, 2026 •

Copy link
Copy Markdown

Pet Currency collects eligible nearby currency into a stash tab with currency affinity. Its settings control radius, pickup rate and the pet requirement.

Requires LocalExile Update. The prerequisite is LocalExile #792. The 0.4.2-beta manifest entry is provisional. The public release must include the required Gateway API before this mod can run on it.

The mod uses its manifest ID to register with the Gateway. It starts disabled. Version 1.1.0 includes the 256×256 icon and lists JJ ouyang as author.

Verification

  • Rebased onto LocalExile-Mods main at 99e9770. Mod head 3e59a04.
  • The repository index was regenerated and its check passed. The local install package was built for testing.
  • The four 1.1.0 packages loaded, reloaded and unloaded on an isolated Gateway. The log showed no load failures or retained mod warnings. Integration head e9ee16cf7f90d17584f88192748c14b768360cd7.
  • The real client connected to the isolated Auth server and stalled after key exchange. The controller reported no client frame, so in-game /mod and /mod_disable checks are pending.

@Wrathen Wrathen added the Requires LocalExile Update This mod will only be compatible after a certain LocalExile PR is merged to support this mod. label Nov 10, 2026
@Wrathen

Wrathen commented Nov 10, 2026

Copy link
Copy Markdown
Member

Requires LocalExile Update: this mod needs LocalExile/LocalExile#792 to be merged first. The mod will be reviewed once that pull request is merged, and before merging the maintainer will set compatibleClientVersions to the LocalExile release that ships it.

Two questions for @ou3051, following the updated AGENTS.md:

  • Credit: author in mod.json is your name as Waypoint shows it. It is ou3051 now; is that how you want to be credited?
  • Image: would you like to add a custom icon.png for the mod (PNG, at most 1 MB and 1024 px a side; 256×256 is plenty; a game screenshot is fine)?

@ou3051

ou3051 commented Nov 10, 2026

Copy link
Copy Markdown
Author

Thanks for checking. Please credit me as JJ ouyang in Waypoint.

I have updated mod.json and the generated mods.json to use that author name, bumped the mod to 1.0.1, and added icon.png (256×256 PNG, 157,737 bytes, below 1 MB). The follow-up commit is bc42cf2.

The icon shows a kiwi-like pet guiding currency into a stash chest, representing pet currency collection into an affinity-bound tab. It is AI-assisted original artwork based on the repository's in-game screenshots and the mod's feature description, rather than an extracted client asset.

petcurrency icon

tools/build-index.ps1 -Check passes. This update changes credits, artwork and documentation; the gameplay code is unchanged.

I understand that this PR must wait for LocalExile#792 and retain the Requires LocalExile Update label. Please set compatibleClientVersions to the shipping release during your review, as described in the updated contribution rules. The author-credit and custom-image requests are now addressed.

— JJ ouyang

@Wrathen

Wrathen commented Nov 10, 2026

Copy link
Copy Markdown
Member

The mod infrastructure has changed (LocalExile 0.4.1-beta)

Hi, and thanks for this PR. LocalExile/LocalExile#818 is merged and shipped in LocalExile v0.4.1-beta. It changes how every mod hooks into the server, so this PR no longer builds as it is. I've moved it to draft until it's updated; mark it ready for review again once it builds against main.

What changed

  • One hook system: GameEvents. Modules and mods subscribe to the same events in the Gateway (src/GameServer.Gateway/Modding/GameEvents.cs). ServerHooks is gone, and so are all the hook methods on IModContext: OnChatCommand, OnTick, OnPacket, OnAreaGenerated, OnObjectUsed, OnMonsterKilled, OnPlayerLeaving, OnHideoutReady, OnEnterMessages, OnAreaHeader, OnNpcOption, ModifyDrops, ModifyExperience, ModifyStats, UseChatServer, UseExchangeOptions and PublishExchangeRates.
  • Subscribe with your mod's id as the owner (mod.Manifest.Id). The returned handle can be ignored: when the mod unloads, the host releases everything held under its id. You no longer need lists of handles or Dispose code just to unhook. A mod's subscribers run in every league, after the league's modules.
  • IModContext keeps only the host services: Manifest, Lifetime, Folder, CharacterBuilds, Log, Settings<T>() and SaveSettings<T>().
  • Server switches are public Gateway members, held under an owner and reset on unload: ChatRoutes.Use(id, host, port), ExchangeRateStore.Use(id, options) and ExchangeRateStore.Publish(json). To have anything else released on unload, use GameEventOwners.Own(id, disposable).
  • The connection is ClientState. Event handlers get ClientState conn; Program.PlayerOf(conn) still gives an IPlayer (character, Tell, Send, …) when you want it.
  • Script mods (loose .cs files) now compile against the Gateway and GameServer.Core as well. The Gateway's types, GameEvents and Program among them, are in the global namespace. Project mods already referenced the Gateway, Core and Game through mods/Directory.Build.props.

How the old calls translate

Before Now
mod.OnChatCommand("x", usage, c => …) GameEvents.Command(mod.Manifest.Id, "x", usage, (conn, args) => …) with args a string[]; reply with conn.Commands!.Reply(text) (or Program.PlayerOf(conn).Tell(text))
mod.OnTick(p => …) GameEvents.Tick.Add(id, (conn, seconds) => …)
mod.OnPacket(opcode, p => …) GameEvents.Packet(opcode).Add(id, (conn, bytes) => …), returning true to take the message
mod.OnAreaGenerated / OnPlayerLeaving / OnHideoutReady GameEvents.AreaGenerated / PlayerLeaving ((conn, reason)) / HideoutReady
mod.OnObjectUsed(u => …) GameEvents.ObjectUse.Add(id, (conn, use, at) => …), with use.TargetId
mod.OnMonsterKilled / OnNpcOption GameEvents.MonsterKilled / NpcOption (payloads carry Conn)
mod.ModifyDrops / ModifyExperience / ModifyStats GameEvents.Drops / Experience / Stats, same payload members (Quantity, Rarity, Items, Experience, sheet.Add(stat, value))
mod.UseChatServer / UseExchangeOptions / PublishExchangeRates ChatRoutes.Use(id, …) / ExchangeRateStore.Use(id, …) / ExchangeRateStore.Publish(json)

The official mods were ported this way in #26; fastcampaign (commands, experience, stats) and itemquantity (drops) are short examples. The reference is LocalExile's Agents/docs/dev/modding.md, section "Hooks".

Before marking it ready again

  • Rebase on main, build against LocalExile main, and set compatibleClientVersions to 0.4.1-beta (or the release that ships any LocalExile change you still need).
  • Bump the mod's version, run tools/build-index.ps1, and commit mods.json.
  • Try it in game: /mod shows it loaded, and /mod_disable <id> leaves no an unloaded mod is still in memory line in the log.

For this PR

  • It calls mod.UseCurrencyPickupRules(…), which its companion feat: expose lifetime-owned currency pickup rules LocalExile#792 adds to IModContext. That method can't exist any more, so #792 needs reworking first: expose the rules as a public Gateway member that takes an owner (like ChatRoutes.Use(id, …), registering its reset with GameEventOwners.Own), or as a GameEvents entry, naming no mod. Then this mod calls it with mod.Manifest.Id.
  • mod.Settings stays as it is. main.cs is a script mod, so it now also sees the Gateway's types directly.

@Wrathen Wrathen removed the Requires LocalExile Update This mod will only be compatible after a certain LocalExile PR is merged to support this mod. label Nov 10, 2026
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.

2 participants