Module:maimai Difficulty: Difference between revisions

Jump to navigation Jump to search
m
Protected "Module:maimai Difficulty": structural page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
imported>Jack980517
No edit summary
m (Protected "Module:maimai Difficulty": structural page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(5 intermediate revisions by one other user not shown)
Line 6: Line 6:
function p.maimai_difficulty_multi(frame)
function p.maimai_difficulty_multi(frame)
     args=frame:getParent().args
     args=frame:getParent().args
     mw.logObject(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 VerToNum({"maimai", args[#args]}) <= 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.
         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 31: Line 31:
     }
     }
     local j = 1
     local j = 1
     for i = 1, #args, 2 do
    local endvernum = nil
         local startver = args[i]
     for i = 1, 99, 2 do -- again, ugly hack
         local endver = ""
         if args[i] == nil then break end
        if i ~= #args then
         local startvernum = VerToNum({"maimai", args[i]})
            endver = args[i + 1]
         endvernum = VerToNum({"maimai", args[i + 1]})
        end
         if endvernum == nil then
        -- print('start = ' .. startver .. ' end = ' .. endver)
             endvernum = 99
         local startvernum = VerToNum({"maimai", startver})
         local endvernum = 99
        if endver ~= "" then
             endvernum = VerToNum({"maimai", endver})
         end
         end
         for j = 1, #version_range_borders do
         for j = 1, #version_range_borders do
Line 59: Line 55:
         end
         end
     end
     end
     if #included_ranges == 1 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)
Line 75: Line 71:
     end
     end
     result = result .. "<br>[[Category:Songs]][[Category:maimai Songs]]"
     result = result .. "<br>[[Category:Songs]][[Category:maimai Songs]]"
     if #args % 2 == 0 then
     if endvernum ~= 99 then
         result = result .. "[[Category:maimai Removed Songs]]"
         result = result .. "[[Category:maimai Removed Songs]]"
     end
     end

Navigation menu