Модуль:ItemInfoCard: различия между версиями
Материал из Eco - Русская Wiki
| [досмотренная версия] | [досмотренная версия] |
StalEF (обсуждение | вклад) Нет описания правки |
StalEF (обсуждение | вклад) Нет описания правки |
||
| Строка 2: | Строка 2: | ||
local Utils = require('Module:Utils') | local Utils = require('Module:Utils') | ||
local RecipeUtils = require('Module:RecipeUtils') | |||
local IconUtils = require('Module:IconUtils') | local IconUtils = require('Module:IconUtils') | ||
local Lang = Utils.getLanguageName() | local Lang = Utils.getLanguageName() | ||
| Строка 14: | Строка 14: | ||
local WikiText ='' | local WikiText ='' | ||
WikiText = WikiText ..'__NOTOC__' | |||
WikiText = WikiText ..'page name get test: ' .. PageName ..'</br>' | WikiText = WikiText ..'page name get test: ' .. PageName ..'</br>' | ||
WikiText = WikiText ..'Item name get test: ' .. ItemName ..'</br>' | WikiText = WikiText ..'Item name get test: ' .. ItemName ..'</br>' | ||
| Строка 19: | Строка 20: | ||
local RecipeItemCraft = RecipeUtils.ItemCraft(ItemName) | local RecipeItemCraft = RecipeUtils.ItemCraft(ItemName) | ||
if (RecipeItemCraft ~= "") then | if (RecipeItemCraft ~= "") then | ||
WikiText = WikiText .. '<h3>Crafted At:</h3>'; | WikiText = WikiText .. '<h3>' .. Utils.Translate("Crafted At") .. ':</h3>'; | ||
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemCraft); | WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemCraft); | ||
end | end | ||
| Строка 25: | Строка 26: | ||
local RecipeItemIngredient = RecipeUtils.ItemIngredient(ItemName) | local RecipeItemIngredient = RecipeUtils.ItemIngredient(ItemName) | ||
if (RecipeItemIngredient ~= "") then | if (RecipeItemIngredient ~= "") then | ||
WikiText = WikiText .. '<h3>Used in:</h3>'; | WikiText = WikiText .. '<h3>' .. Utils.Translate("Used in") .. ':</h3>'; | ||
WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemIngredient) | WikiText = WikiText .. RecipeUtils.CraftTable(RecipeItemIngredient) | ||
end | end | ||
WikiText = WikiText .. '<h3> | local ItemTagList = Item.Tags | ||
WikiText = WikiText .. '<p> | if (#ItemTagList > 0 ) then | ||
WikiText = WikiText .. ' | WikiText = WikiText .. '<h3>' .. Utils.Translate("Tags Applying to") .. ':</h3>'; | ||
WikiText = WikiText .. ' | WikiText = WikiText .. Utils.ItemTags(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 | |||
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 ~= 'English') then WikiText = WikiText .. '[[en:' .. Item.Name.English .. ']]' end | ||
Версия от 22:04, 16 сентября 2025
Для документации этого модуля может быть создана страница Модуль: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>' .. 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 = Item.Tags
if (#ItemTagList > 0 ) then
WikiText = WikiText .. '<h3>' .. Utils.Translate("Tags Applying to") .. ':</h3>';
WikiText = WikiText .. Utils.ItemTags(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
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