Модуль:Entity Lookup: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
CL w (обсуждение | вклад) м Замена текста — «Mousegif.gif» на «MobMouse2.png» |
||
| (не показаны 4 промежуточные версии 2 участников) | |||
| Строка 12: | Строка 12: | ||
if not id then return "Не найдено" end | if not id then return "Не найдено" end | ||
local override = p.name_overrides[id] | local override = p.name_overrides[id] | ||
if override then | if override then | ||
| Строка 32: | Строка 31: | ||
if not name then return "Не найдено" end | if not name then return "Не найдено" end | ||
for id, overrideName in pairs(p.name_overrides) do | for id, overrideName in pairs(p.name_overrides) do | ||
if overrideName == name then | if overrideName == name then | ||
| Строка 39: | Строка 37: | ||
end | end | ||
for id, entity in pairs(p.entities) do | for id, entity in pairs(p.entities) do | ||
if entity.name == name then | if entity.name == name then | ||
| Строка 50: | Строка 47: | ||
-- p.createtexttooltip{args={"Верхний текст", "FreedomImplant", "Файл: | -- p.getname{args={"FreedomImplant"}} | ||
function p.getdesc(frame, entid) -- {{#invoke:Entity Lookup|getdesc|ProtoID}} | |||
local out = "" | |||
local id = "" | |||
if frame.args[1] ~= nil then id = frame.args[1] | |||
else id = entid end | |||
local entity = p.entities[id] | |||
if entity ~= nil then | |||
out = entity.desc | |||
else | |||
out = "Не найдено" | |||
end | |||
return out | |||
end | |||
-- 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 = " " | ||
| Строка 63: | Строка 76: | ||
-- {{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 | ||
| Строка 69: | Строка 82: | ||
-- 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 = " " | ||
| Строка 85: | Строка 98: | ||
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 | ||