Jump to content

Module:ArmorChance: Difference between revisions

From In-System
Created page with "local p = {} function p.table(frame) local level = tonumber(frame.args.level or frame.args[1]) or 1 if level < 1 then level = 1 end local output = { '{| class="wikitable"', '|+ Armor Chance by Character Level', '! Armor Type<br>(not Armor Class)', '! Percentage' } for armorType = 10, 1, -1 do local chance = (level * 10) - ((10 - armorType) * 7) if chance < 0 then chance = 0..."
 
No edit summary
 
Line 10: Line 10:
     local output = {
     local output = {
         '{| class="wikitable"',
         '{| class="wikitable"',
         '|+ Armor Chance by Character Level',
         '|+ Liver Pull Chance by Character Level',
         '! Armor Type<br>(not Armor Class)',
         '! Armor Type<br>(not Armor Class)',
         '! Percentage'
         '! Percentage'

Latest revision as of 04:08, 2 August 2026

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

local p = {}

function p.table(frame)
    local level = tonumber(frame.args.level or frame.args[1]) or 1

    if level < 1 then
        level = 1
    end

    local output = {
        '{| class="wikitable"',
        '|+ Liver Pull Chance by Character Level',
        '! Armor Type<br>(not Armor Class)',
        '! Percentage'
    }

    for armorType = 10, 1, -1 do
        local chance = (level * 10) - ((10 - armorType) * 7)

        if chance < 0 then
            chance = 0
        end

        table.insert(output, '|-')
        table.insert(output, '| ' .. armorType)
        table.insert(output, '| ' .. chance .. '%')
    end

    table.insert(output, '|}')

    return table.concat(output, '\n')
end

return p