优化自定义序列/任务编码
This commit is contained in:
@@ -79,11 +79,11 @@ function pasteQuestArgs(str)
|
||||
ENV.sequence= sub(str,4)
|
||||
end
|
||||
|
||||
|
||||
--Encoding Functions
|
||||
--Safe char: 33~94, 96~126
|
||||
--Sep symbol: 33 (!)
|
||||
--Safe char: 34~126
|
||||
--[[
|
||||
Count: 33~94
|
||||
Count: 34~96
|
||||
Block: 97~125
|
||||
Encode: [A] or [AB] sequence, A = block ID, B = repeat times, no B means do not repeat.
|
||||
Example: "abcdefg" is [SZJLTOI], "a^aDb)" is [Z*63,Z*37,S*10]
|
||||
@@ -94,10 +94,10 @@ function copySequence()
|
||||
|
||||
local count=1
|
||||
for i=1,#preBag+1 do
|
||||
if preBag[i+1]~=preBag[i]or count==63 then
|
||||
if preBag[i+1]~=preBag[i]or count==64 then
|
||||
str=str..char(96+preBag[i])
|
||||
if count>1 then
|
||||
str=str..char(31+count)
|
||||
str=str..char(32+count)
|
||||
count=1
|
||||
end
|
||||
else
|
||||
@@ -124,8 +124,8 @@ function pasteSequence(str)
|
||||
if _>=97 and _<=125 then
|
||||
ins(bag,reg)
|
||||
reg=_-96
|
||||
elseif _>=33 and _<=94 then
|
||||
for i=1,_-31 do
|
||||
elseif _>=34 and _<=96 then
|
||||
for i=1,_-32 do
|
||||
ins(bag,reg)
|
||||
end
|
||||
reg=nil
|
||||
@@ -215,8 +215,8 @@ function pasteBoard(str)
|
||||
end
|
||||
|
||||
--[[
|
||||
mission: 33~94,96~115
|
||||
Count: 116~126
|
||||
Mission: 33~114
|
||||
Count: 115~126
|
||||
Encode: [A] or [AB] sequence, A = mission ID, B = repeat times, no B means do not repeat.
|
||||
|
||||
_1=01,_2=02,_3=03,_4=04,
|
||||
@@ -237,12 +237,11 @@ function copyMission()
|
||||
|
||||
local count=1
|
||||
for i=1,#preMission+1 do
|
||||
if preMission[i+1]~=preMission[i]or count==11 then
|
||||
if preMission[i+1]~=preMission[i]or count==12 then
|
||||
_=32+preMission[i]
|
||||
if _>=95 then _=_+1 end
|
||||
str=str..char(_)
|
||||
if count>1 then
|
||||
str=str..char(115+count)
|
||||
str=str..char(114+count)
|
||||
count=1
|
||||
end
|
||||
else
|
||||
@@ -259,17 +258,17 @@ function pasteMission(str)
|
||||
for i=1,#str do
|
||||
_=byte(str,i)
|
||||
if not reg then
|
||||
if _>=33 and _<=115 and _~=95 then
|
||||
reg=_<95 and _-32 or _-33
|
||||
if _>=33 and _<=114 then
|
||||
reg=_-32
|
||||
else
|
||||
return
|
||||
end
|
||||
else
|
||||
if _>=33 and _<=115 and _~=95 then
|
||||
if _>=33 and _<=114 then
|
||||
ins(mission,reg)
|
||||
reg=_<95 and _-32 or _-33
|
||||
reg=_-32
|
||||
elseif _>=116 and _<=126 then
|
||||
for i=1,_-114 do
|
||||
for i=1,_-113 do
|
||||
ins(mission,reg)
|
||||
end
|
||||
reg=nil
|
||||
|
||||
@@ -1261,24 +1261,24 @@ do--custom_basic
|
||||
SCN.swapTo("custom_rule","swipeL")
|
||||
end
|
||||
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
|
||||
local str="Techmino Quest:"..copyQuestArgs().."_"
|
||||
local str="Techmino Quest:"..copyQuestArgs().."!"
|
||||
if #preBag>0 then str=str..copySequence()end
|
||||
str=str.."_"..copyBoard().."_"
|
||||
str=str.."!"..copyBoard().."!"
|
||||
if #preMission>0 then str=str..copyMission()end
|
||||
sys.setClipboardText(str.."_")
|
||||
sys.setClipboardText(str.."!")
|
||||
LOG.print(text.copySuccess,color.green)
|
||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||
local str=sys.getClipboardText()
|
||||
local p1,p2,p3,p4,p5--ptr*
|
||||
while true do
|
||||
p1=find(str,":")or 0
|
||||
p2=find(str,"_",p1+1)
|
||||
p2=find(str,"!",p1+1)
|
||||
if not p2 then break end
|
||||
p3=find(str,"_",p2+1)
|
||||
p3=find(str,"!",p2+1)
|
||||
if not p3 then break end
|
||||
p4=find(str,"_",p3+1)
|
||||
p4=find(str,"!",p3+1)
|
||||
if not p4 then break end
|
||||
p5=find(str,"_",p4+1)or #str+1
|
||||
p5=find(str,"!",p4+1)or #str+1
|
||||
|
||||
pasteQuestArgs(sub(str,p1+1,p2-1))
|
||||
if p2+1~=p3 then
|
||||
|
||||
Reference in New Issue
Block a user