Difference between revisions of "Module:OInfobox-Building"

Jump to navigation Jump to search
m
no edit summary
m
m
 
(32 intermediate revisions by the same user not shown)
Line 236: Line 236:
         --/
         --/
         --SECTION-RUNNING-COSTS
         --SECTION-RUNNING-COSTS
        local costData = {}
local costData = {}
local goldCoinsFound = false


if buildingData.costs or buildingData.influence['bsplendour'] then
    if buildingData.costs or buildingData.influence['bsplendour'] then
             local costData = {}
        for resource, amount in pairs(buildingData.costs) do
             local labelText = com.firstUpper({resource})
             if resource == 'gold coins' then
            if resource == 'gold coins' then
                local resourceIcon = i.icon('gold coins', nil, nil, 'gold coins', 'en')
        labelText = com.firstUpper({'build cost'})
                table.insert(costData, {label = '[[File:Gold Coins.png|frameless|20x20px]] ' .. '[[Gold Coins|Build Cost]]', value = amount})
    end
                goldCoinsFound = true
             local resourceIcon = i.icon(resource, nil, nil, labelText, 'en') -- Use the correctly set labelText
             elseif resource ~= 'maintenance' then
    table.insert(costData, {label = resourceIcon, value = amount})
                local resourceIcon = i.icon(resource, nil, nil, com.firstUpper({resource}), 'en')
           
                table.insert(costData, {label = resourceIcon, value = amount})
            end
            if resource ~= 'maintenance' then
            local displayAmount = amount
            if second and buildingData.costs.maintenance then
              displayAmount = displayAmount .. ' ' .. buildingData.costs.maintenance
              second = false
              end
          end
        end
       
        if buildingData.costs and buildingData.costs['maintenance'] then
             local resourceIcon = i.icon('maintenance', nil, nil, 'maintenance', 'en')
            table.insert(costData, {label = resourceIcon, value = '[[File:Gold Coins.png|frameless|20x20px]] ' .. buildingData.costs['maintenance'] .. ' monthly'})
         end
         end
 
-- Add 'bsplendour' to running costs if it exists
        if buildingData.influence['bsplendour'] then
if buildingData.influence['bsplendour'] then
             local resourceIcon = i.icon('bsplendour', nil, nil, 'splendor', 'en')
             local resourceIcon = i.icon('bsplendour', nil, nil, 'splendor', 'en')
        table.insert(costData, {label = resourceIcon, value = buildingData.influence['bsplendour']})
            table.insert(costData, {label = '[[File:Splendor.png|frameless|20x20px]] ' .. '[[Splendour|Splendour]]', value = '+ ' .. buildingData.influence['bsplendour'] .. ' ea'})
            end
        end
 
            if #costData > 0 then
        if #costData > 0 then
                addSection(infobox, costData, 'Economic Impact', 2)
            addSection(infobox, costData, 'Economic Impact', 2)
            end
        end
          
         end
        --/
     end
     end
     --/
     --/
606

edits

Navigation menu