Skip to content

Commit

Permalink
try ocr and find its broken
Browse files Browse the repository at this point in the history
  • Loading branch information
tkkcc committed Jan 12, 2020
1 parent 3ee5acf commit 1df1520
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 11 deletions.
9 changes: 5 additions & 4 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cron = require("crontab")
每八小时 = {"邮件", "轮次作战", "基建点击全部", "换人",
"制造站加速", "制造站补充", "订单交付",
"线索接收", "信用奖励", "访问好友基建",
"信用收取", "信用购买", "公开招募聘用", "任务",
"后台", "显示全部"}
"信用收取", "信用购买", "公开招募聘用",
"公开招募刷新", "任务", "后台", "显示全部"}
每日开始 = {"关闭", "限时活动", "每日更新", "作战1-11",
"基建点击全部", "基建副手换人", "任务", "后台",
"显示全部"}
Expand All @@ -17,13 +17,14 @@ fight_type_ext = {"PR-A-2", "PR-B-2", "PR-C-2", "PR-D-2", "PR-A-1", "PR-B-1",
"PR-C-1", "PR-D-1"}
table.extend(fight_type_ext,
{"4-8", "LS-5", "CA-5", "AP-5", "CE-5", "龙门市区"})
fight_type_ext = {"4-8"}
fight_type_ext = {"4-10", "4-8"}
insert(fight_type_ext, "CE-5")
repeat_last(fight_type_ext, 500)
insert(fight_type_ext, "龙门市区")
repeat_last(fight_type_ext, 10)
fight_type = fight_type_ext
table.shuffle(fight_type)
-- fight_type={"4-10"}
-- insert(fight_type, "CE-5")
-- repeat_last(fight_type, 500)
-- now("邮件", "轮次作战", "基建点击全部", "换人", "制造站加速",
Expand All @@ -40,5 +41,5 @@ table.shuffle(fight_type)
-- "访问好友基建", "信用收取", "信用购买", "公开招募聘用",
-- "任务", "后台", "显示全部")
-- now("轮次作战")
-- now("关闭", "限时活动")
now("公开招募刷新")
cron(map(hc, {{每日开始, 4}, {每八小时, "2,10,18"}}))
76 changes: 69 additions & 7 deletions path.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require("util")
require("point")
require("tag")

-- set bl true
bl = {}
Expand All @@ -8,7 +9,9 @@ cl = {}
for k, v in pairs(fight_type_all) do cl[v] = 0 end

path = {}

