Skip to content

feat: Grand Exchange (stockmarket) commands for 647 (0.7.6) - #22

Merged
ultraviolet-jordan merged 1 commit into
mainfrom
feat/stockmarket-commands
Dec 1, 2026
Merged

ultraviolet-jordan merged 1 commit into
mainfrom
feat/stockmarket-commands

Conversation

@tyler27

@tyler27 tyler27 commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Adds 18 server commands for rs-majula's 647 Grand Exchange (rev 647, May 2011). Opcodes run 2193-2210, after sound_vorbis. The version goes to 0.7.6, so merging this and pushing tag v0.7.6 publishes the release that rs-majula's GE PRs need. Until then, rs-majula points at this branch with a [patch.crates-io] line.

The commands

Opcode Command Pointer Name from
2193 stockmarket_buy(int slot, obj, int count, int price) active_player this PR
2194 stockmarket_sell(int slot, obj, int count, int price) active_player this PR
2195 stockmarket_abort(int slot) active_player this PR
2196-2201 stockmarket_getoffertype / getofferitem / getofferprice / getoffercount / getoffercompletedcount / getoffercompletedgold (int slot) active_player the client (cs2 3903-3908)
2202-2205 stockmarket_isofferempty / isofferstable / isofferadding / isofferfinished (int slot) active_player the client (cs2 3910-3913)
2206 stockmarket_guideprice(obj)(int) none (world data) this PR
2207-2210 stockmarket_gethistorytype / gethistoryitem / gethistorycount / gethistorygold (int index) active_player this PR

Each command also has its dot form, which needs active_player2. The pointer rules follow the inventory commands (inv_add, inv_del). Buy and sell are placed after the script has taken the coins or items itself. Nothing suspends.

Where the names come from

The names were checked against the reference material we have:

  • Jagex leaks: the leaked RuneScript screenshots, plus the OSRS RuneScript transcriptions.

  • Clients: the NXT client's file names, RuneLite's Opcodes.java, the 2019Scape client, openrs2, rs-deob and hdos.

  • Servers: Void (rev 634).

  • The read commands take the client's own names for the same reads: its clientscript commands 3903-3913. RuneLite's opcode list (STOCKMARKET_ISOFFERSTABLE = 3911 etc.) and the 2019Scape client give the same names. 2019Scape says its names are "based on known leaks". Jagex's NXT source paths (rs2client/logic/stockmarket/, Stockmarket_Op.cpp) confirm "stockmarket" as Jagex's own word for the system.

  • No source names a server-side GE command, so buy, sell, abort, the guide price and the history getters are named here, in the client's pattern. The history getters are for the clerk's History window, which the May 2011 RuneScape Wiki says shows the last five trades.

Tests

  • tests/server_pointer_test.rs stockmarket_commands_require_the_selected_player_but_not_the_guide_price: buy, abort, a status read and a history read warn without active_player (dot forms without .active_player); the guide price doesn't.
  • cargo test --lib opcodes (names and opcodes unique, constant per name) and cargo clippy --all-targets -D warnings pass.
  • Red/green: with main's src/pointer.rs, the new test fails (no warning for the GE commands); with this PR it passes.

After merging

Push tag v0.7.6 to publish (release.yml publishes on version tags). rs-majula then swaps its temporary [patch.crates-io] for rs-runec = "0.7.6".

Eighteen server commands for rs-majula's 647 Grand Exchange, at 2193-2210
after sound_vorbis:

- Reads, named as the 647 client names its own clientscript commands
  3903-3913 (RuneLite's Opcodes.java, the 2019Scape client):
  stockmarket_getoffertype, _getofferitem, _getofferprice,
  _getoffercount, _getoffercompletedcount, _getoffercompletedgold,
  _isofferempty, _isofferstable, _isofferadding, _isofferfinished.
- Not named by any source found (Jagex's leaked RuneScript, the OSRS and
  NXT clients, RuneLite, openrs2, Void), so named here in the same
  pattern: stockmarket_buy, _sell, _abort, _guideprice, and
  _gethistorytype, _gethistoryitem, _gethistorycount, _gethistorygold.

Every one but stockmarket_guideprice (the world's price) needs
active_player, as the inventory commands do; the dot forms need
active_player2. Bumps the version to 0.7.6.
@ultraviolet-jordan ultraviolet-jordan self-assigned this Dec 1, 2026
@ultraviolet-jordan ultraviolet-jordan added the enhancement New feature or request label Dec 1, 2026
@ultraviolet-jordan
ultraviolet-jordan merged commit e6cd8f9 into main Dec 1, 2026
4 checks passed
@ultraviolet-jordan
ultraviolet-jordan deleted the feat/stockmarket-commands branch December 1, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants