Editing Module:Infobox Animal/sandbox
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 18: | Line 18: | ||
local animalimagename = string.gsub(animalEN, ' ', '') | local animalimagename = string.gsub(animalEN, ' ', '') | ||
local subheaderClass = ' | -- string used to build the infobox | ||
local subheaderClass = 'class=\"subheader\"' | |||
local valueColumnClass = 'class=\"value-column\"' | |||
local wideColumnClass = 'class=\"value-column wide-column\"' | local wideColumnClass = 'class=\"value-column wide-column\"' | ||
local infobox = '{| class=\"infobox animal-infobox\"\n' | local infobox = '{| class=\"infobox animal-infobox\"\n' | ||
-- name of the animal | -- name of the animal | ||
Line 43: | Line 44: | ||
end | end | ||
infobox = infobox .. '|- | infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding:0;\" | [[File:' .. image .. '|center|frameless|250x250px]]\n' | ||
-- 'General' section header | -- 'General' section header | ||
infobox = infobox .. subheaderClass .. '| colspan=\"2\" | General\n' | infobox = infobox .. '|-' .. subheaderClass .. '\n| colspan=\"2\" | \'\'\'General\'\'\'\n' | ||
-- Health | -- Health | ||
if animalTable.health ~= nil then | if animalTable.health ~= nil then | ||
infobox = infobox .. '|-\n| Health:\n|' .. animalTable.health .. '\n' | infobox = infobox .. '|-\n| Health:\n|' .. valueColumnClass .. '| ' .. animalTable.health .. '\n' | ||
end | end | ||
-- Idle Speed | -- Idle Speed | ||
if animalTable.wanderingSpeed ~= nil then | if animalTable.wanderingSpeed ~= nil then | ||
infobox = infobox .. ' | infobox = infobox .. '| Idle Speed:\n|' .. valueColumnClass .. '| ' .. Unit._unit(animalTable.wanderingSpeed, 'm/s') .. '\n' | ||
end | end | ||
Line 67: | Line 68: | ||
-- Climbing | -- Climbing | ||
if animalTable.climbHeight ~= nil then | if animalTable.climbHeight ~= nil then | ||
infobox = infobox .. ' | infobox = infobox .. '| Climb Height:\n|' .. valueColumnClass .. '| ' .. Unit._unit(animalTable.climbHeight, 'm') .. '\n' | ||
end | end | ||
-- Carbon Released | -- Carbon Released | ||
if animalTable.carbonRelease ~= nil then | if animalTable.carbonRelease ~= nil then | ||
infobox = infobox .. '|-\n| Carbon Released:\n|' .. Unit._unit(animalTable.carbonRelease, 'ppm') .. '\n' | infobox = infobox .. '|-\n| Carbon Released:\n|' .. valueColumnClass .. '| ' .. Unit._unit(animalTable.carbonRelease, 'ppm') .. '\n' | ||
end | end | ||
-- 'Hunting Information' section header | -- 'Hunting Information' section header | ||
infobox = infobox .. subheaderClass .. '| colspan=\"2\" | Hunting\n' | infobox = infobox .. '|-' .. subheaderClass .. '\n| colspan=\"2\" | \'\'\'Hunting\'\'\'\n' | ||
-- Harvest | -- Harvest | ||
if animalTable.resourceItem ~= nil then | if animalTable.resourceItem ~= nil then | ||
infobox = infobox .. '|-\n| Harvest Item:\n|' .. animalTable.resourceItem .. '\n' | infobox = infobox .. '|-\n| Harvest Item:\n|' .. valueColumnClass .. '| ' .. animalTable.resourceItem .. '\n' | ||
end | end | ||
-- Flees | -- Flees | ||
infobox = infobox .. ' | infobox = infobox .. '| Flees:\n|' .. valueColumnClass .. '| ' .. Utils.formatNilToYesNo(animalTable.flees) .. '\n' | ||
-- Animals Fear | -- Animals Fear | ||
if animalTable.fearFactor ~= nil then | if animalTable.fearFactor ~= nil then | ||
infobox = infobox .. '|-\n| [[Fear Factor]]:\n|' .. animalTable.fearFactor .. '\n' | infobox = infobox .. '|-\n| [[Fear Factor]]:\n|' .. valueColumnClass .. '| ' .. animalTable.fearFactor .. '\n' | ||
end | end | ||
-- Running Speed | -- Running Speed | ||
if animalTable.speed ~= nil then | if animalTable.speed ~= nil then | ||
infobox = infobox .. ' | infobox = infobox .. '| Flee Speed:\n|' .. valueColumnClass .. '| ' .. Unit._unit(animalTable.speed, 'm/s') .. '\n' | ||
end | end | ||
-- Attack Chance | -- Attack Chance | ||
if animalTable.chanceToAttack ~= nil then | if animalTable.chanceToAttack ~= nil then | ||
infobox = infobox .. '|-\n| Attack Chance:\n|' .. (animalTable.chanceToAttack * 100) .. ' % \n' | infobox = infobox .. '|-\n| Attack Chance:\n|' .. valueColumnClass .. '| ' .. (animalTable.chanceToAttack*100) .. ' % \n' | ||
end | end | ||
-- Attack Damage | -- Attack Damage | ||
if animalTable.damage ~= nil then | if animalTable.damage ~= nil then | ||
infobox = infobox .. ' | infobox = infobox .. '| Attack Damage:\n|' .. valueColumnClass .. '| ' .. animalTable.damage .. '\n' | ||
end | end | ||
-- Detect Range | -- Detect Range | ||
if animalTable.detectRange ~= nil then | if animalTable.detectRange ~= nil then | ||
infobox = infobox .. '|-\n| Detect Range:\n|' .. Unit._unit(animalTable.detectRange, 'm') .. '\n' | infobox = infobox .. '|-\n| Detect Range:\n|' .. valueColumnClass .. '| ' .. Unit._unit(animalTable.detectRange, 'm') .. '\n' | ||
end | end | ||
-- Attack Range | -- Attack Range | ||
if animalTable.attackRange ~= nil then | if animalTable.attackRange ~= nil then | ||
infobox = infobox .. ' | infobox = infobox .. '| Attack Range:\n|' .. valueColumnClass .. '| ' .. Unit._unit(animalTable.attackRange, 'm') .. '\n' | ||
end | end | ||