4,951
edits
(getModifierTable: Add option to force modifier magnitude sorting) |
Falterfire (talk | contribs) (Attempting to add Points of Interest to Modifier tables) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
local Shop = require('Module:Shop') | local Shop = require('Module:Shop') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
local Cartography = require('Module:Skills/Cartography') | |||
--First up, functions to get all the things in a category that have a given modifier: | --First up, functions to get all the things in a category that have a given modifier: | ||
Line 195: | Line 196: | ||
end) | end) | ||
return upgradeList | return upgradeList | ||
end | |||
function p.getPOIsWithModifier(modifiers, skill, getOpposites) | |||
if type(modifiers) == 'string' then | |||
modifiers = {modifiers} | |||
end | |||
local POIList = Cartography.getPointsOfInterest( | |||
function(POI) | |||
if POI.activeModifiers == nil then | |||
return false | |||
end | |||
for i, mod in ipairs(modifiers) do | |||
if p.getModifierValue(POI.activeModifiers, mod, skill, getOpposites) ~= 0 then | |||
return true | |||
end | |||
end | |||
return false | |||
end) | |||
return POIList | |||
end | end | ||
Line 333: | Line 355: | ||
local row = {} | local row = {} | ||
row.name = obst.name | row.name = obst.name | ||
row.icon = Icons.Icon({'Agility', obst.name, type='skill'}) | row.icon = Icons.Icon({'Agility%23'..string.gsub(obst.name, ' ', ''), obst.name, type='skill', img='Agility'}) | ||
row.expIcon = Icons.getExpansionIcon(obst.id) | row.expIcon = Icons.getExpansionIcon(obst.id) | ||
row.type = '[[Agility#Obstacles|Agility Obstacle '..tostring(tonumber(obst.category)+1)..']]' | row.type = '[[Agility#Obstacles|Agility Obstacle '..tostring(tonumber(obst.category)+1)..']]' | ||
Line 356: | Line 378: | ||
local row = {} | local row = {} | ||
row.name = pillar.name | row.name = pillar.name | ||
row.icon = Icons.Icon({'Agility', pillar.name, type='skill'}) | row.icon = Icons.Icon({'Agility%23'..string.gsub(pillar.name, ' ', ''), pillar.name, type='skill', img='Agility'}) | ||
row.expIcon = Icons.getExpansionIcon(pillar.id) | row.expIcon = Icons.getExpansionIcon(pillar.id) | ||
row.type = '[[Agility#Passive Pillars|Agility Pillar]]' | row.type = '[[Agility#Passive Pillars|Agility Pillar]]' | ||
Line 423: | Line 445: | ||
local constellationList = p.getConstellationsWithModifier(modifiers, skill, getOpposites) | local constellationList = p.getConstellationsWithModifier(modifiers, skill, getOpposites) | ||
for i, cons in ipairs(constellationList) do | for i, cons in ipairs(constellationList) do | ||
local modList = Skills._buildAstrologyModifierArray(cons, nil, true, true, true, true) | |||
local row = {} | local row = {} | ||
row.name = cons.name | row.name = cons.name | ||
Line 429: | Line 452: | ||
row.type = '[[Astrology#Constellations|Constellation]]' | row.type = '[[Astrology#Constellations|Constellation]]' | ||
row.typeText = 'Constellation' | row.typeText = 'Constellation' | ||
row.val = | row.modifierText, row.otherModifiers = getModText(modList) | ||
local totalVal = 0 | |||
for i, mod in pairs(modifiers) do | |||
totalVal = totalVal + p.getModifierValue(modList, mod, skill, getOpposites) | |||
end | |||
row.val = totalVal | |||
local | if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then | ||
row.modifierText, row.otherModifiers = getModText( | hasOtherModifiers = true | ||
end | |||
table.insert(tableArray, row) | |||
end | |||
local POIList = p.getPOIsWithModifier(modifiers, skill, getOpposites) | |||
for i, POI in ipairs(POIList) do | |||
local row = {} | |||
row.name = POI.name | |||
row.icon = Icons.Icon({POI.name, type='poi'}) | |||
row.expIcon = Icons.getExpansionIcon(POI.id) | |||
row.type = '[[Cartography|Point of Interest]]' | |||
row.typeText = 'Point of Interest' | |||
local totalVal = 0 | |||
for i, mod in ipairs(modifiers) do | |||
totalVal = totalVal + p.getModifierValue(POI.activeModifiers, mod, skill, getOpposites) | |||
end | |||
row.val = totalVal | |||
row.modifierText, row.otherModifiers = getModText(POI.activeModifiers) | |||
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then | if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then |