Module:DropsLine: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 366:
-- rarity cell contents
local rare_class, rare_sort
end
--if rarity_value == undefined then
if raritynotes and #raritynotes > 0 then
-- rare_class, rare_sort = unpack(rarities[rarity:lower()] or rarities._default)
-- If raritynotes is provided, only show the notes, skip rarity value
--elseif rarity_value == false then
rarity_cell:wikitext(raritynotes)
-- rare_class, rare_sort = unpack(rarities._default)
-- else
-- If rarity_value is provided, calculate rare_sort =and 1/rarity_valuefetch rare_class
--if rarity_value =~= undefinednil then
-- rare_class = get_rarity_class(rarity_value)
ifrare_sort rarity_value ~= nil1 then/ rarity_value
--rare_class If= get_rarity_class(rarity_value is provided, calculate rare_sort and fetch rare_class)
else
rare_sort = 1 / rarity_value
rare_class-- =If get_rarity_class(rarity_value) is not provided, fallback to rarity string
-- rare_class, rare_sort = unpack(rarities[rarity:lower()] or rarities._default)
else
end
-- If rarity_value is not provided, fallback to rarity string
rare_class, rare_sort = unpack(rarities[rarity:lower()] or rarities._default)
local rollstext = ''
end
localif rollstextrolls = ''then
if rollstext = rolls then.. ' × '
rollstextrare_sort = rollsrare_sort ../ ' × 'rolls
rare_sortrare_class = get_rarity_class(math.min(1/rare_sort / rolls,0.99))
end
rare_class = get_rarity_class(math.min(1/rare_sort,0.99))
end
local tilde = ''
if approx and type(rarity_value) == 'number' then
tilde = '~'
end
-- Add rarity and any other additional rarity-related info
local rarity_span = rarity_cell:tag('span')
rarity_span:wikitext(rollstext .. tilde .. rarity)
rarity_cell:attr('data-sort-value', rare_sort)
:addClass(rare_class)
--elseifif type(rarity_value) == false'number' then
rarity_cell:attr('title', rollstext .. tilde .. string.format('%.3g%%', 100 * rarity_value))
rarity_span:attr({
['data-drop-fraction'] = rollstext .. tilde .. rarity,
['data-drop-oneover'] = rollstext .. tilde .. '1/' .. commas(sigfig(1/rarity_value, 4)),
['data-drop-percent'] = rollstext .. tilde .. sigfig(100 * rarity_value, 3),
['data-drop-permil'] = rollstext .. tilde .. sigfig(1000 * rarity_value, 3),
['data-drop-permyriad'] = rollstext .. tilde .. sigfig(10000 * rarity_value, 3),
})
end
-- Handle alt_rarity if provided
if alt_rarity ~= '' then
if alt_rarity_endash ~= '' then
rarity_cell:tag('span'):wikitext('–')
else
rarity_cell:tag('span'):wikitext('; ')
end
local alt_rarity_span = rarity_cell:tag('span')
alt_rarity_span:wikitext(alt_rarity)
if type(alt_rarity_value) == 'number' then
alt_rarity_span:attr({
['data-drop-fraction'] = alt_rarity,
['data-drop-oneover'] = '1/' .. commas(sigfig(1/alt_rarity_value, 3)),
['data-drop-percent'] = sigfig(100 * alt_rarity_value, 3),
['data-drop-permil'] = sigfig(1000 * alt_rarity_value, 3),
['data-drop-permyriad'] = sigfig(10000 * alt_rarity_value, 3),
})
end
end
end
local _r = rarity

Navigation menu