Anonymous

Module:Sandbox/GauTest/ModifierTables: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 234: Line 234:




function p._getModifierTable(modifiers, skill, columnName, getOpposites, displayOtherMods, maxOtherMods, township)
function p._getModifierTable(modifiers, skill, columnName, getOpposites, displayOtherMods, maxOtherMods, townshipBuildingName)
local modifierNames = {}
local modifierNames = {}
if type(modifiers) == 'string' then
if type(modifiers) == 'string' then
Line 465: Line 465:
-- Special biomeModifiers for Township buildings
-- Special biomeModifiers for Township buildings
if townshipBuildingName ~= nil then
if townshipBuildingName ~= nil then
local building = Township.GetBuildingByName(townshipBuildingName)
local building = Township._GetBuildingByName(townshipBuildingName)
for _, biome in ipairs(building.biomeModifiers) do
for _, biome in ipairs(building.biomeModifiers) do
local biomename = GameData.getEntityByID(GameData.skillData.Township.biomes, biome.biomeID).name
local biomename = GameData.getEntityByID(GameData.skillData.Township.biomes, biome.biomeID).name
local row = {}
local row = {}
row.name = GameData.getEntityByID(GameData.skillData.Township.biomes, biome.biomeID).name
row.name = GameData.getEntityByID(GameData.skillData.Township.biomes, biome.biomeID).name
row.icon = Icons.Icon({'Township', type='skill'})
row.icon = Icons.Icon({row.name, link='Biome', img='Township', type='skill'})
row.type = 'Biome'
row.type = 'Biome'
row.val = biome.value
row.val = biome.value
row.modifierText, row.otherModifiers = getModText({['TownshipResourceProduction']=biome.value})
local color = biome.val < 0 and 'red' or 'green'
row.modifierText = '<span style="color:'..color..'">..'..Shared.numStrWithSign(biome.value)..'% Production for this Building</span>'
row.otherModifiers = ''
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then
Line 594: Line 596:
if frame.args == nil then
if frame.args == nil then
frame[1] = modifier
frame[1] = modifier
frame.townshipBuildingName = name
else
else
frame.args[1] = modifier
frame.args[1] = modifier
frame.args.townshipBuildingName = name
end
if type == 'building' then
if frame.args == nil then
frame.townshipBuildingName = name
else
frame.args.townshipBuildingName = name
end
end
end


572

edits