請問各位大大
SummonersWar v2_161213 這個版本
要改Main的甚麼地方呀
function keyNum()
local preMinSimilarity = Settings:get("MinSimilarity")
Settings:set("MinSimilarity", 0.7)
local anchor = low:wait("slash.png")
-- local charx = keyPre:find("charx.png")
local numRegion = Region(anchor:getX() - 50, anchor:getY(), 50, anchor:getH())
numRegion:highlight(1)
local num = numberOCRNoFindException(numRegion, "vFlash")
Settings:set("MinSimilarity", preMinSimilarity)
return(num)
end
-- ========== Settings ================
Settings:setCompareDimension(true, 1196)
Settings:setScriptDimension(true, 1196)
Settings:set("MinSimilarity", 0.8)
localPath = scriptPath()
dofile(localPath.."lib/commonLib.lua")
setImmersiveMode(false)
dimension = autoResize(Pattern("bigFlash.png"):similar(0.9), 1196, false)
if (dimension < 0) then
simpleDialog("Error", "cannot find correct compare dimension")
return
end
toast (""..dimension)
-- ========== main program ===========
upperRight = Region(640, 0, 640, 350)
right = Region(640, 0, 640, 800)
left = Region(0, 0, 640, 800)
upper = Region(0, 0, 1280, 380)
low = Region(0, 360, 1280, 440)
skip = Location(640, 200)
dialogInit()
addCheckBox("nextArea", "Goto next area", true)
dialogShow("Choose goto next area or not after winning this stage")
language = getLanguage()
acquirePng = "acquire."..language..".png"
confirmPng = "confirm."..language..".png"
clickList = {Pattern("defeatedDiamond.png"):similar(0.9), "worldMap.png", "bigFlash.png",
Pattern("cancel2.png"):targetOffset(-3,-40), Pattern("cancelLong.png"):targetOffset(122,10),
"box.png", "cancel.png", Pattern("victoryDiamond.png"):targetOffset(-85,-185), --confirmPng,
"victoryFlash.png", "levelupFlash.png", "play.png"}
-- "award.png",
if (nextArea) then
table.insert(clickList, "ilin.png")
table.insert(clickList, "libia.png")
table.insert(clickList, "dulander.png")
end
if (nextArea) then flashRequireRegion = right else flashRequireRegion = left end
bigCancel = find("bigCancel.png")
skip = Location(bigCancel:getX()- bigCancel:getW(), bigCancel:getY() + bigCancel:getH())
click("bigFlash.png")
existsClick("play.png", 10)
while (true) do
local choice, listMatch = waitMulti(clickList, 20*60, skip)
if (choice == -1) then
simpleDialog("Warning", "Unknown happened\nReport to ankulua@gmail.com")
return
end
listMatch:highlight(1)
if (choice > 2) then click(listMatch) end
if (choice == 1) then
getLastMatch():highlight(1)
if (exists(Pattern("defeatedDiamond.png"):similar(0.9), 0.9)) then
simpleDialog("Warning", "Lose")
return
end
end
if (clickList[choice] == "box.png") then
existsClick(Pattern("cancel.png"):similar(0.8), 3)
end
if (clickList[choice] == "ilin.png" or clickList[choice] == "libia.png" or clickList[choice] == "dulander.png") then
while (existsClick(clickList[choice], 0)) do
wait(1)
end
end
if (choice == 2 and exists("worldMap.png", 0)) then -- next round
if (nextArea and flashRequireRegion:exists("require0.png",0)) then
simpleDialog("Warning", "Reach end of curent area.")
return
end
local requiredFlash = existsMultiMax(flashRequireRegion,
{"require3.png", "require4.png", "require5.png", "require6.png", "require7.png", "require8.png"})
if (requiredFlash == -1) then requiredFlash = 9 else requiredFlash = requiredFlash + 2 end
toast("required Flash = "..requiredFlash)
while (true) do
flashNum = keyNum()
if (flashNum < 0) then break end
if ( flashNum < requiredFlash) then
toast("Not enough flash, wait 5 minutes")
wait(5*60)
else
toast(flashNum.." flashes")
flashRequireRegion:click("smallFlash.png")
break
end
end
end
end