Skip to content

Commit

Permalink
Merge pull request icegreentee#443 from segfault-bilibili/rollup-7.2.6
Browse files Browse the repository at this point in the history
【7.2.6】增加纯色检测容差设置
  • Loading branch information
segfault-bilibili committed Jun 10, 2023
2 parents 18d8c37 + 2a3161a commit c95cea8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
1 change: 0 additions & 1 deletion audiofix.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function parseElf(elf) {
throw new Error(`eh.e_machine (${eh.e_machine}) != EM_ARM`);
}
is64 = false;
addrLen = 4;
eh.e_entry_START_ADDRESS = elf.readUInt32LE(0x18);
eh.e_phoff_PROGRAM_HEADER_OFFSET_IN_FILE = elf.readUInt32LE(0x1c);
eh.e_shoff_SECTION_HEADER_OFFSET_IN_FILE = elf.readUInt32LE(0x20);
Expand Down
20 changes: 13 additions & 7 deletions floatUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,7 @@ var limit = {
dungeonBattleCountBeforeKill: "20",
openUpTryToConnect: true,
openUpClickAllSkills: false,
openUpPureColorThreshold: "3",
firstRequestPrivilege: true,
privilege: null
}
Expand Down Expand Up @@ -13069,27 +13070,32 @@ function algo_init() {
playerLvUp: "#b28750",
resultExpItem: "#b28750",
}
function detectPureColor(screenshot, type) {
function detectPureColor(screenshot, type, threshold) {
let area = getConvertedArea(knownQuestCoords[type]);
let img = renewImage(images.clip(screenshot, area.topLeft.x, area.topLeft.y, getAreaWidth(area), getAreaHeight(area)))
let imgRanged = renewImage(images.interval(img, knownQuestColors[type], 0));
let img = renewImage(images.clip(screenshot, area.topLeft.x, area.topLeft.y, getAreaWidth(area), getAreaHeight(area)));
if (threshold == null) threshold = 0;
let imgRanged = renewImage(images.interval(img, knownQuestColors[type], threshold));
let found = images.findColor(imgRanged, "#000000", 0) ? false : true;
log(type, found);
return found;
}
function isFirstSupportAvailable(screenshot) {
let found = ["playerSupport", "NPCSupport"].find((type) => detectPureColor(screenshot, type)) ? true : false;
let threshold = parseInt(limit.openUpPureColorThreshold);
let found = ["playerSupport", "NPCSupport"].find((type) => detectPureColor(screenshot, type, threshold)) ? true : false;
return found;
}
function isThirdSupportPlayer(screenshot) {
let found = ["playerSupport3rd"].find((type) => detectPureColor(screenshot, type)) ? true : false;
let threshold = parseInt(limit.openUpPureColorThreshold);
let found = ["playerSupport3rd"].find((type) => detectPureColor(screenshot, type, threshold)) ? true : false;
return found;
}
function isPlayerLvUp(screenshot) {
return detectPureColor(screenshot, "playerLvUp");
let threshold = parseInt(limit.openUpPureColorThreshold);
return detectPureColor(screenshot, "playerLvUp", threshold);
}
function isQuestResult(screenshot) {
let found = ["followPrompt", "charaExpEventLvUp", "resultExpItem"].find((type) => detectPureColor(screenshot, type)) ? true : false;
let threshold = parseInt(limit.openUpPureColorThreshold);
let found = ["followPrompt", "charaExpEventLvUp", "resultExpItem"].find((type) => detectPureColor(screenshot, type, threshold)) ? true : false;
return found;
}

Expand Down
9 changes: 9 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ ui.layout(
<text text="为节省时间,在凑连携时默认不使用主动技能。" textColor="#000000" />
<text text="注:是否使用Magia仍然依照识图自动战斗脚本的设置。" textColor="#000000" />
</vertical>
<vertical id="OpenUpExtraSettings3" visibility="gone" padding="10 8 0 6" w="*" h="auto">
<linear>
<text text="纯色检测容差" textColor="#000000" />
<input maxLength="1" id="openUpPureColorThreshold" hint="3" text="3" textSize="14" inputType="number|none" />
</linear>
<text text="(多见于真机)屏幕可能会进行调色,导致色彩偏离参考值、从而匹配失败。" textColor="#000000" />
<text text="警告:过度增加这个数值则可能导致误匹配、误操作!" textColor="#ff0000" />
</vertical>
</vertical>
</vertical>
<vertical margin="0 5" bg="#ffffff" elevation="1dp" w="*" h="auto">
Expand Down Expand Up @@ -1026,6 +1034,7 @@ const persistParamList = [
"dungeonBattleCountBeforeKill",
"openUpTryToConnect",
"openUpClickAllSkills",
"openUpPureColorThreshold",
];
const tempParamList = [
"drug1",
Expand Down
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.2.5",
"versionName": "7.2.6",
"versionInfo": "",
"versionCode": 1,
"icon":"./images/icon.png",
Expand Down
2 changes: 1 addition & 1 deletion update/updateList.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion update/updateList.json.sig.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
R6c2Snh/3S/tVEizAJlJbfj4Fy4VYUf5k+ti+lcr8h/kNdOvs+DvVoGCZOSwWDX6BGiGYHG/N4DhemADN2tpprvOpVuyI7XAsyl6kHHUzUWGxsD3qIWmv9POFJS2rU7/mz1FxeEHmW6cSyaauu5KkKjQGJq+uqtb9yAIGBMvFpcLVoJD+zrP+gxbd9ezTRecc8I/5eTcBtM4+Bjcsk/DGOEUGoEH3DeCeOJPbEZRInJm2hyNRLGUfoqL8rMGZlTrWYdFKId5456qW1fNfJefpGmR4fFWHJWmleSa9okfZS9ROuTv2tSryadVUfX4Rn6SxxsDU/H0eOJUZXqfNEsZuA==
1AUjSQMpGeuVkkGp4rGjnueJRK7xl8Ibd7j5+lYy0MFxanzfRN7SuereddDiCF8RK6Hex14YTD4IYE/qXxcgzstEEbv+2fQhmbTuIA6JPTiVYQa7yucHI6/gZvEx6jgg/HY3OFc1o/kFcsLph19ub6ncbhSWRO4lgiZ920sJKB827XmpedKtkT97D9U5CWvgTpV+x3K0o9yGzju/poimFdZ1eIjbLj+fInrsISbwSjjbRgy+6kGHQfVONiqFM8uCR+il2hyeJCvn/G9s6KtPf8A9jVoQS4+Yy0Pd9vAdmOz8OfOWQZB+6gq+i85lZZtFSu7tbrl2XDTsaaBEIe9wVA==

0 comments on commit c95cea8

Please sign in to comment.