444
edits
Inconvenient (talk | contribs) mNo edit summary |
Inconvenient (talk | contribs) (made farming navbox collapsible. maybe.) |
||
Line 11: | Line 11: | ||
function p.getFarmingNavbox(frame) | function p.getFarmingNavbox(frame) | ||
local | local allotmentSeedsTable = {} | ||
local | local allotmentProduceTable = {} | ||
local | local herbSeedsTable = {} | ||
local | local herbProduceTable = {} | ||
local | local treeSeedsTable = {} | ||
local | local treeProduceTable = {} | ||
for i, item in Shared.skpairs(ItemData.Items) do | for i, item in Shared.skpairs(ItemData.Items) do | ||
if | if item.tier == 'Allotment' then | ||
table.insert( | table.insert(allotmentSeedsTable, Icons.Icon({item.name, type='item'})) | ||
elseif | elseif item.type == 'Harvest' then | ||
table.insert( | table.insert(allotmentProduceTable, Icons.Icon({item.name, type='item'})) | ||
elseif | elseif item.tier == 'Herb' then | ||
table.insert( | table.insert(herbSeedsTable, Icons.Icon({item.name, type='item'})) | ||
elseif | elseif item.type == 'Herb' then | ||
table.insert( | table.insert(herbProduceTable, Icons.Icon({item.name, type='item'})) | ||
elseif | elseif item.tier == 'Tree' then | ||
table.insert( | table.insert(treeSeedsTable, Icons.Icon({item.name, type='item'})) | ||
elseif i | elseif i == 2 or i == 3 or i == 5 or i == 7 or i == 8 then | ||
table.insert( | table.insert(treeProduceTable, Icons.Icon({item.name, type='item'})) | ||
end | end | ||
end | end | ||
local allotmentSeeds = table.concat(allotmentSeedsTable, ' • ') | |||
local allotmentProduce = table.concat(allotmentProduceTable, ' • ') | |||
local herbSeeds = table.concat(herbSeedsTable, ' • ') | |||
local herbProduce = table.concat(herbProduceTable, ' • ') | |||
local treeSeeds = table.concat(treeSeedsTable, ' • ') | |||
local treeProduce = table.concat(treeProduceTable, ' • ') | |||
local pagename = '' | |||
local allotment = 'mw-collapsible mw-collapsed' | |||
local herb = 'mw-collapsible mw-collapsed' | |||
local tree = 'mw-collapsible mw-collapsed' | |||
if frame.args ~= nil and frame.args[1] then | |||
pagename = frame.args[1] | |||
if Shared.contains(allotmentSeeds, pagename) or Shared.contains(allotmentProduce, pagename) then | |||
allotment = 'mw-collapsible' | |||
elseif Shared.contains(herbSeeds, pagename) or Shared.contains(herbProduce, pagename) then | |||
herb = 'mw-collapsible' | |||
elseif Shared.contains(treeSeeds, pagename) or Shared.contains(treeProduce, pagename) then | |||
tree = 'mw-collapsible' | |||
end | |||
end | |||
local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"' | local result = '{| class="wikitable" style="margin:auto; clear:both; width: 100%"' | ||
result = result..'\r\n! | result = result..'\r\n!'..Icons.Icon({'Farming', type='skill'}) | ||
result = result..' | result = result..'{| class="wikitable '..allotment..'" style="margin:auto; clear:both; width: 100%"' | ||
result = result..'\r\n!colspan="2"|Allotments' | |||
result = result..'\r\n|-\r\n!scope="row"|Seeds' | result = result..'\r\n|-\r\n!scope="row"|Seeds' | ||
result = result..'\r\n|style="text-align:center;|'.. | result = result..'\r\n|style="text-align:center;|'..allotmentSeeds | ||
result = result..'\r\n|-\r\n!scope="row"|Produce' | result = result..'\r\n|-\r\n!scope="row"|Produce' | ||
result = result..'\r\n|style="text-align:center;|'.. | result = result..'\r\n|style="text-align:center;|'..allotmentProduce | ||
result = result..'\r\n| | result = result..'\r\n|}' | ||
result = result..'{| class="wikitable '..herb..'" style="margin:auto; clear:both; width: 100%"' | |||
result = result..'\r\n!colspan="2"|Herbs' | |||
result = result..'\r\n|-\r\n!scope="row"|Seeds' | result = result..'\r\n|-\r\n!scope="row"|Seeds' | ||
result = result..'\r\n|style="text-align:center;|'.. | result = result..'\r\n|style="text-align:center;|'..herbSeeds | ||
result = result..'\r\n|-\r\n!scope="row"|Produce' | result = result..'\r\n|-\r\n!scope="row"|Produce' | ||
result = result..'\r\n|style="text-align:center;|'.. | result = result..'\r\n|style="text-align:center;|'..herbProduce | ||
result = result..'\r\n| | result = result..'\r\n|}' | ||
result = result..'{| class="wikitable '..tree..'" style="margin:auto; clear:both; width: 100%"' | |||
result = result..'\r\n!scope="row" colspan="2"|Trees' | |||
result = result..'\r\n|-\r\n!scope="row"|Seeds' | result = result..'\r\n|-\r\n!scope="row"|Seeds' | ||
result = result..'\r\n|style="text-align:center;|'.. | result = result..'\r\n|style="text-align:center;|'..treeSeeds | ||
result = result..'\r\n|-\r\n!scope="row"|Produce' | result = result..'\r\n|-\r\n!scope="row"|Produce' | ||
result = result..'\r\n|style="text-align:center;|'.. | result = result..'\r\n|style="text-align:center;|'..treeProduce | ||
result = result..'\r\n|}' | |||
result = result..'\r\n|}' | |||
return result | return result |
edits