Anonymous

Module:Township: Difference between revisions

From Melvor Idle
Add biome icons to p.GetBuildingBiomeTable(), p.GetBuildingTable() p._GetBiomeModifiers()
(p.GetTraderTable -> V1.1.1 Update)
(Add biome icons to p.GetBuildingBiomeTable(), p.GetBuildingTable() p._GetBiomeModifiers())
Line 386: Line 386:
-- Biomes
-- Biomes
table.insert(ret, '\r\n|-\r\n| <b>Biomes:</b><br><ul>')
table.insert(ret, '\r\n|-\r\n| <b>Biomes:</b><br>')
for _, biomeid in ipairs(building.biomes) do
for _, biomeid in ipairs(building.biomes) do
local biomename = GameData.getEntityByID(Township.biomes, biomeid).name
local biomename = GameData.getEntityByID(Township.biomes, biomeid).name
Line 397: Line 397:
local color = modifier.value < 0 and 'red' or 'green'
local color = modifier.value < 0 and 'red' or 'green'
local modifier_value = Shared.numStrWithSign(modifier.value)
local modifier_value = Shared.numStrWithSign(modifier.value)
table.insert(ret, '<li style="color:'..color..'"><b>'..biomename..' ('..modifier_value..'%)</b></li>')
table.insert(ret, Icons.Icon({biomename, type='biome', notext=true, nolink=true})..' <span style="color:'..color..'"><b>'..biomename..' ('..modifier_value..'%)</b></span>')
else
else
table.insert(ret, '<li>'..biomename..'</li>')
table.insert(ret, Icons.Icon({biomename, type='biome', notext=true, nolink=true})..' <span>'..biomename..'</span>')
end
end
end
end
Line 517: Line 517:
local color = biome.value < 0 and 'red' or 'green'
local color = biome.value < 0 and 'red' or 'green'
local biome_value = Shared.numStrWithSign(biome.value)
local biome_value = Shared.numStrWithSign(biome.value)
table.insert(biomeRet, '<li style="color:'..color..'">'..biomename..' ('..biome_value..'%)</li>')
table.insert(biomeRet, Icons.Icon({biomename, type='biome', notext=true, nolink=true})..' <span style="color:'..color..'">'..biomename..' ('..biome_value..'%)</span>')
end
end
if #biomeRet == 0 then
if #biomeRet == 0 then
return nil
return nil
end
end
return '<ul>'..table.concat(biomeRet)..'</ul>'
return table.concat(biomeRet, '<br>')
end
end


Line 668: Line 668:
biomeModifiersMaster[biome.id] = false
biomeModifiersMaster[biome.id] = false
end
end
-- Put the icons in the second row
table.insert(ret, '\r\n|-')
table.insert(ret, '\r\n!')
for _, biome in ipairs(Township.biomes) do
table.insert(ret, '\r\n!'..Icons.Icon({biome.name, type='biome', notext=true, nolink=true}))
end
for _, _building in ipairs(p._SortedBuildings()) do
for _, _building in ipairs(p._SortedBuildings()) do
-- Fix melvorF:Statues
-- Fix melvorF:Statues
572

edits