56
edits
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 | local meetsCondition = true | ||
if discoveryModifier ~= nil then | |||
if POI.discoveryModifiers ~= nil then | |||
local modifierText = Constants.getModifiersText(POI.discoveryModifiers.modifiers)..' (for '..POI.discoveryModifiers.moves..' travels)' | |||
meetsCondition = meetsCondition and string.find(modifierText, discoveryModifier) | |||
else | |||
meetsCondition = false | |||
end | |||
end | end | ||
if | if activeModifier ~= nil then | ||
if POI.activeModifiers ~= nil then | if POI.activeModifiers ~= nil then | ||
local modifierText = Constants.getModifiersText(POI.activeModifiers) | |||
meetsCondition = meetsCondition and string.find(modifierText, activeModifier) | |||
else | |||
meetsCondition = false | |||
end | end | ||
end | end | ||
--Add Requirements | if meetsCondition then | ||
local X, Y = p.convertAxialToXY(POI.coords) | |||
table.insert(POI_Strings, POI.name..' ('..X..', '..Y..')') | |||
table.insert(tableStr,'\r\n|-\r\n|') | |||
table.insert(tableStr, Icons.Icon({POI.name, type='poi', notext='true', nolink='true', size='50'})) | |||
table.insert(tableStr, '||id="'..string.gsub(POI.name,' ', '')..'"|') | |||
--Link Dig Sites | |||
if POI.type == 'DigSite' then | |||
table.insert(tableStr, '[['..POI.name..']]') | |||
else | |||
table.insert(tableStr, POI.name) | |||
end | |||
local POIType = POI.type | |||
if POIType == 'DigSite' then | |||
POIType = 'Dig Site' | |||
else | |||
if POI.activeModifiers ~= nil then | |||
POIType = 'Active' | |||
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 |
edits