Bureaucrats, editor, Interface administrators, Administrators (Semantic MediaWiki), Curators (Semantic MediaWiki), Editors (Semantic MediaWiki), Administrators
47,327
edits
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
Line 366:
-- rarity cell contents
local rare_class, rare_sort
--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)
-- If rarity_value is provided, calculate rare_sort
else▼
▲ else
end▼
local rollstext = ''
▲ end
end
▲ 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)
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
|