Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LoadFont("Common Large") .. {
- Name = "IIDXGrade",
- InitCommand = function(self)
- self:xy(frameWidth + frameX - 18, frameY - 152)
- self:zoom(0.45)
- self:halign(1)
- self:queuecommand("Set")
- self:maxwidth(capWideScale(125, 300))
- end,
- BeginCommand = function(self) self:queuecommand("Set") end,
- ScoreChangedMessageCommand = function(self) self:queuecommand("Set") end,
- SetCommand = function(self)
- -- force custom window and rescore replay
- unloadCustomWindowConfig()
- loadCurrentCustomWindowConfig() -- pick up exscore config
- MESSAGEMAN:Broadcast("RecalculateGraphs", {judge=GetTimingDifficulty()})
- -- pull last replay snapshot
- local replay = REPLAYS:GetActiveReplay()
- replay:LoadAllData()
- local snap = replay:GetLastReplaySnapshot()
- local j = snap:GetJudgments()
- -- EX = PGREAT*2 + GREAT*1
- local w1, w2 = j.W1, j.W2
- local ex = w1*2 + w2
- -- total taps = sum of all judgments
- local taps = j.W1 + j.W2 + j.W3 + j.W4 + j.W5 + j.Miss
- -- MAX = taps * 2
- local max = taps * 2
- local ratio = ex / max
- -- gradez
- local txt
- local bands = {
- { name="MAX", pct=9/9 },
- { name="AAA", pct=8/9 },
- { name="AA", pct=7/9 },
- { name="A", pct=6/9 },
- { name="B", pct=5/9 },
- { name="C", pct=4/9 },
- { name="D", pct=3/9 },
- { name="E", pct=2/9 },
- }
- local thr = {}
- for i, band in ipairs(bands) do
- thr[i] = math.ceil(max * band.pct)
- end
- if ex == max then
- txt = "MAX"
- else
- for i = 2, #bands do
- if ex >= thr[i] then
- -- compare distance above the lower‐band threshold vs.
- -- distance below the higher‐band threshold
- local up = thr[i-1] - ex -- towards the higher band
- local down = ex - thr[i] -- above this band’s floor
- if up <= down then
- -- closer to the top
- txt = string.format("%s-%d", bands[i-1].name, up)
- else
- -- closer to the bottom
- txt = string.format("%s+%d", bands[i].name, down)
- end
- break
- end
- end
- if not txt then txt = "F" end
- end
- -- display & color
- self:settext(txt)
- local c
- if txt == "MAX" then
- c = color("0.933,0.933,0.933,1")
- elseif txt:match("^MAX%-") then
- c = color("0.400,0.800,1.000,1")
- elseif txt:match("^AAA%+") then
- c = color("0.933,0.667,0.000,1")
- elseif txt:match("^AAA%-") then
- c = color("0.400,0.800,0.400,1")
- elseif txt:match("^AA%+") then
- c = color("0.400,0.800,0.400,1")
- elseif txt:match("^AA%-") then
- c = color("0.855,0.341,0.341,1")
- elseif txt:match("^A[+%-]") then
- c = color("0.855,0.341,0.341,1")
- elseif txt:match("^B") then
- c = color("0.357,0.471,0.733,1")
- elseif txt:match("^C") then
- c = color("0.788,0.482,1.000,1")
- elseif txt:match("^D") then
- c = color("0.549,0.384,0.224,1")
- elseif txt == "F" then
- c = color("0.804,0.804,0.804,1")
- else
- c = color("1,1,1,1")
- end
- self:diffuse(c)
- end,
- },
Advertisement
Add Comment
Please, Sign In to add comment