Anonymous

Module:Skills/Cartography: Difference between revisions

From Melvor Idle
Add support for discoveryModifier and activeModifier parameters
m (Added note that overlapping features must go in Skills/Archaeology)
(Add support for discoveryModifier and activeModifier parameters)
Line 228: Line 228:


function p.getPointOfInterestTable(frame)
function p.getPointOfInterestTable(frame)
local args = frame.args ~= nil and frame.args or frame
local POIs = {}
local POIs = {}
local POI_Strings = {}
local POI_Strings = {}
local tableStr = {}
local tableStr = {}
local discoveryModifier = args.discoveryModifier
local activeModifier = args.activeModifier
table.insert(tableStr, '{| class="wikitable sortable lighttable"')
table.insert(tableStr, '{| class="wikitable sortable lighttable"')
table.insert(tableStr, '\r\n|-\r\n!colspan="2"|Name!!Type!!X!!Y!!Requirements!!Discovery Rewards!!Discovery Modifiers!!Active Effect')
table.insert(tableStr, '\r\n|-\r\n!colspan="2"|Name!!Type!!X!!Y!!Requirements!!Discovery Rewards!!Discovery Modifiers!!Active Effect')
Line 240: Line 244:
for i, POI in pairs(POIs) do
for i, POI in pairs(POIs) do
local X, Y = p.convertAxialToXY(POI.coords)
local meetsCondition = true
table.insert(POI_Strings, POI.name..' ('..X..', '..Y..')')
table.insert(tableStr,'\r\n|-\r\n|')
if discoveryModifier ~= nil then
table.insert(tableStr, Icons.Icon({POI.name, type='poi', notext='true', nolink='true', size='50'}))
if POI.discoveryModifiers ~= nil then
table.insert(tableStr, '||id="'..string.gsub(POI.name,' ', '')..'"|')
local modifierText = Constants.getModifiersText(POI.discoveryModifiers.modifiers)..' (for '..POI.discoveryModifiers.moves..' travels)'
--Link Dig Sites
meetsCondition = meetsCondition and string.find(modifierText, discoveryModifier)
if POI.type == 'DigSite' then
else
table.insert(tableStr, '[['..POI.name..']]')
meetsCondition = false
else
end
table.insert(tableStr, POI.name)
end
end
local POIType = POI.type
if POIType == 'DigSite' then
if activeModifier ~= nil then
POIType = 'Dig Site'
else
if POI.activeModifiers ~= nil then
if POI.activeModifiers ~= nil then
POIType = 'Active'
local modifierText = Constants.getModifiersText(POI.activeModifiers)
elseif POI.fastTravel ~= nil then
meetsCondition = meetsCondition and string.find(modifierText, activeModifier)
POIType = 'Port'
else
meetsCondition = false
end
end
end
end
table.insert(tableStr, '||'..POIType)
table.insert(tableStr, '||'..X)
table.insert(tableStr, '||'..Y)
--Add Requirements
if meetsCondition then
table.insert(tableStr, '\r\n|')
local X, Y = p.convertAxialToXY(POI.coords)
local reqTable= p._getPOIRequirements(POI)
table.insert(POI_Strings, POI.name..' ('..X..', '..Y..')')
table.insert(tableStr, table.concat(reqTable, '<br/>'))
table.insert(tableStr,'\r\n|-\r\n|')
--Add Discovery Rewards
table.insert(tableStr, Icons.Icon({POI.name, type='poi', notext='true', nolink='true', size='50'}))
table.insert(tableStr, '\r\n|')
table.insert(tableStr, '||id="'..string.gsub(POI.name,' ', '')..'"|')
local rewardTable = p._getDiscoveryRewards(POI)
--Link Dig Sites
table.insert(tableStr, table.concat(rewardTable,'<br/>'))
if POI.type == 'DigSite' then
table.insert(tableStr, '[['..POI.name..']]')
--Add Discovery Modifiers
else
table.insert(tableStr, '\r\n|')
table.insert(tableStr, POI.name)
if POI.discoveryModifiers ~= nil then
end
table.insert(tableStr, Constants.getModifiersText(POI.discoveryModifiers.modifiers)..' (for '..POI.discoveryModifiers.moves..' travels)')
local POIType = POI.type
end
if POIType == 'DigSite' then
POIType = 'Dig&nbsp;Site'
--Add Active Modifiers
else
table.insert(tableStr, '\r\n|')
if POI.activeModifiers ~= nil then
if POI.activeModifiers ~= nil then
POIType = 'Active'
table.insert(tableStr, Constants.getModifiersText(POI.activeModifiers))
elseif POI.fastTravel ~= nil then
POIType = 'Port'
end
end
table.insert(tableStr, '||'..POIType)
table.insert(tableStr, '||'..X)
table.insert(tableStr, '||'..Y)
--Add Requirements
table.insert(tableStr, '\r\n|')
local reqTable= p._getPOIRequirements(POI)
table.insert(tableStr, table.concat(reqTable, '<br/>'))
--Add Discovery Rewards
table.insert(tableStr, '\r\n|')
local rewardTable = p._getDiscoveryRewards(POI)
table.insert(tableStr, table.concat(rewardTable,'<br/>'))
--Add Discovery Modifiers
table.insert(tableStr, '\r\n|')
if POI.discoveryModifiers ~= nil then
table.insert(tableStr, Constants.getModifiersText(POI.discoveryModifiers.modifiers)..' (for '..POI.discoveryModifiers.moves..' travels)')
end
--Add Active Modifiers
table.insert(tableStr, '\r\n|')
if POI.activeModifiers ~= nil then
table.insert(tableStr, Constants.getModifiersText(POI.activeModifiers))
end
end
end
end
end
56

edits