Modul:ItemInfoCard: Unterschied zwischen den Versionen

Aus Eco - Deutsches Wiki
Wechseln zu:Navigation, Suche
[unmarkierte Version][unmarkierte Version]
Keine Bearbeitungszusammenfassung
K StalEF verschob die Seite Modul:Infobox Item nach Modul:ItemInfoCard, ohne dabei eine Weiterleitung anzulegen
 
(15 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
-- Credit: Die von Pradoxzon erstellte Original-Infobox (jetzt als Infobox_Item bekannt) wurde dann von Nesphit und TreeNuts0 bearbeitet. Fyre (FishAus) und Scotty (ZeelNightwolf) haben das Infobox_Item weiter bearbeitet. Sie wurden dann dupliziert und als Basis für Infobox_Skill, Infobox_Plant und Infobox_Animal verwendet.
local p = {}
local p = {}


-- Grabs args from the parent frame
local Utils = require('Module:Utils')
-- Trims and parses the args into a table, then returns the table
local RecipeUtils = require('Module:RecipeUtils')
function norm()
local IconUtils = require('Module:IconUtils')
    local origArgs = mw.getCurrentFrame():getParent().args
local InfoCardUtils = require('Module:InfoCardUtils')
    local args = {}
   
    for k, v in pairs( origArgs ) do
        v = mw.text.trim( tostring( v ) )
        if v ~= '' then
            args[k] = v
        end
    end
   
    return args
end


-- Build an Item Infobox
local Lang = Utils.getLanguageName()
function itemBox( args, itemData )
 
    -- check that all necessary arguments are passed correctly
function p.main(frame)
    if args.name == nil or args.name == '' then
local PageName = frame.args[1]
        return '\'name\' must be specified.'
if (Lang == 'English') then ItemName = PageName else ItemName = Utils.ItemSearch(PageName) end
    end
local ItemData = mw.loadData( "Module:ItemData" )
   
    local Item = ItemData.items[ItemName]
local item = args.name
local WikiText =''
local itemTable = itemData.items[item]
    local itemType = itemTable.type
local itemEN = string.sub (itemType, -4)
local itemimagename = string.gsub(itemEN, ' ', '')
if itemTable == nil then
WikiText = WikiText ..'__NOTOC__'
return item .. 'Konnte nicht in Modul: ItemData gefunden werden.'
WikiText = WikiText ..'Page name get test: ' .. PageName ..'</br>'
end
WikiText = WikiText ..'Item name get test: ' .. ItemName ..'</br>'
   
    -- string used to build the infobox
    local infobox = '{| class=\"infobox\"\n'
   
-- 'Name and Image' section
-- name of the item
infobox = infobox .. '|- style=\"color: white; background-color: #1165AF; text-align: center;\"\n| colspan=\"2\" | \'\'\'<big>' .. item .. '</big>\'\'\'\n'
   
-- the item's type (ItemData - group)
infobox = infobox .. '|- style=\"text-align: center; color: white; background-color: '
if itemTable.group == 'Food' then
WikiText = WikiText .. '<div class="row gy-4 gx-5"><div class="col-md-6">'
infobox = infobox .. '#85D66B;\"\n| colspan=\"2\" | \'\'\'Food\'\'\'\n'
-- Items:Food Icon Image
local image = 'NoImage.png|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. itemimagename .. '_Icon.png|[[Category:Pages_with_missing_icon]]'
if mw.title.makeTitle('File', itemimagename .. '_Icon.png').file.exists then
image = itemimagename .. '_Icon.png'
elseif mw.title.makeTitle('File', itemimagename .. '_Icon.jpg').file.exists then
image = itemimagename .. '_Icon.jpg'
end
    infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | <div class="iconContainer"><div class="iconStack">[[File:' .. image .. '|frameless|class=iconGreen]]</div><div class=iconBorder style=\"position:absolute;\"></div></div> \n'
elseif itemTable.group == 'Skill Books' or itemTable.group == 'Skill Scrolls' then
infobox = infobox .. '#FFCF4D;\"\n| colspan=\"2\" | \'\'\'' .. itemTable.group .. '\'\'\'\n'
-- Items:Skill Books Icon Image
local image = 'NoImage.png|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. itemimagename .. '_Icon.png|[[Category:Pages_with_missing_icon]]'
if mw.title.makeTitle('Datei', itemimagename .. '_Icon.png').file.exists then
image = itemimagename .. '_Icon.png'
elseif mw.title.makeTitle('Datei', itemimagename .. '_Icon.jpg').file.exists then
image = itemimagename .. '_Icon.jpg'
end
infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | <div class="iconContainer"><div class="iconStack">[[File:' .. image .. '|frameless|class=iconGold]]</div><div class=iconBorder style=\"position:absolute;\"></div></div> \n'
else
infobox = infobox .. '#78B1FF;\"\n| colspan=\"2\" | \'\'\'' .. itemTable.group .. '\'\'\'\n'
-- Items: Other Icon Image
local image = 'NoImage.png|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. itemimagename .. '_Icon.png|[[Category:Pages_with_missing_icon]]'
if mw.title.makeTitle('Datei', itemimagename .. '_Icon.png').file.exists then
image = itemimagename .. '_Icon.png'
elseif mw.title.makeTitle('Datei', itemimagename .. '_Icon.jpg').file.exists then
image = itemimagename .. '_Icon.jpg'
end
    infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | <div class="iconContainer"><div class="iconStack">[[File:' .. image .. '|frameless|class=iconBlue]]</div><div class=iconBorder style=\"position:absolute;\"></div></div> \n'
end
   
  -- 'Description' section header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Beschreibung\'\'\'\n'
if itemTable.description == nil then
infobox = infobox .. '|- style=\"text-align: center;\"\n| colspan=\"2\" | \'\'\'None\'\'\'\n'
elseif itemTable.description == '' then
infobox = infobox .. '|- style=\"text-align: center;\"\n| colspan=\"2\" | \'\'\'None\'\'\'\n'
else
infobox = infobox .. '|- style=\"text-align: center;\"\n| colspan=\"2\" | ' .. itemTable.description .. '\n'
end
    -- 'General' section header
WikiText =  WikiText .. '</div>'
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'General\'\'\'\n'
WikiText = WikiText ..'<div class="col-md-6"><div class="card border-primary"><div class="card-body">'
   
    WikiText =  WikiText ..'<h2 class="card-title fs-40">' .. IconUtils.main{name = Item.Name[Lang], id = Item.ID , size = 48, style = 1} .. ' ' .. Item.Name[Lang] .. '</h2>'
-- -- created at
WikiText =  WikiText ..'<p class="col-lg-10 card-text">' .. Item.Description[Lang] .. '</p>'
-- local craftingRecipes = require( "Modul:CraftingRecipes" )
-- local recipes = craftingRecipes.recipes
-- local function addToSet(set, key)
WikiText = WikiText ..'</div></div></div></div>'
-- set[key] = true
-- end
-- local function setNotContains(set, key)
local RecipeItemCraft = RecipeUtils.ItemCraft(ItemName)
-- return set[key] == nil
if (RecipeItemCraft ~= "") then
-- end
WikiText = WikiText .. '<h3>' .. Utils.Translate("Crafted At") .. ':</h3>';
WikiText =  WikiText .. RecipeUtils.CraftTable(RecipeItemCraft);
end
-- if craftingRecipes.items[item] ~= nil and #craftingRecipes.items[item] >= 1 then
local RecipeItemIngredient = RecipeUtils.ItemIngredient(ItemName)
-- local count = 0
if (RecipeItemIngredient ~= "") then
-- local stations = {}
WikiText = WikiText .. '<h3>' .. Utils.Translate("Used in") .. ':</h3>';
-- local sortStations = {}
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemIngredient)
-- local stationString = ''
end
-- local found = false
-- for k, v in ipairs( craftingRecipes.items[item] ) do
-- for num = 1, #recipes[v].numberOfVariants do
-- if (recipes[v].variants[v] ~= nil and recipes[v].numberOfVariants <= tostring(1)) then
-- if setNotContains(stations, recipes[v].craftStn[1]) then
-- addToSet(stations, recipes[v].craftStn[1])
-- count = count + 1
-- end
-- if found == false then
-- found = true
-- infobox = infobox .. '|-\n| Created at:\n| style=\"text-align: right; padding: 3px;\" |'
-- end
-- end
-- end
-- end
-- local track = 0
-- if found == true then
-- for a, b in pairs(stations) do
-- table.insert(sortStations, a)
-- end
-- table.sort(sortStations)
-- for i, n in ipairs(sortStations) do
-- stationString = stationString .. ' [[' .. n .. ']]'
-- track = track + 1
-- if track ~= count then -- Changed these line to produce comma if not last table.
-- stationString = stationString .. ','
-- end
-- end
-- infobox = infobox .. stationString .. '\n'
-- else
-- infobox = infobox .. '|-\n| Created at:\n| style=\"text-align: right; padding: 3px;\" | N/A\n'
-- end
-- elseif args.created ~= nil and args.created ~= '' then
-- infobox = infobox .. '|-\n| Created at:\n| style=\"text-align: right; padding: 3px;\" | ' .. args.created .. '\n'
-- else
-- infobox = infobox .. '|-\n| Created at:\n| style=\"text-align: right; padding: 3px;\" | N/A\n'
-- end
 
