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

De TibiaRPGBrasil Wiki
Ir para navegação Ir para pesquisar
Sem resumo de edição
Sem resumo de edição
 
(5 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 6: Linha 6:
     local bonusHundred = tonumber(frame.args.bonusHundredLevels) or 0
     local bonusHundred = tonumber(frame.args.bonusHundredLevels) or 0


     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,550,600,650,700,750,800,850,900,950,1000}


    -- Cria linhas da tabela
     local levelRow = {}
     local levelRow = {""}
     local hpRow = {}
     local hpRow = {""}
     local mpRow = {}
     local mpRow = {""}


     for _, level in ipairs(levels) do
     for _, level in ipairs(levels) do
Linha 21: Linha 20:
     end
     end


    -- Concatena linhas
     local lines = {
     local lines = {
         "! Level\n|" .. table.concat(levelRow, "||"),
         "! Level !!" .. table.concat(levelRow, "!!"),
         "! Vida\n|" .. table.concat(hpRow, " || "),
         "! Vida\n|" .. table.concat(hpRow, " || "),
         "! Mana\n|" .. table.concat(mpRow, " || ")
         "! Mana\n|" .. table.concat(mpRow, " || ")

Edição atual tal como às 17h42min de 17 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,550,600,650,700,750,800,850,900,950,1000}

    local levelRow = {}
    local hpRow = {}
    local mpRow = {}

    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

    local lines = {
        "! Level !!" .. table.concat(levelRow, "!!"),
        "! Vida\n|" .. table.concat(hpRow, " || "),
        "! Mana\n|" .. table.concat(mpRow, " || ")
    }

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

return p