Module:DropRateCalc: Difference between revisions
Jump to navigation
Jump to search
ThroatPDiddy (talk | contribs) m (ThroatPDiddy moved page Module:DropRate to Module:DropRateCalc without leaving a redirect: rename since Template:DropRate already exists) |
ThroatPDiddy (talk | contribs) No edit summary |
||
| Line 2: | Line 2: | ||
local buffs = { | local buffs = { | ||
{label = "Base", reduction = 0}, | {label = "Base", reduction = 0}, | ||
{label = "Donator", reduction = 0.15}, | {label = "Donator", reduction = 0.15}, | ||
{label = "Super donator", reduction = 0.25}, | {label = "Super donator", reduction = 0.25}, | ||
{label = "Extreme donator", reduction = 0.30}, | {label = "Extreme donator", reduction = 0.30}, | ||
{label = "Legendary donator", reduction = 0.35}, | {label = "Legendary donator", reduction = 0.35}, | ||
{label = "Royal donator", reduction = 0.40}, | {label = "Royal donator", reduction = 0.40}, | ||
{label = "Divine donator", reduction = 0.45}, | {label = "Divine donator", reduction = 0.45}, | ||
} | } | ||
local function getColor(rate) | |||
if rate == 1 then | |||
return "#0b5884" | |||
elseif rate <= 25 then | |||
return "#3c780a" | |||
elseif rate <= 99 then | |||
return "#a48900" | |||
elseif rate <= 999 then | |||
return "#b55e0c" | |||
else | |||
return "#9f261e" | |||
end | |||
end | |||
function p.calc(frame) | function p.calc(frame) | ||
| Line 16: | Line 30: | ||
local cells = {} | local cells = {} | ||
for _, tier in ipairs(buffs) do | for _, tier in ipairs(buffs) do | ||
local rate = math.floor(base * (1 - tier.reduction) + 0.5) | |||
local color = getColor(rate) | |||
table.insert(cells, '<td style="background-color:' .. color .. '; color:#ffffff; text-align:center;">1/' .. rate .. '</td>') | |||
end | end | ||
return table.concat(cells, " | return table.concat(cells, "") | ||
end | end | ||
return p | return p | ||
Revision as of 19:46, 18 July 2026
Need to test if Larran's keys are buffed, specifically for Template:CallistoDrops and the other bosses like that.
local p = {}
local buffs = {
{label = "Base", reduction = 0},
{label = "Donator", reduction = 0.15},
{label = "Super donator", reduction = 0.25},
{label = "Extreme donator", reduction = 0.30},
{label = "Legendary donator", reduction = 0.35},
{label = "Royal donator", reduction = 0.40},
{label = "Divine donator", reduction = 0.45},
}
local function getColor(rate)
if rate == 1 then
return "#0b5884"
elseif rate <= 25 then
return "#3c780a"
elseif rate <= 99 then
return "#a48900"
elseif rate <= 999 then
return "#b55e0c"
else
return "#9f261e"
end
end
function p.calc(frame)
local base = tonumber(frame.args[1])
if not base then return "Invalid base rate" end
local cells = {}
for _, tier in ipairs(buffs) do
local rate = math.floor(base * (1 - tier.reduction) + 0.5)
local color = getColor(rate)
table.insert(cells, '<td style="background-color:' .. color .. '; color:#ffffff; text-align:center;">1/' .. rate .. '</td>')
end
return table.concat(cells, "")
end
return p