-- calories and nutrients (if itemTable.group == 'Food')
if itemTable.group == 'Food' then
infobox = infobox .. '|-\n| Kalorien:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.calories .. '\n|- valign=\"center\"\n| rowspan=\"4\" | Nutrients:\n'
infobox = infobox .. '| style=\"color: red; text-align: right; padding: 3px;\" | Kohlenhydrate: ' .. itemTable.carbs .. '\n'
infobox = infobox .. '|- valign=\"center\"\n| style=\"color: orange; text-align: right; padding: 3px;\" | Protein: ' .. itemTable.protein .. '\n'
infobox = infobox .. '|- valign=\"center\"\n| style=\"color: yellow; text-align: right; padding: 3px;\" | Fett: ' .. itemTable.fat .. '\n'
infobox = infobox .. '|- valign=\"center\"\n| style=\"color: limegreen; text-align: right; padding: 3px;\" | Vitamine: ' .. itemTable.vitamins .. '\n'
infobox = infobox .. '|-\n| Nährstoffdichte:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.density .. ' per 100 cals\n'
end
-- carried
local ItemTagList = Utils.ItemTags(Item.Tags);
if args.carried ~= nil and args.carried ~= '' then
if (ItemTagList ~= "") then
infobox = infobox .. '|-\n| Getragen :\n| style=\"text-align: right; padding: 3px;\" | ' .. args.carried .. '\n'
WikiText = WikiText .. '<h3>' .. Utils.Translate("Tags Applying to") .. ':</h3>';
else
WikiText = WikiText .. ItemTagList
infobox = infobox .. '|-\n| Getragen: \n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.carried .. '\n'
end
end
   
