Module:ModifierTables: Difference between revisions

getModifierTable: Implement displayOtherMods parameter
(Include prayers)
(getModifierTable: Implement displayOtherMods parameter)
Line 175: Line 175:
end
end


function p._getModifierTable(modifiers, skill, columnName, getOpposites)
function p._getModifierTable(modifiers, skill, columnName, getOpposites, displayOtherMods)
   local modifierNames = {}
   local modifierNames = {}
   if type(modifiers) == 'string' then
   if type(modifiers) == 'string' then
Line 352: Line 352:
   result = result..'\r\n|- class="headerRow-0"'
   result = result..'\r\n|- class="headerRow-0"'
   result = result..'\r\n!Source!!Type!!'..columnName
   result = result..'\r\n!Source!!Type!!'..columnName
   if hasOtherModifiers then result = result..'!!Other Modifiers' end
   if hasOtherModifiers and displayOtherMods then result = result..'!!Other Modifiers' end


   --Sort by value if only one modifier was passed in
   --Sort by value if only one modifier was passed in
Line 373: Line 373:
     result = result..'\r\n|data-sort-value="'..row.name..'"|'..row.icon
     result = result..'\r\n|data-sort-value="'..row.name..'"|'..row.icon
     result = result..'||'..row.type..'||data-sort-value="'..row.val..'"|'..row.modifierText
     result = result..'||'..row.type..'||data-sort-value="'..row.val..'"|'..row.modifierText
     if hasOtherModifiers then
     if hasOtherModifiers and displayOtherMods then
       result = result..'||'..row.otherModifiers
       result = result..'||'..row.otherModifiers
     end
     end
Line 387: Line 387:
   local columnName = frame.args ~= nil and frame.args[2] or frame[2]
   local columnName = frame.args ~= nil and frame.args[2] or frame[2]
   local getOpposites = frame.args ~= nil and frame.args[3] or frame[3]
   local getOpposites = frame.args ~= nil and frame.args[3] or frame[3]
  local displayOtherMods = frame.args ~= nil and frame.args.displayOtherMods or frame.displayOtherMods


   if Shared.contains(modifier, ',') then
   if Shared.contains(modifier, ',') then
Line 397: Line 398:
     getOpposites = true
     getOpposites = true
   end
   end
    
    
   return p._getModifierTable(modifier, skill, columnName, getOpposites)
  if displayOtherMods ~= nil then
  displayOtherMods = string.upper(displayOtherMods) ~= 'FALSE'
  else
  displayOtherMods = true
  end
 
   return p._getModifierTable(modifier, skill, columnName, getOpposites, displayOtherMods)
end
end


return p
return p