Module:Skills/Cartography: Difference between revisions

Fix POI discovery rewards handling
(getPointOfInterestTable: Fix active modifiers)
(Fix POI discovery rewards handling)
Line 136: Line 136:
end
end
return reqTable
return reqTable
end
function p._getDiscoveryRewards(POI)
local rewardTable = {}
if POI.discoveryRewards ~= nil then
if POI.discoveryRewards.gp ~= nil then
table.insert(rewardTable, Icons.GP(POI.discoveryRewards.gp))
end
if POI.discoveryRewards.sc ~= nil then
table.insert(rewardTable, Icons.SC(POI.discoveryRewards.sc))
end
if POI.discoveryRewards.items ~= nil then
for j, reward in pairs(POI.discoveryRewards.items) do
local item = Items.getItemByID(reward.id)
local qty = reward.quantity
table.insert(rewardTable, Icons.Icon({item.name, type='item', qty = qty}))
end
end
end
return rewardTable
end
end


Line 300: Line 280:
--Add Discovery Rewards
--Add Discovery Rewards
table.insert(tableStr, '\r\n|')
table.insert(tableStr, '\r\n|')
local rewardTable = p._getDiscoveryRewards(POI)
table.insert(tableStr, Common.getCostString(POI.discoveryRewards or {}, ''))
table.insert(tableStr, table.concat(rewardTable,'<br/>'))
--Add Discovery Modifiers
--Add Discovery Modifiers
Line 359: Line 338:
tr:tag('td'):wikitext(Y)
tr:tag('td'):wikitext(Y)
tr:tag('td'):wikitext(table.concat(p._getPOIRequirements(POI), '<br/>'))
tr:tag('td'):wikitext(table.concat(p._getPOIRequirements(POI), '<br/>'))
tr:tag('td'):wikitext(table.concat(p._getDiscoveryRewards(POI), '<br/>'))
tr:tag('td'):wikitext(Common.getCostString(POI.discoveryRewards or {}, ''))
resultTable:node(tr)
resultTable:node(tr)
end
end