Skip to main content
Three surfaces cover commerce: GrandExchangeActions for GE offers, TradeActions for player trades, and ShopActions for NPC shops. Price reads come from the SDK market APIs.

Grand Exchange

GrandExchangeActions (com.n3plugins.Api.actions) manages independent GE operations. Every acting method returns InteractionResult, and offer construction returns TaskPipeline steps that route through the shared pacer.
The buy and sell pipelines cover the mechanical offer flow. Pricing policy, buy-limit decisions, retry rules, budget reservation, and pending-offer accounting stay with the caller. The GE Buyer plugin is the reference consumer of the buy pipeline.
Treat a queued SUCCESS from close() as dispatch, not proof the interface closed. The close path searches the visible interface tree for a widget exposing Close and fails with WIDGET_NOT_FOUND rather than sending a guessed child packet, but you should still observe the interface state on a later tick.
openNearest() and collectAll() check the pacer before queuing and return PACED while the gate is closed, so a per-tick retry loop lands the action once the pacer clears. Calls made while the GE is closed return a non-success status instead of throwing.

Player trades

TradeActions writes on the two-screen trade interface:
All methods return TRADE_NOT_OPEN when neither trade screen is visible, and the pacer gates every write. Inspect screen state, acceptance state, and either side’s offer through TradeQuery, and re-validate the other player’s offer on the confirmation screen before acceptSecondScreen().

Shops

ShopActions provides paced, result-aware purchase dispatches for NPC shops. Run buy methods only while the shop interface is open; a blocked action returns PACED for a next-tick retry. Name overloads are case-insensitive and match the tag-stripped display name. Stock reads: isOpen(), getStock(itemId) (0 when absent or closed), and getItems() for the visible stock list.
A successful buy dispatch means the packet queued, not that the server processed the purchase or that coins were sufficient. Track inventory container updates through the event layer to confirm the transaction.

Item info and prices

The sdk.items package reads item metadata and prices without dispatching anything:
  • PricesApi returns current price quotes for an item.
  • ItemInfo exposes name and examine metadata.
  • WikiMarketClient fetches market data, and MarketPrice models a quote for analysis code such as AlchemyCandidateSelector.
Use these reads to choose or explain an action, then dispatch through the action classes above. The events and data playbook covers the query helpers that pair with these surfaces.