Difference between revisions of "Module:Drop"
| (6 intermediate revisions by the same user not shown) | |||
| Line 9: | Line 9: | ||
row:tag('td'):wikitext(args.Quantity) | row:tag('td'):wikitext(args.Quantity) | ||
| − | local rarity = row:tag('td'):wikitext( | + | local text = args.Rate and args.Rate or args.Rarity |
| + | |||
| + | local rarity = row:tag('td'):wikitext(text) | ||
if args.Rarity == 'Rare' then | if args.Rarity == 'Rare' then | ||
| − | rarity:attr('style', 'background-color: # | + | rarity:attr('style', 'background-color: #b55e0c; color: #fef0e4') |
elseif args.Rarity == 'Uncommon' then | elseif args.Rarity == 'Uncommon' then | ||
| − | rarity:attr('style', 'background-color: # | + | rarity:attr('style', 'background-color: #a48900; color: #fef9de') |
elseif args.Rarity == 'Common' then | elseif args.Rarity == 'Common' then | ||
| − | rarity:attr('style', 'background-color: ## | + | rarity:attr('style', 'background-color: #3c780a; color: #ecf8e3') |
elseif args.Rarity == 'Very rare' then | elseif args.Rarity == 'Very rare' then | ||
| − | rarity:attr('style', 'background-color: # | + | rarity:attr('style', 'background-color: #9f261e; color: #feecea') |
end | end | ||
Latest revision as of 09:12, 28 September 2023
Documentation for this module may be created at Module:Drop/doc
local export = {}
local item = require('Module:Item')
function export.main(frame)
local args = frame:getParent().args
local row = mw.html.create('tr'):addClass('coa-drop-row')
row:tag('td'):attr('style', 'text-align:left'):wikitext(item.inline(args.Name))
row:tag('td'):wikitext(args.Quantity)
local text = args.Rate and args.Rate or args.Rarity
local rarity = row:tag('td'):wikitext(text)
if args.Rarity == 'Rare' then
rarity:attr('style', 'background-color: #b55e0c; color: #fef0e4')
elseif args.Rarity == 'Uncommon' then
rarity:attr('style', 'background-color: #a48900; color: #fef9de')
elseif args.Rarity == 'Common' then
rarity:attr('style', 'background-color: #3c780a; color: #ecf8e3')
elseif args.Rarity == 'Very rare' then
rarity:attr('style', 'background-color: #9f261e; color: #feecea')
end
return tostring(row)
end
return export