Difference between revisions of "Module:OTable"

Jump to navigation Jump to search
406 bytes added ,  13:22, 19 April 2025
m
no edit summary
m
m
 
(14 intermediate revisions by the same user not shown)
Line 49: Line 49:
local buildingType = c.type
local buildingType = c.type
local influence = ''
local influence = ''
if c.influence then
          if c.influence then
for k, v in pairs(c.influence) do
          local influenceKeys = {}
influence = influence .. i.icon(k, v, nil, k, 'en') .. '<br />'
          for k in pairs(c.influence) do
end
            if k ~= 'bsplendour' and k ~= 'tier' then -- Exclude 'bsplendour' and 'tier'... for now
local l = string.len(influence)
            table.insert(influenceKeys, k)
influence = string.sub(influence, 1, l -6)
            end
end
          end
local unlocks = influence
          local lastKey = influenceKeys[#influenceKeys]
          local itemCount = #influenceKeys
       
          for k, v in pairs(c.influence) do
            if k ~= 'bsplendour' and k ~= 'tier' then
            influence = influence .. i.icon(k, v, nil, k, 'en')
            if k ~= lastKey and itemCount > 1 then
              influence = influence .. '<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 78: Line 90:
end
end
        local construction = ''
local construction = ''
        if c.construction then
if c.construction then
            local n = #c.construction -- Trying to make it count so it excludes the last one (bonus splendor)
for k, v in pairs(c.construction) do
            local i = 0
construction = construction .. i.icon(k, v, nil, k, 'en') .. '<br />'
            for k, v in pairs(c.construction) do
end
                i = i + 1
local l = string.len(construction)
                if i < n then
if l > 0 then
                    construction = construction .. i.icon(k, v, nil, k, 'en') .. '<br />'
construction = string.sub(construction, 1, l - 6)
                end
end
            end
end
            local l = string.len(construction)
 
            if l > 0 then
-- adding gold coins back in??
                construction = string.sub(construction, 1, l -6)
if c.costs and c.costs['gold coins'] then
            end
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')
newRow:tag('th')
newRow:tag('th')
606

edits

Navigation menu