-- weight
if itemTable.weight ~= nil then
infobox = infobox .. '|-\n| Gewicht:\n| style="text-align: right; padding: 3px;" | ' .. itemTable.weight .. ' kg\n'
else
infobox = infobox .. '|-\n| Gewicht:\n| style="text-align: right; padding: 3px;" | 0.00kg\n'
end
   
-- stack limit
if itemTable.maxStack ~= nil then
infobox = infobox .. '|-\n| Stapellimit:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.maxStack .. '\n'
end
-- yield
local RecipeTagsIngredient = RecipeUtils.TagsIngredient(Item.Tags)
if itemTable.yield ~= nil then
if (RecipeTagsIngredient ~= "") then
infobox = infobox .. '|-\n| Ertrag verbessern: \n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.yield .. '\n'
WikiText = WikiText .. '<h3>Used as Tag item in:</h3>';
end
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeTagsIngredient)
end
-- fuel
if (Item.WorldObjectItem == "True") then WikiText = WikiText .. InfoCardUtils.WorldObjectModule(ItemName) end
if itemTable.fuel ~= nil then
infobox = infobox .. '|-\n| Kraftstoff:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.fuel .. ' J\n'
end
   
-- currency
if itemTable.currency ~= nil then
infobox = infobox .. '|-\n| Wird als Währung verwendet:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.currency .. '\n'
end
    -- 'IDs' section header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'IDs\'\'\'\n'
   
-- item id (type)
infobox = infobox .. '|- valign=\"center\"\n| Artikel-ID\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.type .. '\n'
   
-- id number (type id)
infobox = infobox .. '|- valign=\"center\"\n| ID-Nummer:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.typeID .. '\n'
    -- 'Item' World Object header (if itemTable.group = Placeable or Blocks)
if itemTable.group == 'Block Items' or itemTable.group == 'World Object Items' then
infobox = infobox .. '|- style=\"text-align: center; background-color: #517ab2;\"\n| colspan=\"2\" | \'\'\'World Object\'\'\'\n'
-- Object Placed Image
WikiText = WikiText .. '<h3>How use Icon:</h3>'
local image = 'NoImage.png|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. itemimagename .. '_Placed.png|[[Category:Pages_with_missing_placed]]'
WikiText =  WikiText .. '<p>' .. Item.Name[Lang] .. ' icon can be used on any sign that has a text component, including on [[Vehicles]]:</br>'
if mw.title.makeTitle('File', itemimagename .. '_Placed.png').file.exists then
WikiText = WikiText .. 'Icon with background: <icon name="' .. Item.ID .. '"></br>'
image = itemimagename .. '_Placed.png'
WikiText = WikiText .. 'Icon without background: <icon name="' .. Item.ID .. '" type="nobg"></p>'
elseif mw.title.makeTitle('File', itemimagename .. '_Placed.jpg').file.exists then
image = itemimagename .. '_Placed.jpg'
end
infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | [[File:' .. image .. '|center|border|240px]]\n'
 
