Module:ModifierTables/Sandbox: Difference between revisions

no edit summary
(Created page with "--Module that constructs tables for all things that can affect Player Modifiers --This includes Agility, Equipment, Pets, Prayers, and Constellations right now local p = {} local Constants = require('Module:Constants') local Shared = require('Module:Shared') local Common = require('Module:Common') local Modifiers = require('Module:Modifiers') local Pets = require('Module:Pets') local Items = require('Module:Items') local Skills = require('Module:Skills') local Agility...")
 
No edit summary
Line 206: Line 206:
row.icon = Icons.Icon({item.name, type='item'})
row.icon = Icons.Icon({item.name, type='item'})
row.expIcon = Icons.getExpansionIcon(item.id)
row.expIcon = Icons.getExpansionIcon(item.id)
row.expSort = Icons.getExpansionID(item.id)
row.type = 'Item'
row.type = 'Item'
row.typeText = row.type
row.typeText = row.type
Line 235: Line 236:
row.icon = Icons.Icon({pet.name, type='pet'})
row.icon = Icons.Icon({pet.name, type='pet'})
row.expIcon = Icons.getExpansionIcon(pet.id)
row.expIcon = Icons.getExpansionIcon(pet.id)
row.expSort = Icons.getExpansionID(pet.id)
row.type = '[[Pets|Pet]]'
row.type = '[[Pets|Pet]]'
row.typeText = 'Pet'
row.typeText = 'Pet'
Line 256: Line 258:
row.icon = Icons.Icon({'Agility%23'..string.gsub(obst.name, ' ', ''), obst.name, type='skill', img='Agility'})
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.expSort = Icons.getExpansionID(obst.id)
row.type = '[[Agility#Obstacles|Agility Obstacle '..tostring(tonumber(obst.category)+1)..']]'
row.type = '[[Agility#Obstacles|Agility Obstacle '..tostring(tonumber(obst.category)+1)..']]'
row.typeText = 'Agility Obstacle '..string.format("%02d", (obst.category + 1))
row.typeText = 'Agility Obstacle '..string.format("%02d", (obst.category + 1))
Line 276: Line 279:
row.icon = Icons.Icon({'Agility%23'..string.gsub(pillar.name, ' ', ''), pillar.name, type='skill', img='Agility'})
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.expSort = Icons.getExpansionID(pillar.id)
row.type = '[[Agility#Passive Pillars|Agility Pillar]]'
row.type = '[[Agility#Passive Pillars|Agility Pillar]]'
row.typeText = 'Agility Pillar'
row.typeText = 'Agility Pillar'
Line 296: Line 300:
row.icon = Icons.Icon({prayer.name, type='prayer'})
row.icon = Icons.Icon({prayer.name, type='prayer'})
row.expIcon = Icons.getExpansionIcon(prayer.id)
row.expIcon = Icons.getExpansionIcon(prayer.id)
row.expSort = Icons.getExpansionID(prayer.id)
row.type = [[Prayer]]
row.type = [[Prayer]]
row.typeText = 'Prayer'
row.typeText = 'Prayer'
Line 316: Line 321:
row.icon = Icons.Icon({row.name, type='upgrade'})
row.icon = Icons.Icon({row.name, type='upgrade'})
row.expIcon = Icons.getExpansionIcon(upgrade.id)
row.expIcon = Icons.getExpansionIcon(upgrade.id)
row.expSort = Icons.getExpansionID(upgrade.id)
row.type = '[[Shop|Upgrade]]'
row.type = '[[Shop|Upgrade]]'
row.typeText = 'Upgrade'
row.typeText = 'Upgrade'
Line 345: Line 351:
row.icon = Icons.Icon({cons.name, type='constellation'})
row.icon = Icons.Icon({cons.name, type='constellation'})
row.expIcon = Icons.getExpansionIcon(cons.id)
row.expIcon = Icons.getExpansionIcon(cons.id)
row.expSort = Icons.getExpansionID(cons.id)
row.type = '[[Astrology#Constellations|Constellation]]'
row.type = '[[Astrology#Constellations|Constellation]]'
row.typeText = 'Constellation'
row.typeText = 'Constellation'
Line 365: Line 372:
row.icon = Icons.Icon({POI.name, type='poi'})
row.icon = Icons.Icon({POI.name, type='poi'})
row.expIcon = Icons.getExpansionIcon(POI.id)
row.expIcon = Icons.getExpansionIcon(POI.id)
row.expSort = Icons.getExpansionID(POI.id)
row.type = '[[Cartography|Point of Interest]]'
row.type = '[[Cartography|Point of Interest]]'
row.typeText = 'Point of Interest'
row.typeText = 'Point of Interest'
Line 385: Line 393:
row.icon = Icons.Icon({'Cartography', Shared.formatnum(bonus.masteredHexes) .. ' Hexes Mastered', type='skill'})
row.icon = Icons.Icon({'Cartography', Shared.formatnum(bonus.masteredHexes) .. ' Hexes Mastered', type='skill'})
row.expIcon = Icons.getExpansionIcon(bonus.id)
row.expIcon = Icons.getExpansionIcon(bonus.id)
row.expSort = Icons.getExpansionID(bonus.id)
row.type = Icons.Icon({'Cartography', 'Mastery Bonus', section='Mastery Unlocks', type='skill', noicon=true})
row.type = Icons.Icon({'Cartography', 'Mastery Bonus', section='Mastery Unlocks', type='skill', noicon=true})
row.typeText = 'Mastery Bonus'
row.typeText = 'Mastery Bonus'
Line 399: Line 408:
end
end


local result = '{| class="wikitable sortable stickyHeader"'
local html = mw.html.create('table')
result = result..'\r\n|- class="headerRow-0"'
:addClass("wikitable sortable stickyHeader mw-collapsible")
result = result..'\r\n!Source!!Type!!'..columnName
if hasOtherModifiers and displayOtherMods then result = result..'!!Other Modifiers' end
html:tag('tr'):addClass("headerRow-0")
:tag('th'):wikitext('Source')
:tag('th'):wikitext('Type')
:tag('th'):wikitext('[[DLC]]')
:tag('th'):wikitext(columnName)
 
if hasOtherModifiers and displayOtherMods then  
html:tag('th'):wikitext('Other Modifiers')
end


--Sort by value if only one modifier was passed in
--Sort by value if only one modifier was passed in
Line 416: Line 433:
end)
end)
for i, row in ipairs(tableArray) do
for i, row in ipairs(tableArray) do
result = result..'\r\n|-'
html:tag('tr')
result = result..'\r\n|data-sort-value="'..row.name..'"|'..row.icon
:tag('td'):wikitext(row.icon)
result = result..'|| data-sort-value="'..row.typeText..'" | '..row.expIcon..row.type..'||data-sort-value="'..row.val..'"| '..row.modifierText
  :attr('data-sort-value', row.name)
:tag('td'):wikitext(row.type)
  :attr('data-sort-value', row.typeText)
:tag('td'):wikitext(row.expIcon)
  :css('text-align', 'center')
  :attr('data-sort-value', row.expSort)
:tag('td'):wikitext(row.modifierText)
  :attr('data-sort-value', row.val)
 
if hasOtherModifiers and displayOtherMods then
if hasOtherModifiers and displayOtherMods then
result = result..'|| '..row.otherModifiers
html:tag('td'):wikitext(row.otherModifiers)
end
end
end
end


result = result..'\r\n|}'
return tostring(html)
return result
end
end


2,875

edits