Skip to content

Commit

Permalink
修复DPI<320闪退(雷电模拟器);修复全面屏返回手势冲突;修复root权限检测。
Browse files Browse the repository at this point in the history
  • Loading branch information
tkkcc committed Dec 14, 2021
1 parent 5df91bb commit e8a3db5
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 20 deletions.
2 changes: 1 addition & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ skip_snapshot_service_check = true
-- 设成10以下时,单核机作战导航失败率高,真机基建缩放也会有问题
frame_milesecond = 1000 // 30
milesecond_after_click = frame_milesecond
release_date = "2021.12.14 19:46"
release_date = "2021.12.14 23:30"
ui_submit_color = "#ff0d47a1"
ui_cancel_color = "#ff1976d2"
ui_page_width = -2
Expand Down
8 changes: 1 addition & 7 deletions path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -825,14 +825,8 @@ end
path.基建换班 = function()
path.宿舍换班()
-- path.制造换班()
-- path.贸易换班()
path.总览换班()
-- shift1=shift2=shift3=1
-- log(shift1, shift2, shift3)
-- log(751)
-- if shift1 then path.宿舍换班() end
-- if shift2 then path.制造换班() end
-- if shift3 then path.总览换班() end
-- log(752)
end

path.制造加速 = function()
Expand Down
2 changes: 1 addition & 1 deletion point.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ log("分辨率:" .. screen.width .. "x" .. screen.height)
if screen.width / screen.height < 16 / 9 or screen.height < 720 then
stop("不支持分辨率" .. screen.width .. 'x' .. screen.height)
end
if getDisplayDpi() < 320 then stop("不支持DPI" .. dpi) end
-- if getDisplayDpi() < 320 then stop("不支持DPI" .. getDisplayDpi()) end

hscale = screen.height / 1080
wscale = screen.width / 1920
Expand Down
2 changes: 1 addition & 1 deletion release
Submodule release updated from 6fc486 to 21b3d2
45 changes: 41 additions & 4 deletions skill.lua
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,44 @@ skillpng2operator['empty1.png'] = table.remove_duplicate(table.flatten(
-- log("skillpng2operator",skillpng2operator["empty2.png"])
-- exit()

--
--
--
--
-- 制造站干员选择
-- operator: 列表,每个元素包含两个技能图标与心情
-- tradingStationNum: 贸易站数量
-- type: 制造物类别
-- level: 制造站等级
-- 返回效率最高的index
manufacturingStationOperatorBest = function(operator, tradingStationNum, type,
level)
-- 参考 https://prts.wiki/w/罗德岛基建/制造站
local maxStorage, maxOperator
maxOperator = level
if level == 1 then
maxStorage = 24
elseif level == 2 then
maxStorage = 36
else
maxStorage = 54
end
log("maxStorage", maxStorage)
log("maxOperator", maxOperator)

-- 输入index组合,计算8小时平均加成
local base
local score = function(c)
base = 0
return base
end

-- 遍历全部组合
local best
local best_score = -1
for _, c in pairs(table.combination(range(1, #operator), maxOperator)) do
local s = score(c)
if s > best_score then
best = c
best_score = s
end
end
return best
end

43 changes: 37 additions & 6 deletions util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,27 @@ string.padEnd = function(str, len, char)
return str .. string.rep(char, len - #str)
end

-- 从t中选出长度为n的所有组合,结果在ans,
table.combination = function(t, n)
local ans = {}
local cur = {}
local k = 1
combination(t, n, ans, cur, k)
return ans
end
combination = function(t, n, ans, cur, k)
-- cur = cur or {}
-- k = k or 1
if n == 0 then
table.insert(ans, shallowCopy(cur))
elseif k <= #t then
table.insert(cur, t[k])
combination(t, n - 1, ans, cur, k + 1)
cur[#cur] = nil
combination(t, n, ans, cur, k + 1)
end
end

table.flatten = function(t)
local ans = {}
for _, v in pairs(t) do
Expand Down Expand Up @@ -641,12 +662,14 @@ end
swipe = function(x)
log("swipe", x)
if x == 'right' then
gesture({{point = {{0, 500}, {1000000, 500}}, start = 0, duration = 150}})
gesture({
{point = {{scale(300), 500}, {1000000, 500}}, start = 0, duration = 150},
})
sleep(150 + 50)
elseif x == 'left' then
gesture({
{
point = {{0, scale(150)}, {0, screen.height - 1}},
point = {{scale(300), scale(150)}, {scale(300), screen.height - 1}},
start = 0,
duration = 100,
},
Expand Down Expand Up @@ -1819,15 +1842,17 @@ show_help_ui = function()
newRow(layout)
addTextView(layout, [[
源码与其他脚本:https://github.com/tkkcc/arknights。
好用给个star。
好用给个star,有问题请反馈
提示:
1. 剿灭合成玉已满会跳过,关卡没开放会跳过,因此无需频繁修改作战设置。
2. 代理作战中启动时,脚本优先重复刷当前关,可用于刷活动。活动也可用“上一次”刷。
3. 脚本没有任何反应,可尝试关闭游戏后启动脚本。
3. 无障碍提示选“不再提醒”,进入后点“确定”。
4. 脚本没有任何反应,可尝试关闭游戏后启动脚本。
更新:
2021-12-14 修复密码输入错误与截屏权限未开导致的定时任务失败。修复多次传递线索。
2021-12-14 修正root权限检测,支持无障碍关闭游戏。允许DPI<320,雷电模拟器平板模式测试未发现问题。修复多次传递线索。修复密码输入错误与截屏权限未开导致的定时任务失败
]])

newRow(layout)
Expand Down Expand Up @@ -2195,6 +2220,10 @@ end

predebug_hook = function()
if not predebug then return end
-- log(table.combination(range(1, 10), 3))
-- log(ans)
exit()
log(ans)
ssleep(1)
while true do if not appear("怒号光明", 0.5) then stop(1) end end
exit()
Expand Down Expand Up @@ -2372,7 +2401,9 @@ predebug_hook = function()
end

check_root_mode = function()
if not disable_root_mode and pcall(exec, "su") then root_mode = true end
if not disable_root_mode and #exec("su -c 'echo aaa'") > 1 then
root_mode = true
end
log("root_mode", root_mode)
end

Expand Down

0 comments on commit e8a3db5

Please sign in to comment.