Module:ItemInfoCard: Difference between revisions
From Eco - English Wiki
| [checked revision] | [checked revision] |
No edit summary |
No edit summary |
||
| Line 32: | Line 32: | ||
local ItemTagList = Item.Tags | local ItemTagList = Item.Tags | ||
WikiText = WikiText .. '<h3>Tags:</h3>'; | WikiText = WikiText .. '<h3>Tags:</h3>'; | ||
WikiText = WikiText .. Utils.Translate("{0} Tag"); | |||
Revision as of 16:38, 15 September 2025
Documentation for this module may be created at Module:ItemInfoCard/doc
local p = {}
local Utils = require('Module:Utils')
local RecipeUtils = require('Module:RecipeUtils')
local IconUtils = require('Module:IconUtils')
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 = require( "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>'
local RecipeItemCraft = RecipeUtils.ItemCraft(ItemName)
if (RecipeItemCraft ~= "") then
WikiText = WikiText .. '<h3>Crafted At:</h3>';
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemCraft);
end
local RecipeItemIngredient = RecipeUtils.ItemIngredient(ItemName)
if (RecipeItemIngredient ~= "") then
WikiText = WikiText .. '<h3>Used in:</h3>';
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemIngredient)
end
local ItemTagList = Item.Tags
WikiText = WikiText .. '<h3>Tags:</h3>';
WikiText = WikiText .. Utils.Translate("{0} Tag");
local RecipeTagsIngredient = RecipeUtils.TagsIngredient(Item.Tags)
if (RecipeTagsIngredient ~= "") then
WikiText = WikiText .. '<h3>Used as Tag item in:</h3>';
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeTagsIngredient)
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