Модуль:Entity Lookup: различия между версиями
Pok (обсуждение | вклад) м откат суффиксов Метка: ручная отмена |
Pok (обсуждение | вклад) label |
||
| (не показано 5 промежуточных версий 2 участников) | |||
| Строка 1: | Строка 1: | ||
local | local p = {} | ||
p.entities = mw.loadData("Модуль:IanComradeBot/entity prototypes.json/data") or {} | |||
p.entities = prototypes. | p.name_overrides = mw.loadData("Модуль:IanComradeBot/entity name overrides.json/data") or {} | ||
p.name_overrides = overrides. | |||
| Строка 19: | Строка 17: | ||
local entity = p.entities[id] | local entity = p.entities[id] | ||
if entity then | if entity then | ||
local name = entity.name or "" | |||
if entity.label and entity.label ~= "" then | |||
name = name .. " (" .. entity.label .. ")" | |||
end | |||
return name | |||
end | end | ||
| Строка 63: | Строка 65: | ||
-- p.createtexttooltip{args={"Верхний текст", "FreedomImplant", "Файл: | -- p.createtexttooltip{args={"Верхний текст", "FreedomImplant", "Файл:Horns.png"}} | ||
function p.createtexttooltip(frame) -- {{#invoke:Entity Lookup|createtexttooltip|Текст|ProtoID|img=картиночка}} | function p.createtexttooltip(frame) -- {{#invoke:Entity Lookup|createtexttooltip|Текст|ProtoID|img=картиночка}} | ||
local out = " " | local out = " " | ||
| Строка 76: | Строка 78: | ||
-- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}} | -- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}} | ||
end else | end else | ||
out = frame:preprocess("{{Tooltip|".. frame.args[1] .."|Не найден|Предмет не найден|img= | out = frame:preprocess("{{Tooltip|".. frame.args[1] .."|Не найден|Предмет не найден|img=MobMouse2.png}}") | ||
end | end | ||
return out | return out | ||
| Строка 82: | Строка 84: | ||
-- p.createimagetooltip{args={"Файл: | -- p.createimagetooltip{args={"Файл:Horns.png", "FreedomImplant", Статы="Имеет 3 заряда"}} | ||
function p.createimagetooltip(frame) -- {{#invoke:Entity Lookup|createimagetooltip|Картинка|ProtoID|Мета=мета|Статы=статы}} | function p.createimagetooltip(frame) -- {{#invoke:Entity Lookup|createimagetooltip|Картинка|ProtoID|Мета=мета|Статы=статы}} | ||
local out = " " | local out = " " | ||
| Строка 98: | Строка 100: | ||
out = frame:preprocess("{{Tooltip|".. pic .. "|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}") | out = frame:preprocess("{{Tooltip|".. pic .. "|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}") | ||
end else | end else | ||
out = frame:preprocess("{{Tooltip|[[Файл: | out = frame:preprocess("{{Tooltip|[[Файл:MobMouse2.png|64x64px|left|middle|link=]]|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}") | ||
end | end | ||
-- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}} | -- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}} | ||
end else | end else | ||
out = frame:preprocess("{{Tooltip|" .. pic .. "|Не найден|Предмет не найден|img= | out = frame:preprocess("{{Tooltip|" .. pic .. "|Не найден|Предмет не найден|img=MobMouse2.png|no-text-decoration=1}}") | ||
end | end | ||
return out | return out | ||