Skip to content

Commit

Permalink
Merge pull request icegreentee#453 from segfault-bilibili/rollup-7.3.6
Browse files Browse the repository at this point in the history
【7.3.6】镜层周回增加掉线重连;解决误触MENU
  • Loading branch information
segfault-bilibili committed Aug 31, 2023
2 parents 8019106 + fd487e9 commit f30bb25
Show file tree
Hide file tree
Showing 68 changed files with 140 additions and 86 deletions.
101 changes: 76 additions & 25 deletions floatUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2782,7 +2782,7 @@ function algo_init() {

return result;
}
function findPopupInfoDetailTitleJP(title_to_find, wait) {
function findPopupInfoDetailTitleJP(title_to_find, wait, screenshot) {
let default_x = getFragmentViewBounds().right - 1;
let default_y = 0;
let result = {
Expand All @@ -2797,7 +2797,7 @@ function algo_init() {

if (last_alive_lang !== "ja") throw new Error("last_alive_lang must be ja");

let screenshot = compatCaptureScreen();
if (screenshot == null) screenshot = compatCaptureScreen();
let halfWidth = parseInt(screenshot.getWidth() / 2);
let halfHeight = parseInt(screenshot.getHeight() / 2);
let clipX = screenshot.getWidth() - halfWidth;
Expand Down Expand Up @@ -8633,6 +8633,9 @@ function algo_init() {
"OKButton",
"OKButtonGray",
"downloadDataOKBtn",
"communicationError",
"reconnectOK",
"reload",
"newQuest",
"startBtn",
"closeBtn",
Expand Down Expand Up @@ -10557,6 +10560,12 @@ function algo_init() {
break;
}
}
if (cycles % 5 == 0) {
if (isCommunicationErrorPresent(screenshot) && isReconnectOKButtonPresent(screenshot)) {
log("点击掉线重连按钮");
click(convertCoords(clickSets.reconection));
}
}
}
if (mirrorsAutoBattleConfig.CVAutoBattleDebug) {
if (cycles < 30) {
Expand Down Expand Up @@ -10676,6 +10685,30 @@ function algo_init() {
x: 1190, y: 880, pos: "center"
}
},
communicationError: {
topLeft: {
x: 813, y: 240, pos: "center"
},
bottomRight: {
x: 1106, y: 348, pos: "center"
}
},
reconnectOK: {
topLeft: {
x: 483, y: 656, pos: "center"
},
bottomRight: {
x: 911, y: 799, pos: "center"
}
},
reload: {
topLeft: {
x: 747, y: 760, pos: "center"
},
bottomRight: {
x: 1174, y: 904, pos: "center"
}
},
mirrorsEntranceBtn: {
//[1213,613][1354,679]
topLeft: {
Expand Down Expand Up @@ -10810,6 +10843,15 @@ function algo_init() {
function isSectionClear(screenshot) {
return isButtonPresent(screenshot, "sectionClearMagiaStone");
}
function isCommunicationErrorPresent(screenshot) {
return isButtonPresent(screenshot, "communicationError");
}
function isReconnectOKButtonPresent(screenshot) {
return isButtonPresent(screenshot, "reconnectOK");
}
function isReloadButtonPresent(screenshot) {
return isButtonPresent(screenshot, "reload");
}
function findNewSectionOnMap(screenshot) {
const btnSize = {
sectionOnMapJP: {
Expand Down Expand Up @@ -12101,6 +12143,23 @@ function algo_init() {
return detectBPRelatedWindow(2);
}

function killAndRestartGame() {
for (let attempt = 0; attempt < 10; attempt++) {
killGame();
log("等待10秒");
sleep(10 * 1000);
log("重启游戏");
reLaunchGame();
log("等待5秒");
sleep(5000);
log("重新登录");
if (reLogin()) {
return true;
}
}
return false;
}

function taskMirrors() {
log("镜层周回\n自动战斗策略:"+(limit.useCVAutoBattle?"识图":"无脑123盘"));

Expand Down Expand Up @@ -12161,7 +12220,10 @@ function algo_init() {
let knownClickPos = null;
let screenshot = compatCaptureScreen();
let buttonPoint = null;
if (isMirrorsTop(screenshot)) {
if (isMirrorsEntranceButtonPresent(screenshot)) {
log("已回到首页");
knownClickPos = clickSets.enterMirrors;
} else if (isMirrorsTop(screenshot)) {
log("镜层首页");
knownClickPos = clickSets.mirrorsTop;
} else if (isNextMirror(screenshot)) {
Expand All @@ -12176,6 +12238,13 @@ function algo_init() {
} else if (didWeWin(screenshot) || didWeLose(screenshot)) {
log("镜层结算");
knownClickPos = clickSets.screenCenter;
} else if (isReloadButtonPresent(screenshot)) {
log("掉线");
if (!killAndRestartGame()) {
log("多次重新登录失败,停止运行");
return;
}
totalBattleTime = 0;
} else if (isBPExhausted()) {
log("BP耗尽窗口");
knownClickPos = clickSetsMod.bpClose;
Expand Down Expand Up @@ -12304,31 +12373,10 @@ function algo_init() {
log("镜层战斗时间["+battleTime+"]秒 累计["+totalBattleTime+"]秒");
if (limit.mirrorsRelaunchTime !== "" && totalBattleTime >= parseInt(limit.mirrorsRelaunchTime)) {
log("镜层累计周回战斗时间["+totalBattleTime+"]秒已超过设定值["+limit.mirrorsRelaunchTime+"],杀进程重开");
let reloginSuccess = false;
for (let attempt = 0; attempt < 10; attempt++) {
killGame();
log("等待10秒");
sleep(10 * 1000);
log("重启游戏");
reLaunchGame();
log("等待5秒");
sleep(5000);
log("重新登录");
if (reLogin()) {
reloginSuccess = true;
break;
}
}
if (!reloginSuccess) {
if (!killAndRestartGame()) {
log("多次重新登录失败,停止运行");
return;
}
while (isMirrorsEntranceButtonPresent(compatCaptureScreen())) {
log("点击进入镜层");
click(convertCoords(clickSets.enterMirrors));
sleep(5000);
}
log("已重新进入镜层");
totalBattleTime = 0;
}
}
Expand Down Expand Up @@ -13240,6 +13288,7 @@ function algo_init() {

while (true) {
let newSectionOnMapPoint = null;
let found_popup = null;

let screenshot = compatCaptureScreen();
if (isFirstSupportAvailable(screenshot)) {
Expand All @@ -13264,6 +13313,8 @@ function algo_init() {
click(convertCoords(clickSets.dataDownloadOK));
} else if (isSkipButtonPresent(screenshot)) {
click(convertCoords(getAreaCenter(knownButtonCoords["skipBtn"])));
} else if (found_popup = findPopupInfoDetailTitleJP(undefined, undefined, screenshot)) {
click(found_popup.close); //解决误触MENU
} else if (isPlayerLvUp(screenshot)) {
click(convertCoords(clickSets.levelup));
} else if (isQuestResult(screenshot)) {
Expand Down
Binary file added images/communicationError.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/reconnectOK.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/reload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build"
],
"packageName": "top.momoe.auto",
"versionName": "7.3.5",
"versionName": "7.3.6",
"versionInfo": "",
"versionCode": 1,
"icon":"./images/icon.png",
Expand Down
2 changes: 1 addition & 1 deletion update/fileJson/19.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/20.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/21.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/22.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/23.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/24.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/25.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/26.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/27.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/28.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/29.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/fileJson/30.json

Large diffs are not rendered by default.

Loading

0 comments on commit f30bb25

Please sign in to comment.