Files
max bittkerandClaude Fable 5 9cd3d7019a fix(sdk,mcp,gateway): market-bench audit fixes - trade binding, serve window, walkTo guards
From the market-split-n24 audit (24 bots, 64 sdk-kind problems):

- tradeWith verifies the partner: declines a session open with a different
  player (a pending request racing yours used to be silently adopted -
  bots completed trades with the wrong counterparty) and re-pursues the
  requested one until the deadline; trade() gains retryOnBusy
- serveTrades maxTrades counts only completed trades (a lowballer's
  declined session used to consume a maxTrades:1 window); new rejectAfterMs
  declines offers that stay unacceptable; accept() predicate evaluated on
  offer change + every ~2s instead of every tick (console-spam fix)
- trade completion waits for the inventory delta to land before reporting
  received items as missing; TradeResult items carry an `amount` alias
- walkTo rejects non-numeric coordinates (walkTo(undefined, undefined)
  used to march bots into scorpions/wolves) and aborts when the player
  dies en route; NearbyPlayer gains worldX/worldZ aliases
- interactLoc/interactNpc reject null targets (used to hit a random loc);
  find* patterns get a clear error for non-string/RegExp input
- formatter no longer flags the open trade window (3323) as a blocking
  modal to close - that advice cost a bot a 100gp advance
- Spells component ids (HIGH_ALCHEMY etc.) exported from sdk/spells.ts
  and injected as an execute_code global
- MCP execute_code transpiles TS (the tool advertised TS but rejected
  type syntax), formats Errors in console capture (was '{}'), and warns
  about ~60s MCP client caps with code continuing to run
- gateway serializes HTTP says per bot: concurrent PMs clobbered
  currentActionId, so delivered messages reported false "Say timed out"

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 19:47:32 -04:00

43 lines
1.2 KiB
TypeScript

// Spell component ids (from server/content/pack/interface.pack).
// These are what sdk.sendSpellOnTarget / sendSpellOnItem and bot.castSpell
// take as the spell argument, e.g.:
// await sdk.sendSpellOnItem(item.slot, Spells.HIGH_ALCHEMY);
// await bot.castSpell('goblin', Spells.WIND_STRIKE);
export const Spells = {
// Combat spells
WIND_STRIKE: 1152,
CONFUSE: 1153,
WATER_STRIKE: 1154,
ENCHANT_LVL1: 1155, // Sapphire
EARTH_STRIKE: 1156,
WEAKEN: 1157,
FIRE_STRIKE: 1158,
WIND_BOLT: 1160,
CURSE: 1161,
LOW_ALCHEMY: 1162,
WATER_BOLT: 1163,
VARROCK_TELEPORT: 1164,
ENCHANT_LVL2: 1165, // Emerald
EARTH_BOLT: 1166,
LUMBRIDGE_TELEPORT: 1167,
FIRE_BOLT: 1169,
FALADOR_TELEPORT: 1170,
WIND_BLAST: 1172,
SUPERHEAT: 1173, // Requires Magic 43 AND Smithing level for the bar
CAMELOT_TELEPORT: 1174,
WATER_BLAST: 1175,
ENCHANT_LVL3: 1176, // Ruby
EARTH_BLAST: 1177,
HIGH_ALCHEMY: 1178,
ENCHANT_LVL4: 1180, // Diamond
FIRE_BLAST: 1181,
WIND_WAVE: 1183,
WATER_WAVE: 1185,
ENCHANT_LVL5: 1187, // Dragonstone
EARTH_WAVE: 1188,
FIRE_WAVE: 1189,
BIND: 1572,
} as const;
export type SpellName = keyof typeof Spells;