Модуль:Meals Lookup: различия между версиями
Mhamster (обсуждение | вклад) Нет описания правки |
Mhamster (обсуждение | вклад) INCOMING!!!! |
||
| Строка 91: | Строка 91: | ||
local out = {} | local out = {} | ||
for type, recipes in pairs(tabl) do | for type, recipes in pairs(tabl) do | ||
out[type]= {} | out[type] = {} | ||
for recipeId, recipe in pairs(recipes) do | for recipeId, recipe in pairs(recipes) do | ||
if string.match(recipeId, str) then | if string.match(recipeId, str) then | ||
| Строка 101: | Строка 101: | ||
end | end | ||
function getotherrecipes(frame, tabl, str) | function getotherrecipes(frame, tabl, str) -- should not be invoked | ||
local out = {} | local out = {} | ||
for type, recipes in pairs(tabl) do | for type, recipes in pairs(tabl) do | ||
if not table.containsk(out, type) then | if not table.containsk(out, type) then | ||
out[type]= {} | out[type] = {} | ||
end | end | ||
for recipeId, recipe in pairs(recipes) do | for recipeId, recipe in pairs(recipes) do | ||
| Строка 117: | Строка 117: | ||
return out | return out | ||
end | end | ||
function p.imageslist(frame) | function p.imageslist(frame) | ||
| Строка 152: | Строка 151: | ||
end | end | ||
function p.buildeverything(frame) | function p.buildeverything(frame) -- old code compatibility | ||
return p.buildeverythingnew(frame) | |||
end | |||
function p.buildeverythingold(frame) | |||
local out = "" | local out = "" | ||
out = out .. p.buildmicrowaverecipes(frame) | out = out .. p.buildmicrowaverecipes(frame) | ||
| Строка 341: | Строка 344: | ||
local recipe = p.chemicals[id] | local recipe = p.chemicals[id] | ||
local input = buildreagents(frame, getchemicalreagents(recipe)) | local input = buildreagents(frame, getchemicalreagents(recipe)) | ||
local results = {} | local results = {} | ||
for _, v in pairs(recipe["effects"]) do | for _, v in pairs(recipe["effects"]) do | ||
table.insert(results, v.description) | |||
end | end | ||
local result = table.concat(results, "\n") | local result = table.concat(results, "\n") | ||
out = frame:preprocess("{{Recipe Box" .. | out = frame:preprocess("{{Recipe Box" .. | ||
"|component-1=" .. input .. | "|component-1=" .. input .. | ||
| Строка 368: | Строка 371: | ||
--#region dishes | --#region dishes | ||
function p.buildrecipeboxuniversal(frame, idtable) | |||
local out = "" | |||
for type, ids in pairs(idtable) do | |||
-- INTRUDER ALERT: SHITCODE IS IN THE BASE | |||
if type == "microwaveRecipes" then | |||
do | |||
for id in pairs(ids) do | |||
out = out .. | |||
frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
elseif type == "mixableRecipes" then | |||
do | |||
for id in pairs(ids) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmixablerecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
elseif type == "sliceableRecipes" then | |||
do | |||
for id in pairs(ids) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
elseif type == "grindableRecipes" then | |||
do | |||
for id in pairs(ids) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildgrindrecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
elseif type == "heatableRecipes" then | |||
do | |||
for id in pairs(ids) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildheatrecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
elseif type == "toolmadeRecipes" then | |||
do | |||
for id in pairs(ids) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildtoolmaderecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
end | |||
end | |||
end | |||
return out | |||
end | |||
function p.soups(frame) | function p.soups(frame) | ||
local out = "" | local out = "" | ||
return out | return out | ||
end | end | ||
--#endregion | --#endregion | ||
| Строка 405: | Строка 456: | ||
return out | return out | ||
end | end | ||
function p.tests3(frame) | |||
local out = "" | |||
local tablo = p.meals | |||
for _, patt in pairs(frame.args) do | |||
local ids = pairs(getrecipesbyname(frame, tablo, patt)) | |||
out = out .. p.buildrecipeboxuniversal(frame, ids) | |||
end | |||
return out | |||
end | |||
-- function p.tests2(frame) | -- function p.tests2(frame) | ||