kill-switch-mcp 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ export default async function fightLoop(bot: any, sdk: any, opts: any = {}) {
35
35
  const state = sdk.getState();
36
36
  if (!state) { await sdk.waitForTicks(1); continue; }
37
37
 
38
- const hp = state.player.hitpoints;
38
+ const hp = state.player.hp;
39
39
  const players = sdk.getNearbyPlayers();
40
40
 
41
41
  // Bail signal: low food + outnumbered
@@ -43,7 +43,7 @@ export default async function fightLoop(bot: any, sdk: any, opts: any = {}) {
43
43
  if (foodCount <= fleeAt && players.length > 1) {
44
44
  return {
45
45
  hp,
46
- maxHp: state.player.hitpointsBase ?? 0,
46
+ maxHp: state.player.maxHp ?? 0,
47
47
  foodLeft: foodCount,
48
48
  target: lastTarget,
49
49
  nearbyPlayers: players,
@@ -92,8 +92,8 @@ export default async function fightLoop(bot: any, sdk: any, opts: any = {}) {
92
92
  // Return status
93
93
  const finalState = sdk.getState();
94
94
  return {
95
- hp: finalState?.player?.hitpoints ?? 0,
96
- maxHp: finalState?.player?.hitpointsBase ?? 0,
95
+ hp: finalState?.player?.hp ?? 0,
96
+ maxHp: finalState?.player?.maxHp ?? 0,
97
97
  foodLeft: countFood(sdk),
98
98
  target: lastTarget,
99
99
  nearbyPlayers: sdk.getNearbyPlayers(),
@@ -27,7 +27,7 @@ export default async function kite(bot: any, sdk: any, opts: any = {}) {
27
27
  const state = sdk.getState();
28
28
  if (!state) { await sdk.waitForTicks(1); continue; }
29
29
 
30
- const hp = state.player.hitpoints;
30
+ const hp = state.player.hp;
31
31
 
32
32
  // Check if we've healed enough
33
33
  if (hp >= safeHp) {
@@ -82,7 +82,7 @@ export default async function kite(bot: any, sdk: any, opts: any = {}) {
82
82
  await sdk.waitForTicks(2);
83
83
  }
84
84
 
85
- const finalHp = sdk.getState()?.player?.hitpoints ?? 0;
85
+ const finalHp = sdk.getState()?.player?.hp ?? 0;
86
86
  return { hp: finalHp, foodLeft: countFood(sdk), escaped: finalHp >= safeHp };
87
87
  }
88
88
 
package/dist/server.js CHANGED
@@ -4076,14 +4076,14 @@ execute it by sending code to the game via execute_code.
4076
4076
  3. Call join_game with mode "shorty" (or "longy" when available) to queue up
4077
4077
  4. Chat with your human about strategy while waiting
4078
4078
  5. Call wait_for_game_start — it blocks until the admin starts the match
4079
- 6. When it returns, you're at the arena edge run to the center to grab loot!
4079
+ 6. When it returns, you're in the arena — start fighting!
4080
4080
 
4081
4081
  ## Game Modes
4082
4082
  - **SHORTY**: Quick battle royale at Draynor Manor. 50 atk/str/def, 99 HP. Loot & fight.
4083
4083
  - **LONGY**: (Coming soon) Large survival map. Level 1 stats, skill up, craft, outlast.
4084
4084
 
4085
4085
  ## The Arena (Shorty)
4086
- - You spawn on the PERIMETER of Draynor Manor with nothing
4086
+ - You spawn inside Draynor Manor's fenced arena with nothing
4087
4087
  - Items are scattered on the ground in a cornucopia pattern:
4088
4088
  - Outer ring: bronze/iron weapons, leather armor, bread/meat
4089
4089
  - Mid ring: mithril/adamant weapons, chainmail, trout/salmon
@@ -4094,49 +4094,51 @@ execute it by sending code to the game via execute_code.
4094
4094
  - If you die, your agent is DEAD FOREVER. No respawns, no second chances.
4095
4095
  - Only the last agent standing wins. Winners earn party hats!
4096
4096
 
4097
- ## Key Actions
4098
- - bot.pickupItem(/item name/i) — pick up ground items (CRITICAL — you start empty!)
4099
- - bot.equipItem(/item name/i) — equip weapons and armor from inventory
4100
- - bot.eatFood(/food name/i) — eat food to heal
4101
- - bot.attackPlayer("name") or bot.attackPlayer(/pattern/i) — attack another player
4102
- - sdk.getNearbyPlayers() — see nearby players (name, combatLevel, distance, x, z)
4103
- - sdk.findGroundItem(/pattern/i) — find items on the ground near you
4104
- - sdk.getState().player.hitpoints — your current HP
4105
- - sdk.getInventory() — check what you've picked up
4097
+ ## API Reference
4106
4098
 
4107
- ## Combat Loop Pattern
4108
- Write reactive loops in execute_code that run for 15-30 seconds, then return state:
4099
+ ### Three globals in execute_code:
4100
+ - **bot**: High-level actions (await required they wait for the effect to complete)
4101
+ - **sdk**: Low-level state access and direct commands
4102
+ - **actions**: Pre-built strategy functions from your bot's actions/ directory
4109
4103
 
4110
- // Phase 1: Grab loot
4111
- const items = sdk.findGroundItem(/scimitar|sword|lobster|chainbody/i);
4112
- if (items) await bot.pickupItem(items);
4104
+ ### bot methods (high-level, await each one):
4105
+ - bot.pickupItem(/item name/i) — walk to and pick up a ground item
4106
+ - bot.equipItem(/item name/i) equip from inventory
4107
+ - bot.eatFood(/item name/i) — eat food to heal
4108
+ - bot.attackPlayer("name" or /pattern/i) — attack a player
4109
+ - bot.attackNpc("name" or /pattern/i) — attack an NPC
4110
+ - bot.walkTo(x, z) — pathfind and walk (complex, uses server pathfinding)
4113
4111
 
4114
- // Equip best weapon found
4115
- const weapon = sdk.findInventoryItem(/rune scimitar|adamant|mithril scimitar/i);
4116
- if (weapon) await bot.equipItem(weapon);
4112
+ ### sdk methods (low-level, instant):
4113
+ - sdk.sendWalk(x, z) — click a tile to walk there (fast, no pathfinding)
4114
+ - sdk.getState() full game state object
4115
+ - sdk.getState().player.worldX / .worldZ — your position
4116
+ - sdk.getState().player.hp — your current HP
4117
+ - sdk.getState().player.maxHp — your max HP
4118
+ - sdk.getInventory() — array of inventory items (each has .name)
4119
+ - sdk.getEquipment() — array of equipment items
4120
+ - sdk.findInventoryItem(/pattern/i) — find item in inventory
4121
+ - sdk.findGroundItem(/pattern/i) — find item on ground (returns { name, x, z, distance } — NOT .worldX!)
4122
+ - sdk.getGroundItems() — all nearby ground items (each has .name, .x, .z, .distance, .id, .count)
4123
+ - sdk.getNearbyPlayers() — nearby players (each has .name, .combatLevel, .distance, .x, .z)
4124
+ - sdk.waitForTicks(n) — wait n game ticks (~0.6s each)
4117
4125
 
4118
- // Phase 2: Fight
4119
- const endTime = Date.now() + 15_000;
4120
- while (Date.now() < endTime) {
4121
- const hp = sdk.getState().player.hitpoints;
4122
- if (hp < 25) {
4123
- const food = sdk.findInventoryItem(/swordfish|lobster|salmon|trout|bread|meat/i);
4124
- if (food) await bot.eatFood(food);
4125
- }
4126
- const players = sdk.getNearbyPlayers();
4127
- if (players.length > 0) {
4128
- const nearest = players.sort((a, b) => a.distance - b.distance)[0];
4129
- await bot.attackPlayer(nearest);
4130
- }
4131
- await sdk.waitForTicks(2);
4132
- }
4133
- return { hp: sdk.getState().player.hitpoints, inventory: sdk.getInventory(), nearbyPlayers: sdk.getNearbyPlayers() };
4126
+ ### actions (pre-built strategies, await each one):
4127
+ Actions are loaded from your bot's actions/ directory at login. Default actions:
4128
+ - actions.lootAndEquip({ maxItems, radius, foodOnly }) — scan ground, pick up best items, equip gear
4129
+ - actions.fightLoop({ eatAt, duration, target, fleeAt }) — attack nearest/weakest, auto-eat, run loop
4130
+ - actions.kite({ safeHp, duration, direction }) — retreat from enemies while eating
4131
+
4132
+ ### IMPORTANT NOTES:
4133
+ - Blocking UI is auto-dismissed before every execute_code call — you do NOT need to call bot.dismissBlockingUI()
4134
+ - bot.walkTo() uses server pathfinding (can be slow). For quick movement, use sdk.sendWalk(x, z) + sdk.waitForTicks(5)
4135
+ - State uses .player (NOT .localPlayer): sdk.getState().player.worldX (NOT state.localPlayer.x)
4136
+ - Keep execute_code calls to 15-30 seconds, then check state and adapt
4134
4137
 
4135
4138
  ## Key Tips
4136
4139
  - You start with NOTHING — picking up items is your first priority!
4137
4140
  - Grab a weapon first, then food, then armor
4138
4141
  - Risk vs reward: center has the best loot but everyone converges there
4139
- - Keep execute_code calls to 15-30 seconds, then check state and adapt
4140
4142
  - The human gives you strategy ("rush center", "play safe", "grab and run") — you turn it into code`;
4141
4143
  var server = new Server({ name: "kill-switch", version: "3.0.0" }, { capabilities: { tools: {} } });
4142
4144
  server.setRequestHandler(ListToolsRequestSchema, async () => {
@@ -4164,16 +4166,15 @@ ${GAME_DESCRIPTION}`,
4164
4166
  {
4165
4167
  name: "execute_code",
4166
4168
  description: `Execute TypeScript code on your connected bot. The code runs in an async context with three globals:
4167
- - bot: High-level actions (attackPlayer, eatFood, walkTo, equipItem, pickupItem, etc.)
4168
- - sdk: Low-level state access (getState, getNearbyPlayers, getInventory, findGroundItem, etc.)
4169
- - actions: Pre-built strategy functions loaded from your bot's actions/ directory
4169
+ - bot: High-level actions (await bot.pickupItem(/name/i), bot.equipItem(), bot.eatFood(), bot.attackPlayer(), bot.walkTo())
4170
+ - sdk: Low-level state/commands (sdk.getState(), sdk.sendWalk(x,z), sdk.getNearbyPlayers(), sdk.getInventory(), sdk.findGroundItem())
4171
+ - actions: Pre-built strategy functions from bot's actions/ directory (listed at login)
4170
4172
 
4171
- Use actions for common patterns instead of writing loops from scratch:
4172
- await actions.fightLoop({ eatAt: 25, duration: 15000 })
4173
- await actions.lootAndEquip({ maxItems: 5 })
4174
- await actions.kite({ safeHp: 40 })
4173
+ State object: sdk.getState().player.worldX, .worldZ, .hp, .maxHp
4174
+ Movement: sdk.sendWalk(x, z) for quick moves, bot.walkTo(x, z) for pathfinding
4175
+ Timing: await sdk.waitForTicks(n) each tick is ~0.6 seconds
4175
4176
 
4176
- Or write custom code using bot/sdk directly for full control.
4177
+ Blocking UI is auto-dismissed before your code runs do NOT call bot.dismissBlockingUI().
4177
4178
 
4178
4179
  You MUST call login before using this tool.`,
4179
4180
  inputSchema: {
@@ -4712,10 +4713,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
4712
4713
  return errorResponse("Not connected. Call login first.");
4713
4714
  }
4714
4715
  const timeoutSecs = Math.min(Math.max(args?.timeout || 300, 10), 600);
4715
- const ARENA_MIN_X = 3070;
4716
- const ARENA_MAX_X = 3141;
4717
- const ARENA_MIN_Z = 3317;
4718
- const ARENA_MAX_Z = 3402;
4716
+ const ARENA_MIN_X = 3077;
4717
+ const ARENA_MAX_X = 3134;
4718
+ const ARENA_MIN_Z = 3324;
4719
+ const ARENA_MAX_Z = 3393;
4719
4720
  console.error(`[Kill Switch] Waiting for tournament to start (timeout: ${timeoutSecs}s)...`);
4720
4721
  const startTime = Date.now();
4721
4722
  const deadline = startTime + timeoutSecs * 1000;
@@ -4739,11 +4740,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
4739
4740
  "",
4740
4741
  "REMEMBER: You die = your agent dies FOREVER. No second chances.",
4741
4742
  "",
4742
- "IMMEDIATELY:",
4743
+ "IMMEDIATELY use execute_code to start your strategy:",
4743
4744
  "1. Pick up weapons and food from the ground",
4744
4745
  "2. Equip best weapon found, then start fighting",
4745
- "3. Eat when HP gets low — you have 99 HP but no food yet!"
4746
+ "3. Eat when HP gets low — you have 99 HP but no food yet!",
4747
+ "",
4748
+ "QUICK START: await actions.lootAndEquip({ maxItems: 5 }); await actions.fightLoop({ eatAt: 25, duration: 30000 });",
4749
+ "",
4750
+ "API REMINDERS:",
4751
+ "- sdk.sendWalk(x, z) for quick movement (NOT bot.walkTo for combat)",
4752
+ "- sdk.getState().player.worldX / .worldZ / .hp",
4753
+ "- Blocking UI is auto-dismissed — do NOT call bot.dismissBlockingUI()"
4746
4754
  ];
4755
+ if (activeActionDescriptions.length > 0) {
4756
+ parts.push("");
4757
+ parts.push("AVAILABLE ACTIONS:");
4758
+ parts.push(...activeActionDescriptions);
4759
+ }
4747
4760
  return { content: [{ type: "text", text: parts.join(`
4748
4761
  `) }] };
4749
4762
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kill-switch-mcp",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Kill Switch MCP Server — AI battle royale powered by Claude Code",
5
5
  "type": "module",
6
6
  "bin": {