Difference between revisions of "Module:OTable"

Jump to navigation Jump to search
m
no edit summary
m
m
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
-- This is adapted from Sakaratte's table located at Module:Tables --
local com = require('Module:Common')
local com = require('Module:Common')
local a = require('Module:Arguments')
local a = require('Module:Arguments')
Line 8: Line 10:
local args = a.getArgs(frame)
local args = a.getArgs(frame)
local buildingTable = mw.html.create('table')
local buildingTable = mw.html.create('table')
local dataTasble = {}
local dataTable = {}
for k, v in pairs(buildingList) do
for k, v in pairs(buildingList) do
if v.group == args['group'] or not args['group'] then
if v.group == args['group'] or not args['group'] then
Line 25: Line 27:
:done()
:done()
:tag('th')
:tag('th')
:wikitext('Unlocks')
:wikitext('Prerequisites')
:done()
:done()
:tag('th')
:tag('th')
Line 45: Line 47:
local buildingName = buildString:format(pageTitle, u .. string.sub(v, 2))
local buildingName = buildString:format(pageTitle, u .. string.sub(v, 2))
local c = buildingList[v]
local c = buildingList[v]
local getUnlocks = {}
local buildingType = c.type
table.insert(getUnlocks, c.building)
local influence = ''
table.insert(getUnlocks, c.population)
          if c.influence then
if c.path then
          local influenceKeys = {}
for k, v in pairs(c.path) do
          for k in pairs(c.influence) do
table.insert(getUnlocks, i.icon(k .. ' path', v, nil, nil, 'en'))
            if k ~= 'bsplendour' and k ~= 'tier' then -- Exclude 'bsplendour' and 'tier'... for now
end
            table.insert(influenceKeys, k)
end
            end
          end
if c.influence then
          local lastKey = influenceKeys[#influenceKeys]
for k, v in pairs(c.influence) do
          local itemCount = #influenceKeys
table.insert(getUnlocks, i.icon(k .. ' influence', v, nil, nil, 'en'))
       
end
          for k, v in pairs(c.influence) do
end
            if k ~= 'bsplendour' and k ~= 'tier' then
            influence = influence .. i.icon(k, v, nil, k, 'en')
local Unlocks = ''
            if k ~= lastKey and itemCount > 1 then
for k, v in ipairs(getUnlocks) do
              influence = influence .. '<br />'
Unlocks = Unlocks .. v
            end
if k ~= #getUnlocks then
            end
Unlocks = Unlocks .. '<br />'
          end
end
          end
end
          local unlocks = influence
local production = ''
local production = ''
if c.input then  
if c.input then  
production = '\'\'\'Requires:\'\'\'<br />'
production = '\'\'\'Consumes:\'\'\'<br />'
for k, v in pairs(c.input) do
for k, v in pairs(c.input) do
production = production .. i.icon(v, nil, nil, v, 'en') .. '<br />'
production = production .. i.icon(v, nil, nil, v, 'en') .. '<br />'
Line 94: Line 96:
end
end
local l = string.len(construction)
local l = string.len(construction)
construction = string.sub(construction, 1, l -6)
if l > 0 then
construction = string.sub(construction, 1, l - 6)
end
end
 
-- adding gold coins back in??
if c.costs and c.costs['gold coins'] then
construction = construction .. '<br />' .. i.icon('gold coins', c.costs['gold coins'], nil, 'gold coins', 'en')
end
end
local newRow = mw.html.create('tr')
local newRow = mw.html.create('tr')
606

edits

Navigation menu