17,428
edits
(_getRecipeTable: Amend XP rate number formatting) |
(_getRecipeTable: Determine DLC correctly for recipes with alt costs) |
||
Line 518: | Line 518: | ||
["ItemName"] = {["header"] = 'Name', ["altRepeat"] = true}, | ["ItemName"] = {["header"] = 'Name', ["altRepeat"] = true}, | ||
["SkillLevel"] = {["header"] = Icons._SkillRealmIcon(skillName, categoryRealm) .. ' Level', ["altRepeat"] = false}, | ["SkillLevel"] = {["header"] = Icons._SkillRealmIcon(skillName, categoryRealm) .. ' Level', ["altRepeat"] = false}, | ||
["DLC"] = {["header"] = '[[DLC]]', ["altRepeat"] = | ["DLC"] = {["header"] = '[[DLC]]', ["altRepeat"] = true}, | ||
["SkillXP"] = {["header"] = 'XP', ["altRepeat"] = false}, | ["SkillXP"] = {["header"] = 'XP', ["altRepeat"] = false}, | ||
["Currency"] = {["header"] = 'Value', ["altRepeat"] = true}, | ["Currency"] = {["header"] = 'Value', ["altRepeat"] = true}, | ||
Line 566: | Line 566: | ||
if item ~= nil then | if item ~= nil then | ||
-- Some recipes have alternative costs, so the recipe may require multiple rows | -- Some recipes have alternative costs, so the recipe may require multiple rows | ||
local | local hasAltCosts = recipe.alternativeCosts ~= nil and not Shared.tableIsEmpty(recipe.alternativeCosts) | ||
local costList = (hasAltCosts and recipe.alternativeCosts) or {{["itemCosts"] = recipe.itemCosts}} | |||
local costCount = Shared.tableCount(costList) | local costCount = Shared.tableCount(costList) | ||
-- Build one row per element within costList | -- Build one row per element within costList | ||
Line 604: | Line 600: | ||
:css('text-align', 'right') | :css('text-align', 'right') | ||
elseif colID == 'DLC' then | elseif colID == 'DLC' then | ||
cell:wikitext(Icons.getDLCColumnIcon( | local dlcID = recipe.id | ||
:attr('data-sort-value', Icons.getExpansionID( | if hasAltCosts then | ||
-- For alt costs, look at the namespace of the required materials, | |||
-- as the recipe could be from base game but using expansion materials | |||
local recNS, recLocalID = Shared.getLocalID(recipe.id) | |||
if Shared.contains({'melvorD', 'melvorF'}, recNS) then | |||
for k, mat in ipairs(costDef.itemCosts) do | |||
local matNS, matLocalID = Shared.getLocalID(mat.id) | |||
if matNS ~= recNS then | |||
dlcID = mat.id | |||
break | |||
end | |||
end | |||
end | |||
end | |||
cell:wikitext(Icons.getDLCColumnIcon(dlcID)) | |||
:attr('data-sort-value', Icons.getExpansionID(dlcID)) | |||
:css('text-align', 'center') | :css('text-align', 'center') | ||
elseif colID == 'SkillXP' then | elseif colID == 'SkillXP' then |