Anonymous

Module:Skills/Artisan: Difference between revisions

From Melvor Idle
no edit summary
(Center align level requirement)
No edit summary
Line 147: Line 147:
table.sort(potionArray, function(a, b) return Skills.standardRecipeSort(skillID, a, b) end)
table.sort(potionArray, function(a, b) return Skills.standardRecipeSort(skillID, a, b) end)


local resultPart = {}
local html = mw.html.create('table')
table.insert(resultPart, '{|class="wikitable sortable stickyHeader"')
:addClass('wikitable sortable stickyHeader mw-collapsible')
table.insert(resultPart, '\r\n|- class="headerRow-0"')
table.insert(resultPart, '\r\n!Potion!!Requirements')
html:tag('tr'):addClass('headerRow-0')
table.insert(resultPart, '!!XP!!Ingredients!!style="width:30px;"|Tier!!Value!!Charges!!Effect')
:tag('th'):wikitext('Potion')
    :tag("th"):wikitext(Icons.Icon({'Herblore', type='skill', notext=true}) .. '<br>Level')
    :tag('th'):wikitext('XP')
    :tag('th'):wikitext('Ingredients')
    :tag('th'):wikitext('[[DLC]]')
    :tag('th'):wikitext('Tier')
          :css('width', '30px')
    --:tag('th'):wikitext('Value')
    :tag('th'):wikitext('Charges')
    :tag('th'):wikitext('Effect')


for i, potion in ipairs(potionArray) do
for i, potion in ipairs(potionArray) do
Line 160: Line 169:
["items"] = potion.itemCosts,
["items"] = potion.itemCosts,
["currencies"] = potion.currencyCosts
["currencies"] = potion.currencyCosts
}, 'N/A', nil, ', ')
}, 'N/A', nil, '<br>')
 
table.insert(resultPart, '\r\n|-')
local row = html:tag('tr')
local expIcon = Icons.getExpansionIcon(potion.potionIDs[1])
row:tag('td'):attr('rowspan', 4):wikitext('[['..potion.name..']]')
table.insert(resultPart, '\r\n|rowspan="4"|'..expIcon..'[['..potion.name..']]')
row:tag('td'):attr('rowspan', 4):wikitext(level)
table.insert(resultPart, '||rowspan="4" style="text-align:right" data-sort-value="' .. level .. '"|'..reqText)
:css('text-align', 'center')
table.insert(resultPart, '||rowspan="4" style="text-align:right" data-sort-value="' .. baseXP .. '"|'..Shared.formatnum(baseXP))
row:tag('td'):attr('rowspan', 4):wikitext(Shared.formatnum(baseXP))
table.insert(resultPart, '||rowspan="4"|'..costText..'||')
:attr('data-sort-value', baseXP)
:css('text-align', 'right')
row:tag('td'):attr('rowspan', 4):wikitext(costText)
row:tag('td'):attr('rowspan', 4):wikitext(Icons.getExpansionIcon(potion.potionIDs[1]))
:css('text-align', 'center')
:attr('data-sort-value', Icons.getExpansionID(potion.potionIDs[1]))


local tierRows = {}
local tierRows = {}
Line 173: Line 187:
local rowTxt = {}
local rowTxt = {}
local tierPot = Items.getItemByID(potionID)
local tierPot = Items.getItemByID(potionID)
table.insert(rowTxt, Icons.Icon({tierPot.name, type='item', notext=true}))
table.insert(rowTxt, Icons.Icon({tierPot.name, tierSuffix[j], type = 'item', noicon=true}))
-- First row needs to be added to the main row of the rowspan row.
table.insert(rowTxt, '||style="text-align:right;" data-sort-value="'..tierPot.sellsFor..'"|'..Items.getValueText(tierPot))
-- The other 3 need to be added to the main table as new rows.
table.insert(rowTxt, '||style="text-align:right;"|'..tierPot.charges..'|| '..p._getPotionDescription(tierPot))
local tierRow = j == 1 and row or html:tag('tr')
table.insert(tierRows, table.concat(rowTxt))
tierRow:tag('td'):wikitext(Icons.Icon({tierPot.name, type='item', notext=true}))
        :wikitext('[[' .. tierPot.name .. '|' .. tierSuffix[j] .. ']]')
--tierRow:tag('td'):wikitext(Items.getValueText(tierPot))
--        :css('text-align', 'right')
--        :attr('data-sort-value', tierPot.sellsFor)
tierRow:tag('td'):wikitext(tierPot.charges)
    :css('text-align', 'right')
tierRow:tag('td'):wikitext(p._getPotionDescription(tierPot))
end
end
table.insert(resultPart, table.concat(tierRows, '\r\n|-\r\n|'))
end
end


table.insert(resultPart, '\r\n|}')
return tostring(html)
return table.concat(resultPart)
end
end


2,875

edits