Module:Skills/Artisan: Difference between revisions

Correct inconsistencies in potion descriptions, and temporary fix for Traps Potion
(Use classes rather than styles where possible)
(Correct inconsistencies in potion descriptions, and temporary fix for Traps Potion)
Line 94: Line 94:


local tierSuffix = { 'I', 'II', 'III', 'IV' }
local tierSuffix = { 'I', 'II', 'III', 'IV' }
function p._getPotionDescription(potion)
-- TODO: Temporary fix below for incorrect Traps Potion descriptions. To amend
-- once corrected within game data
if potion.customDescription and not Shared.contains(potion.id, 'melvorTotH:Traps_Potion_') then
return potion.customDescription
elseif type(potion.modifiers) == 'table' and not Shared.tableIsEmpty(potion.modifiers) then
return Constants.getModifiersText(potion.modifiers, false, true)
else
return ''
end
end
function p._getHerblorePotionTable(categoryName)
function p._getHerblorePotionTable(categoryName)
local categoryID = nil
local categoryID = nil
Line 116: Line 128:
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|-')
local expIcon = Icons.getExpansionIcon(potion.potionIDs[1])
local expIcon = Icons.getExpansionIcon(potion.potionIDs[1])
if potion.name == 'Bird Nests Potion' then
table.insert(resultPart, '\r\n|rowspan="4"|'..expIcon..'[['..potion.name..']]')
table.insert(resultPart, '\r\n|rowspan="4"|'..expIcon..'[[Bird Nest Potion]]')
else
table.insert(resultPart, '\r\n|rowspan="4"|'..expIcon..'[['..potion.name..']]')
end
table.insert(resultPart, '||rowspan="4" style="text-align:right"|'..potion.level)
table.insert(resultPart, '||rowspan="4" style="text-align:right"|'..potion.level)
table.insert(resultPart, '||rowspan="4" style="text-align:right"|'..potion.baseExperience)
table.insert(resultPart, '||rowspan="4" style="text-align:right"|'..potion.baseExperience)
Line 135: Line 143:
local rowTxt = {}
local rowTxt = {}
local tierPot = Items.getItemByID(potionID)
local tierPot = Items.getItemByID(potionID)
local potDesc = ''
if type(tierPot.modifiers) == 'table' and not Shared.tableIsEmpty(tierPot.modifiers) then
potDesc = Constants.getModifiersText(tierPot.modifiers, false) or ''
end
table.insert(rowTxt, Icons.Icon({tierPot.name, type='item', notext=true}))
table.insert(rowTxt, Icons.Icon({tierPot.name, type='item', notext=true}))
table.insert(rowTxt, Icons.Icon({tierPot.name, tierSuffix[j], type = 'item', noicon=true}))
table.insert(rowTxt, Icons.Icon({tierPot.name, tierSuffix[j], type = 'item', noicon=true}))
table.insert(rowTxt, '||style="text-align:right;" data-sort-value="'..tierPot.sellsFor..'"|'..Icons.GP(tierPot.sellsFor))
table.insert(rowTxt, '||style="text-align:right;" data-sort-value="'..tierPot.sellsFor..'"|'..Icons.GP(tierPot.sellsFor))
table.insert(rowTxt, '||style="text-align:right;"|'..tierPot.charges..'|| '..potDesc)
table.insert(rowTxt, '||style="text-align:right;"|'..tierPot.charges..'|| '..p._getPotionDescription(tierPot))
table.insert(tierRows, table.concat(rowTxt))
table.insert(tierRows, table.concat(rowTxt))
end
end
Line 167: Line 171:
local resultPart = {}
local resultPart = {}
table.insert(resultPart, '{| class="wikitable"')
table.insert(resultPart, '{| class="wikitable"')
--The Bird Nest Potion specifically has the wrong name in code
table.insert(resultPart, '\r\n!colspan=4|[['..potionName..']]')
if potionName == 'Bird Nests Potion' then
table.insert(resultPart, '\r\n!colspan=4|[[Bird Nest Potion]]')
else
table.insert(resultPart, '\r\n!colspan=4|[['..potionName..']]')
end
table.insert(resultPart, '\r\n|-\r\n!Potion!!Tier!!Charges!!Effect')
table.insert(resultPart, '\r\n|-\r\n!Potion!!Tier!!Charges!!Effect')


Line 179: Line 178:
local potion = Items.getItemByID(potionID)
local potion = Items.getItemByID(potionID)
if potion ~= nil then
if potion ~= nil then
local potDesc = potion.customDescription or ''
if potDesc == '' and type(potion.modifiers) == 'table' and not Shared.tableIsEmpty(potion.modifiers) then
potDesc = Constants.getModifiersText(potion.modifiers, false) or ''
end
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n| ' .. Icons.Icon({potion.name, type='item', notext=true, size='60'}))
table.insert(resultPart, '\r\n| ' .. Icons.Icon({potion.name, type='item', notext=true, size='60'}))
table.insert(resultPart, '|| ' .. Icons.getExpansionIcon(potion.id) .. Icons.Icon({potion.name, tier, type='item', noicon=true}))
table.insert(resultPart, '|| ' .. Icons.getExpansionIcon(potion.id) .. Icons.Icon({potion.name, tier, type='item', noicon=true}))
table.insert(resultPart, '|| ' .. potion.charges .. '|| ' .. potDesc)
table.insert(resultPart, '|| ' .. potion.charges .. '|| ' .. p._getPotionDescription(potion))
end
end
end
end