Skip to main content

Grand Exchange Actions

GrandExchangeActions (com.n3plugins.InteractionApi.actions) covers the GE actions that stand on their own: open or close the nearest GE, collect finished offers, cancel offers, check whether the interface is open, and build paced buy/sell offer pipelines. Each acting method returns an InteractionResult or a TaskPipeline whose steps route through ActionPacer.

if (!GrandExchangeActions.isOpen()) {
GrandExchangeActions.openNearest(); // walk to and open the nearest GE
}
GrandExchangeActions.collectAll(); // collect coins and bought/sold items
GrandExchangeActions.close(); // close the GE before other interface work
MethodReturnsDoes
openNearest()InteractionResultwalks to and opens the nearest Grand Exchange
collectAll()InteractionResultcollects all completed offers
cancelOffer(int slot)InteractionResultcancels a one-based GE offer slot
close()InteractionResultcloses the open GE interface
createBuyPipeline(int itemId, int quantity, int priceEach)TaskPipelineopens a free slot, sets item, price, quantity, confirms, and waits for a submitted buy offer
createSellPipeline(int itemId, int quantity, int priceEach)TaskPipelineopens a free slot, sets item, price, quantity, confirms, and waits for a submitted sell offer

Building offers

GrandExchangeActions constructs the generic buy and sell offer pipelines: open a free slot, wait for the setup page, set item, set price, set quantity, confirm the offer, and wait until the submitted offer is visible in the live GE offers. Plugin-specific policy still belongs at the caller: pricing, buy-limit decisions, retry rules, budget reservation, and pending-offer accounting are not encoded in the shared action class. Market Alcher is the reference consumer for the buy pipeline. See market-alcher.md and task-pipeline.md.

For open/page state, slot state, and prices, use the GE query and widget helpers in query-helpers.md. The grouped facade exposes AutomationApi.grandExchange with isOpen(), items(), and offer(...) for scripts that want a boolean surface (see automation-api.md).

Pacing and guards

openNearest and collectAll check ActionPacer.isReady(...) before they queue a packet and return InteractionStatus.PACED when the gate is closed, so a caller that retries each tick lands the action once the pacer clears. A call made while the GE is closed returns a non-success status and does not throw. close() succeeds when the GE is already closed; otherwise it waits for ActionPacer, searches the visible GE interface tree for a widget exposing Close, and fails with WIDGET_NOT_FOUND instead of sending a guessed child packet.