-- 'Placement' section
--Placement Header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Platzierung\'\'\'\n'
 
--Vechile
if itemTable.mobile ~= nil then
infobox = infobox .. '|-\n| Fahrzeug / mobiles Objekt:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.mobile .. '\n'
end
--Dimensions
if itemTable.footprint ~= nil then
infobox = infobox .. '|-\n| Maße (X,Y,Z):\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.footprint .. '\n'
end
--Material Tier
if itemTable.materialTier ~= nil or itemTable.materialTier == 0 then
infobox = infobox .. '|-\n| Raummaterial:\n| style=\"text-align: right; padding: 3px;\" | Tier ' .. itemTable.materialTier .. '\n'
end
--Room Req.
if itemTable.roomContainReq ~= nil then
infobox = infobox .. '|-\n| Zimmer erforderlich:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.roomContainReq .. '\n'
end
--Room Size. Req.
if itemTable.roomSizeReq ~= nil then
infobox = infobox .. '|-\n| Raumgröße:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.roomSizeReq .. ' m³\n'
end
--Room Mat. Req.
if itemTable.roomMatReq ~= nil then
infobox = infobox .. '|-\n| Raummaterialien:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.roomMatReq .. '\n'
end
-- Object Form Image
if itemTable.group == 'Block Items' then
local image = 'NoImage.png|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. itemimagename .. '_Form.png|[[Category:Pages_with_missing_form]]'
if mw.title.makeTitle('File', itemimagename .. '_Form.png').file.exists then
image = itemimagename .. '_Form.png'
elseif mw.title.makeTitle('File', itemimagename .. '_Form.jpg').file.exists then
image = itemimagename .. '_Form.jpg'
end
infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | [[File:' .. image .. '|center|border|240px]]\n'
end
 
-- 'Housing' section (if there is a Room Category)
if itemTable.roomCategory ~= nil then 
-- Housing Header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Gehäuse\'\'\'\n'
   
--roomCategory
infobox = infobox .. '|-\n| Zimmerkategorie:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.roomCategory .. '\n'


if itemTable.roomCategory ~= 'Industrial' then
if (Lang ~= 'English') then WikiText = WikiText .. '[[en:' .. Item.Name.English .. ']]' end
if itemTable.furnitureType ~= nil then
if (Lang ~= 'Russian') then WikiText = WikiText .. '[[ru:' .. Item.Name.Russian .. ']]' end
--furnitureType
if (Lang ~= 'German') then WikiText = WikiText .. '[[de:' .. Item.Name.German .. ']]' end
infobox = infobox .. '|-\n| Möbeltyp:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.furnitureType .. '\n'
if (Lang ~= 'French') then WikiText = WikiText .. '[[fr:' .. Item.Name.French .. ']]' end
           
--Value of the object
infobox = infobox .. '|-\n| Wert:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.skillValue .. '\n'
           
--Dim. Return % of Object 
infobox = infobox .. '|-\n| Abnehmender Ertrag %:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.repeatsDepreciation .. '\n'   
end
end
if itemTable.roomCategory == 'Industrial' then
infobox = infobox .. '|- style=\"background-color: red; text-align: center;\"\n| colspan=\"2\" | \'\'\'Alle Zimmerwert verloren\'\'\'\n'
end
end
-- 'Storage' Section (if inventorySlots is not nil)
if itemTable.inventorySlots ~= nil then
-- Storage Header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Speicherung\'\'\'\n'
 
--Inventory Slots
infobox = infobox .. '|-\n| Inventarplätze:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.inventorySlots .. '\n'
--inventoryMaxWeight
if itemTable.inventoryMaxWeight ~= nil then
maxWeightKg = itemTable.inventoryMaxWeight/1000
infobox = infobox .. '|-\n| Inventar Max. Gewicht:\n| style=\"text-align: right; padding: 3px;\" | ' .. maxWeightKg .. ' Kg\n'
else
infobox = infobox .. '|-\n| Inventar Max. Gewicht:\n| style=\"text-align: right; padding: 3px;\" |Unbegrenzt \n'
end
end
 
