Модуль:Entity Lookup: различия между версиями

м откат суффиксов
Метка: ручная отмена
label
 
(не показано 5 промежуточных версий 2 участников)
Строка 1: Строка 1:
local prototypes = mw.loadData("Module:Entity Lookup/data")
local p = {}
local overrides = mw.loadData("Module:Entity Lookup/names")


local p = {}
p.entities = mw.loadData("Модуль:IanComradeBot/entity prototypes.json/data") or {}
p.entities = prototypes.entities
p.name_overrides = mw.loadData("Модуль:IanComradeBot/entity name overrides.json/data") or {}
p.name_overrides = overrides.name_overrides or {}




Строка 19: Строка 17:
local entity = p.entities[id]
local entity = p.entities[id]
if entity then
if entity then
return entity.name
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", "Файл:Honks.gif"}}
-- 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=Mousegif.gif}}")
  out = frame:preprocess("{{Tooltip|".. frame.args[1] .."|Не найден|Предмет не найден|img=MobMouse2.png}}")
end
end
return out
return out
Строка 82: Строка 84:




-- p.createimagetooltip{args={"Файл:Honks.gif", "FreedomImplant", Статы="Имеет 3 заряда"}}
-- 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|[[Файл:Mousegif.gif|64x64px|left|middle|link=]]|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}")
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=Mousegif.gif|no-text-decoration=1}}")
  out = frame:preprocess("{{Tooltip|" .. pic .. "|Не найден|Предмет не найден|img=MobMouse2.png|no-text-decoration=1}}")
end
end
return out
return out