bettergi-scripts-list/repo/js/MiliastraExperiencePlayback/libs/constants/regions.js

364 lines
11 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { __name } from "../rolldown-runtime.js";
import {
findImageWithinBounds,
findTextWithinBounds,
findTextWithinListView,
} from "../@bettergi+utils.js";
//#region src/constants/regions.ts
/** 通用:查找确认按钮 */
const findConfirmBtn = () => {
const txt = findTextWithinBounds("确认", 480, 720, 960, 145);
txt?.drawSelf("group_text");
return txt;
};
/** 通用:查找标题文字 */
const findHeaderTitle = (title, contains) => {
const txt = findTextWithinBounds(title, 0, 0, 300, 95, { contains });
txt?.drawSelf("group_text");
return txt;
};
/** 通用:查找提示文字 */
const findPromptText = (text, contains = true) => {
const txt = findTextWithinBounds(text, 576, 432, 768, 216, { contains });
txt?.drawSelf("group_text");
return txt;
};
/** 通用:查找底部按钮文字 */
const findBottomBtnText = (text, contains) => {
const txt = findTextWithinBounds(text, 0, 980, 1920, 100, { contains });
txt?.drawSelf("group_text");
return txt;
};
/** 通用:查找关闭对话框按钮 */
const findCloseDialog = () => {
const iro = findImageWithinBounds("assets/UI_BtnIcon_Close.png", 410, 160, 1100, 660, {
useMask: true,
threshold: 0.85,
});
iro?.drawSelf("group_img");
return iro;
};
/** 通用:点击空白处区域继续位置 */
const clickToContinue = (offsetX = 0, offsetY = 0) => {
click(960 + offsetX, 1070 + offsetY);
};
/** 查找UID文本 */
const findUidText = () => {
const im = captureGameRegion();
const ro = RecognitionObject.ocr(1730, 1050, 140, 30);
return (() => {
const list = im.findMulti(ro);
for (let i = 0; i < list.count; i++)
if (list[i] && list[i].isExist()) {
const uid = list[i].text.replace(/\D/g, "");
/** 亚服 4.4 版本注册后的 UID 为 18开头的10位数字 */
if (uid.length >= 9) {
list[i].drawSelf("group_text");
return uid;
}
}
})();
};
/** 查找派蒙图标(判断处于奇域大世界/大厅) */
const findPaimon = () => {
const iro = findImageWithinBounds("assets/UI_Icon_Paimon.png", 0, 0, 100, 100, {
useMask: true,
threshold: 0.8,
});
iro?.drawSelf("group_img");
return iro;
};
/** 查找元素视野按钮(判断处于大世界) */
const findElementViewBtn = () => {
const iro = findImageWithinBounds("assets/UI_BtnIcon_ElementView.png", 0, 0, 500, 80, {
useMask: true,
threshold: 0.8,
});
iro?.drawSelf("group_img");
return iro;
};
/** 查找禁止联机按钮 */
const findSinglePlayerBtn = () => {
const iro = findImageWithinBounds("assets/UI_BtnIcon_SinglePlayer.png", 0, 0, 500, 80, {
useMask: true,
threshold: 0.92,
});
iro?.drawSelf("group_img");
return iro;
};
/** 查找奇域大厅按钮(判断处于奇域大厅) */
const findMiliastraBtn = () => {
const iro = findImageWithinBounds("assets/UI_BtnIcon_Miliastra.png", 960, 0, 960, 80, {
useMask: true,
threshold: 0.75,
});
iro?.drawSelf("group_img");
return iro;
};
/** 房间:查找搜索奇域按钮 */
const findAllWonderlandsBtn = () => {
return findTextWithinBounds("搜索", 1320, 0, 600, 95, { contains: true });
};
/** 房间:查找奇域搜索输入框 */
const findSearchWonderlandInput = () => {
const txt = findTextWithinBounds("搜索", 0, 120, 1920, 60, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 房间:查找奇域搜索输入框清除按钮 */
const findClearInputBtn = () => {
return findTextWithinBounds("清除", 0, 120, 1920, 60, { contains: true });
};
/** 房间:查找搜索奇域按钮 */
const findSearchWonderlandBtn = () => {
return findTextWithinBounds("搜索", 0, 120, 1920, 60, { contains: true });
};
/** 房间:查找首行前N个奇域搜索结果名称 */
const findTopNSearchResultTexts = (n) => {
const boundsN = (n) => [240 + n * 360, 475, 300, 50];
const ir = captureGameRegion();
return [...Array(n).keys()]
.reverse()
.map((i) => {
return (() => {
const ro = RecognitionObject.ocr(...boundsN(i));
const list = ir.findMulti(ro);
for (let i = 0; i < list.count; i++)
if (list[i] && list[i].isExist()) {
const text = list[i].text.trim();
if (text) {
list[i].drawSelf("group_text");
return text;
}
}
})();
})
.reverse();
};
/** 房间:点击选择第一个搜索结果位置 */
const clickToChooseFirstSearchResult = () => {
click(265, 390);
};
/** 房间:查找进入房间快捷键按钮 */
const findEnterRoomShortcut = () => {
const txt = findTextWithinBounds("房间", 1580, 110, 320, 390, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 房间:查找退出房间按钮 */
const findLeaveRoomBtn = () => {
const iro = findImageWithinBounds("assets/UI_Icon_Leave_Right.png", 1570, 0, 350, 100, {
threshold: 0.8,
});
iro?.drawSelf("group_img");
return iro;
};
/** 房间:查找跳转大厅按钮 */
const findGoToLobbyBtn = () => {
return findTextWithinBounds("大厅", 880, 840, 1040, 110, { contains: true });
};
/** 房间:查找创建房间按钮 */
const findCreateRoomBtn = () => {
const txt = findTextWithinBounds("房间", 960, 95, 960, 70, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 房间:点击加入准备区位置 */
const clickToPrepare = () => {
click(770, 275);
};
/** 房间:查找编队过滤器按钮 */
const findSetupFilterBtn = () => {
const iro = findImageWithinBounds("assets/UI_Icon_Setup_Filter.png", 0, 0, 90, 80, {
threshold: 0.8,
});
iro?.drawSelf("group_img");
return iro;
};
/** 房间:点击选择第一位角色位置 */
const clickToChooseFirstCharacter = () => {
click(100, 195);
};
/** 存档:查找奇域收藏 */
const findBeyondFavoritesBtn = () => {
return findTextWithinBounds("收藏", 0, 880, 200, 200, { contains: true });
};
/** 存档:查找管理关卡按钮 */
const findManageStagesBtn = () => {
return findTextWithinBounds("管理", 1320, 0, 600, 95, { contains: true });
};
/** 存档:查找编辑关卡存档按钮 */
const findEditStageSaveBtn = () => {
return findTextWithinBounds("管理", 1220, 980, 700, 100);
};
/** 存档:查找存档时间占位符 */
const saveListViewBounds = [210, 248, 1650, 670];
const findSaveTimePlaceholder = () => {
const [x, y, w, h] = saveListViewBounds;
return findTextWithinBounds("1970年", x, y, w, h, { contains: true });
};
/** 存档:查找要删除的存档位置 */
const findSaveToDeletePos = (keyword) => {
const [x, y, w, h] = saveListViewBounds;
return findTextWithinListView(
keyword,
{
x,
y,
w,
h,
scrollLines: 7,
lineHeight: 95,
},
{ contains: true },
);
};
/** 存档:查找局外存档列头 */
const findExternalSaveColumnPos = () => {
const txt = findTextWithinBounds("局外", 55, 190, 1810, 50, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 存档:查找删除局外存档复选框已选中状态 */
const findDeleteExternalSaveChecked = (colPos) => {
const iro = findImageWithinBounds("assets/Checkbox_Checked.png", colPos, 250, 290, 710, {
threshold: 0.8,
use3Channels: true,
});
iro?.drawSelf("group_img");
return iro;
};
/** 存档:查找删除关卡存档按钮 */
const findDeleteStageSaveBtn = () => {
return findTextWithinBounds("删除所选", 1220, 980, 700, 100);
};
/** 关卡:查找结算跳过按钮 */
const findSkipBtn = () => {
const txt = findTextWithinBounds("跳过", 1720, 0, 200, 100, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 关卡:查找绮星盛会投票按钮 */
const findStarlitGalaVoteBtn = () => {
const txt = findTextWithinBounds("投票", 1180, 650, 740, 330, { contains: false });
txt?.drawSelf("group_text");
return txt;
};
/** 关卡:查找关卡退出按钮 */
const findStageEscBtn = () => {
const iro = findImageWithinBounds("assets/UI_Icon_Leave.png", 0, 0, 100, 100, {
useMask: true,
threshold: 0.8,
});
iro?.drawSelf("group_img");
return iro;
};
/** 关卡:查找中断挑战按钮 */
const findExitStageBtn = () => {
return findTextWithinBounds("中断挑战", 576, 324, 768, 432, { contains: true });
};
/** 退出:查找返回提瓦特按钮 */
const findGotTeyvatBtn = () => {
const txt = findTextWithinBounds("返回", 1500, 0, 300, 95, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 纪游:查找诸界纪游按钮 */
const findBeyondBattlepassBtn = () => {
const iro = findImageWithinBounds("assets/UI_BtnIcon_Beyond_Battlepass.png", 960, 0, 960, 80, {
useMask: true,
threshold: 0.75,
});
iro?.drawSelf("group_img");
return iro;
};
/** 纪游:查找纪游开屏动画 */
const findBeyondBattlepassPopup = () => {
return findTextWithinBounds("奖励一览", 0, 0, 960, 1080, { contains: true });
};
/** 绮星盛会:查找奖励按钮 */
const findStarlitGalaRewardBtn = () => {
const txt = findTextWithinBounds("奖励", 960, 815, 960, 265, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 绮星盛会:查找奖励对话框 */
const findStarlitGalaRewardDialog = () => {
const txt = findTextWithinBounds("奖励", 810, 150, 300, 230, { contains: true });
txt?.drawSelf("group_text");
return txt;
};
/** 绮星盛会:查找盛会人气图标 */
const findFestiveFever = () => {
const iro = findImageWithinBounds("assets/UI_Icon_FestiveFever.png", 410, 160, 1100, 660, {
use3Channels: true,
threshold: 0.8,
});
iro?.drawSelf("group_img");
return iro;
};
/** 奖励:查找领取奖励按钮 */
const findFetchRewardBtn = () => {
const iro = findImageWithinBounds(
"assets/UI_Img_UGCCultivateReward_FetchHint.png",
1450,
100,
470,
880,
{
useMask: true,
use3Channels: true,
threshold: 0.8,
},
);
iro?.drawSelf("group_img");
return iro;
};
//#endregion
export {
clickToChooseFirstCharacter,
clickToChooseFirstSearchResult,
clickToContinue,
clickToPrepare,
findAllWonderlandsBtn,
findBeyondBattlepassBtn,
findBeyondBattlepassPopup,
findBeyondFavoritesBtn,
findBottomBtnText,
findClearInputBtn,
findCloseDialog,
findConfirmBtn,
findCreateRoomBtn,
findDeleteExternalSaveChecked,
findDeleteStageSaveBtn,
findEditStageSaveBtn,
findElementViewBtn,
findEnterRoomShortcut,
findExitStageBtn,
findExternalSaveColumnPos,
findFestiveFever,
findFetchRewardBtn,
findGoToLobbyBtn,
findGotTeyvatBtn,
findHeaderTitle,
findLeaveRoomBtn,
findManageStagesBtn,
findMiliastraBtn,
findPaimon,
findPromptText,
findSaveTimePlaceholder,
findSaveToDeletePos,
findSearchWonderlandBtn,
findSearchWonderlandInput,
findSetupFilterBtn,
findSinglePlayerBtn,
findSkipBtn,
findStageEscBtn,
findStarlitGalaRewardBtn,
findStarlitGalaRewardDialog,
findStarlitGalaVoteBtn,
findTopNSearchResultTexts,
findUidText,
};