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)
function p._getModifierTable(modifiers, skill, columnName, getOpposites, displayOtherMods, maxOtherMods, township)
local modifierNames = {}
local modifierNames = {}
if type(modifiers) == 'string' then
if type(modifiers) == 'string' then
Line 461: Line 461:


table.insert(tableArray, row)
table.insert(tableArray, row)
end
-- Special biomeModifiers for Township buildings
if townshipBuildingName ~= nil then
local building = Township.GetBuildingByName(townshipBuildingName)
for _, biome in ipairs(building.biomeModifiers) do
local biomename = GameData.getEntityByID(GameData.skillData.Township.biomes, biome.biomeID).name
local row = {}
row.name = GameData.getEntityByID(GameData.skillData.Township.biomes, biome.biomeID).name
row.icon = Icons.Icon({'Township', type='skill'})
row.type = 'Biome'
row.val = biome.value
row.modifierText, row.otherModifiers = getModText({['TownshipResourceProduction']=biome.value})
if not hasOtherModifiers and string.len(row.otherModifiers) > 0 then
hasOtherModifiers = true
end
table.insert(tableArray, row)
end
end
end


Line 543: Line 563:
local displayOtherMods = frame.args ~= nil and frame.args.displayOtherMods or frame.displayOtherMods
local displayOtherMods = frame.args ~= nil and frame.args.displayOtherMods or frame.displayOtherMods
local maxOtherMods = frame.args ~= nil and tonumber(frame.args.maxOtherMods) or 5
local maxOtherMods = frame.args ~= nil and tonumber(frame.args.maxOtherMods) or 5
local townshipBuildingName = frame.args ~= nil and frame.args.townshipBuildingName or frame.townshipBuildingName


if Shared.contains(modifier, ',') then
if Shared.contains(modifier, ',') then
Line 560: Line 582:
end
end


return p._getModifierTable(modifier, skill, columnName, getOpposites, displayOtherMods, maxOtherMods)
return p._getModifierTable(modifier, skill, columnName, getOpposites, displayOtherMods, maxOtherMods, townshipBuildingName)
end
end


Line 569: Line 591:
local modifier = Township.GetModifiers(name, type)
local modifier = Township.GetModifiers(name, type)
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
end


572

edits