-- 'Power' section (if EngeryType is ``not nil)
if itemTable.energyType ~= nil then 
-- Power Header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Leistung\'\'\'\n'
 
--EngergyType
infobox = infobox .. '|-\n| Energietyp:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.energyType .. '\n'
--Grid Radius
infobox = infobox .. '|-\n| Gitterradius:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.gridRadius .. ' m\n'
--Energy Produced
infobox = infobox .. '|-\n|Energie produziert:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.energyProduced .. ' J\n'
--Energy Used
infobox = infobox .. '|-\n| Energieverbrauch:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.energyUsed .. ' J\n'
end
 
-- 'Fuel' Section (if fuelsUsed by Object)
if itemTable.fuelsUsed ~= nil then
-- Fuel Header
infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Kraftstoffe\'\'\'\n'
--Fuels Used by Object
infobox = infobox .. '|-\n| Verwendete Kraftstoffe:\n| style=\"text-align: right; padding: 3px;\" | ' .. itemTable.fuelsUsed .. '\n'
end
-- 'Fluid' section (if fludisUsed is not nil)   
            if itemTable.fluidsUsed ~= nil then
            -- Liquid/Gas Header
                infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Flüssigkeit / Gas\'\'\'\n'
           
                --Input (fludisUsed)  
                infobox = infobox .. '|-\n|Eingang: \n| style=\"text-align: right; padding: 3px;\" | '
                    for a,b in ipairs(itemTable.fluidsUsed) do
                        local acceptedType =  b[1]
                        local cRateString = string.gsub(b[2], "%s+", "")
                        local consumingRate = tonumber(cRateString)
                        infobox = infobox .. acceptedType .. ' at ' .. consumingRate .. ' L'
                        if (a ~= #itemTable.fluidsUsed) then
                            infobox = infobox .. ', '
                        end
                    end
                infobox = infobox .. '\n'
--Output (liquidProduced)
infobox = infobox .. '|-\n| Ausgabe: \n| style=\"text-align: right; padding: 3px;\" | '
for a,b in ipairs(itemTable.fluidsProduced) do
local producedType =  b[1]
                        local pRateString = string.gsub(b[2], "%s+", "")
                        local producingRate = tonumber(pRateString)
if (producingRate == 0) then
producingRate = 'Rate of Input'
end
infobox = infobox .. producedType .. ' at ' .. producingRate .. ' L'
if (a ~= #itemTable.fluidsProduced) then
infobox = infobox .. ', '
end
end
infobox = infobox .. '\n'
end
end
-- Road Object header (if group == Road Items)
return WikiText
if itemTable.group == 'Road Items' then
infobox = infobox .. '|- style=\"text-align: center; background-color: #517ab2;\"\n| colspan=\"2\" | \'\'\'Road Object\'\'\'\n'
-- Object Placed Image
local image = 'NoImage.png|link=https://wiki.play.eco/index.php?title=Special:Upload&wpDestFile=' .. itemimagename .. '_Placed.png|[[Category:Pages_with_missing_placed]]'
if mw.title.makeTitle('File', itemimagename .. '_Placed.png').file.exists then
image = itemimagename .. '_Placed.png'
elseif mw.title.makeTitle('File', itemimagename .. '_Placed.jpg').file.exists then
image = itemimagename .. '_Placed.jpg'
end
infobox = infobox .. '|-\n| colspan=\"2\" style=\"padding: 10px;\" | [[File:' .. image .. '|center|border|240px]]\n'
end
-- Tags Header
if itemTable.tagGroups ~= nil and itemTable.tagGroups ~= {} then
            -- Tags Header
            infobox = infobox .. '|- style=\"background-color: #4688C0; text-align: center;\"\n| colspan=\"2\" | \'\'\'Tags\'\'\'\n'
            local tags = itemTable.tagGroups
            local list = ''
            -- for each item in the list (a is position, b is value)           
            for a,b in ipairs(tags) do
            --if not these tags listed here
                if (b ~='[[Object]]' or b ~= '[[World  Object]]' or b ~= '[[Housing  Object]]') then
                    -- add the tag to the list
                    list = list .. b
                end
                -- if not the last item in the list
                if (b ~= tags[#tags]) then
                    -- add a comma
                    list = list .. ', '
                end
            end
            -- Now the list is made add it to the infobox
            infobox = infobox .. '|- style=\"text-align: center;\"\n| colspan=\"2\" | ' .. list .. '\n'
        end
 
infobox = infobox .. '|}'
return infobox
end
 
-- Main entry point for the Module
function p.ItemMain()
    -- get args from the Template
    local args = norm()
   
    -- get item data
    local itemData = require( "Module:ItemData" )
    return itemBox( args, itemData )
end
end


return p
return p

Aktuelle Version vom 3. März 2026, 19:44 Uhr


local p = {}

local Utils = require('Module:Utils')
local RecipeUtils = require('Module:RecipeUtils')
local IconUtils = require('Module:IconUtils')
local InfoCardUtils = require('Module:InfoCardUtils')

local Lang = Utils.getLanguageName()

function p.main(frame)
	local PageName = frame.args[1]
	if (Lang == 'English') then ItemName = PageName else ItemName = Utils.ItemSearch(PageName) end
	local ItemData = mw.loadData( "Module:ItemData" )
    local Item = ItemData.items[ItemName]
	local WikiText =''
	
	WikiText =  WikiText ..'__NOTOC__'
	WikiText =  WikiText ..'Page name get test: ' .. PageName ..'</br>'
	WikiText =  WikiText ..'Item name get test: ' .. ItemName ..'</br>'
	
	WikiText =  WikiText .. '<div class="row gy-4 gx-5"><div class="col-md-6">'
	
	WikiText =  WikiText .. '</div>'
	WikiText =  WikiText ..'<div class="col-md-6"><div class="card border-primary"><div class="card-body">'
    WikiText =  WikiText ..'<h2 class="card-title fs-40">' .. IconUtils.main{name = Item.Name[Lang], id = Item.ID , size = 48, style = 1} .. '  ' .. Item.Name[Lang] .. '</h2>'
	WikiText =  WikiText ..'<p class="col-lg-10 card-text">' .. Item.Description[Lang] .. '</p>'
	
	WikiText =  WikiText ..'</div></div></div></div>'
	
	local RecipeItemCraft = RecipeUtils.ItemCraft(ItemName)
	if (RecipeItemCraft ~= "") then
		WikiText =  WikiText .. '<h3>' .. Utils.Translate("Crafted At") .. ':</h3>';
		WikiText =  WikiText .. RecipeUtils.CraftTable(RecipeItemCraft);
	end
	
	local RecipeItemIngredient = RecipeUtils.ItemIngredient(ItemName)
	if (RecipeItemIngredient ~= "") then
		WikiText =  WikiText .. '<h3>' .. Utils.Translate("Used in") .. ':</h3>';
		WikiText =  WikiText .. RecipeUtils.CraftTable(RecipeItemIngredient)
	end
	
	local ItemTagList = Utils.ItemTags(Item.Tags);
	if (ItemTagList ~= "") then
		WikiText =  WikiText .. '<h3>' .. Utils.Translate("Tags Applying to") .. ':</h3>';
		WikiText =  WikiText .. ItemTagList
	end
	
	local RecipeTagsIngredient = RecipeUtils.TagsIngredient(Item.Tags)
	if (RecipeTagsIngredient ~= "") then
		WikiText =  WikiText .. '<h3>Used as Tag item in:</h3>';
		WikiText =  WikiText .. RecipeUtils.CraftTable(RecipeTagsIngredient)
	end
	
	if (Item.WorldObjectItem == "True") then WikiText =  WikiText .. InfoCardUtils.WorldObjectModule(ItemName) end
	
	
	WikiText =  WikiText .. '<h3>How use Icon:</h3>'
	WikiText =  WikiText .. '<p>' .. Item.Name[Lang] .. ' icon can be used on any sign that has a text component, including on [[Vehicles]]:</br>'
	WikiText =  WikiText .. 'Icon with background: <icon name="' .. Item.ID .. '"></br>'
	WikiText =  WikiText .. 'Icon without background: <icon name="' .. Item.ID .. '" type="nobg"></p>'

	if (Lang ~= 'English') then WikiText =  WikiText .. '[[en:' .. Item.Name.English .. ']]' end
	if (Lang ~= 'Russian') then WikiText =  WikiText .. '[[ru:' .. Item.Name.Russian .. ']]' end
	if (Lang ~= 'German') then WikiText =  WikiText .. '[[de:' .. Item.Name.German .. ']]' end
	if (Lang ~= 'French') then WikiText =  WikiText .. '[[fr:' .. Item.Name.French .. ']]' end
	
	return WikiText
end

return p