kill-switch-mcp 1.1.6 → 1.1.7
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.
- package/dist/server.js +63 -51
- package/package.json +1 -1
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
|
|
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
|
|
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,50 @@ 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
|
-
##
|
|
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
|
-
|
|
4108
|
-
|
|
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
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
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
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
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.hitpoints — your current HP
|
|
4117
|
+
- sdk.getState().player.hitpointsBase — 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 nearby
|
|
4122
|
+
- sdk.getNearbyPlayers() — nearby players (each has .name, .combatLevel, .distance, .x, .z)
|
|
4123
|
+
- sdk.waitForTicks(n) — wait n game ticks (~0.6s each)
|
|
4117
4124
|
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
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() };
|
|
4125
|
+
### actions (pre-built strategies, await each one):
|
|
4126
|
+
Actions are loaded from your bot's actions/ directory at login. Default actions:
|
|
4127
|
+
- actions.lootAndEquip({ maxItems, radius, foodOnly }) — scan ground, pick up best items, equip gear
|
|
4128
|
+
- actions.fightLoop({ eatAt, duration, target, fleeAt }) — attack nearest/weakest, auto-eat, run loop
|
|
4129
|
+
- actions.kite({ safeHp, duration, direction }) — retreat from enemies while eating
|
|
4130
|
+
|
|
4131
|
+
### IMPORTANT NOTES:
|
|
4132
|
+
- Blocking UI is auto-dismissed before every execute_code call — you do NOT need to call bot.dismissBlockingUI()
|
|
4133
|
+
- bot.walkTo() uses server pathfinding (can be slow). For quick movement, use sdk.sendWalk(x, z) + sdk.waitForTicks(5)
|
|
4134
|
+
- State uses .player (NOT .localPlayer): sdk.getState().player.worldX (NOT state.localPlayer.x)
|
|
4135
|
+
- Keep execute_code calls to 15-30 seconds, then check state and adapt
|
|
4134
4136
|
|
|
4135
4137
|
## Key Tips
|
|
4136
4138
|
- You start with NOTHING — picking up items is your first priority!
|
|
4137
4139
|
- Grab a weapon first, then food, then armor
|
|
4138
4140
|
- 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
4141
|
- The human gives you strategy ("rush center", "play safe", "grab and run") — you turn it into code`;
|
|
4141
4142
|
var server = new Server({ name: "kill-switch", version: "3.0.0" }, { capabilities: { tools: {} } });
|
|
4142
4143
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
@@ -4164,16 +4165,15 @@ ${GAME_DESCRIPTION}`,
|
|
|
4164
4165
|
{
|
|
4165
4166
|
name: "execute_code",
|
|
4166
4167
|
description: `Execute TypeScript code on your connected bot. The code runs in an async context with three globals:
|
|
4167
|
-
- bot: High-level actions (
|
|
4168
|
-
- sdk: Low-level state
|
|
4169
|
-
- actions: Pre-built strategy functions
|
|
4168
|
+
- bot: High-level actions (await bot.pickupItem(/name/i), bot.equipItem(), bot.eatFood(), bot.attackPlayer(), bot.walkTo())
|
|
4169
|
+
- sdk: Low-level state/commands (sdk.getState(), sdk.sendWalk(x,z), sdk.getNearbyPlayers(), sdk.getInventory(), sdk.findGroundItem())
|
|
4170
|
+
- actions: Pre-built strategy functions from bot's actions/ directory (listed at login)
|
|
4170
4171
|
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
await actions.kite({ safeHp: 40 })
|
|
4172
|
+
State object: sdk.getState().player.worldX, .worldZ, .hitpoints, .hitpointsBase
|
|
4173
|
+
Movement: sdk.sendWalk(x, z) for quick moves, bot.walkTo(x, z) for pathfinding
|
|
4174
|
+
Timing: await sdk.waitForTicks(n) — each tick is ~0.6 seconds
|
|
4175
4175
|
|
|
4176
|
-
|
|
4176
|
+
Blocking UI is auto-dismissed before your code runs — do NOT call bot.dismissBlockingUI().
|
|
4177
4177
|
|
|
4178
4178
|
You MUST call login before using this tool.`,
|
|
4179
4179
|
inputSchema: {
|
|
@@ -4712,10 +4712,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
4712
4712
|
return errorResponse("Not connected. Call login first.");
|
|
4713
4713
|
}
|
|
4714
4714
|
const timeoutSecs = Math.min(Math.max(args?.timeout || 300, 10), 600);
|
|
4715
|
-
const ARENA_MIN_X =
|
|
4716
|
-
const ARENA_MAX_X =
|
|
4717
|
-
const ARENA_MIN_Z =
|
|
4718
|
-
const ARENA_MAX_Z =
|
|
4715
|
+
const ARENA_MIN_X = 3077;
|
|
4716
|
+
const ARENA_MAX_X = 3134;
|
|
4717
|
+
const ARENA_MIN_Z = 3324;
|
|
4718
|
+
const ARENA_MAX_Z = 3393;
|
|
4719
4719
|
console.error(`[Kill Switch] Waiting for tournament to start (timeout: ${timeoutSecs}s)...`);
|
|
4720
4720
|
const startTime = Date.now();
|
|
4721
4721
|
const deadline = startTime + timeoutSecs * 1000;
|
|
@@ -4733,17 +4733,29 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
4733
4733
|
"",
|
|
4734
4734
|
`You've been teleported to Draynor Manor. The fight is ON!`,
|
|
4735
4735
|
`Position: ${state.player.worldX}, ${state.player.worldZ}`,
|
|
4736
|
-
`HP: ${state.player.
|
|
4736
|
+
`HP: ${state.player.hitpoints}/${state.player.hitpointsBase}`,
|
|
4737
4737
|
"",
|
|
4738
4738
|
`Nearby players: ${players.length > 0 ? players.map((p) => `${p.name} (CB ${p.combatLevel}, dist ${p.distance})`).join(", ") : "scanning..."}`,
|
|
4739
4739
|
"",
|
|
4740
4740
|
"REMEMBER: You die = your agent dies FOREVER. No second chances.",
|
|
4741
4741
|
"",
|
|
4742
|
-
"IMMEDIATELY:",
|
|
4742
|
+
"IMMEDIATELY use execute_code to start your strategy:",
|
|
4743
4743
|
"1. Pick up weapons and food from the ground",
|
|
4744
4744
|
"2. Equip best weapon found, then start fighting",
|
|
4745
|
-
"3. Eat when HP gets low — you have 99 HP but no food yet!"
|
|
4745
|
+
"3. Eat when HP gets low — you have 99 HP but no food yet!",
|
|
4746
|
+
"",
|
|
4747
|
+
"QUICK START: await actions.lootAndEquip({ maxItems: 5 }); await actions.fightLoop({ eatAt: 25, duration: 30000 });",
|
|
4748
|
+
"",
|
|
4749
|
+
"API REMINDERS:",
|
|
4750
|
+
"- sdk.sendWalk(x, z) for quick movement (NOT bot.walkTo for combat)",
|
|
4751
|
+
"- sdk.getState().player.worldX / .worldZ / .hitpoints",
|
|
4752
|
+
"- Blocking UI is auto-dismissed — do NOT call bot.dismissBlockingUI()"
|
|
4746
4753
|
];
|
|
4754
|
+
if (activeActionDescriptions.length > 0) {
|
|
4755
|
+
parts.push("");
|
|
4756
|
+
parts.push("AVAILABLE ACTIONS:");
|
|
4757
|
+
parts.push(...activeActionDescriptions);
|
|
4758
|
+
}
|
|
4747
4759
|
return { content: [{ type: "text", text: parts.join(`
|
|
4748
4760
|
`) }] };
|
|
4749
4761
|
}
|