Módulo:PetStatsVisualizer: mudanças entre as edições

De TibiaRPGBrasil Wiki
Ir para navegação Ir para pesquisar
(Criou página com 'local p = {} function p.render(frame) local hpGain = tonumber(frame.args.hpGain) or 0 local mpGain = tonumber(frame.args.mpGain) or 0 local bonusHundred = tonumber(frame.args.bonusHundredLevels) or 0 local levels = {1,50,100,150,200,250,300,350,400,450,500} local lines = {} for _, level in ipairs(levels) do local hp = 150 + (level-1)*hpGain + math.floor(level/100)*bonusHundred local mp = (level-1)*mpGain table.insert(lin...')
 
Sem resumo de edição
Linha 7: Linha 7:


     local levels = {1,50,100,150,200,250,300,350,400,450,500}
     local levels = {1,50,100,150,200,250,300,350,400,450,500}
     local lines = {}
 
    -- Cria linhas da tabela
    local levelRow = {"! Level"}
    local hpRow = {"! Vida"}
     local mpRow = {"! Mana"}


     for _, level in ipairs(levels) do
     for _, level in ipairs(levels) do
        table.insert(levelRow, level)
         local hp = 150 + (level-1)*hpGain + math.floor(level/100)*bonusHundred
         local hp = 150 + (level-1)*hpGain + math.floor(level/100)*bonusHundred
         local mp = (level-1)*mpGain
         local mp = (level-1)*mpGain
         table.insert(lines, string.format("|-\n| %d || %d || %d", level, hp, mp))
         table.insert(hpRow, hp)
        table.insert(mpRow, mp)
     end
     end


     return table.concat(lines, "\n")
    -- Concatena linhas
    local lines = {
        "|" .. table.concat(levelRow, " || "),
        "|" .. table.concat(hpRow, " || "),
        "|" .. table.concat(mpRow, " || ")
    }
 
     return table.concat(lines, "\n|- \n")
end
end


return p
return p

Edição das 18h04min de 16 de agosto de 2025

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

local p = {}

function p.render(frame)
    local hpGain = tonumber(frame.args.hpGain) or 0
    local mpGain = tonumber(frame.args.mpGain) or 0
    local bonusHundred = tonumber(frame.args.bonusHundredLevels) or 0

    local levels = {1,50,100,150,200,250,300,350,400,450,500}

    -- Cria linhas da tabela
    local levelRow = {"! Level"}
    local hpRow = {"! Vida"}
    local mpRow = {"! Mana"}

    for _, level in ipairs(levels) do
        table.insert(levelRow, level)
        local hp = 150 + (level-1)*hpGain + math.floor(level/100)*bonusHundred
        local mp = (level-1)*mpGain
        table.insert(hpRow, hp)
        table.insert(mpRow, mp)
    end

    -- Concatena linhas
    local lines = {
        "|" .. table.concat(levelRow, " || "),
        "|" .. table.concat(hpRow, " || "),
        "|" .. table.concat(mpRow, " || ")
    }

    return table.concat(lines, "\n|- \n")
end

return p