Refactor Master Graded (#960)

This commit is contained in:
NOT_A_ROBOT
2023-09-05 17:01:54 +07:00
committed by GitHub
parent c7b8dd24c7
commit e152e147e2
7 changed files with 234 additions and 203 deletions

View File

@@ -1,10 +1,3 @@
local gradeList={
"Grade 9","Grade 8","Grade 7","Grade 6","Grade 5","Grade 4","Grade 3","Grade 2","Grade 1",
"S1","S2","S3","S4","S5","S6","S7","S8","S9",
"m1","m2","m3","m4","m5","m6","m7","m8","m9",
"M","MK","MV","MO","MM-","MM","MM+","GM-","GM","GM+","TM-","TM","TM+"
}
return {
env={
freshLimit=15,
@@ -15,7 +8,7 @@ return {
},
slowMark=true,
score=function(P) return {P.modeData.gradePts,P.stat.time} end,
scoreDisp=function(D) return(gradeList[D[1]] or D[1]).." "..STRING.time(D[2]) end,
scoreDisp=function(D) return(getMasterGradeText(D[1]) or D[1]).." "..STRING.time(D[2]) end,
comp=function(a,b) return a[1]>b[1] or (a[1]==b[1] and a[2]<b[2]) end,
getRank=function(P)
local G=P.modeData.gradePts

View File

@@ -1,26 +1,3 @@
local function getSmallNum(num)
local smalldigit={[0]="","","","","","","","","",""}
local str=tostring(num)
local out=""
for i=1,#str do
out=out..smalldigit[tonumber(string.sub(str,i,i))]
end
return out
end
local function getRank(index)
if index<11 then -- rank 10 - 1
return "Grade "..tostring(11-index)
elseif index<20 then -- S1 - S9 ranks
return "S"..index-10
elseif index<24 then -- GM, GM+, TM, TM+ ranks
local r={"GM","GM+","TM","TM+"}
return r[index-19]
else
return "TM+"..getSmallNum(index-22)
end
end
return {
env={
drop=180,lock=180,
@@ -29,7 +6,7 @@ return {
bg='bg2',bgm='race',
},
score=function(P) return {P.modeData.rankPts,P.stat.piece} end,
scoreDisp=function(D) return getRank(D[1]).." "..D[2].." Pieces" end,
scoreDisp=function(D) return getSecretGradeText(D[1]).." "..D[2].." Pieces" end,
comp=function(a,b) return a[1]>b[1] or a[1]==b[1] and a[2]<b[2] end,
getRank=function(P)
local G=P.modeData.rankPts