Module:Shop

-- https://booty-farm.fandom.com/wiki/Module:Shop/animals https://booty-farm.fandom.com/wiki/Module:Shop/production https://booty-farm.fandom.com/wiki/Module:Shop/decorations local p = {} local decorations = mw.loadData('Module:Shop/decorations') local production = mw.loadData('Module:Shop/production') local animals = mw.loadData('Module:Shop/animals')

function p.animals(frame) local data = { '==Animal List==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! Name', '! Picture', '! Cost', '! Level', '! Input', '! Product', '! Time', '! Selling Price', '|-'   }    for a, s in pairs(animals) do        table.insert(data, '| '..a)        table.insert(data, '| ') table.insert(data, '|-') end table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end return table.concat(data, "\n") end

function p.production(frame) local data = { '==Production List==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! Picture', '! Name', '|-'   }    for a, s in pairs(production) do        table.insert(data, '| ') table.insert(data, '| '..a)       table.insert(data, '|-') end table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end return table.concat(data, "\n") end

function p.decorations(frame) local data = { '==Decorations List==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! Picture', '! Name', '|-'   }    for a, s in pairs(decorations) do        table.insert(data, '| ') table.insert(data, '|'..a)       table.insert(data, '|-') end table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end return table.concat(data, "\n") end

function p.infobox(frame) local name = mw.title.getCurrentTitle.text if decorations[name] ~= nil then shop_data = decorations[name] elseif production[name] ~= nil then shop_data = production[name] elseif animals[name] ~= nil then shop_data = animals[name] else return end local data = {} return table.concat(data, "\n") end function p.cost(frame) local name = mw.title.getCurrentTitle.text if decorations[name] ~= nil then shop_data = decorations[name] elseif production[name] ~= nil then shop_data = production[name] elseif animals[name] ~= nil then shop_data = animals[name] else return end local data = {} return table.concat(data, "\n") end function p.products(frame) local name = mw.title.getCurrentTitle.text if decorations[name] ~= nil then shop_data = decorations[name] elseif production[name] ~= nil then shop_data = production[name] elseif animals[name] ~= nil then shop_data = animals[name] else return end local data = {} return table.concat(data, "\n") end

return p