Модуль:Meals Lookup: различия между версиями
Mhamster (обсуждение | вклад) Нет описания правки |
Mhamster (обсуждение | вклад) Нет описания правки |
||
| Строка 28: | Строка 28: | ||
return out | return out | ||
end | end | ||
function buildsolids(frame, array) -- should not be invoked | function buildsolids(frame, array) -- should not be invoked | ||
local out = "" | local out = "" | ||
for solid, amount in pairs(array) do | for solid, amount in pairs(array) do | ||
out = out .. frame:preprocess( "{{Recipe Component|item={{#invoke:Entity Lookup|getname|".. solid .."}}|image=File:Mousegif.gif|amount=".. amount .."}}" ) | out = out .. | ||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
solid .. "}}|image=File:Mousegif.gif|amount=" .. amount .. "}}") | |||
end | end | ||
return out | return out | ||
| Строка 41: | Строка 42: | ||
local out = "" | local out = "" | ||
for item, amount in pairs(array) do | for item, amount in pairs(array) do | ||
out = out .. frame:preprocess( "{{Chem Recipe Component|reagent=".. item .."|amount={{{"..amount.."|1}}}}}" ) | out = out .. frame:preprocess("{{Chem Recipe Component|reagent=" .. item .. "|amount={{{" .. amount .. "|1}}}}}") | ||
end | end | ||
return out | return out | ||
end | end | ||
--#endregion | --#endregion | ||
| Строка 64: | Строка 66: | ||
return out | return out | ||
end | end | ||
function p.buildmicrowaverecipebox(frame) -- {{#invoke:Meals Lookup|buildmicrowaverecipebox|MicrowaveRecipeID}} | function p.buildmicrowaverecipebox(frame) -- {{#invoke:Meals Lookup|buildmicrowaverecipebox|MicrowaveRecipeID}} | ||
| Строка 72: | Строка 73: | ||
local solids = buildsolids(frame, getmicrowaverecipesolids(frame, recipe)) | local solids = buildsolids(frame, getmicrowaverecipesolids(frame, recipe)) | ||
local reagents = buildreagents(frame, getmicrowaverecipereagents(frame, recipe)) | local reagents = buildreagents(frame, getmicrowaverecipereagents(frame, recipe)) | ||
out = frame:preprocess("{{Recipe Box".. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["result"] .. "}}" .. | |||
"|component-1=" .. solids .. "\n" .. reagents .. | |||
"|transformer={{Recipe Transformers|microwaveRecipes|" .. recipe["time"] .. "}}" .. | |||
"|result=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["result"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"}}") | |||
return out | return out | ||
end | end | ||
function p.buildmicrowaverecipes(frame) | |||
local out = "" | |||
for id in pairs(getrecipesfromtype(frame, "microwaveRecipes")) do | |||
out = out .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. id .. "}}") .. "\n" | |||
end | |||
return out | |||
end | |||
--#endregion microwaveRecipes | --#endregion microwaveRecipes | ||
| Строка 88: | Строка 100: | ||
local id = frame.args[1]:gsub(' ', '') | local id = frame.args[1]:gsub(' ', '') | ||
local recipe = getrecipe(frame, "sliceableRecipes", id) | local recipe = getrecipe(frame, "sliceableRecipes", id) | ||
out = frame:preprocess("{{Recipe Box".. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["result"] .. "}}" .. | |||
"|component-1=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["input"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"|transformer={{Recipe Transformers|sliceableRecipes}}" .. | |||
"|result=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["result"] .. "}}|image=File:Mousegif.gif|amount=" .. recipe["count"] .. "}}") .. | |||
"}}") | |||
return out | return out | ||
end | end | ||
| Строка 106: | Строка 122: | ||
local recipe = getrecipe(frame, "grindableRecipes", id) | local recipe = getrecipe(frame, "grindableRecipes", id) | ||
local reagents = buildreagents(frame, recipe["result"]) | local reagents = buildreagents(frame, recipe["result"]) | ||
out = frame:preprocess("{{Recipe Box".. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | |||
"|component-1=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["input"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"|transformer={{Recipe Transformers|grindableRecipes}}" .. | |||
"|result=" .. reagents .. | |||
"}}") | |||
return out | return out | ||
end | end | ||
| Строка 123: | Строка 141: | ||
local id = frame.args[1]:gsub(' ', '') | local id = frame.args[1]:gsub(' ', '') | ||
local recipe = getrecipe(frame, "heatableRecipes", id) | local recipe = getrecipe(frame, "heatableRecipes", id) | ||
out = frame:preprocess("{{Recipe Box".. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | |||
"|component-1=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["input"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"|transformer={{Recipe Transformers|heatableRecipes|" .. recipe["minTemp"] .. "}}" .. | |||
"|result=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["result"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"}}") | |||
return out | return out | ||
end | end | ||
| Строка 141: | Строка 163: | ||
local recipe = getrecipe(frame, "toolmadeRecipes", id) | local recipe = getrecipe(frame, "toolmadeRecipes", id) | ||
local transformer = "toolmadeRecipes" .. recipe["tool"] | local transformer = "toolmadeRecipes" .. recipe["tool"] | ||
out = frame:preprocess("{{Recipe Box".. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | |||
"|component-1=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["input"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"|transformer={{Recipe Transformers|" .. transformer .. "}}" .. | |||
"|result=" .. | |||
frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
recipe["result"] .. "}}|image=File:Mousegif.gif}}") .. | |||
"}}") | |||
return out | return out | ||
end | end | ||
| Строка 159: | Строка 185: | ||
out[ingredient] = data["amount"] | out[ingredient] = data["amount"] | ||
end | end | ||
return out | return out | ||
end | end | ||
| Строка 169: | Строка 195: | ||
local output = recipe["effects"][1]["Entity"] | local output = recipe["effects"][1]["Entity"] | ||
local outamount = recipe["effects"][1]["Number"] | local outamount = recipe["effects"][1]["Number"] | ||
out = frame:preprocess("{{Recipe Box".. | out = frame:preprocess("{{Recipe Box" .. | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["effects"][1]["Entity"] .. "}}" .. | |||
"|component-1=" .. input .. | |||
"|transformer={{Recipe Transformers|mixableRecipes}}" .. | |||
"|result={{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | |||
output .. "}}|image=File:Mousegif.gif|amount=" .. outamount .. "}}" .. | |||
"}}") | |||
return out | return out | ||
end | end | ||
| Строка 180: | Строка 207: | ||
--#endregion mixableRecipes | --#endregion mixableRecipes | ||
-- tests. | -- tests. | ||
function p.tests(frame) | function p.tests(frame) | ||
local out = "" | local out = "" | ||
out = out .. | out = out .. p.buildmicrowaverecipes(frame) | ||
out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|".. frame.args[1] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|" .. frame.args[1] .. "}}") | ||
out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|".. frame.args[2] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildslicerecipebox|" .. frame.args[2] .. "}}") | ||
out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildgrindrecipebox|".. frame.args[3] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildgrindrecipebox|" .. frame.args[3] .. "}}") | ||
out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildheatrecipebox|".. frame.args[4] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildheatrecipebox|" .. frame.args[4] .. "}}") | ||
out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildtoolmaderecipebox|".. frame.args[5] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildtoolmaderecipebox|" .. frame.args[5] .. "}}") | ||
out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmixablerecipebox|".. frame.args[6] .. "}}") | -- out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmixablerecipebox|" .. frame.args[6] .. "}}") | ||
return out | return out | ||
end | end | ||
return p | return p | ||