kill-switch-mcp 1.1.5 → 1.1.6
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 +38 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1299,6 +1299,15 @@ class BotActions {
|
|
|
1299
1299
|
const state = this.sdk.getState();
|
|
1300
1300
|
if (!state)
|
|
1301
1301
|
break;
|
|
1302
|
+
if (state.modalOpen) {
|
|
1303
|
+
if (state.modalInterface === 3559) {
|
|
1304
|
+
await this.sdk.sendAcceptCharacterDesign();
|
|
1305
|
+
} else {
|
|
1306
|
+
await this.sdk.sendCloseModal();
|
|
1307
|
+
}
|
|
1308
|
+
await this.sdk.waitForStateChange(2000).catch(() => {});
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1302
1311
|
if (state.dialog.isOpen) {
|
|
1303
1312
|
await this.sdk.sendClickDialog(0);
|
|
1304
1313
|
await this.sdk.waitForStateChange(2000).catch(() => {});
|
|
@@ -4513,6 +4522,34 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
4513
4522
|
console.error(`[Kill Switch] Warning: initial state not received within 20s`);
|
|
4514
4523
|
}
|
|
4515
4524
|
activeBotName = botName;
|
|
4525
|
+
const initialState = connection.sdk.getState();
|
|
4526
|
+
if (initialState?.player) {
|
|
4527
|
+
const x = initialState.player.worldX;
|
|
4528
|
+
const z = initialState.player.worldZ;
|
|
4529
|
+
const isOnTutorialIsland = x >= 3050 && x <= 3160 && z >= 3050 && z <= 3140;
|
|
4530
|
+
if (isOnTutorialIsland) {
|
|
4531
|
+
console.error(`[Kill Switch] New player detected on Tutorial Island at (${x}, ${z}), auto-skipping...`);
|
|
4532
|
+
const tutorialStart = Date.now();
|
|
4533
|
+
const TUTORIAL_TIMEOUT = 30000;
|
|
4534
|
+
while (Date.now() - tutorialStart < TUTORIAL_TIMEOUT) {
|
|
4535
|
+
try {
|
|
4536
|
+
await connection.bot.skipTutorial({ randomizeAppearance: true });
|
|
4537
|
+
} catch (e) {
|
|
4538
|
+
console.error(`[Kill Switch] skipTutorial call: ${e.message}`);
|
|
4539
|
+
}
|
|
4540
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
4541
|
+
const currentState = connection.sdk.getState();
|
|
4542
|
+
if (currentState?.player) {
|
|
4543
|
+
const cx = currentState.player.worldX;
|
|
4544
|
+
const cz = currentState.player.worldZ;
|
|
4545
|
+
if (cx < 3050 || cx > 3160 || cz < 3050 || cz > 3140) {
|
|
4546
|
+
console.error(`[Kill Switch] Tutorial complete! Now at (${cx}, ${cz})`);
|
|
4547
|
+
break;
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4516
4553
|
const { actions, descriptions } = await loadActions(botName, connection.bot, connection.sdk);
|
|
4517
4554
|
activeActions = actions;
|
|
4518
4555
|
activeActionDescriptions = descriptions;
|
|
@@ -4629,6 +4666,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
|
4629
4666
|
return value;
|
|
4630
4667
|
}
|
|
4631
4668
|
});
|
|
4669
|
+
await connection.bot.dismissBlockingUI();
|
|
4632
4670
|
let result;
|
|
4633
4671
|
try {
|
|
4634
4672
|
result = await Promise.race([fn(cancellable(connection.bot), cancellable(connection.sdk), activeActions), timeoutPromise, cancelPromise]);
|