Mudanças entre as edições de "Módulo:Teste"

De Wiki Gla
Ir para navegação Ir para pesquisar
m (bannerzin)
m
Linha 1: Linha 1:
local p = {}
--[[
Módulo:Boss.Gedatsu — Dados de habilidades do boss semanal Gedatsu.


-- Parseia bau no formato "2 comum, 8 ouro" ou "8 ouro, 2 comum". Retorna comum, ouro (números) ou nil,nil se for só tipo (comum/ouro).
Uso:
local function parseBau(s)
  {{#invoke:BossSkills|main|module=Boss.Gedatsu}}
    if not s or s == '' then return nil, nil end
  {{#widget:BossSkills}}
    s          = mw.text.trim(s)
]]
    local comum = tonumber(s:match('(%d+)%s*[Cc]omum')) or 0
    local ouro  = tonumber(s:match('(%d+)%s*[Oo]uro')) or 0
    if comum > 0 or ouro > 0 then
        return comum, ouro
    end
    return nil, nil
end


function p.main(frame)
local M = {
     local args = frame:getParent().args
     name = "Gedatsu",
     local cards = {}
     background = "GedatsuBossBackground.png",


     local i = 1
     order = {
    while true do
        "Swamp Cloud Burger",
         local nome = args['nome' .. i]
         "Milky Dial",
         if not nome or mw.text.trim(nome) == '' then break end
         "Jet Punch",
    },


         local link        = mw.text.trim(args['link' .. i] or '')
    skills = {
        local img        = mw.text.trim(args['img' .. i] or '')
         ["Swamp Cloud Burger"] = {
        local qtd        = mw.text.trim(args['qtd' .. i] or '0')
            icon = "SwampCloudBurger-Icon.png",
         local bauParam    = mw.text.trim(args['bau' .. i] or 'comum')
            cooldown = "12s",
            video = "SwampCloudBurger-Video.mp4",
            desc = {
                pt =
                "Gedatsu cria uma nuvem pantanosa que prende os jogadores na área, causando dano contínuo e reduzindo a velocidade de movimento.",
                en =
                "Gedatsu creates a swamp cloud that traps players in the area, dealing continuous damage and reducing movement speed.",
            },
         },


         local comum, ouro = parseBau(bauParam)
         ["Milky Dial"] = {
        if comum == nil and ouro == nil then
            icon = "MilkyDial-Icon.png",
             -- Modo antigo: bau = comum ou ouro, qtd = quantidade
             cooldown = "8s",
             local n = tonumber(qtd) or 0
             video = "MilkyDial-Video.mp4",
             if bauParam:lower() == 'ouro' then
             desc = {
                 comum, ouro = 0, n
                pt =
            else
                 "Gedatsu usa o Milky Dial para criar uma barreira de nuvens que empurra os jogadores para longe e causa dano ao contato.",
                 comum, ouro = n, 0
                en =
             end
                 "Gedatsu uses the Milky Dial to create a cloud barrier that pushes players away and deals damage on contact.",
         end
             },
         },


         local href      = tostring(mw.uri.localUrl(link))
         ["Jet Punch"] = {
        local comumHtml = frame:preprocess('[[File:Chest_normal.png|link=]]')
            icon = "JetPunch-Icon.png",
        local ouroHtml  = frame:preprocess('[[File:Chest_gold.png|link=]]')
            video = "JetPunch-Video.mp4",
            desc = {
                pt =
                "Gedatsu avança rapidamente e desfere um soco poderoso que causa grande dano e derruba os jogadores atingidos.",
                en =
                "Gedatsu dashes forward and delivers a powerful punch that deals heavy damage and knocks down hit players.",
            },
        },
    },
}


        -- Banner 380x80: fundo = img da ilha, baus canto superior esquerdo, título canto inferior esquerdo
return M
        local banner    = mw.html.create('span')
        banner:attr('class', 'island-banner')
            :attr('data-href', href)
            :attr('data-bgimg', img)
            :attr('role', 'link')
            :attr('tabindex', '0')
 
        local chests = banner:tag('span'):attr('class', 'island-chests')
        if comum > 0 then
            chests:tag('span'):attr('class', 'island-chest-group')
                :node(mw.html.create(''):wikitext(comumHtml))
                :tag('span'):attr('class', 'island-chest-count'):wikitext(tostring(comum))
        end
        if ouro > 0 then
            chests:tag('span'):attr('class', 'island-chest-group')
                :node(mw.html.create(''):wikitext(ouroHtml))
                :tag('span'):attr('class', 'island-chest-count'):wikitext(tostring(ouro))
        end
 
        banner:tag('span'):attr('class', 'island-title'):wikitext(nome)
 
        cards[#cards + 1] = banner
        i = i + 1
    end
 
    local grid = mw.html.create('div')
    grid:attr('class', 'island-grid')
    for _, card in ipairs(cards) do
        grid:node(card)
    end
 
    return tostring(grid)
end
 
return p

Edição das 22h13min de 17 de março de 2026

A documentação para este módulo pode ser criada em Módulo:Teste/doc

--[[
Módulo:Boss.Gedatsu — Dados de habilidades do boss semanal Gedatsu.

Uso:
  {{#invoke:BossSkills|main|module=Boss.Gedatsu}}
  {{#widget:BossSkills}}
]]

local M = {
    name = "Gedatsu",
    background = "GedatsuBossBackground.png",

    order = {
        "Swamp Cloud Burger",
        "Milky Dial",
        "Jet Punch",
    },

    skills = {
        ["Swamp Cloud Burger"] = {
            icon = "SwampCloudBurger-Icon.png",
            cooldown = "12s",
            video = "SwampCloudBurger-Video.mp4",
            desc = {
                pt =
                "Gedatsu cria uma nuvem pantanosa que prende os jogadores na área, causando dano contínuo e reduzindo a velocidade de movimento.",
                en =
                "Gedatsu creates a swamp cloud that traps players in the area, dealing continuous damage and reducing movement speed.",
            },
        },

        ["Milky Dial"] = {
            icon = "MilkyDial-Icon.png",
            cooldown = "8s",
            video = "MilkyDial-Video.mp4",
            desc = {
                pt =
                "Gedatsu usa o Milky Dial para criar uma barreira de nuvens que empurra os jogadores para longe e causa dano ao contato.",
                en =
                "Gedatsu uses the Milky Dial to create a cloud barrier that pushes players away and deals damage on contact.",
            },
        },

        ["Jet Punch"] = {
            icon = "JetPunch-Icon.png",
            video = "JetPunch-Video.mp4",
            desc = {
                pt =
                "Gedatsu avança rapidamente e desfere um soco poderoso que causa grande dano e derruba os jogadores atingidos.",
                en =
                "Gedatsu dashes forward and delivers a powerful punch that deals heavy damage and knocks down hit players.",
            },
        },
    },
}

return M