Module:maimai Difficulty: Difference between revisions

Jump to navigation Jump to search
remove reliance on hard-coded numbers
imported>Jack980517
No edit summary
imported>Jack980517
(remove reliance on hard-coded numbers)
Line 6: Line 6:
function p.maimai_difficulty_multi(frame)
function p.maimai_difficulty_multi(frame)
     args=frame:getParent().args
     args=frame:getParent().args
    local version_range_borders = {3, 9, 13, 15}
     local result = "maimai "
     local result = "maimai "
     if VerToNum({"maimai", args[1]}) <= 2 then
     if VerToNum({"maimai", args[1]}) < version_range_borders[1] then
         result = result .. "to PLUS difficulty rated from 1 to 10"
         result = result .. "to PLUS difficulty rated from 1 to 10"
     else
     else
         result = result .. "difficulty rated "
         result = result .. "difficulty rated "
     end
     end
     if args[2] ~= nil and VerToNum({"maimai", args[2]}) <= 2 then
     if args[2] ~= nil and VerToNum({"maimai", args[2]}) < version_range_borders[1] then
         -- ugly hack; #args can't be used, and since there's (currently) no songs removed in _~_+ and revived later, the only use case is 舞萌 songs.
         -- ugly hack; #args can't be used, and since there's (currently) no songs removed in _~_+ and revived later, the only use case is 舞萌 songs.
         result = result .. "."
         result = result .. "."
     elseif VerToNum({"maimai", args[1]}) <= 2 then
     elseif VerToNum({"maimai", args[1]}) < version_range_borders[1] then
         result = result .. ", "
         result = result .. ", "
     end
     end
    local version_range_borders = {3, 9, 13, 15} -- first range already dealt with above
     local i = 0
     local i = 0
     local in_range = {}
     local in_range = {}
Line 55: Line 55:
         end
         end
     end
     end
     if #included_ranges == 1 and VerToNum({"maimai", args[1]}) <= 2 then -- first range special case
     if #included_ranges == 1 and VerToNum({"maimai", args[1]}) < version_range_borders[1] then -- first range special case
         result = result .. "and " .. ranges_text[included_ranges[1]] .. "."
         result = result .. "and " .. ranges_text[included_ranges[1]] .. "."
         -- print(result)
         -- print(result)
Anonymous user

Navigation menu