Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 05:20, 6 February 2026 by Esportsamaze (talk | contribs) (Created page with "local p = {} local html = mw.html -- ============================================================ -- 1. STAGE TIMELINE (Vertical Flow) -- ============================================================ function p.timeline(frame) local args = frame:getParent().args local container = html.create('div'):addClass('fmt-timeline') for i = 1, 10 do local name = args['stage' .. i] local date = args['date' .. i] local desc = args['desc' .. i]...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Format/doc

local p = {}
local html = mw.html

-- ============================================================
-- 1. STAGE TIMELINE (Vertical Flow)
-- ============================================================
function p.timeline(frame)
    local args = frame:getParent().args
    local container = html.create('div'):addClass('fmt-timeline')

    for i = 1, 10 do
        local name = args['stage' .. i]
        local date = args['date' .. i]
        local desc = args['desc' .. i]
        
        if name and name ~= "" then
            local node = container:tag('div'):addClass('fmt-node')
            
            -- Left Marker (Visual Dot)
            node:tag('div'):addClass('fmt-marker')
            
            -- Content Box
            local content = node:tag('div'):addClass('fmt-content')
            content:tag('div'):addClass('fmt-stage-title'):wikitext(name)
            
            if date and date ~= "" then
                content:tag('div'):addClass('fmt-date'):wikitext('<i class="fa-regular fa-calendar"></i> ' .. date)
            end
            
            if desc and desc ~= "" then
                content:tag('div'):addClass('fmt-desc'):wikitext(desc)
            end
        end
    end
    
    return tostring(container)
end

-- ============================================================
-- 2. POINTS SYSTEM (Auto-Presets or Manual)
-- ============================================================
function p.points(frame)
    local args = frame:getParent().args
    local system = args.type or "10" -- Default to 10 point system
    
    -- Presets
    local dist = {}
    local killPts = args.kill_pts or 1
    
    if system == "15" then
        dist = {15, 12, 10, 8, 6, 4, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0}
    elseif system == "10" then
        dist = {10, 6, 5, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0}
    else
        -- Manual input (p1, p2, p3...)
        for i = 1, 16 do
            table.insert(dist, args['p' .. i] or 0)
        end
    end

    local container = html.create('div'):addClass('fmt-points-container')
    
    -- Header
    container:tag('div'):addClass('fmt-points-header'):wikitext('Scoring System (' .. system .. ' Pt)')
    
    -- Grid
    local grid = container:tag('div'):addClass('fmt-points-grid')
    
    for i, pts in ipairs(dist) do
        local cell = grid:tag('div'):addClass('fmt-pt-cell')
        
        -- Rank Label (1st, 2nd, etc.)
        local rankTxt = i
        local rankClass = "pt-def"
        if i == 1 then rankTxt = "1st"; rankClass = "pt-1"
        elseif i == 2 then rankTxt = "2nd"; rankClass = "pt-2"
        elseif i == 3 then rankTxt = "3rd"; rankClass = "pt-3"
        end
        
        cell:tag('div'):addClass('fmt-pt-rank ' .. rankClass):wikitext(rankTxt)
        cell:tag('div'):addClass('fmt-pt-val'):wikitext(pts)
    end
    
    -- Kill Points Display
    local killBox = container:tag('div'):addClass('fmt-kill-box')
    killBox:wikitext('Each Finish: <b>' .. killPts .. ' Point</b>')
    
    return tostring(container)
end

-- ============================================================
-- 3. MAP ROTATION (Horizontal Strip)
-- ============================================================
function p.maps(frame)
    local args = frame:getParent().args
    local container = html.create('div'):addClass('fmt-maps-container')
    
    if args.title then
        container:tag('div'):addClass('fmt-maps-header'):wikitext(args.title)
    end
    
    local list = container:tag('div'):addClass('fmt-maps-list')
    
    -- Dictionary for clean names and classes
    local mapDict = {
        e = {name="Erangel", class="map-erangel"},
        m = {name="Miramar", class="map-miramar"},
        s = {name="Sanhok", class="map-sanhok"},
        v = {name="Vikendi", class="map-vikendi"},
        r = {name="Rondo",   class="map-rondo"},
        tbd = {name="TBD",   class="map-tbd"}
    }
    
    for i = 1, 10 do
        local m = args[i] or args['m' .. i]
        if m and m ~= "" then
            local key = m:lower():sub(1,1) -- Get first letter
            local data = mapDict[key] or {name=m, class="map-tbd"}
            
            -- Special check for full words
            if m:lower() == "rondo" then data = mapDict['r'] end
            if m:lower() == "erangel" then data = mapDict['e'] end
            if m:lower() == "miramar" then data = mapDict['m'] end
            if m:lower() == "sanhok" then data = mapDict['s'] end
            if m:lower() == "vikendi" then data = mapDict['v'] end

            local item = list:tag('div'):addClass('fmt-map-item')
            item:tag('span'):addClass('fmt-map-badge ' .. data.class):wikitext(data.name)
        end
    end
    
    return tostring(container)
end

return p