path.关闭 = close
path.显示全部 = showALL
path.后台 = background
path.base = {
客户端过时 = function() stop() end,
限时活动返回 = function()
Expand Down Expand Up @@ -961,13 +964,72 @@ path["1-11"] = function()
end
end

path.公开招募刷新 = function()
-- auto(update(path.base, {面板 = "面板公开招募", 公开招募 = true}))
-- if find("公开招募联络次数0") then return end
local ocr, msg = createOCR({
type = "tesseract",
path = "[external]",
lang = "chi_sim",
})
for i = 1, #point.公开招募列表 do
-- auto(update(path.base, {面板 = "面板公开招募", 公开招募 = true}))
auto(update(path.base, {
面板 = "面板公开招募",
公开招募 = function()
-- if find("公开招募联络次数0") then return true end
if not findTap('公开招募列表' .. i) then return true end
end,
公开招募确认 = function()
local code, text
local a = {}
for k, v in pairs(point.公开招募标签列表) do
v = point[v]
local colorTbl = binarizeImage(
{rect = v, diff = {"0xffffff-0x444444"}})
for k, v in pairs(colorTbl) do print(table.concat(v)) end
code, text = ocr:getText({
-- rect = v,
data = colorTbl,
-- diff = {"0xffffff-0x444444"},
-- diff = {"0xffffff-0x555555"},
-- diff = {"0xbbbbbb-0x222222"},
whitelist = tagw,
psm = 7,
})
insert(a, text)
end
log(i, a)
local flag
local t = {}
for k, v in pairs(tagk) do
flag = true
for k1, v1 in pairs(v) do
if not table.includes(a, v1) then
flag = false
break
end
end
if flag then insert(t, k) end
end
if #t ~= 0 then
for k, v in pairs(t) do log(tagk[v], '=>', tagv[v]) end
else
if findTap("公开招募标签刷新蓝") then
tap("消耗一次联络机会确认")
return false
end
end
return true
end,
}))
end
ocr:release()
end

path["作战1-11"] = function() for i = 1, 6 do path.作战("1-11") end end

path.base.药剂恢复理智取消 =
function() tap('药剂恢复理智确认') end
-- path.base.源石恢复理智取消 =
-- function() tap('药剂恢复理智确认') end

path["作战1-11"] = function() for i = 1, 4 do path.作战("1-11") end end

path.关闭 = close
path.显示全部 = showALL
path.后台 = background
16 changes: 16 additions & 0 deletions point.lua
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ point = {
线索全部收取有 = "1516|1031|0xfdfefe,1501|1013|0xffffff,1565|1034|0xffffff,1315|20|0x323232,1093|45|0xdc92ff,558|93|0x313131,1054|34|0x522f64",
线索全部收取无 = "1522|540|0x808080,1522|544|0x808080,1522|548|0x808080,1318|20|0x323232,1332|60|0x323232,1099|45|0xdc92ff,1054|34|0x522f64,1136|74|0x522f64",
确认 = "958|735|0xffffff,943|745|0xffffff,948|775|0xffffff,953|790|0x0e0e0e,983|765|0xffffff,973|750|0x0f0f0f,958|765|0x141414,948|755|0x999999,1743|275|0x333333",

收取所有邮件无 = "1650|162|0xffffff,1525|155|0xffffff,1619|1011|0xffffff,1613|1003|0xffffff,1605|1005|0xffffff,81|57|0x555555,54|48|0xffffff,336|69|0x313131,81|982|0xffffff",
可露希尔推荐 = "21|136|0xffffff,264|136|0xffffff,171|214|0xffffff,58|61|0xffffff,611|42|0xffffff,39|135|0x9a0101,21|159|0xffffff,15|165|0x9a0101,57|189|0x9a0101",
信用交易所 = "1675|163|0xffffff,1681|183|0xff6801,1683|194|0xffffff,67|48|0xffffff,611|41|0xffffff,1900|1068|0x313131,1780|168|0xffffff,1774|163|0x313131,1762|171|0x313131",
Expand Down Expand Up @@ -603,6 +604,19 @@ point = {
行动结束 = "95|887|0xffffff,81|897|0xffffff,80|944|0xffffff,89|998|0xffffff,143|995|0xffffff,396|903|0xffffff,439|933|0xffffff,396|955|0xffffff,439|986|0xffffff,485|899|0xffffff,581|902|0xffffff,531|960|0xffffff,578|986|0xffffff,289|994|0xffffff,476|896|0xffffff,442|903|0xffffff",
客户端过时 = "960|762|0x0e0e0e,955|750|0xffffff,662|711|0x1a1a1a,8|693|0x4d4444,11|249|0x343434,1906|247|0x333333,1902|694|0x333333,1908|725|0x0a0a0a,868|480|0xff0000,889|509|0xff0000,930|486|0xff0000,953|481|0xff0000,971|483|0xff0000,963|496|0xff0000,944|495|0xff0000,889|509|0xff0000",
获取网络配置失败 = "960|738|0xffffff,921|756|0x181818,30|762|0x171717,33|657|0x423c3c,51|222|0x151515,737|448|0xffffff,825|435|0xffffff,876|449|0xffffff,886|459|0xffffff,940|441|0xffffff,979|439|0xffffff,1020|446|0xffffff,1085|450|0xffffff,1135|457|0xffffff,1189|463|0xffffff,997|523|0xffffff,899|540|0xffffff,1749|258|0x333333,1758|810|0x0a0a0a",
开始招募干员 = "487|434|0xffffff,383|503|0xffffff,544|534|0xffffff",
公开招募 = "1902|1064|0x15120c,8|1064|0x070309,14|9|0x3a372e,1908|5|0x53534d,22|165|0x845208,1896|165|0x865400,1896|105|0x313131,624|41|0xffffff,247|208|0xffffff,261|194|0xffffff,312|165|0xf1960f",
公开招募确认 = "1460|860|0xffffff,1331|835|0x0098dc,1604|1007|0x313131,571|190|0x313131,1027|479|0x313131,1467|956|0xffffff,920|430|0x313131,1890|78|0x313131",
公开招募列表 = {"487|435|0xffffff,1902|1064|0x15120c,8|1064|0x070309,14|9|0x3a372e,1908|5|0x53534d,22|165|0x845208,1896|165|0x865400,1896|105|0x313131,624|41|0xffffff,247|208|0xffffff,261|194|0xffffff,312|165|0xf1960f",
"1434|435|0xffffff,1902|1064|0x15120c,8|1064|0x070309,14|9|0x3a372e,1908|5|0x53534d,22|165|0x845208,1896|165|0x865400,1896|105|0x313131,624|41|0xffffff,247|208|0xffffff,261|194|0xffffff,312|165|0xf1960f",
"487|852|0xffffff,1902|1064|0x15120c,8|1064|0x070309,14|9|0x3a372e,1908|5|0x53534d,22|165|0x845208,1896|165|0x865400,1896|105|0x313131,624|41|0xffffff,247|208|0xffffff,261|194|0xffffff,312|165|0xf1960f",
"1434|852|0xffffff,1902|1064|0x15120c,8|1064|0x070309,14|9|0x3a372e,1908|5|0x53534d,22|165|0x845208,1896|165|0x865400,1896|105|0x313131,624|41|0xffffff,247|208|0xffffff,261|194|0xffffff,312|165|0xf1960f"},
公开招募标签列表 = {{566, 542, 775, 606}, {817, 542, 1023, 606},
{1067, 542, 1275, 606}, {566, 651, 775, 712},
{817, 651, 1023, 712}, {1067, 651, 1275, 712}},
公开招募联络次数0 = "1402|113|0xffffff,1395|125|0xffffff,1407|125|0xfbfcfd,1902|1064|0x15120c,8|1064|0x070309,14|9|0x3a372e,1908|5|0x53534d,22|165|0x845208,1896|165|0x865400,1896|105|0x313131,624|41|0xffffff,247|208|0xffffff,261|194|0xffffff,312|165|0xf1960f",
公开招募标签刷新蓝 = "1449|613|0x0098dc,1453|577|0xffffff,1335|839|0x0098dc,1455|863|0xffffff,1467|953|0xffffff,1591|995|0x313131,1896|105|0x313131",
消耗一次联络机会确认 = {1263, 765},
}
-- sleep more time when tap these
tap_extra_delay = {
Expand Down Expand Up @@ -671,6 +685,8 @@ tap_extra_delay = {
清空完毕进驻 = .5,
基建副手列表 = 1,
信用交易所列表 = .5,
公开招募列表 = 1,
公开招募标签刷新蓝 = 1,
["0"] = 2,
["1"] = 2,
["2"] = 2,
Expand Down
4 changes: 4 additions & 0 deletions util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ hudid = createHUD()

insert = table.insert

string.trim = function(s)
return s:match'^%s*(.*%S)' or ''
end

string.startsWith = function(str, prefix)
return string.sub(str, 1, string.len(prefix)) == prefix
end
Expand Down

0 comments on commit 1df1520

Please sign in to comment.