Aktualisiert. // Updated.
K (Fehler behoben. // Minor fix.) |
(Aktualisiert. // Updated.) |
||
local item_link = require('Module:Item').go
local trim = mw.text.trim
local currentFrame -- global cache for current frame object.
local inputArgs -- global args cache.
local lang -- cache current lang.
local extCols_stationBefore = nil
local itemLink = function(name, args)
local args = args or {}
local namede = currentFrame:expandTemplate{ title = 'tr', args = { name, en = 'y' } } -- get German name of the item through {{tr|name|en=y}}▼
args[1] = name
▲
args['link'] = namede▼
args['small'] = 'y'
args['nolink'] = args['nolink'] and 'y' or nil
return item_link(currentFrame, args)
end
-- credit: http://richard.warburton.it
-- this version is with trim.
local explode = function(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
elseif item == 'Mallard Duck' or item == 'Duck' then
return 'Any Duck'
elseif item == 'Sulphur Butterfly' or item == 'Julia Butterfly' or item == 'Monarch Butterfly' or item == 'Purple Emperor Butterfly'
or item == 'Red Admiral Butterfly' or item == 'Tree Nymph Butterfly' or item == 'Ulysses Butterfly' or item == 'Zebra Swallowtail Butterfly' then
return 'Any Butterfly'
constraints['ingredient'] = str
end
--versions
local _version = normalizeVersion(args['version'] or args['versions'] or '')
constraints['version'] = 'version = '..enclose(_version)
end
end
local stationCell = function(station, options)
options = options or {wrap = 'y'}
if station == 'By Hand' then
return '[[kein Objekt]]'
or station == 'Solidifier' or station == 'Honey Dispenser' or station == 'Bone Welder' or station == 'Blend-O-Matic' or station == 'Steampunk Boiler'
or station == 'Ancient Manipulator' or station == 'Lihzahrd Furnace' or station == 'Living Wood' then
return itemLink(station,
elseif station == 'Iron Anvil' then
return itemLink('Iron Anvil', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Lead Anvil', options)
elseif station == 'Adamantite Forge' then
return itemLink('Adamantite Forge', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Titanium Forge', options)
elseif station == 'Mythril Anvil' then
return itemLink('Mythril Anvil', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Orichalcum Anvil', options)
elseif station == 'Demon Altar' then
return itemLink('Demon Altar', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Crimson Altar', options)
elseif station == 'Cooking Pot' then
return itemLink('Cooking Pot', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Cauldron', options)
elseif station == 'Placed Bottle' then
return itemLink('Placed Bottle', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Alchemy Table',
elseif station == 'Water' then
return itemLink('Water', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Sink',
elseif station == 'Table and Chair' then
return itemLink('Table', options) .. " '''und''' " .. itemLink('Chair', options)
elseif station == 'Work Bench and Chair' then
return itemLink('Work Bench', options) .. " '''und''' " .. itemLink('Chair', options)
elseif station == 'Crystal Ball and Lava' then
return itemLink('Crystal Ball', options) .. " '''und''' " .. itemLink('Lava', options)
elseif station == 'Crystal Ball and Honey' then
return itemLink('Crystal Ball', options) .. " '''und''' " .. itemLink('Honey', options)
elseif station == 'Crystal Ball and Water' then
return itemLink('Crystal Ball', options) .. " '''und''' ".. '<span class="water">' .. itemLink('Water', options) .. "<br/>'''''oder'''''<br/>" .. itemLink('Sink',
elseif station == 'Sky Mill and Water' then
return itemLink('Sky Mill',
elseif station == 'Sky Mill and Snow Biome' then
return itemLink('Sky Mill',
elseif station == 'Placed Bottle only' then
return itemLink('Placed Bottle', options)
else
return station
local addCate, cateStr = (function()
local cate = {
['Lead Anvil'] = 'Eisen- oder Bleiamboss',
local str = ''
for station, _ in pairs(cateCache) do
str = str .. '[[Category:'..currentFrame:preprocess(cate[station] or '{{tr|'..station..'|
end
if str ~= '' then
str = '[[Category:
end
return str
-- cate:
if needCate then
if needCate == 2 or rootpagename == currentFrame:expandTemplate{title='tr', args= {row['result'],
addCate(row['station'])
end
amount = trim(args['amount'] or ''),
version = version,
station = normalizeStation(trim(args['station'] or '')),
ingredients = mw.ustring.sub(ingredients_string, 2),
ings = mw.ustring.sub(ingredients_string_full, 2),
local args = frame:getParent().args
inputArgs = args
lang = getArg('lang') or frame:expandTemplate{ title = 'lang' } or 'en'
local where = trim(args['where'] or '')
-- no constraint no result.
if where == '' then
return '<span style="color:red;font-weight:bold;">Keine Eingrenzung in {{
end
p.extract = function(frame)
currentFrame = frame -- global frame cache
local args = frame:getParent().args
inputArgs = args
lang = getArg('lang') or frame:expandTemplate{ title = 'lang' } or 'en'
local where = trim(args['where'] or '')
local withResult = getArg('withresult')
local withStation = not getArg('nostation')
local withVersion = not getArg('noversion')
local str = nil
for _, row in ipairs(result) do
end
str = str .. '<span class="recipe compact">'
if withVersion then
if row['version'] ~= '' then
str = str ..currentFrame:expandTemplate{ title = 'version icons', args = {row['version']} }..': '
end
end
local ingFlag = nil
for _, v in ipairs(explode('^', row['args'])) do
if amount ~= '1' then
str = str .. amount .. ' '
end
local s
for _, itemname in ipairs(split(item)) do
end
if withResult then
str = str .. ' = '
if row['amount'] ~= '1' then
str = str .. row['amount'] .. ' '
end
str = str .. itemLink(row['result'], args)
end
str = str..'</span>'
end
-- only return first row.
for _, row in ipairs(result) do
return stationCell(row['station'], {})
end
elseif mode == 'result' then
|