poi-plugin-kca-next 1.0.7 → 1.0.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.
- package/dist/index.js +957 -164
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -790,7 +790,16 @@ function createDefaultSettings() {
|
|
|
790
790
|
minDwellMs: 38,
|
|
791
791
|
maxDwellMs: 92,
|
|
792
792
|
delayJitterRatio: 0.15,
|
|
793
|
-
useWheelPagination: true
|
|
793
|
+
useWheelPagination: true,
|
|
794
|
+
naturalCursorGlide: true,
|
|
795
|
+
idleBreakEnabled: false,
|
|
796
|
+
idleBreakEveryMin: 45,
|
|
797
|
+
idleBreakMinSec: 45,
|
|
798
|
+
idleBreakMaxSec: 180,
|
|
799
|
+
quietHoursEnabled: false,
|
|
800
|
+
quietHoursStart: "02:00",
|
|
801
|
+
quietHoursEnd: "07:00",
|
|
802
|
+
quietHoursAllowExpedition: true
|
|
794
803
|
},
|
|
795
804
|
safety: {
|
|
796
805
|
strictTaihaGuard: true,
|
|
@@ -803,7 +812,18 @@ function createDefaultSettings() {
|
|
|
803
812
|
f5FullRefreshJitterMin: 20,
|
|
804
813
|
start2CacheMode: "off",
|
|
805
814
|
start2CacheTtlSec: 7200,
|
|
806
|
-
start2CacheKeepSec: 300
|
|
815
|
+
start2CacheKeepSec: 300,
|
|
816
|
+
minFuelToSortie: 0,
|
|
817
|
+
minAmmoToSortie: 0,
|
|
818
|
+
minSteelToSortie: 0,
|
|
819
|
+
minBauxiteToSortie: 0,
|
|
820
|
+
minBucketToSortie: 0,
|
|
821
|
+
minFreeEquipSlotsToSortie: 5,
|
|
822
|
+
stopOnNewShipDrop: false,
|
|
823
|
+
preventEventUntaggedSally: true,
|
|
824
|
+
maxConsecutiveModuleErrors: 3,
|
|
825
|
+
manualYieldEnabled: true,
|
|
826
|
+
manualYieldSec: 20
|
|
807
827
|
},
|
|
808
828
|
expedition: {
|
|
809
829
|
targets: [-1, -1, -1],
|
|
@@ -3189,6 +3209,175 @@ var ActionPrimitives = class {
|
|
|
3189
3209
|
}
|
|
3190
3210
|
};
|
|
3191
3211
|
|
|
3212
|
+
// src/core/safety-guards.ts
|
|
3213
|
+
var SAFE_MARGIN_ZONES = [
|
|
3214
|
+
// Bottom-left blank strip
|
|
3215
|
+
{ xMin: 76, xMax: 292, yMin: 694, yMax: 714 },
|
|
3216
|
+
// Top-left subtle safe edge (away from literal 0,0)
|
|
3217
|
+
{ xMin: 14, xMax: 64, yMin: 10, yMax: 44 },
|
|
3218
|
+
// Top-right quiet corner
|
|
3219
|
+
{ xMin: 1136, xMax: 1186, yMin: 12, yMax: 48 },
|
|
3220
|
+
// Bottom-right quiet strip
|
|
3221
|
+
{ xMin: 1055, xMax: 1184, yMin: 694, yMax: 714 }
|
|
3222
|
+
];
|
|
3223
|
+
function clamp(v, lo, hi) {
|
|
3224
|
+
if (hi < lo) return lo;
|
|
3225
|
+
return Math.max(lo, Math.min(hi, v));
|
|
3226
|
+
}
|
|
3227
|
+
function clampToBounds(pt, bounds) {
|
|
3228
|
+
if (!bounds || bounds.width <= 0 || bounds.height <= 0) {
|
|
3229
|
+
return {
|
|
3230
|
+
x: clamp(pt.x, 4, CANVAS_WIDTH - 4),
|
|
3231
|
+
y: clamp(pt.y, 4, CANVAS_HEIGHT - 4)
|
|
3232
|
+
};
|
|
3233
|
+
}
|
|
3234
|
+
const padX = Math.min(4, bounds.width * 0.05);
|
|
3235
|
+
const padY = Math.min(4, bounds.height * 0.05);
|
|
3236
|
+
return {
|
|
3237
|
+
x: clamp(pt.x, bounds.left + padX, bounds.left + bounds.width - padX),
|
|
3238
|
+
y: clamp(pt.y, bounds.top + padY, bounds.top + bounds.height - padY)
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
function computeCursorApproachPoints(from, to, bounds, rng = Math.random) {
|
|
3242
|
+
if (!from) return [];
|
|
3243
|
+
const dx = to.x - from.x;
|
|
3244
|
+
const dy = to.y - from.y;
|
|
3245
|
+
const dist = Math.hypot(dx, dy);
|
|
3246
|
+
if (!Number.isFinite(dist) || dist < 22) return [];
|
|
3247
|
+
const steps = dist > 300 ? 3 : 2;
|
|
3248
|
+
const nx = -dy / dist;
|
|
3249
|
+
const ny = dx / dist;
|
|
3250
|
+
const arcMag = (rng() - 0.5) * Math.min(44, dist * 0.16);
|
|
3251
|
+
const ctrlX = (from.x + to.x) * 0.5 + nx * arcMag;
|
|
3252
|
+
const ctrlY = (from.y + to.y) * 0.5 + ny * arcMag;
|
|
3253
|
+
const points = [];
|
|
3254
|
+
for (let i = 1; i <= steps; i++) {
|
|
3255
|
+
const rawT = i / (steps + 1);
|
|
3256
|
+
const t = clamp(rawT + (rng() - 0.5) * 0.08, 0.12, 0.88);
|
|
3257
|
+
const omt = 1 - t;
|
|
3258
|
+
const x = omt * omt * from.x + 2 * omt * t * ctrlX + t * t * to.x;
|
|
3259
|
+
const y = omt * omt * from.y + 2 * omt * t * ctrlY + t * t * to.y;
|
|
3260
|
+
points.push(clampToBounds({ x, y }, bounds));
|
|
3261
|
+
}
|
|
3262
|
+
return points;
|
|
3263
|
+
}
|
|
3264
|
+
function computeNaturalPostClickPark(clickPt, bounds, rng = Math.random) {
|
|
3265
|
+
if (rng() < 0.55) {
|
|
3266
|
+
const angle = rng() * Math.PI * 2;
|
|
3267
|
+
const radius = 3 + rng() * 11;
|
|
3268
|
+
const drifted = {
|
|
3269
|
+
x: clickPt.x + Math.cos(angle) * radius,
|
|
3270
|
+
y: clickPt.y + Math.sin(angle) * radius
|
|
3271
|
+
};
|
|
3272
|
+
return clampToBounds(drifted, bounds);
|
|
3273
|
+
}
|
|
3274
|
+
const zone = SAFE_MARGIN_ZONES[Math.floor(rng() * SAFE_MARGIN_ZONES.length) % SAFE_MARGIN_ZONES.length];
|
|
3275
|
+
const canonX = zone.xMin + rng() * (zone.xMax - zone.xMin);
|
|
3276
|
+
const canonY = zone.yMin + rng() * (zone.yMax - zone.yMin);
|
|
3277
|
+
if (!bounds || bounds.width <= 0 || bounds.height <= 0) {
|
|
3278
|
+
return clampToBounds({ x: canonX, y: canonY }, null);
|
|
3279
|
+
}
|
|
3280
|
+
return clampToBounds(
|
|
3281
|
+
{
|
|
3282
|
+
x: bounds.left + canonX * bounds.width / CANVAS_WIDTH,
|
|
3283
|
+
y: bounds.top + canonY * bounds.height / CANVAS_HEIGHT
|
|
3284
|
+
},
|
|
3285
|
+
bounds
|
|
3286
|
+
);
|
|
3287
|
+
}
|
|
3288
|
+
function evaluatePreSortieSafetyGuards(state, profile, safety, isCombined) {
|
|
3289
|
+
const lowResources = [];
|
|
3290
|
+
if (safety.minFuelToSortie > 0 && state.materials.fuel < safety.minFuelToSortie) {
|
|
3291
|
+
lowResources.push(`\u71C3\u6599 ${state.materials.fuel} < ${safety.minFuelToSortie}`);
|
|
3292
|
+
}
|
|
3293
|
+
if (safety.minAmmoToSortie > 0 && state.materials.ammo < safety.minAmmoToSortie) {
|
|
3294
|
+
lowResources.push(`\u5F39\u836F ${state.materials.ammo} < ${safety.minAmmoToSortie}`);
|
|
3295
|
+
}
|
|
3296
|
+
if (safety.minSteelToSortie > 0 && state.materials.steel < safety.minSteelToSortie) {
|
|
3297
|
+
lowResources.push(`\u94A2\u6750 ${state.materials.steel} < ${safety.minSteelToSortie}`);
|
|
3298
|
+
}
|
|
3299
|
+
if (safety.minBauxiteToSortie > 0 && state.materials.bauxite < safety.minBauxiteToSortie) {
|
|
3300
|
+
lowResources.push(`\u94DD\u6750 ${state.materials.bauxite} < ${safety.minBauxiteToSortie}`);
|
|
3301
|
+
}
|
|
3302
|
+
if (lowResources.length > 0) {
|
|
3303
|
+
return {
|
|
3304
|
+
ok: false,
|
|
3305
|
+
code: "low_resource",
|
|
3306
|
+
reason: `\u8D44\u6E90\u4F4E\u4E8E\u5B89\u5168\u4E0B\u9650 (${lowResources.join(" / ")})\uFF0C\u5DF2\u81EA\u52A8\u505C\u6B62\u51FA\u51FB`
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
if (safety.minBucketToSortie > 0 && state.materials.bucket < safety.minBucketToSortie) {
|
|
3310
|
+
return {
|
|
3311
|
+
ok: false,
|
|
3312
|
+
code: "low_bucket",
|
|
3313
|
+
reason: `\u9AD8\u901F\u4FEE\u590D\u6750\u4E0D\u8DB3 (${state.materials.bucket} < ${safety.minBucketToSortie})\uFF0C\u5DF2\u81EA\u52A8\u505C\u6B62\u51FA\u51FB`
|
|
3314
|
+
};
|
|
3315
|
+
}
|
|
3316
|
+
if (safety.minFreeEquipSlotsToSortie > 0 && state.maxSlotItemCount > 0) {
|
|
3317
|
+
const usedEquip = Object.keys(state.slotItems).length;
|
|
3318
|
+
const freeEquip = Math.max(0, state.maxSlotItemCount - usedEquip);
|
|
3319
|
+
if (freeEquip < safety.minFreeEquipSlotsToSortie) {
|
|
3320
|
+
return {
|
|
3321
|
+
ok: false,
|
|
3322
|
+
code: "low_equip_slots",
|
|
3323
|
+
reason: `\u88C5\u5907\u7A7A\u4F4D\u4E0D\u8DB3 (\u5269\u4F59 ${freeEquip} < \u4E0B\u9650 ${safety.minFreeEquipSlotsToSortie})\uFF0C\u5DF2\u81EA\u52A8\u505C\u6B62\u51FA\u51FB`
|
|
3324
|
+
};
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
if (profile.isEvent && safety.preventEventUntaggedSally) {
|
|
3328
|
+
const fleetIds = isCombined && profile.fleet === 1 ? [1, 2] : [profile.fleet];
|
|
3329
|
+
const untaggedNames = [];
|
|
3330
|
+
for (const fid of fleetIds) {
|
|
3331
|
+
const fleet = state.fleets[fid];
|
|
3332
|
+
if (!fleet) continue;
|
|
3333
|
+
for (const sid of fleet.shipIds) {
|
|
3334
|
+
const ship = state.ships[sid];
|
|
3335
|
+
if (ship && ship.sallyArea === 0) {
|
|
3336
|
+
untaggedNames.push(ship.name);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
if (untaggedNames.length > 0) {
|
|
3341
|
+
const preview = untaggedNames.length <= 4 ? untaggedNames.join("\u3001") : `${untaggedNames.slice(0, 4).join("\u3001")} \u7B49 ${untaggedNames.length} \u8258`;
|
|
3342
|
+
return {
|
|
3343
|
+
ok: false,
|
|
3344
|
+
code: "event_untagged_sally",
|
|
3345
|
+
reason: `\u6D3B\u52A8\u9632\u8BEF\u8D34\u6761\u62E6\u622A\uFF1A${preview} \u5C1A\u672A\u8D34\u6761 (sallyArea=0)\uFF0C\u5DF2\u505C\u6B62\u51FA\u51FB`
|
|
3346
|
+
};
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
return { ok: true };
|
|
3350
|
+
}
|
|
3351
|
+
function parseHHMMToMinutes(str) {
|
|
3352
|
+
const m = /^\s*(\d{1,2})\s*:\s*(\d{2})\s*$/.exec(String(str ?? ""));
|
|
3353
|
+
if (!m) return null;
|
|
3354
|
+
const h = Number(m[1]);
|
|
3355
|
+
const min = Number(m[2]);
|
|
3356
|
+
if (!Number.isInteger(h) || !Number.isInteger(min)) return null;
|
|
3357
|
+
if (h < 0 || h > 23 || min < 0 || min > 59) return null;
|
|
3358
|
+
return h * 60 + min;
|
|
3359
|
+
}
|
|
3360
|
+
function isWithinQuietHours(now, startHHMM, endHHMM) {
|
|
3361
|
+
const start = parseHHMMToMinutes(startHHMM);
|
|
3362
|
+
const end = parseHHMMToMinutes(endHHMM);
|
|
3363
|
+
if (start === null || end === null || start === end) return false;
|
|
3364
|
+
const cur = now.getHours() * 60 + now.getMinutes();
|
|
3365
|
+
if (start < end) {
|
|
3366
|
+
return cur >= start && cur < end;
|
|
3367
|
+
}
|
|
3368
|
+
return cur >= start || cur < end;
|
|
3369
|
+
}
|
|
3370
|
+
function computeNextIdleBreakMs(nowMs, everyMin, rng = Math.random) {
|
|
3371
|
+
const safeEvery = clamp(Number.isFinite(everyMin) ? everyMin : 45, 10, 480);
|
|
3372
|
+
const factor = 0.75 + rng() * 0.5;
|
|
3373
|
+
return nowMs + Math.round(safeEvery * 6e4 * factor);
|
|
3374
|
+
}
|
|
3375
|
+
function sampleIdleBreakDurationMs(minSec, maxSec, rng = Math.random) {
|
|
3376
|
+
const lo = clamp(Number.isFinite(minSec) ? minSec : 45, 10, 3600);
|
|
3377
|
+
const hi = Math.max(lo, clamp(Number.isFinite(maxSec) ? maxSec : 180, lo, 3600));
|
|
3378
|
+
return Math.round((lo + rng() * (hi - lo)) * 1e3);
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3192
3381
|
// src/core/vision.ts
|
|
3193
3382
|
var SRGB_TO_LINEAR = new Float64Array(256);
|
|
3194
3383
|
for (let i = 0; i < 256; i++) {
|
|
@@ -3604,12 +3793,14 @@ var AutomationModule = class {
|
|
|
3604
3793
|
state = "idle";
|
|
3605
3794
|
statusText = "\u5F85\u673A";
|
|
3606
3795
|
lastError = null;
|
|
3796
|
+
consecutiveErrors = 0;
|
|
3607
3797
|
setEnabled(value) {
|
|
3608
3798
|
if (this.enabled === value) return;
|
|
3609
3799
|
this.enabled = value;
|
|
3610
3800
|
if (value) {
|
|
3611
3801
|
this.state = "idle";
|
|
3612
3802
|
this.lastError = null;
|
|
3803
|
+
this.consecutiveErrors = 0;
|
|
3613
3804
|
this.statusText = "\u5DF2\u5F00\u542F\uFF0C\u7B49\u5F85\u6761\u4EF6";
|
|
3614
3805
|
this.onEnabled();
|
|
3615
3806
|
} else {
|
|
@@ -3651,6 +3842,7 @@ var AutomationModule = class {
|
|
|
3651
3842
|
const ctx = this.createContext(signal, Boolean(options.allowDuringSortieLock));
|
|
3652
3843
|
await fn(ctx);
|
|
3653
3844
|
});
|
|
3845
|
+
this.consecutiveErrors = 0;
|
|
3654
3846
|
if (this.state === "running") {
|
|
3655
3847
|
this.state = "idle";
|
|
3656
3848
|
}
|
|
@@ -3663,6 +3855,7 @@ var AutomationModule = class {
|
|
|
3663
3855
|
this.runtime.notifyStateChanged();
|
|
3664
3856
|
return false;
|
|
3665
3857
|
}
|
|
3858
|
+
this.consecutiveErrors++;
|
|
3666
3859
|
const msg = err instanceof Error ? err.message : String(err);
|
|
3667
3860
|
this.lastError = msg;
|
|
3668
3861
|
this.runtime.logger.error(this.category, `${this.displayName} \u5931\u8D25: ${msg}`);
|
|
@@ -3687,6 +3880,19 @@ var AutomationModule = class {
|
|
|
3687
3880
|
} else {
|
|
3688
3881
|
if (!snapshot.inSortie) this.state = "idle";
|
|
3689
3882
|
}
|
|
3883
|
+
const maxErrors = Math.max(
|
|
3884
|
+
0,
|
|
3885
|
+
Math.floor(this.runtime.getSettings().safety.maxConsecutiveModuleErrors ?? 0)
|
|
3886
|
+
);
|
|
3887
|
+
if (maxErrors > 0 && this.consecutiveErrors >= maxErrors && this.enabled) {
|
|
3888
|
+
const fuseMsg = `\u8FDE\u7EED\u5931\u8D25 ${this.consecutiveErrors} \u6B21\uFF0C\u5DF2\u81EA\u52A8\u7194\u65AD\u505C\u6B62`;
|
|
3889
|
+
this.runtime.logger.error("safety", `\u{1F525} ${this.displayName}${fuseMsg} (\u672B\u6B21\u9519\u8BEF: ${msg})`);
|
|
3890
|
+
this.runtime.bridge.notify?.("KCA Next \u6A21\u5757\u7194\u65AD", `${this.displayName}${fuseMsg}`, "error");
|
|
3891
|
+
this.setEnabled(false);
|
|
3892
|
+
this.state = "error";
|
|
3893
|
+
this.statusText = fuseMsg;
|
|
3894
|
+
this.lastError = msg;
|
|
3895
|
+
}
|
|
3690
3896
|
this.runtime.notifyStateChanged();
|
|
3691
3897
|
return false;
|
|
3692
3898
|
}
|
|
@@ -9433,8 +9639,21 @@ var AutoSortieModule = class extends AutomationModule {
|
|
|
9433
9639
|
const name = String(drop.api_ship_name);
|
|
9434
9640
|
const type = String(drop.api_ship_type ?? "");
|
|
9435
9641
|
const map = String(ev.body?.api_quest_name ?? "");
|
|
9436
|
-
|
|
9437
|
-
this.
|
|
9642
|
+
const dropMasterId = Number(drop.api_ship_id) || 0;
|
|
9643
|
+
const baseline = this.ownedShipsBeforeSortie.length > 0 ? this.ownedShipsBeforeSortie : Object.values(this.runtime.bridge.getState().ships);
|
|
9644
|
+
const alreadyOwned = baseline.length === 0 ? true : baseline.some(
|
|
9645
|
+
(owned) => shipsMayCollideInSameFleet({ id: -1, masterId: dropMasterId, name }, owned)
|
|
9646
|
+
);
|
|
9647
|
+
const isNewShip = baseline.length > 0 && !alreadyOwned;
|
|
9648
|
+
this.lastDropShip = { name, type, map, time: Date.now(), isNewShip };
|
|
9649
|
+
if (isNewShip) {
|
|
9650
|
+
this.runtime.logger.success(
|
|
9651
|
+
"sortie",
|
|
9652
|
+
`\u2728 \u635E\u5230\u672A\u6301\u6709\u65B0\u8230\u5A18 [${type ? `${type} ` : ""}${name}] (${map || "\u5F53\u524D\u6D77\u57DF"})\uFF01`
|
|
9653
|
+
);
|
|
9654
|
+
}
|
|
9655
|
+
this.checkTargetShipDrop(name, isNewShip);
|
|
9656
|
+
this.runtime.notifyStateChanged();
|
|
9438
9657
|
}
|
|
9439
9658
|
}
|
|
9440
9659
|
});
|
|
@@ -9447,7 +9666,15 @@ var AutoSortieModule = class extends AutomationModule {
|
|
|
9447
9666
|
condWaitUntilMs = 0;
|
|
9448
9667
|
equipSyncedFleetSig = "";
|
|
9449
9668
|
lbasLastRefreshMs = 0;
|
|
9669
|
+
ownedShipsBeforeSortie = [];
|
|
9450
9670
|
unsubDrop;
|
|
9671
|
+
snapshotOwnedShips(state) {
|
|
9672
|
+
this.ownedShipsBeforeSortie = Object.values(state.ships).map((s) => ({
|
|
9673
|
+
id: s.id,
|
|
9674
|
+
masterId: s.masterId,
|
|
9675
|
+
name: s.name
|
|
9676
|
+
}));
|
|
9677
|
+
}
|
|
9451
9678
|
dispose() {
|
|
9452
9679
|
this.unsubDrop?.();
|
|
9453
9680
|
}
|
|
@@ -9455,14 +9682,26 @@ var AutoSortieModule = class extends AutomationModule {
|
|
|
9455
9682
|
const s = this.runtime.getSettings().sortie;
|
|
9456
9683
|
return s.profiles.find((p) => p.id === s.activeProfileId) ?? s.profiles[0];
|
|
9457
9684
|
}
|
|
9458
|
-
checkTargetShipDrop(shipName) {
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9685
|
+
checkTargetShipDrop(shipName, isNewShip) {
|
|
9686
|
+
if (!this.enabled) return;
|
|
9687
|
+
const settings = this.runtime.getSettings();
|
|
9688
|
+
const s = settings.sortie;
|
|
9689
|
+
if (s.autoStopOnTargetDrop && s.targetDropShips.some((t) => t.trim() === shipName)) {
|
|
9462
9690
|
this.runtime.logger.success("sortie", `\u76EE\u6807\u8230\u5A18\u6389\u843D [${shipName}]\uFF01\u5DF2\u81EA\u52A8\u505C\u6B62\u51FA\u51FB`);
|
|
9463
9691
|
this.runtime.bridge.notify?.("KCA Next", `\u76EE\u6807\u8230\u5A18\u6389\u843D: ${shipName}\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u51FA\u51FB`, "info");
|
|
9464
9692
|
this.setEnabled(false);
|
|
9465
9693
|
this.setStatus(`\u76EE\u6807\u8230\u5A18 [${shipName}] \u6389\u843D\uFF0C\u5DF2\u505C\u6B62`, "idle");
|
|
9694
|
+
return;
|
|
9695
|
+
}
|
|
9696
|
+
if (isNewShip && settings.safety.stopOnNewShipDrop) {
|
|
9697
|
+
this.runtime.logger.success("sortie", `\u2728 \u635E\u5230\u672A\u6301\u6709\u65B0\u8239 [${shipName}]\uFF01\u5DF2\u81EA\u52A8\u505C\u6B62\u51FA\u51FB`);
|
|
9698
|
+
this.runtime.bridge.notify?.(
|
|
9699
|
+
"KCA Next",
|
|
9700
|
+
`\u635E\u5230\u672A\u6301\u6709\u65B0\u8239: ${shipName}\uFF0C\u5DF2\u505C\u6B62\u81EA\u52A8\u51FA\u51FB`,
|
|
9701
|
+
"info"
|
|
9702
|
+
);
|
|
9703
|
+
this.setEnabled(false);
|
|
9704
|
+
this.setStatus(`\u2728 \u65B0\u8239 [${shipName}] \u6389\u843D\uFF0C\u5DF2\u505C\u6B62`, "idle");
|
|
9466
9705
|
}
|
|
9467
9706
|
}
|
|
9468
9707
|
decrementLimitCounter(profileId) {
|
|
@@ -9819,6 +10058,14 @@ var AutoSortieModule = class extends AutomationModule {
|
|
|
9819
10058
|
this.setEnabled(false);
|
|
9820
10059
|
return;
|
|
9821
10060
|
}
|
|
10061
|
+
const guard = evaluatePreSortieSafetyGuards(state, profile, settings.safety, isCombined);
|
|
10062
|
+
if (!guard.ok) {
|
|
10063
|
+
this.runtime.logger.warn("safety", `\u{1F6E1}\uFE0F \u51FA\u51FB\u5B89\u5168\u7194\u65AD\uFF1A${guard.reason}`);
|
|
10064
|
+
this.runtime.bridge.notify?.("KCA Next \u5B89\u5168\u62E6\u622A", guard.reason, "warning");
|
|
10065
|
+
this.setEnabled(false);
|
|
10066
|
+
this.setStatus(guard.reason, "waiting");
|
|
10067
|
+
return;
|
|
10068
|
+
}
|
|
9822
10069
|
const supportDispatches = this.hooks.getPendingSupportExpeditions();
|
|
9823
10070
|
if (supportDispatches.length > 0) {
|
|
9824
10071
|
await this.runLocked(async (ctx) => {
|
|
@@ -9901,6 +10148,7 @@ var AutoSortieModule = class extends AutomationModule {
|
|
|
9901
10148
|
return null;
|
|
9902
10149
|
};
|
|
9903
10150
|
const mapLabel = profile.isEvent ? `E-${profile.mapIndex}` : `${profile.mapArea}-${profile.mapIndex}`;
|
|
10151
|
+
this.snapshotOwnedShips(this.runtime.bridge.getState());
|
|
9904
10152
|
this.setStatus(`\u51FA\u51FB ${mapLabel} \u4E2D`);
|
|
9905
10153
|
this.runtime.scheduler.enterSortieClickLock(this.id);
|
|
9906
10154
|
const unsub = this.runtime.bridge.onApiResponse((ev) => {
|
|
@@ -10317,6 +10565,7 @@ var AutoSortieModule = class extends AutomationModule {
|
|
|
10317
10565
|
this.setStatus(`${mapLabel} \u51FA\u51FB\u7ED3\u675F`, "idle");
|
|
10318
10566
|
} finally {
|
|
10319
10567
|
unsub();
|
|
10568
|
+
this.ownedShipsBeforeSortie = [];
|
|
10320
10569
|
this.runtime.scheduler.exitSortieClickLock(this.id);
|
|
10321
10570
|
}
|
|
10322
10571
|
}
|
|
@@ -10505,7 +10754,11 @@ var KcaAssistantCoordinator = class {
|
|
|
10505
10754
|
void this.requestAutoF5(ev.reason);
|
|
10506
10755
|
}
|
|
10507
10756
|
});
|
|
10757
|
+
this.unsubUserInput = this.bridge.onUserInput?.(() => {
|
|
10758
|
+
this.notifyUserManualInput();
|
|
10759
|
+
});
|
|
10508
10760
|
this.syncStart2CacheFromSettings();
|
|
10761
|
+
this.syncBridgeInputSettings();
|
|
10509
10762
|
if (options.autoStartTimers !== false) {
|
|
10510
10763
|
this.startTimers();
|
|
10511
10764
|
}
|
|
@@ -10535,8 +10788,15 @@ var KcaAssistantCoordinator = class {
|
|
|
10535
10788
|
tickRunning = false;
|
|
10536
10789
|
autoRefreshing = false;
|
|
10537
10790
|
consecutiveCatHits = 0;
|
|
10791
|
+
manualPauseUntilMs = 0;
|
|
10792
|
+
idleBreakUntilMs = 0;
|
|
10793
|
+
nextIdleBreakAtMs = 0;
|
|
10794
|
+
quietHoursActive = false;
|
|
10795
|
+
lastQuietLogState = false;
|
|
10796
|
+
lastManualYieldLogMs = 0;
|
|
10538
10797
|
unsubInvalidNet;
|
|
10539
10798
|
unsubScheduler;
|
|
10799
|
+
unsubUserInput;
|
|
10540
10800
|
syncStart2CacheFromSettings() {
|
|
10541
10801
|
const sf = this.settings.safety;
|
|
10542
10802
|
this.bridge.syncStart2CacheConfig?.({
|
|
@@ -10545,6 +10805,37 @@ var KcaAssistantCoordinator = class {
|
|
|
10545
10805
|
keepSec: sf.start2CacheKeepSec
|
|
10546
10806
|
});
|
|
10547
10807
|
}
|
|
10808
|
+
syncBridgeInputSettings() {
|
|
10809
|
+
this.bridge.setNaturalCursorGlide?.(this.settings.humanInput.naturalCursorGlide !== false);
|
|
10810
|
+
}
|
|
10811
|
+
/** Called when real player mouse/wheel input is observed on the game pane */
|
|
10812
|
+
notifyUserManualInput(nowMs = Date.now()) {
|
|
10813
|
+
const sf = this.settings.safety;
|
|
10814
|
+
if (!sf.manualYieldEnabled) return;
|
|
10815
|
+
const anyEnabled = this.orderedModules.some((m) => m.enabled);
|
|
10816
|
+
if (!anyEnabled) return;
|
|
10817
|
+
const yieldSec = Math.max(5, Math.min(300, Math.round(sf.manualYieldSec || 20)));
|
|
10818
|
+
const wasPaused = this.manualPauseUntilMs > nowMs;
|
|
10819
|
+
this.manualPauseUntilMs = Math.max(this.manualPauseUntilMs, nowMs + yieldSec * 1e3);
|
|
10820
|
+
if (!wasPaused || nowMs - this.lastManualYieldLogMs >= 15e3) {
|
|
10821
|
+
this.lastManualYieldLogMs = nowMs;
|
|
10822
|
+
this.logger.info("safety", `\u270B \u68C0\u6D4B\u5230\u624B\u52A8\u64CD\u4F5C\u6E38\u620F\uFF0C\u81EA\u52A8\u5316\u793C\u8BA9\u6682\u505C ${yieldSec} \u79D2`);
|
|
10823
|
+
}
|
|
10824
|
+
this.emitState();
|
|
10825
|
+
}
|
|
10826
|
+
resumeManualPause() {
|
|
10827
|
+
if (this.manualPauseUntilMs <= 0) return;
|
|
10828
|
+
this.manualPauseUntilMs = 0;
|
|
10829
|
+
this.logger.info("safety", "\u5DF2\u7ED3\u675F\u624B\u52A8\u64CD\u4F5C\u793C\u8BA9\uFF0C\u7ACB\u5373\u6062\u590D\u81EA\u52A8\u5316");
|
|
10830
|
+
this.emitState();
|
|
10831
|
+
}
|
|
10832
|
+
skipIdleBreak(nowMs = Date.now()) {
|
|
10833
|
+
if (this.idleBreakUntilMs <= 0) return;
|
|
10834
|
+
this.idleBreakUntilMs = 0;
|
|
10835
|
+
this.nextIdleBreakAtMs = this.settings.humanInput.idleBreakEnabled ? computeNextIdleBreakMs(nowMs, this.settings.humanInput.idleBreakEveryMin) : 0;
|
|
10836
|
+
this.logger.info("system", "\u5DF2\u8DF3\u8FC7\u672C\u6B21\u62DF\u4EBA\u53D1\u5446\u4F11\u606F\uFF0C\u6062\u590D\u8FD0\u884C");
|
|
10837
|
+
this.emitState();
|
|
10838
|
+
}
|
|
10548
10839
|
getStart2CacheSnapshot() {
|
|
10549
10840
|
return this.bridge.getStart2CacheSnapshot?.() ?? null;
|
|
10550
10841
|
}
|
|
@@ -10577,6 +10868,7 @@ var KcaAssistantCoordinator = class {
|
|
|
10577
10868
|
this.settings = next;
|
|
10578
10869
|
this.logger.setMaxEntries(next.general.maxLogEntries);
|
|
10579
10870
|
this.syncStart2CacheFromSettings();
|
|
10871
|
+
this.syncBridgeInputSettings();
|
|
10580
10872
|
this.scheduleSave();
|
|
10581
10873
|
this.emitState();
|
|
10582
10874
|
}
|
|
@@ -10590,6 +10882,7 @@ var KcaAssistantCoordinator = class {
|
|
|
10590
10882
|
this.settings = merged;
|
|
10591
10883
|
this.logger.setMaxEntries(merged.general.maxLogEntries);
|
|
10592
10884
|
this.syncStart2CacheFromSettings();
|
|
10885
|
+
this.syncBridgeInputSettings();
|
|
10593
10886
|
this.saveNow();
|
|
10594
10887
|
const modeLabel = options.mode === "replace" ? "\u8986\u76D6\u5BFC\u5165" : "\u5408\u5E76\u5BFC\u5165";
|
|
10595
10888
|
this.logger.success(
|
|
@@ -10623,6 +10916,14 @@ var KcaAssistantCoordinator = class {
|
|
|
10623
10916
|
updateSettings(mutator) {
|
|
10624
10917
|
mutator(this.settings);
|
|
10625
10918
|
this.syncStart2CacheFromSettings();
|
|
10919
|
+
this.syncBridgeInputSettings();
|
|
10920
|
+
if (!this.settings.humanInput.idleBreakEnabled) {
|
|
10921
|
+
this.idleBreakUntilMs = 0;
|
|
10922
|
+
this.nextIdleBreakAtMs = 0;
|
|
10923
|
+
}
|
|
10924
|
+
if (!this.settings.safety.manualYieldEnabled) {
|
|
10925
|
+
this.manualPauseUntilMs = 0;
|
|
10926
|
+
}
|
|
10626
10927
|
this.scheduleSave();
|
|
10627
10928
|
this.emitState();
|
|
10628
10929
|
}
|
|
@@ -10653,6 +10954,9 @@ var KcaAssistantCoordinator = class {
|
|
|
10653
10954
|
this.emitState();
|
|
10654
10955
|
}
|
|
10655
10956
|
stopAll() {
|
|
10957
|
+
this.manualPauseUntilMs = 0;
|
|
10958
|
+
this.idleBreakUntilMs = 0;
|
|
10959
|
+
this.nextIdleBreakAtMs = 0;
|
|
10656
10960
|
this.scheduler.abortActive("\u7528\u6237\u4E00\u952E\u505C\u6B62\u5168\u90E8\u81EA\u52A8\u5316");
|
|
10657
10961
|
for (const mod of this.orderedModules) {
|
|
10658
10962
|
mod.setEnabled(false);
|
|
@@ -10684,7 +10988,7 @@ var KcaAssistantCoordinator = class {
|
|
|
10684
10988
|
}
|
|
10685
10989
|
}
|
|
10686
10990
|
/** Execute one deterministic coordinator heartbeat (also directly callable from unit/E2E tests!) */
|
|
10687
|
-
async tickOnce() {
|
|
10991
|
+
async tickOnce(nowMs = Date.now()) {
|
|
10688
10992
|
if (this.tickRunning || this.autoRefreshing) return;
|
|
10689
10993
|
this.tickRunning = true;
|
|
10690
10994
|
try {
|
|
@@ -10693,9 +10997,68 @@ var KcaAssistantCoordinator = class {
|
|
|
10693
10997
|
if (this.plan.isRestPaused) {
|
|
10694
10998
|
return;
|
|
10695
10999
|
}
|
|
11000
|
+
if (this.manualPauseUntilMs > 0) {
|
|
11001
|
+
if (nowMs < this.manualPauseUntilMs) {
|
|
11002
|
+
return;
|
|
11003
|
+
}
|
|
11004
|
+
this.manualPauseUntilMs = 0;
|
|
11005
|
+
this.logger.info("safety", "\u624B\u52A8\u64CD\u4F5C\u793C\u8BA9\u7ED3\u675F\uFF0C\u81EA\u52A8\u6062\u590D\u8FD0\u884C");
|
|
11006
|
+
this.emitState();
|
|
11007
|
+
}
|
|
11008
|
+
const hi = this.settings.humanInput;
|
|
11009
|
+
const inSortie = this.bridge.getState().inSortie;
|
|
11010
|
+
const inQuiet = hi.quietHoursEnabled && isWithinQuietHours(new Date(nowMs), hi.quietHoursStart, hi.quietHoursEnd);
|
|
11011
|
+
this.quietHoursActive = inQuiet;
|
|
11012
|
+
if (inQuiet !== this.lastQuietLogState) {
|
|
11013
|
+
this.lastQuietLogState = inQuiet;
|
|
11014
|
+
if (inQuiet) {
|
|
11015
|
+
this.logger.info(
|
|
11016
|
+
"system",
|
|
11017
|
+
`\u{1F319} \u8FDB\u5165\u6BCF\u65E5\u9759\u9ED8\u4F5C\u606F\u65F6\u6BB5 (${hi.quietHoursStart}~${hi.quietHoursEnd})${hi.quietHoursAllowExpedition ? "\uFF0C\u4EC5\u4FDD\u7559\u8FDC\u5F81\u4E0E\u5165\u6E20" : "\uFF0C\u5168\u90E8\u81EA\u52A8\u6A21\u5757\u6682\u505C"}`
|
|
11018
|
+
);
|
|
11019
|
+
} else {
|
|
11020
|
+
this.logger.info("system", "\u2600\uFE0F \u6BCF\u65E5\u9759\u9ED8\u4F5C\u606F\u65F6\u6BB5\u7ED3\u675F\uFF0C\u6062\u590D\u5E38\u89C4\u81EA\u52A8\u5316");
|
|
11021
|
+
}
|
|
11022
|
+
this.emitState();
|
|
11023
|
+
}
|
|
11024
|
+
if (inQuiet && !inSortie && !hi.quietHoursAllowExpedition) {
|
|
11025
|
+
return;
|
|
11026
|
+
}
|
|
11027
|
+
const hasActiveWorker = this.orderedModules.some((m) => m.id !== "plan" && m.enabled);
|
|
11028
|
+
if (!hi.idleBreakEnabled || !hasActiveWorker || inQuiet) {
|
|
11029
|
+
if (this.idleBreakUntilMs > 0 || this.nextIdleBreakAtMs > 0) {
|
|
11030
|
+
this.idleBreakUntilMs = 0;
|
|
11031
|
+
this.nextIdleBreakAtMs = 0;
|
|
11032
|
+
}
|
|
11033
|
+
} else if (this.idleBreakUntilMs > 0) {
|
|
11034
|
+
if (nowMs < this.idleBreakUntilMs) {
|
|
11035
|
+
return;
|
|
11036
|
+
}
|
|
11037
|
+
this.idleBreakUntilMs = 0;
|
|
11038
|
+
this.nextIdleBreakAtMs = computeNextIdleBreakMs(nowMs, hi.idleBreakEveryMin);
|
|
11039
|
+
this.logger.info("system", "\u2615 \u62DF\u4EBA\u968F\u673A\u53D1\u5446\u4F11\u606F\u7ED3\u675F\uFF0C\u6062\u590D\u8FD0\u884C");
|
|
11040
|
+
this.emitState();
|
|
11041
|
+
} else if (!this.scheduler.isBusy && !inSortie) {
|
|
11042
|
+
if (this.nextIdleBreakAtMs === 0) {
|
|
11043
|
+
this.nextIdleBreakAtMs = computeNextIdleBreakMs(nowMs, hi.idleBreakEveryMin);
|
|
11044
|
+
} else if (nowMs >= this.nextIdleBreakAtMs) {
|
|
11045
|
+
const durMs = sampleIdleBreakDurationMs(hi.idleBreakMinSec, hi.idleBreakMaxSec);
|
|
11046
|
+
this.idleBreakUntilMs = nowMs + durMs;
|
|
11047
|
+
this.nextIdleBreakAtMs = 0;
|
|
11048
|
+
this.logger.info(
|
|
11049
|
+
"system",
|
|
11050
|
+
`\u2615 \u62DF\u4EBA\u8282\u5F8B\uFF1A\u8FDB\u5165\u968F\u673A\u53D1\u5446\u4F11\u606F ${Math.round(durMs / 1e3)} \u79D2`
|
|
11051
|
+
);
|
|
11052
|
+
this.emitState();
|
|
11053
|
+
return;
|
|
11054
|
+
}
|
|
11055
|
+
}
|
|
10696
11056
|
for (const mod of this.orderedModules) {
|
|
10697
11057
|
if (mod.id === "plan") continue;
|
|
10698
11058
|
if (!mod.enabled) continue;
|
|
11059
|
+
if (inQuiet && !inSortie && hi.quietHoursAllowExpedition && mod.id !== "expedition" && mod.id !== "repair") {
|
|
11060
|
+
continue;
|
|
11061
|
+
}
|
|
10699
11062
|
if (this.scheduler.isBusy) break;
|
|
10700
11063
|
await mod.tick();
|
|
10701
11064
|
}
|
|
@@ -10798,7 +11161,7 @@ var KcaAssistantCoordinator = class {
|
|
|
10798
11161
|
this.emitState();
|
|
10799
11162
|
}
|
|
10800
11163
|
}
|
|
10801
|
-
getSnapshot() {
|
|
11164
|
+
getSnapshot(nowMs = Date.now()) {
|
|
10802
11165
|
const modules = {};
|
|
10803
11166
|
for (const [id, mod] of Object.entries(this.moduleMap)) {
|
|
10804
11167
|
modules[id] = {
|
|
@@ -10809,11 +11172,17 @@ var KcaAssistantCoordinator = class {
|
|
|
10809
11172
|
displayName: mod.displayName
|
|
10810
11173
|
};
|
|
10811
11174
|
}
|
|
11175
|
+
const manualPauseRemainingSec = this.manualPauseUntilMs > nowMs ? Math.max(1, Math.ceil((this.manualPauseUntilMs - nowMs) / 1e3)) : 0;
|
|
11176
|
+
const idleBreakRemainingSec = this.idleBreakUntilMs > nowMs ? Math.max(1, Math.ceil((this.idleBreakUntilMs - nowMs) / 1e3)) : 0;
|
|
10812
11177
|
return {
|
|
10813
11178
|
activeOwner: this.scheduler.currentOwner,
|
|
10814
11179
|
currentStep: this.scheduler.currentStep,
|
|
10815
11180
|
sortieClickLockActive: this.scheduler.isSortieClickLockActive,
|
|
10816
11181
|
autoRefreshing: this.autoRefreshing,
|
|
11182
|
+
manualPauseRemainingSec,
|
|
11183
|
+
idleBreakRemainingSec,
|
|
11184
|
+
quietHoursActive: this.quietHoursActive,
|
|
11185
|
+
quietHoursAllowExpedition: Boolean(this.settings.humanInput.quietHoursAllowExpedition),
|
|
10817
11186
|
modules,
|
|
10818
11187
|
stats: {
|
|
10819
11188
|
totalSorties: this.sortie.totalSorties,
|
|
@@ -10847,6 +11216,7 @@ var KcaAssistantCoordinator = class {
|
|
|
10847
11216
|
this.plan.dispose();
|
|
10848
11217
|
this.unsubInvalidNet?.();
|
|
10849
11218
|
this.unsubScheduler?.();
|
|
11219
|
+
this.unsubUserInput?.();
|
|
10850
11220
|
this.bridge.dispose?.();
|
|
10851
11221
|
this.listeners.clear();
|
|
10852
11222
|
}
|
|
@@ -12619,15 +12989,24 @@ var PoiGameBridge = class {
|
|
|
12619
12989
|
stateAdapter;
|
|
12620
12990
|
apiHandlers = /* @__PURE__ */ new Set();
|
|
12621
12991
|
invalidHandlers = /* @__PURE__ */ new Set();
|
|
12992
|
+
userInputHandlers = /* @__PURE__ */ new Set();
|
|
12622
12993
|
bgLeaseContents = null;
|
|
12623
12994
|
bgPrevThrottling = true;
|
|
12624
12995
|
bgRestoreTimer = null;
|
|
12625
12996
|
cdpContents = null;
|
|
12626
12997
|
cdpOwned = false;
|
|
12627
12998
|
cachedBounds = null;
|
|
12999
|
+
lastCursorCdp = null;
|
|
13000
|
+
naturalCursorGlide = true;
|
|
13001
|
+
syntheticInputDepth = 0;
|
|
13002
|
+
syntheticInputEndMs = 0;
|
|
13003
|
+
attachedWebview = null;
|
|
13004
|
+
lastWebviewAttachCheckMs = 0;
|
|
13005
|
+
lastUserInputNotifyMs = 0;
|
|
12628
13006
|
reloadPolicy = new SmartReloadPolicy();
|
|
12629
13007
|
start2Cache;
|
|
12630
13008
|
gameResponseListener;
|
|
13009
|
+
webviewUserInputListener;
|
|
12631
13010
|
proxyRef = null;
|
|
12632
13011
|
proxyInvalidHandler = null;
|
|
12633
13012
|
constructor() {
|
|
@@ -12655,9 +13034,22 @@ var PoiGameBridge = class {
|
|
|
12655
13034
|
}
|
|
12656
13035
|
}
|
|
12657
13036
|
};
|
|
13037
|
+
this.webviewUserInputListener = () => {
|
|
13038
|
+
const now = Date.now();
|
|
13039
|
+
if (this.syntheticInputDepth > 0 || now < this.syntheticInputEndMs) return;
|
|
13040
|
+
if (now - this.lastUserInputNotifyMs < 400) return;
|
|
13041
|
+
this.lastUserInputNotifyMs = now;
|
|
13042
|
+
for (const h of this.userInputHandlers) {
|
|
13043
|
+
try {
|
|
13044
|
+
h();
|
|
13045
|
+
} catch {
|
|
13046
|
+
}
|
|
13047
|
+
}
|
|
13048
|
+
};
|
|
12658
13049
|
if (typeof window !== "undefined") {
|
|
12659
13050
|
window.addEventListener("game.response", this.gameResponseListener);
|
|
12660
13051
|
}
|
|
13052
|
+
this.ensureUserInputListenersAttached(true);
|
|
12661
13053
|
const remote = getElectronRemote();
|
|
12662
13054
|
try {
|
|
12663
13055
|
this.proxyRef = remote?.require?.("./lib/proxy") ?? null;
|
|
@@ -12866,7 +13258,78 @@ var PoiGameBridge = class {
|
|
|
12866
13258
|
const zoom = Number(state?.config?.poi?.appearance?.zoom ?? 1) || 1;
|
|
12867
13259
|
return Math.floor(scWidth * zoom) / CANVAS_WIDTH;
|
|
12868
13260
|
}
|
|
13261
|
+
beginSyntheticInput() {
|
|
13262
|
+
this.syntheticInputDepth++;
|
|
13263
|
+
}
|
|
13264
|
+
endSyntheticInput() {
|
|
13265
|
+
this.syntheticInputDepth = Math.max(0, this.syntheticInputDepth - 1);
|
|
13266
|
+
this.syntheticInputEndMs = Date.now() + 260;
|
|
13267
|
+
}
|
|
13268
|
+
detachUserInputListeners() {
|
|
13269
|
+
const wv = this.attachedWebview;
|
|
13270
|
+
this.attachedWebview = null;
|
|
13271
|
+
if (!wv || typeof wv.removeEventListener !== "function") return;
|
|
13272
|
+
try {
|
|
13273
|
+
wv.removeEventListener("pointerdown", this.webviewUserInputListener, true);
|
|
13274
|
+
wv.removeEventListener("mousedown", this.webviewUserInputListener, true);
|
|
13275
|
+
wv.removeEventListener("wheel", this.webviewUserInputListener, true);
|
|
13276
|
+
} catch {
|
|
13277
|
+
}
|
|
13278
|
+
}
|
|
13279
|
+
ensureUserInputListenersAttached(force = false) {
|
|
13280
|
+
const now = Date.now();
|
|
13281
|
+
if (!force && now - this.lastWebviewAttachCheckMs < 5e3) return;
|
|
13282
|
+
this.lastWebviewAttachCheckMs = now;
|
|
13283
|
+
const wv = this.getWebviewRef();
|
|
13284
|
+
if (!wv || typeof wv.addEventListener !== "function") return;
|
|
13285
|
+
if (this.attachedWebview === wv) return;
|
|
13286
|
+
this.detachUserInputListeners();
|
|
13287
|
+
try {
|
|
13288
|
+
const opts = { capture: true, passive: true };
|
|
13289
|
+
wv.addEventListener("pointerdown", this.webviewUserInputListener, opts);
|
|
13290
|
+
wv.addEventListener("mousedown", this.webviewUserInputListener, opts);
|
|
13291
|
+
wv.addEventListener("wheel", this.webviewUserInputListener, opts);
|
|
13292
|
+
this.attachedWebview = wv;
|
|
13293
|
+
} catch {
|
|
13294
|
+
this.attachedWebview = null;
|
|
13295
|
+
}
|
|
13296
|
+
}
|
|
13297
|
+
setNaturalCursorGlide(enabled) {
|
|
13298
|
+
this.naturalCursorGlide = enabled;
|
|
13299
|
+
}
|
|
13300
|
+
async glideCdpTo(contents, target, bounds) {
|
|
13301
|
+
if (this.naturalCursorGlide && this.lastCursorCdp) {
|
|
13302
|
+
const waypoints = computeCursorApproachPoints(this.lastCursorCdp, target, bounds);
|
|
13303
|
+
for (const wp of waypoints) {
|
|
13304
|
+
const stepOk = await this.dispatchCdpMouse(contents, {
|
|
13305
|
+
type: "mouseMoved",
|
|
13306
|
+
x: wp.x,
|
|
13307
|
+
y: wp.y,
|
|
13308
|
+
button: "none",
|
|
13309
|
+
buttons: 0,
|
|
13310
|
+
pointerType: "mouse"
|
|
13311
|
+
});
|
|
13312
|
+
if (!stepOk) return false;
|
|
13313
|
+
await waitMs(8 + Math.random() * 14);
|
|
13314
|
+
}
|
|
13315
|
+
}
|
|
13316
|
+
const moved = await this.dispatchCdpMouse(contents, {
|
|
13317
|
+
type: "mouseMoved",
|
|
13318
|
+
x: target.x,
|
|
13319
|
+
y: target.y,
|
|
13320
|
+
button: "none",
|
|
13321
|
+
buttons: 0,
|
|
13322
|
+
pointerType: "mouse"
|
|
13323
|
+
});
|
|
13324
|
+
if (moved) {
|
|
13325
|
+
this.lastCursorCdp = target;
|
|
13326
|
+
}
|
|
13327
|
+
return moved;
|
|
13328
|
+
}
|
|
12869
13329
|
getState() {
|
|
13330
|
+
if (this.userInputHandlers.size > 0 && !this.attachedWebview) {
|
|
13331
|
+
this.ensureUserInputListenersAttached(false);
|
|
13332
|
+
}
|
|
12870
13333
|
return this.stateAdapter.buildSnapshot();
|
|
12871
13334
|
}
|
|
12872
13335
|
async click(x, y, dwellMs = 55) {
|
|
@@ -12878,54 +13341,61 @@ var PoiGameBridge = class {
|
|
|
12878
13341
|
if (lease.wakeDelay > 0) await waitMs(lease.wakeDelay);
|
|
12879
13342
|
const bounds = await this.getCanvasBounds(contents);
|
|
12880
13343
|
const pt = this.mapToCdp(bounds, x, y);
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
pointerType: "mouse"
|
|
12888
|
-
});
|
|
12889
|
-
if (moved) {
|
|
12890
|
-
const pressed = await this.dispatchCdpMouse(contents, {
|
|
12891
|
-
type: "mousePressed",
|
|
12892
|
-
x: pt.x,
|
|
12893
|
-
y: pt.y,
|
|
12894
|
-
button: "left",
|
|
12895
|
-
buttons: 1,
|
|
12896
|
-
clickCount: 1,
|
|
12897
|
-
pointerType: "mouse"
|
|
12898
|
-
});
|
|
12899
|
-
if (pressed) {
|
|
12900
|
-
await waitMs(Math.max(15, dwellMs));
|
|
12901
|
-
await this.dispatchCdpMouse(contents, {
|
|
12902
|
-
type: "mouseReleased",
|
|
13344
|
+
this.beginSyntheticInput();
|
|
13345
|
+
try {
|
|
13346
|
+
const moved = await this.glideCdpTo(contents, pt, bounds);
|
|
13347
|
+
if (moved) {
|
|
13348
|
+
const pressed = await this.dispatchCdpMouse(contents, {
|
|
13349
|
+
type: "mousePressed",
|
|
12903
13350
|
x: pt.x,
|
|
12904
13351
|
y: pt.y,
|
|
12905
13352
|
button: "left",
|
|
12906
|
-
buttons:
|
|
13353
|
+
buttons: 1,
|
|
12907
13354
|
clickCount: 1,
|
|
12908
13355
|
pointerType: "mouse"
|
|
12909
13356
|
});
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
13357
|
+
if (pressed) {
|
|
13358
|
+
await waitMs(Math.max(15, dwellMs));
|
|
13359
|
+
await this.dispatchCdpMouse(contents, {
|
|
13360
|
+
type: "mouseReleased",
|
|
13361
|
+
x: pt.x,
|
|
13362
|
+
y: pt.y,
|
|
13363
|
+
button: "left",
|
|
13364
|
+
buttons: 0,
|
|
13365
|
+
clickCount: 1,
|
|
13366
|
+
pointerType: "mouse"
|
|
13367
|
+
});
|
|
13368
|
+
const parkPt = computeNaturalPostClickPark(pt, bounds);
|
|
13369
|
+
await waitMs(10 + Math.random() * 16);
|
|
13370
|
+
const parked = await this.dispatchCdpMouse(contents, {
|
|
13371
|
+
type: "mouseMoved",
|
|
13372
|
+
x: parkPt.x,
|
|
13373
|
+
y: parkPt.y,
|
|
13374
|
+
button: "none",
|
|
13375
|
+
buttons: 0,
|
|
13376
|
+
pointerType: "mouse"
|
|
13377
|
+
});
|
|
13378
|
+
this.lastCursorCdp = parked ? parkPt : pt;
|
|
13379
|
+
return;
|
|
13380
|
+
}
|
|
12919
13381
|
}
|
|
13382
|
+
const scale = this.getSendInputScale();
|
|
13383
|
+
const sx = Math.round(x * scale);
|
|
13384
|
+
const sy = Math.round(y * scale);
|
|
13385
|
+
contents.sendInputEvent({ type: "mouseMove", x: sx, y: sy, button: "left" });
|
|
13386
|
+
contents.sendInputEvent({ type: "mouseDown", x: sx, y: sy, button: "left", clickCount: 1 });
|
|
13387
|
+
await waitMs(Math.max(15, dwellMs));
|
|
13388
|
+
contents.sendInputEvent({ type: "mouseUp", x: sx, y: sy, button: "left", clickCount: 1 });
|
|
13389
|
+
const fallbackPark = computeNaturalPostClickPark({ x, y }, null);
|
|
13390
|
+
contents.sendInputEvent({
|
|
13391
|
+
type: "mouseMove",
|
|
13392
|
+
x: Math.round(fallbackPark.x * scale),
|
|
13393
|
+
y: Math.round(fallbackPark.y * scale),
|
|
13394
|
+
button: "left"
|
|
13395
|
+
});
|
|
13396
|
+
} finally {
|
|
13397
|
+
this.endSyntheticInput();
|
|
12920
13398
|
}
|
|
12921
|
-
const scale = this.getSendInputScale();
|
|
12922
|
-
const sx = Math.round(x * scale);
|
|
12923
|
-
const sy = Math.round(y * scale);
|
|
12924
|
-
contents.sendInputEvent({ type: "mouseMove", x: sx, y: sy, button: "left" });
|
|
12925
|
-
contents.sendInputEvent({ type: "mouseDown", x: sx, y: sy, button: "left", clickCount: 1 });
|
|
12926
|
-
await waitMs(Math.max(15, dwellMs));
|
|
12927
|
-
contents.sendInputEvent({ type: "mouseUp", x: sx, y: sy, button: "left", clickCount: 1 });
|
|
12928
|
-
contents.sendInputEvent({ type: "mouseMove", x: 0, y: 0, button: "left" });
|
|
12929
13399
|
}
|
|
12930
13400
|
async hover(x, y) {
|
|
12931
13401
|
const lease = await this.renewBackgroundLease();
|
|
@@ -12936,21 +13406,19 @@ var PoiGameBridge = class {
|
|
|
12936
13406
|
if (lease.wakeDelay > 0) await waitMs(lease.wakeDelay);
|
|
12937
13407
|
const bounds = await this.getCanvasBounds(contents);
|
|
12938
13408
|
const pt = this.mapToCdp(bounds, x, y);
|
|
12939
|
-
|
|
12940
|
-
|
|
12941
|
-
|
|
12942
|
-
|
|
12943
|
-
|
|
12944
|
-
|
|
12945
|
-
|
|
12946
|
-
|
|
12947
|
-
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
y: Math.round(y * scale)
|
|
12953
|
-
});
|
|
13409
|
+
this.beginSyntheticInput();
|
|
13410
|
+
try {
|
|
13411
|
+
const ok = await this.glideCdpTo(contents, pt, bounds);
|
|
13412
|
+
if (!ok) {
|
|
13413
|
+
const scale = this.getSendInputScale();
|
|
13414
|
+
contents.sendInputEvent({
|
|
13415
|
+
type: "mouseMove",
|
|
13416
|
+
x: Math.round(x * scale),
|
|
13417
|
+
y: Math.round(y * scale)
|
|
13418
|
+
});
|
|
13419
|
+
}
|
|
13420
|
+
} finally {
|
|
13421
|
+
this.endSyntheticInput();
|
|
12954
13422
|
}
|
|
12955
13423
|
}
|
|
12956
13424
|
async drag(x1, y1, x2, y2, durationMs = 620) {
|
|
@@ -12967,79 +13435,86 @@ var PoiGameBridge = class {
|
|
|
12967
13435
|
const ctrlY = (p1.y + p2.y) / 2 + (Math.random() - 0.5) * 18;
|
|
12968
13436
|
const steps = 12;
|
|
12969
13437
|
const stepBase = Math.max(25, durationMs / steps);
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
button: "none",
|
|
12975
|
-
buttons: 0,
|
|
12976
|
-
pointerType: "mouse"
|
|
12977
|
-
});
|
|
12978
|
-
if (useCdp) {
|
|
12979
|
-
await this.dispatchCdpMouse(contents, {
|
|
12980
|
-
type: "mousePressed",
|
|
12981
|
-
x: p1.x,
|
|
12982
|
-
y: p1.y,
|
|
12983
|
-
button: "left",
|
|
12984
|
-
buttons: 1,
|
|
12985
|
-
clickCount: 1,
|
|
12986
|
-
pointerType: "mouse"
|
|
12987
|
-
});
|
|
12988
|
-
for (let i = 1; i <= steps; i++) {
|
|
12989
|
-
const t = i / steps;
|
|
12990
|
-
const omt = 1 - t;
|
|
12991
|
-
const ix = omt * omt * p1.x + 2 * omt * t * ctrlX + t * t * p2.x;
|
|
12992
|
-
const iy = omt * omt * p1.y + 2 * omt * t * ctrlY + t * t * p2.y;
|
|
12993
|
-
await waitMs(stepBase * (0.65 + Math.random() * 0.7));
|
|
13438
|
+
this.beginSyntheticInput();
|
|
13439
|
+
try {
|
|
13440
|
+
const useCdp = await this.glideCdpTo(contents, p1, bounds);
|
|
13441
|
+
if (useCdp) {
|
|
12994
13442
|
await this.dispatchCdpMouse(contents, {
|
|
12995
|
-
type: "
|
|
12996
|
-
x:
|
|
12997
|
-
y:
|
|
13443
|
+
type: "mousePressed",
|
|
13444
|
+
x: p1.x,
|
|
13445
|
+
y: p1.y,
|
|
12998
13446
|
button: "left",
|
|
12999
13447
|
buttons: 1,
|
|
13448
|
+
clickCount: 1,
|
|
13449
|
+
pointerType: "mouse"
|
|
13450
|
+
});
|
|
13451
|
+
for (let i = 1; i <= steps; i++) {
|
|
13452
|
+
const t = i / steps;
|
|
13453
|
+
const omt = 1 - t;
|
|
13454
|
+
const ix = omt * omt * p1.x + 2 * omt * t * ctrlX + t * t * p2.x;
|
|
13455
|
+
const iy = omt * omt * p1.y + 2 * omt * t * ctrlY + t * t * p2.y;
|
|
13456
|
+
await waitMs(stepBase * (0.65 + Math.random() * 0.7));
|
|
13457
|
+
await this.dispatchCdpMouse(contents, {
|
|
13458
|
+
type: "mouseMoved",
|
|
13459
|
+
x: ix,
|
|
13460
|
+
y: iy,
|
|
13461
|
+
button: "left",
|
|
13462
|
+
buttons: 1,
|
|
13463
|
+
pointerType: "mouse"
|
|
13464
|
+
});
|
|
13465
|
+
}
|
|
13466
|
+
await waitMs(80 + Math.random() * 50);
|
|
13467
|
+
await this.dispatchCdpMouse(contents, {
|
|
13468
|
+
type: "mouseReleased",
|
|
13469
|
+
x: p2.x,
|
|
13470
|
+
y: p2.y,
|
|
13471
|
+
button: "left",
|
|
13472
|
+
buttons: 0,
|
|
13473
|
+
clickCount: 1,
|
|
13474
|
+
pointerType: "mouse"
|
|
13475
|
+
});
|
|
13476
|
+
const parkPt = computeNaturalPostClickPark(p2, bounds);
|
|
13477
|
+
await waitMs(10 + Math.random() * 16);
|
|
13478
|
+
const parked = await this.dispatchCdpMouse(contents, {
|
|
13479
|
+
type: "mouseMoved",
|
|
13480
|
+
x: parkPt.x,
|
|
13481
|
+
y: parkPt.y,
|
|
13482
|
+
button: "none",
|
|
13483
|
+
buttons: 0,
|
|
13000
13484
|
pointerType: "mouse"
|
|
13001
13485
|
});
|
|
13486
|
+
this.lastCursorCdp = parked ? parkPt : p2;
|
|
13487
|
+
return;
|
|
13002
13488
|
}
|
|
13003
|
-
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
const scale = this.getSendInputScale();
|
|
13024
|
-
const s1x = Math.round(x1 * scale);
|
|
13025
|
-
const s1y = Math.round(y1 * scale);
|
|
13026
|
-
const s2x = Math.round(x2 * scale);
|
|
13027
|
-
const s2y = Math.round(y2 * scale);
|
|
13028
|
-
contents.sendInputEvent({ type: "mouseMove", x: s1x, y: s1y, button: "left" });
|
|
13029
|
-
contents.sendInputEvent({ type: "mouseDown", x: s1x, y: s1y, button: "left", clickCount: 1 });
|
|
13030
|
-
for (let i = 1; i <= steps; i++) {
|
|
13031
|
-
const t = i / steps;
|
|
13032
|
-
await waitMs(stepBase * (0.65 + Math.random() * 0.7));
|
|
13489
|
+
const scale = this.getSendInputScale();
|
|
13490
|
+
const s1x = Math.round(x1 * scale);
|
|
13491
|
+
const s1y = Math.round(y1 * scale);
|
|
13492
|
+
const s2x = Math.round(x2 * scale);
|
|
13493
|
+
const s2y = Math.round(y2 * scale);
|
|
13494
|
+
contents.sendInputEvent({ type: "mouseMove", x: s1x, y: s1y, button: "left" });
|
|
13495
|
+
contents.sendInputEvent({ type: "mouseDown", x: s1x, y: s1y, button: "left", clickCount: 1 });
|
|
13496
|
+
for (let i = 1; i <= steps; i++) {
|
|
13497
|
+
const t = i / steps;
|
|
13498
|
+
await waitMs(stepBase * (0.65 + Math.random() * 0.7));
|
|
13499
|
+
contents.sendInputEvent({
|
|
13500
|
+
type: "mouseMove",
|
|
13501
|
+
x: Math.round(s1x + (s2x - s1x) * t),
|
|
13502
|
+
y: Math.round(s1y + (s2y - s1y) * t),
|
|
13503
|
+
button: "left"
|
|
13504
|
+
});
|
|
13505
|
+
}
|
|
13506
|
+
await waitMs(90);
|
|
13507
|
+
contents.sendInputEvent({ type: "mouseUp", x: s2x, y: s2y, button: "left", clickCount: 1 });
|
|
13508
|
+
const fallbackPark = computeNaturalPostClickPark({ x: x2, y: y2 }, null);
|
|
13033
13509
|
contents.sendInputEvent({
|
|
13034
13510
|
type: "mouseMove",
|
|
13035
|
-
x: Math.round(
|
|
13036
|
-
y: Math.round(
|
|
13511
|
+
x: Math.round(fallbackPark.x * scale),
|
|
13512
|
+
y: Math.round(fallbackPark.y * scale),
|
|
13037
13513
|
button: "left"
|
|
13038
13514
|
});
|
|
13515
|
+
} finally {
|
|
13516
|
+
this.endSyntheticInput();
|
|
13039
13517
|
}
|
|
13040
|
-
await waitMs(90);
|
|
13041
|
-
contents.sendInputEvent({ type: "mouseUp", x: s2x, y: s2y, button: "left", clickCount: 1 });
|
|
13042
|
-
contents.sendInputEvent({ type: "mouseMove", x: 0, y: 0, button: "left" });
|
|
13043
13518
|
}
|
|
13044
13519
|
/**
|
|
13045
13520
|
* Dispatch a bounded mouse wheel event at canonical 1200x720 coordinates.
|
|
@@ -13060,39 +13535,37 @@ var PoiGameBridge = class {
|
|
|
13060
13535
|
if (lease.wakeDelay > 0) await waitMs(lease.wakeDelay);
|
|
13061
13536
|
const bounds = await this.getCanvasBounds(contents);
|
|
13062
13537
|
const pt = this.mapToCdp(bounds, x, y);
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13068
|
-
|
|
13069
|
-
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
|
|
13538
|
+
this.beginSyntheticInput();
|
|
13539
|
+
try {
|
|
13540
|
+
const moved = await this.glideCdpTo(contents, pt, bounds);
|
|
13541
|
+
if (moved) {
|
|
13542
|
+
const scrolled = await this.dispatchCdpMouse(contents, {
|
|
13543
|
+
type: "mouseWheel",
|
|
13544
|
+
x: pt.x,
|
|
13545
|
+
y: pt.y,
|
|
13546
|
+
deltaX: 0,
|
|
13547
|
+
deltaY: clampedDelta,
|
|
13548
|
+
button: "none",
|
|
13549
|
+
buttons: 0,
|
|
13550
|
+
pointerType: "mouse"
|
|
13551
|
+
});
|
|
13552
|
+
if (scrolled) return;
|
|
13553
|
+
}
|
|
13554
|
+
const scale = this.getSendInputScale();
|
|
13555
|
+
const sx = Math.round(x * scale);
|
|
13556
|
+
const sy = Math.round(y * scale);
|
|
13557
|
+
contents.sendInputEvent({ type: "mouseMove", x: sx, y: sy });
|
|
13558
|
+
contents.sendInputEvent({
|
|
13073
13559
|
type: "mouseWheel",
|
|
13074
|
-
x:
|
|
13075
|
-
y:
|
|
13560
|
+
x: sx,
|
|
13561
|
+
y: sy,
|
|
13076
13562
|
deltaX: 0,
|
|
13077
|
-
deltaY: clampedDelta,
|
|
13078
|
-
|
|
13079
|
-
buttons: 0,
|
|
13080
|
-
pointerType: "mouse"
|
|
13563
|
+
deltaY: -clampedDelta,
|
|
13564
|
+
canScroll: true
|
|
13081
13565
|
});
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
const sx = Math.round(x * scale);
|
|
13086
|
-
const sy = Math.round(y * scale);
|
|
13087
|
-
contents.sendInputEvent({ type: "mouseMove", x: sx, y: sy });
|
|
13088
|
-
contents.sendInputEvent({
|
|
13089
|
-
type: "mouseWheel",
|
|
13090
|
-
x: sx,
|
|
13091
|
-
y: sy,
|
|
13092
|
-
deltaX: 0,
|
|
13093
|
-
deltaY: -clampedDelta,
|
|
13094
|
-
canScroll: true
|
|
13095
|
-
});
|
|
13566
|
+
} finally {
|
|
13567
|
+
this.endSyntheticInput();
|
|
13568
|
+
}
|
|
13096
13569
|
}
|
|
13097
13570
|
async captureFullNativeImage() {
|
|
13098
13571
|
const lease = await this.renewBackgroundLease();
|
|
@@ -13326,6 +13799,13 @@ var PoiGameBridge = class {
|
|
|
13326
13799
|
this.invalidHandlers.delete(handler);
|
|
13327
13800
|
};
|
|
13328
13801
|
}
|
|
13802
|
+
onUserInput(handler) {
|
|
13803
|
+
this.userInputHandlers.add(handler);
|
|
13804
|
+
this.ensureUserInputListenersAttached(true);
|
|
13805
|
+
return () => {
|
|
13806
|
+
this.userInputHandlers.delete(handler);
|
|
13807
|
+
};
|
|
13808
|
+
}
|
|
13329
13809
|
notify(title, message) {
|
|
13330
13810
|
try {
|
|
13331
13811
|
if (typeof window?.notify === "function") {
|
|
@@ -13338,6 +13818,7 @@ var PoiGameBridge = class {
|
|
|
13338
13818
|
void this.runInAllFrames(buildRemoveCoordOverlayScript(), 500).catch(() => void 0);
|
|
13339
13819
|
this.start2Cache.dispose();
|
|
13340
13820
|
this.releaseBackgroundLease();
|
|
13821
|
+
this.detachUserInputListeners();
|
|
13341
13822
|
if (typeof window !== "undefined") {
|
|
13342
13823
|
window.removeEventListener("game.response", this.gameResponseListener);
|
|
13343
13824
|
}
|
|
@@ -13350,6 +13831,7 @@ var PoiGameBridge = class {
|
|
|
13350
13831
|
}
|
|
13351
13832
|
this.apiHandlers.clear();
|
|
13352
13833
|
this.invalidHandlers.clear();
|
|
13834
|
+
this.userInputHandlers.clear();
|
|
13353
13835
|
}
|
|
13354
13836
|
};
|
|
13355
13837
|
|
|
@@ -13725,6 +14207,35 @@ var KCA_NEXT_CSS = `
|
|
|
13725
14207
|
.kca-badge-run { background: #1d3a6e; color: #93c5fd; }
|
|
13726
14208
|
.kca-badge-warn { background: #5a3a11; color: #fcd34d; }
|
|
13727
14209
|
.kca-badge-err { background: #5c1922; color: #fca5a5; }
|
|
14210
|
+
.kca-pause-strip {
|
|
14211
|
+
display: flex;
|
|
14212
|
+
flex-direction: column;
|
|
14213
|
+
gap: 4px;
|
|
14214
|
+
padding: 6px 10px 0;
|
|
14215
|
+
flex-shrink: 0;
|
|
14216
|
+
}
|
|
14217
|
+
.kca-pause-banner {
|
|
14218
|
+
display: flex;
|
|
14219
|
+
align-items: center;
|
|
14220
|
+
justify-content: space-between;
|
|
14221
|
+
gap: 8px;
|
|
14222
|
+
padding: 5px 10px;
|
|
14223
|
+
border-radius: 6px;
|
|
14224
|
+
font-size: 11px;
|
|
14225
|
+
border: 1px solid #6b4b16;
|
|
14226
|
+
background: #2c2110;
|
|
14227
|
+
color: #fde68a;
|
|
14228
|
+
}
|
|
14229
|
+
.kca-pause-banner-quiet {
|
|
14230
|
+
border-color: #3b4b7a;
|
|
14231
|
+
background: #172038;
|
|
14232
|
+
color: #bfdbfe;
|
|
14233
|
+
}
|
|
14234
|
+
.kca-pause-banner-break {
|
|
14235
|
+
border-color: #2f5b48;
|
|
14236
|
+
background: #122a22;
|
|
14237
|
+
color: #a7f3d0;
|
|
14238
|
+
}
|
|
13728
14239
|
.kca-tabs {
|
|
13729
14240
|
display: flex;
|
|
13730
14241
|
flex-wrap: wrap;
|
|
@@ -14343,14 +14854,22 @@ var DashboardTab = ({
|
|
|
14343
14854
|
};
|
|
14344
14855
|
const remMin = tt.enabled && tt.targetTimestampMs ? Math.max(0, Math.ceil((tt.targetTimestampMs - Date.now()) / 6e4)) : null;
|
|
14345
14856
|
const enabledModCount = MODULE_ORDER.filter((id) => snap.modules[id]?.enabled).length;
|
|
14346
|
-
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-card" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-card-title" }, /* @__PURE__ */ import_react2.default.createElement("span", null, "\u8FD0\u884C\u72B6\u6001\u4E0E\u603B\u63A7"), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row" }, snap.sortieClickLockActive && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-warn" }, "\u51FA\u51FB\u70B9\u51FB\u9501\u5DF2\u6FC0\u6D3B"), snap.autoRefreshing && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-warn" }, "F5 \u91CD\u8FDE\u4E2D"), settings.safety.start2CacheMode === "serve" && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-ok" }, "Start2 \u7F13\u5B58\u5F00"), /* @__PURE__ */ import_react2.default.createElement("span", { className: `kca-badge ${gameState.loaded ? "kca-badge-ok" : "kca-badge-err"}` }, gameState.loaded ? `\u5DF2\u8FDE\u63A5: ${gameState.admiralName || "\u6BCD\u6E2F\u5C31\u7EEA"}` : "\u7B49\u5F85\u6E38\u620F\u52A0\u8F7D"))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row", style: { justifyContent: "space-between" } }, /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("div", null, "\u5F53\u524D\u6267\u884C\uFF1A", /* @__PURE__ */ import_react2.default.createElement("strong", null, snap.activeOwner ?? "\u7A7A\u95F2"), snap.currentStep ? ` \u2014 ${snap.currentStep}` : ""), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-muted" }, "\u8230\u5A18 ", shipCount, "/", gameState.maxShipCount, " \xB7 \u88C5\u5907 ", equipCount, "/", gameState.maxSlotItemCount, " \xB7 \u6876", " ", gameState.materials.bucket, " \xB7 \u672C\u6B21\u51FA\u51FB ", snap.stats.totalSorties, " \u6B21 \xB7 \u8FDC\u5F81 ", snap.stats.totalExpeditions, " \u6B21"), snap.stats.lastDropShip && /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-muted" }, "\u6700\u8FD1\u6389\u843D\uFF1A", snap.stats.lastDropShip.type, " ", snap.stats.lastDropShip.name, " (", snap.stats.lastDropShip.map, ")")), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react2.default.createElement("button", { className: "kca-btn", onClick: onOpenLegacyImport }, "\u{1F4E5} \u5BFC\u5165\u65E7\u7248\u914D\u7F6E"), /* @__PURE__ */ import_react2.default.createElement(
|
|
14857
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-card" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-card-title" }, /* @__PURE__ */ import_react2.default.createElement("span", null, "\u8FD0\u884C\u72B6\u6001\u4E0E\u603B\u63A7"), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row" }, snap.sortieClickLockActive && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-warn" }, "\u51FA\u51FB\u70B9\u51FB\u9501\u5DF2\u6FC0\u6D3B"), snap.autoRefreshing && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-warn" }, "F5 \u91CD\u8FDE\u4E2D"), settings.safety.start2CacheMode === "serve" && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-ok" }, "Start2 \u7F13\u5B58\u5F00"), /* @__PURE__ */ import_react2.default.createElement("span", { className: `kca-badge ${gameState.loaded ? "kca-badge-ok" : "kca-badge-err"}` }, gameState.loaded ? `\u5DF2\u8FDE\u63A5: ${gameState.admiralName || "\u6BCD\u6E2F\u5C31\u7EEA"}` : "\u7B49\u5F85\u6E38\u620F\u52A0\u8F7D"))), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row", style: { justifyContent: "space-between" } }, /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("div", null, "\u5F53\u524D\u6267\u884C\uFF1A", /* @__PURE__ */ import_react2.default.createElement("strong", null, snap.activeOwner ?? "\u7A7A\u95F2"), snap.currentStep ? ` \u2014 ${snap.currentStep}` : ""), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-muted" }, "\u8230\u5A18 ", shipCount, "/", gameState.maxShipCount, " \xB7 \u88C5\u5907 ", equipCount, "/", gameState.maxSlotItemCount, " \xB7 \u6876", " ", gameState.materials.bucket, " \xB7 \u672C\u6B21\u51FA\u51FB ", snap.stats.totalSorties, " \u6B21 \xB7 \u8FDC\u5F81 ", snap.stats.totalExpeditions, " \u6B21"), snap.stats.lastDropShip && /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-muted" }, "\u6700\u8FD1\u6389\u843D\uFF1A", snap.stats.lastDropShip.type, " ", snap.stats.lastDropShip.name, " ", snap.stats.lastDropShip.isNewShip && /* @__PURE__ */ import_react2.default.createElement("span", { className: "kca-badge kca-badge-ok", style: { marginRight: 4 } }, "\u2728 \u65B0\u8239"), "(", snap.stats.lastDropShip.map, ")")), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react2.default.createElement("button", { className: "kca-btn", onClick: onOpenLegacyImport }, "\u{1F4E5} \u5BFC\u5165\u65E7\u7248\u914D\u7F6E"), /* @__PURE__ */ import_react2.default.createElement(
|
|
14347
14858
|
"button",
|
|
14348
14859
|
{
|
|
14349
14860
|
className: "kca-btn",
|
|
14350
14861
|
onClick: () => void coordinator.requestAutoF5("\u7528\u6237\u624B\u52A8\u89E6\u53D1\u5237\u65B0", { force: true })
|
|
14351
14862
|
},
|
|
14352
14863
|
"\u624B\u52A8 F5 \u91CD\u8FDE"
|
|
14353
|
-
), /* @__PURE__ */ import_react2.default.createElement(
|
|
14864
|
+
), /* @__PURE__ */ import_react2.default.createElement(
|
|
14865
|
+
"button",
|
|
14866
|
+
{
|
|
14867
|
+
className: "kca-btn kca-btn-danger",
|
|
14868
|
+
title: "\u5168\u5C40\u7D27\u6025\u505C\u6B62\u5FEB\u6377\u952E\uFF1ACtrl+Shift+X",
|
|
14869
|
+
onClick: () => coordinator.stopAll()
|
|
14870
|
+
},
|
|
14871
|
+
"\u7D27\u6025\u505C\u6B62\u5168\u90E8 (Ctrl+Shift+X)"
|
|
14872
|
+
)))), isFreshDefaultConfig && /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-card", style: { borderColor: "#2a4a7f", background: "#162238" } }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-row", style: { justifyContent: "space-between" } }, /* @__PURE__ */ import_react2.default.createElement("div", null, /* @__PURE__ */ import_react2.default.createElement("strong", { style: { color: "#93c5fd" } }, "\u4ECE\u65E7\u7248 (\u975E)\u63D0\u52A9\u624B \u8FC1\u79FB\u914D\u7F6E\uFF1F"), /* @__PURE__ */ import_react2.default.createElement("div", { className: "kca-muted" }, "\u53EF\u4E00\u952E\u81EA\u52A8\u68C0\u6D4B\u672C\u673A %APPDATA%\\KanColleAssistant \u5B58\u6863\u4E0E cdata\uFF0C\u65E0\u635F\u5BFC\u5165\u51FA\u51FB/\u9646\u822A/\u8FDC\u5F81/\u5237\u95EA/\u7F16\u6210/\u6F14\u4E60/\u8BA1\u5212/\u4EFB\u52A1\u8BA1\u6570\u3002")), /* @__PURE__ */ import_react2.default.createElement("button", { className: "kca-btn kca-btn-primary", onClick: onOpenLegacyImport }, "\u{1F50D} \u4E00\u952E\u68C0\u6D4B\u5E76\u5BFC\u5165"))), /* @__PURE__ */ import_react2.default.createElement(
|
|
14354
14873
|
CollapsibleCard,
|
|
14355
14874
|
{
|
|
14356
14875
|
storageKey: "dashboard.modules",
|
|
@@ -16526,14 +17045,146 @@ var SettingsLogsTab = ({
|
|
|
16526
17045
|
}
|
|
16527
17046
|
},
|
|
16528
17047
|
"\u7ACB\u5373\u4FDD\u5B58\u914D\u7F6E"
|
|
16529
|
-
))
|
|
17048
|
+
)),
|
|
17049
|
+
/* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-sub-box" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u51FA\u51FB\u7194\u65AD\u4E0E\u624B\u52A8\u4ECB\u5165\u793C\u8BA9"), /* @__PURE__ */ import_react8.default.createElement("label", { className: "kca-switch" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
17050
|
+
"input",
|
|
17051
|
+
{
|
|
17052
|
+
type: "checkbox",
|
|
17053
|
+
checked: settings.safety.preventEventUntaggedSally !== false,
|
|
17054
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17055
|
+
s.safety.preventEventUntaggedSally = e.target.checked;
|
|
17056
|
+
})
|
|
17057
|
+
}
|
|
17058
|
+
), "\u6D3B\u52A8\u6D77\u57DF\u9632\u8BEF\u8D34\u6761\u62E6\u622A\uFF08\u542B\u672A\u8D34\u6761 sallyArea=0 \u8230\u5A18\u81EA\u52A8\u505C\u51FA\u51FB\uFF09"), /* @__PURE__ */ import_react8.default.createElement("label", { className: "kca-switch" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
17059
|
+
"input",
|
|
17060
|
+
{
|
|
17061
|
+
type: "checkbox",
|
|
17062
|
+
checked: Boolean(settings.safety.stopOnNewShipDrop),
|
|
17063
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17064
|
+
s.safety.stopOnNewShipDrop = e.target.checked;
|
|
17065
|
+
})
|
|
17066
|
+
}
|
|
17067
|
+
), "\u635E\u5230\u672A\u6301\u6709\u65B0\u8239\u81EA\u52A8\u505C\u6B62\u51FA\u51FB\uFF08\u81EA\u52A8\u517C\u5BB9\u6539/\u6539\u4E8C\u53CA\u522B\u540D\u540C\u7CFB\u53BB\u91CD\uFF09"), /* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u5355\u6A21\u5757\u8FDE\u9519\u7194\u65AD"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17068
|
+
"input",
|
|
17069
|
+
{
|
|
17070
|
+
type: "number",
|
|
17071
|
+
className: "kca-input",
|
|
17072
|
+
style: { width: 52 },
|
|
17073
|
+
min: 0,
|
|
17074
|
+
max: 20,
|
|
17075
|
+
value: settings.safety.maxConsecutiveModuleErrors ?? 3,
|
|
17076
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17077
|
+
s.safety.maxConsecutiveModuleErrors = Math.max(0, Number(e.target.value) || 0);
|
|
17078
|
+
})
|
|
17079
|
+
}
|
|
17080
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", { className: "kca-muted" }, "\u6B21 (0=\u5173)"), /* @__PURE__ */ import_react8.default.createElement("label", { className: "kca-switch" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
17081
|
+
"input",
|
|
17082
|
+
{
|
|
17083
|
+
type: "checkbox",
|
|
17084
|
+
checked: settings.safety.manualYieldEnabled !== false,
|
|
17085
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17086
|
+
s.safety.manualYieldEnabled = e.target.checked;
|
|
17087
|
+
})
|
|
17088
|
+
}
|
|
17089
|
+
), "\u624B\u52A8\u64CD\u4F5C\u793C\u8BA9"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17090
|
+
"input",
|
|
17091
|
+
{
|
|
17092
|
+
type: "number",
|
|
17093
|
+
className: "kca-input",
|
|
17094
|
+
style: { width: 54 },
|
|
17095
|
+
min: 5,
|
|
17096
|
+
max: 300,
|
|
17097
|
+
value: settings.safety.manualYieldSec ?? 20,
|
|
17098
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17099
|
+
s.safety.manualYieldSec = Math.max(5, Math.min(300, Number(e.target.value) || 20));
|
|
17100
|
+
})
|
|
17101
|
+
}
|
|
17102
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u79D2")), /* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u51FA\u51FB\u8D44\u6E90\u4E0B\u9650 (0=\u4E0D\u9650)"), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u6CB9"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17103
|
+
"input",
|
|
17104
|
+
{
|
|
17105
|
+
type: "number",
|
|
17106
|
+
className: "kca-input",
|
|
17107
|
+
style: { width: 64 },
|
|
17108
|
+
min: 0,
|
|
17109
|
+
step: 500,
|
|
17110
|
+
value: settings.safety.minFuelToSortie ?? 0,
|
|
17111
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17112
|
+
s.safety.minFuelToSortie = Math.max(0, Number(e.target.value) || 0);
|
|
17113
|
+
})
|
|
17114
|
+
}
|
|
17115
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u5F39"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17116
|
+
"input",
|
|
17117
|
+
{
|
|
17118
|
+
type: "number",
|
|
17119
|
+
className: "kca-input",
|
|
17120
|
+
style: { width: 64 },
|
|
17121
|
+
min: 0,
|
|
17122
|
+
step: 500,
|
|
17123
|
+
value: settings.safety.minAmmoToSortie ?? 0,
|
|
17124
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17125
|
+
s.safety.minAmmoToSortie = Math.max(0, Number(e.target.value) || 0);
|
|
17126
|
+
})
|
|
17127
|
+
}
|
|
17128
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u94A2"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17129
|
+
"input",
|
|
17130
|
+
{
|
|
17131
|
+
type: "number",
|
|
17132
|
+
className: "kca-input",
|
|
17133
|
+
style: { width: 64 },
|
|
17134
|
+
min: 0,
|
|
17135
|
+
step: 500,
|
|
17136
|
+
value: settings.safety.minSteelToSortie ?? 0,
|
|
17137
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17138
|
+
s.safety.minSteelToSortie = Math.max(0, Number(e.target.value) || 0);
|
|
17139
|
+
})
|
|
17140
|
+
}
|
|
17141
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u94DD"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17142
|
+
"input",
|
|
17143
|
+
{
|
|
17144
|
+
type: "number",
|
|
17145
|
+
className: "kca-input",
|
|
17146
|
+
style: { width: 64 },
|
|
17147
|
+
min: 0,
|
|
17148
|
+
step: 500,
|
|
17149
|
+
value: settings.safety.minBauxiteToSortie ?? 0,
|
|
17150
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17151
|
+
s.safety.minBauxiteToSortie = Math.max(0, Number(e.target.value) || 0);
|
|
17152
|
+
})
|
|
17153
|
+
}
|
|
17154
|
+
)), /* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u51FA\u51FB\u6876\u4E0B\u9650"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17155
|
+
"input",
|
|
17156
|
+
{
|
|
17157
|
+
type: "number",
|
|
17158
|
+
className: "kca-input",
|
|
17159
|
+
style: { width: 60 },
|
|
17160
|
+
min: 0,
|
|
17161
|
+
step: 10,
|
|
17162
|
+
value: settings.safety.minBucketToSortie ?? 0,
|
|
17163
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17164
|
+
s.safety.minBucketToSortie = Math.max(0, Number(e.target.value) || 0);
|
|
17165
|
+
})
|
|
17166
|
+
}
|
|
17167
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u88C5\u5907\u7A7A\u4F4D\u4E0B\u9650"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17168
|
+
"input",
|
|
17169
|
+
{
|
|
17170
|
+
type: "number",
|
|
17171
|
+
className: "kca-input",
|
|
17172
|
+
style: { width: 54 },
|
|
17173
|
+
min: 0,
|
|
17174
|
+
max: 100,
|
|
17175
|
+
value: settings.safety.minFreeEquipSlotsToSortie ?? 5,
|
|
17176
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17177
|
+
s.safety.minFreeEquipSlotsToSortie = Math.max(0, Number(e.target.value) || 0);
|
|
17178
|
+
})
|
|
17179
|
+
}
|
|
17180
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", { className: "kca-muted" }, "(0=\u4E0D\u9650 \xB7 \u5FEB\u6377\u952E Ctrl+Shift+X \u7D27\u6025\u5168\u505C)")))
|
|
16530
17181
|
), /* @__PURE__ */ import_react8.default.createElement(
|
|
16531
17182
|
CollapsibleCard,
|
|
16532
17183
|
{
|
|
16533
17184
|
storageKey: "settings.human",
|
|
16534
17185
|
title: "\u62DF\u4EBA\u5316\u8F93\u5165\u5F15\u64CE (\u53CD\u68C0\u6D4B\u4F18\u5316)",
|
|
16535
17186
|
defaultOpen: true,
|
|
16536
|
-
summary: /* @__PURE__ */ import_react8.default.createElement("span", null, speedLabels[settings.humanInput.speedProfile] ?? settings.humanInput.speedProfile, " \xB7", " ", settings.humanInput.useWheelPagination !== false ? "\u6EDA\u8F6E\u7FFB\u9875" : "\u9875\u7801\u70B9\u51FB")
|
|
17187
|
+
summary: /* @__PURE__ */ import_react8.default.createElement("span", null, speedLabels[settings.humanInput.speedProfile] ?? settings.humanInput.speedProfile, " \xB7", " ", settings.humanInput.useWheelPagination !== false ? "\u6EDA\u8F6E\u7FFB\u9875" : "\u9875\u7801\u70B9\u51FB", settings.humanInput.idleBreakEnabled ? " \xB7 \u968F\u673A\u53D1\u5446" : "", settings.humanInput.quietHoursEnabled ? " \xB7 \u9759\u9ED8\u4F5C\u606F" : "")
|
|
16537
17188
|
},
|
|
16538
17189
|
/* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u901F\u5EA6\u6863\u4F4D"), /* @__PURE__ */ import_react8.default.createElement(
|
|
16539
17190
|
"select",
|
|
@@ -16589,7 +17240,117 @@ var SettingsLogsTab = ({
|
|
|
16589
17240
|
),
|
|
16590
17241
|
/* @__PURE__ */ import_react8.default.createElement("strong", null, "\u6362\u8239 / \u6362\u88C5 / \u5165\u6E20 / \u89E3\u4F53\u4F7F\u7528\u9F20\u6807\u6EDA\u8F6E\u7FFB\u9875 (\u514D\u8BA1\u7B97\u9875\u7801\u6309\u94AE)")
|
|
16591
17242
|
),
|
|
16592
|
-
/* @__PURE__ */ import_react8.default.createElement(
|
|
17243
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
17244
|
+
"label",
|
|
17245
|
+
{
|
|
17246
|
+
className: "kca-switch",
|
|
17247
|
+
title: "\u70B9\u51FB\u524D\u901A\u8FC7 2~3 \u6BB5\u8F7B\u5FAE\u5F27\u7EBF\u79FB\u5411\u76EE\u6807\uFF0C\u70B9\u51FB\u540E\u81EA\u7136\u5FAE\u98D8\u6216\u968F\u673A\u505C\u9760\u8FB9\u7F18\u7A7A\u767D\u533A\uFF0C\u5F7B\u5E95\u53D6\u6D88\u673A\u68B0\u5F52\u96F6 (0,0)"
|
|
17248
|
+
},
|
|
17249
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
|
17250
|
+
"input",
|
|
17251
|
+
{
|
|
17252
|
+
type: "checkbox",
|
|
17253
|
+
checked: settings.humanInput.naturalCursorGlide !== false,
|
|
17254
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17255
|
+
s.humanInput.naturalCursorGlide = e.target.checked;
|
|
17256
|
+
})
|
|
17257
|
+
}
|
|
17258
|
+
),
|
|
17259
|
+
/* @__PURE__ */ import_react8.default.createElement("strong", null, "\u70B9\u51FB\u524D\u81EA\u7136\u5F27\u7EBF\u5FAE\u79FB + \u7981\u7528 (0,0) \u673A\u68B0\u5F52\u96F6")
|
|
17260
|
+
),
|
|
17261
|
+
/* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-sub-box" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u62DF\u4EBA\u4F5C\u606F\u4E0E\u968F\u673A\u53D1\u5446\uFF08\u53EF\u9009\uFF09"), /* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react8.default.createElement("label", { className: "kca-switch" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
17262
|
+
"input",
|
|
17263
|
+
{
|
|
17264
|
+
type: "checkbox",
|
|
17265
|
+
checked: Boolean(settings.humanInput.idleBreakEnabled),
|
|
17266
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17267
|
+
s.humanInput.idleBreakEnabled = e.target.checked;
|
|
17268
|
+
})
|
|
17269
|
+
}
|
|
17270
|
+
), "\u968F\u673A\u53D1\u5446\u4F11\u606F"), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u6BCF\u7EA6"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17271
|
+
"input",
|
|
17272
|
+
{
|
|
17273
|
+
type: "number",
|
|
17274
|
+
className: "kca-input",
|
|
17275
|
+
style: { width: 52 },
|
|
17276
|
+
min: 10,
|
|
17277
|
+
max: 480,
|
|
17278
|
+
value: settings.humanInput.idleBreakEveryMin ?? 45,
|
|
17279
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17280
|
+
s.humanInput.idleBreakEveryMin = Math.max(10, Number(e.target.value) || 45);
|
|
17281
|
+
})
|
|
17282
|
+
}
|
|
17283
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u5206 \xB7 \u505C"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17284
|
+
"input",
|
|
17285
|
+
{
|
|
17286
|
+
type: "number",
|
|
17287
|
+
className: "kca-input",
|
|
17288
|
+
style: { width: 52 },
|
|
17289
|
+
min: 10,
|
|
17290
|
+
max: 3600,
|
|
17291
|
+
value: settings.humanInput.idleBreakMinSec ?? 45,
|
|
17292
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17293
|
+
s.humanInput.idleBreakMinSec = Math.max(10, Number(e.target.value) || 45);
|
|
17294
|
+
})
|
|
17295
|
+
}
|
|
17296
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "~"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17297
|
+
"input",
|
|
17298
|
+
{
|
|
17299
|
+
type: "number",
|
|
17300
|
+
className: "kca-input",
|
|
17301
|
+
style: { width: 56 },
|
|
17302
|
+
min: 10,
|
|
17303
|
+
max: 3600,
|
|
17304
|
+
value: settings.humanInput.idleBreakMaxSec ?? 180,
|
|
17305
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17306
|
+
s.humanInput.idleBreakMaxSec = Math.max(
|
|
17307
|
+
s.humanInput.idleBreakMinSec ?? 45,
|
|
17308
|
+
Number(e.target.value) || 180
|
|
17309
|
+
);
|
|
17310
|
+
})
|
|
17311
|
+
}
|
|
17312
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "\u79D2")), /* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react8.default.createElement("label", { className: "kca-switch" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
17313
|
+
"input",
|
|
17314
|
+
{
|
|
17315
|
+
type: "checkbox",
|
|
17316
|
+
checked: Boolean(settings.humanInput.quietHoursEnabled),
|
|
17317
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17318
|
+
s.humanInput.quietHoursEnabled = e.target.checked;
|
|
17319
|
+
})
|
|
17320
|
+
}
|
|
17321
|
+
), "\u6BCF\u65E5\u9759\u9ED8\u4F5C\u606F"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17322
|
+
"input",
|
|
17323
|
+
{
|
|
17324
|
+
type: "time",
|
|
17325
|
+
className: "kca-input",
|
|
17326
|
+
style: { width: 92 },
|
|
17327
|
+
value: settings.humanInput.quietHoursStart || "02:00",
|
|
17328
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17329
|
+
s.humanInput.quietHoursStart = e.target.value || "02:00";
|
|
17330
|
+
})
|
|
17331
|
+
}
|
|
17332
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", null, "~"), /* @__PURE__ */ import_react8.default.createElement(
|
|
17333
|
+
"input",
|
|
17334
|
+
{
|
|
17335
|
+
type: "time",
|
|
17336
|
+
className: "kca-input",
|
|
17337
|
+
style: { width: 92 },
|
|
17338
|
+
value: settings.humanInput.quietHoursEnd || "07:00",
|
|
17339
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17340
|
+
s.humanInput.quietHoursEnd = e.target.value || "07:00";
|
|
17341
|
+
})
|
|
17342
|
+
}
|
|
17343
|
+
), /* @__PURE__ */ import_react8.default.createElement("span", { className: "kca-muted" }, "(\u652F\u6301\u8DE8\u5348\u591C)")), settings.humanInput.quietHoursEnabled && /* @__PURE__ */ import_react8.default.createElement("label", { className: "kca-switch" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
17344
|
+
"input",
|
|
17345
|
+
{
|
|
17346
|
+
type: "checkbox",
|
|
17347
|
+
checked: settings.humanInput.quietHoursAllowExpedition !== false,
|
|
17348
|
+
onChange: (e) => coordinator.updateSettings((s) => {
|
|
17349
|
+
s.humanInput.quietHoursAllowExpedition = e.target.checked;
|
|
17350
|
+
})
|
|
17351
|
+
}
|
|
17352
|
+
), "\u9759\u9ED8\u65F6\u6BB5\u4ECD\u5141\u8BB8\u8F7B\u91CF\u5316\u6536\u53D1\u8FDC\u5F81\u4E0E\u81EA\u52A8\u5165\u6E20")),
|
|
17353
|
+
/* @__PURE__ */ import_react8.default.createElement("div", { className: "kca-muted" }, "\u91C7\u7528 Box-Muller \u9AD8\u65AF\u968F\u673A\u5750\u6807\u504F\u79FB + \u81EA\u7136\u66F2\u7EBF\u79FB\u5165 + \u8D1D\u585E\u5C14\u66F2\u7EBF\u62D6\u62FD + \u5217\u8868\u539F\u751F\u9F20\u6807\u6EDA\u8F6E\u7FFB\u9875\u3002")
|
|
16593
17354
|
)), /* @__PURE__ */ import_react8.default.createElement(
|
|
16594
17355
|
CollapsibleCard,
|
|
16595
17356
|
{
|
|
@@ -18626,13 +19387,31 @@ var KcaNextApp = ({ coordinator }) => {
|
|
|
18626
19387
|
const uiRefresh = setInterval(() => {
|
|
18627
19388
|
setGameState(coordinator.bridge.getState());
|
|
18628
19389
|
setSnap(coordinator.getSnapshot());
|
|
18629
|
-
},
|
|
19390
|
+
}, 1e3);
|
|
19391
|
+
const onKeyDown = (e) => {
|
|
19392
|
+
if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.key.toLowerCase() === "x") {
|
|
19393
|
+
e.preventDefault();
|
|
19394
|
+
coordinator.logger.warn("safety", "\u5FEB\u6377\u952E (Ctrl+Shift+X) \u5DF2\u89E6\u53D1\u7D27\u6025\u505C\u6B62\u5168\u90E8\u6A21\u5757");
|
|
19395
|
+
coordinator.stopAll();
|
|
19396
|
+
}
|
|
19397
|
+
};
|
|
19398
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
18630
19399
|
return () => {
|
|
18631
19400
|
unsubCoord();
|
|
18632
19401
|
unsubLogs();
|
|
18633
19402
|
clearInterval(uiRefresh);
|
|
19403
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
18634
19404
|
};
|
|
18635
19405
|
}, [coordinator]);
|
|
19406
|
+
const formatCountdown = (sec) => {
|
|
19407
|
+
if (sec >= 60) {
|
|
19408
|
+
const m = Math.floor(sec / 60);
|
|
19409
|
+
const s = sec % 60;
|
|
19410
|
+
return `${m}\u5206${String(s).padStart(2, "0")}\u79D2`;
|
|
19411
|
+
}
|
|
19412
|
+
return `${sec}\u79D2`;
|
|
19413
|
+
};
|
|
19414
|
+
const hasPauseBanner = snap.manualPauseRemainingSec > 0 || snap.idleBreakRemainingSec > 0 || snap.quietHoursActive;
|
|
18636
19415
|
return /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-next" }, /* @__PURE__ */ import_react12.default.createElement("style", null, KCA_NEXT_CSS), /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-header" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-title" }, /* @__PURE__ */ import_react12.default.createElement("span", null, "\u2693 KCA Next"), /* @__PURE__ */ import_react12.default.createElement("span", { className: "kca-badge kca-badge-ok" }, "v1.0 \u539F\u751F\u5F15\u64CE")), /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-row" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "kca-muted" }, "\u65E0 DRM \xB7 \u96F6\u72EC\u7ACB\u6D4F\u89C8\u5668 \xB7 \u8FDB\u7A0B\u5185\u76F4\u8FDE"))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-tabs" }, TABS.map((t) => /* @__PURE__ */ import_react12.default.createElement(
|
|
18637
19416
|
"button",
|
|
18638
19417
|
{
|
|
@@ -18657,7 +19436,21 @@ var KcaNextApp = ({ coordinator }) => {
|
|
|
18657
19436
|
onClick: () => setAllMountedCardsOpen(false)
|
|
18658
19437
|
},
|
|
18659
19438
|
"\u5168\u90E8\u6298\u53E0"
|
|
18660
|
-
))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-
|
|
19439
|
+
))), hasPauseBanner && /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-pause-strip" }, snap.manualPauseRemainingSec > 0 && /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-pause-banner" }, /* @__PURE__ */ import_react12.default.createElement("span", null, "\u270B \u68C0\u6D4B\u5230\u624B\u52A8\u64CD\u4F5C\u6E38\u620F\uFF0C\u81EA\u52A8\u5316\u793C\u8BA9\u6682\u505C\u4E2D\uFF08\u5269\u4F59", " ", /* @__PURE__ */ import_react12.default.createElement("strong", null, formatCountdown(snap.manualPauseRemainingSec)), "\uFF09"), /* @__PURE__ */ import_react12.default.createElement(
|
|
19440
|
+
"button",
|
|
19441
|
+
{
|
|
19442
|
+
className: "kca-btn kca-btn-sm",
|
|
19443
|
+
onClick: () => coordinator.resumeManualPause()
|
|
19444
|
+
},
|
|
19445
|
+
"\u7ACB\u5373\u6062\u590D"
|
|
19446
|
+
)), snap.idleBreakRemainingSec > 0 && /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-pause-banner kca-pause-banner-break" }, /* @__PURE__ */ import_react12.default.createElement("span", null, "\u2615 \u62DF\u4EBA\u968F\u673A\u53D1\u5446\u4F11\u606F\u4E2D\uFF08\u5269\u4F59", " ", /* @__PURE__ */ import_react12.default.createElement("strong", null, formatCountdown(snap.idleBreakRemainingSec)), "\uFF09"), /* @__PURE__ */ import_react12.default.createElement(
|
|
19447
|
+
"button",
|
|
19448
|
+
{
|
|
19449
|
+
className: "kca-btn kca-btn-sm",
|
|
19450
|
+
onClick: () => coordinator.skipIdleBreak()
|
|
19451
|
+
},
|
|
19452
|
+
"\u8DF3\u8FC7\u672C\u6B21\u4F11\u606F"
|
|
19453
|
+
)), snap.quietHoursActive && /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-pause-banner kca-pause-banner-quiet" }, /* @__PURE__ */ import_react12.default.createElement("span", null, "\u{1F319} \u6BCF\u65E5\u9759\u9ED8\u4F5C\u606F\u65F6\u6BB5\u4E2D (", settings.humanInput.quietHoursStart, " ~", " ", settings.humanInput.quietHoursEnd, ") \xB7", " ", snap.quietHoursAllowExpedition ? "\u4EC5\u4FDD\u7559\u8FDC\u5F81\u4E0E\u5165\u6E20" : "\u5168\u90E8\u81EA\u52A8\u5316\u5DF2\u6682\u505C"))), /* @__PURE__ */ import_react12.default.createElement("div", { className: "kca-body" }, activeTab === "dashboard" && /* @__PURE__ */ import_react12.default.createElement(
|
|
18661
19454
|
DashboardTab,
|
|
18662
19455
|
{
|
|
18663
19456
|
coordinator,
|