* merge get-cc-url into get-version * add `get-cc` * remove `apt update` * rename `get-version` -> `get-info` * rm unnecessary file * - Add support for ios - Fix missing top folder for macos * - Fix directory names * - Fix with binary r/w * iOS的plist文件先转换为明文 * add IOS * 整合新action * Finishing touch * Update action.yml * Test chmod * - Xcode build test * - Build with default keychain * - Test iOS only * - Use macos-11 * - Change keychain operations' sequence * - Allow provisioning updates * - Set build directory * - Specify build path * - Pack bare app * - Add quiet option * 测试:输出touchrelease位置 * - Test with ad hoc cert * - Fix wrong variable * - Use Release instead of Distribution * - Chmod CCloader to add execute permission * 继续测试ios触屏问题 * 继续测试ios触屏问题 * - Use macos latest - Re-enable other runs * - Sign CCloader after build * - Remove redundant inputs in build.yml * - Install test * - Export test * - install test * - Try fastlane * - Use builtin ruby * - CI Test * - Update python script to fix ios versioning * - Use static lib * - Test static cc * - Fix locations * Update readme.md Co-authored-by: Imple Lee <80144331+ImpleLee@users.noreply.github.com> Co-authored-by: Trebor-Huang <2300936257@qq.com> Co-authored-by: Trebor Huang <41145779+Trebor-Huang@users.noreply.github.com> Co-authored-by: YunyushuLiu <kunluntree@qq.com> Co-authored-by: MrZ626 <1046101471@qq.com> Co-authored-by: 梦飞翔 <1149761294@qq.com>
143 lines
3.7 KiB
Lua
143 lines
3.7 KiB
Lua
local ins,rem=table.insert,table.remove
|
|
|
|
local baseBot={
|
|
pushNewNext=NULL,
|
|
updateField=NULL,
|
|
updateB2B=NULL,
|
|
updateCombo=NULL,
|
|
checkDest=NULL,
|
|
switch20G=NULL,
|
|
revive=NULL,
|
|
}
|
|
function baseBot.update(bot)
|
|
local P=bot.P
|
|
local keys=bot.keys
|
|
if P.control and P.waiting==-1 then
|
|
bot.delay=bot.delay-1
|
|
if not keys[1]then
|
|
if bot.runningThread then
|
|
if not pcall(bot.runningThread)then
|
|
bot.runningThread=false
|
|
end
|
|
else
|
|
bot.delay=math.min(10,bot.delay-1)
|
|
if bot.delay==0 then
|
|
P:pressKey(6)
|
|
P:releaseKey(6)
|
|
bot.delay=10
|
|
end
|
|
end
|
|
elseif bot.delay<=0 then
|
|
if keys[1]>3 then
|
|
bot.delay=bot.delay0
|
|
else
|
|
bot.delay=bot.delay0*.4
|
|
end
|
|
P:pressKey(keys[1])
|
|
P:releaseKey(keys[1])
|
|
rem(keys,1)
|
|
end
|
|
end
|
|
end
|
|
|
|
local function _undefMethod(self,k)
|
|
print("Undefined method: "..k)
|
|
self[k]=NULL
|
|
return NULL
|
|
end
|
|
local botMeta={__index=_undefMethod}
|
|
|
|
local BOT={}
|
|
|
|
local AISpeed={60,50,40,30,20,14,10,6,4,3}
|
|
-- For CC bot:
|
|
-- TODO you still need to switch20G() at the right time.
|
|
-- since it's not cc-specific I'm not dealing with it for now
|
|
--[[
|
|
arg={
|
|
next: number of nexts
|
|
hold: holdable
|
|
speedLV: level
|
|
node: search nodes
|
|
randomizer: random generator
|
|
_20G: 20G?
|
|
}
|
|
]]
|
|
function BOT.template(arg)
|
|
if arg.type=='CC'then
|
|
return{
|
|
type='CC',
|
|
next=arg.next,
|
|
hold=arg.hold,
|
|
delay=AISpeed[arg.speedLV],
|
|
node=arg.node,
|
|
bag=(arg.randomizer or'bag')=='bag',
|
|
_20G=arg._20G,
|
|
}
|
|
elseif arg.type=='9S'then
|
|
return{
|
|
type='9S',
|
|
delay=math.floor(AISpeed[arg.speedLV]),
|
|
hold=arg.hold,
|
|
}
|
|
end
|
|
end
|
|
|
|
function BOT.new(P,data)
|
|
local bot={P=P,data=data}
|
|
if data.type=="CC"then
|
|
P:setRS('SRS')
|
|
bot.keys={}
|
|
bot.nexts={}
|
|
bot.delay=data.delay
|
|
bot.delay0=data.delay
|
|
if P.gameEnv.holdCount>1 then
|
|
P:setHold(1)
|
|
end
|
|
|
|
local cc=cc or REQUIRE"CCloader"
|
|
if not cc then
|
|
data.type=false
|
|
return BOT.new(P,data)
|
|
end
|
|
local opt,wei=cc.getDefaultConfig()
|
|
wei:fastWeights()
|
|
opt:setHold(data.hold)
|
|
opt:set20G(data._20G)
|
|
opt:setBag(data.bag)
|
|
opt:setNode(data.node)
|
|
bot.ccBot=cc.launchAsync(opt,wei)
|
|
local cc_lua=require"parts.bot.bot_cc"
|
|
setmetatable(bot,{__index=function(self,k)
|
|
return
|
|
self.ccBot[k]and function(_,...)self.ccBot[k](self.ccBot,...)end or
|
|
cc_lua[k]and function(_,...)cc_lua[k](self,...)end or
|
|
baseBot[k]and baseBot[k]or
|
|
error("No actions called "..k)
|
|
end})
|
|
|
|
for i,B in next,P.nextQueue do
|
|
if i<=data.next then
|
|
bot:addNext(B.id)
|
|
else
|
|
ins(bot.nexts,B.id)
|
|
end
|
|
end
|
|
bot.runningThread=coroutine.wrap(cc_lua.thread)
|
|
bot.runningThread(bot)
|
|
elseif data.type=="9S"or true then--9s or else
|
|
TABLE.cover(baseBot,bot)
|
|
TABLE.cover(require"parts.bot.bot_9s",bot)
|
|
P:setRS('TRS')
|
|
bot.keys={}
|
|
bot.delay=data.delay
|
|
bot.delay0=data.delay
|
|
bot.runningThread=coroutine.wrap(bot.thread)
|
|
bot.runningThread(bot)
|
|
setmetatable(bot,botMeta)
|
|
end
|
|
return bot
|
|
end
|
|
|
|
return BOT
|