Bureaucrats, Check users, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, Widget editors
1,655
edits
(forgot the underscores) |
(It would help if EffectSprite aliases were accessed) |
||
(11 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
local aliasData = { | local aliasData = { | ||
vanillaAliases = [[Module:InventorySlot/Aliases]], | vanillaAliases = [[Module:InventorySlot/Aliases]], | ||
gm4Aliases = [[Module:Gm4Sprite/Aliases]] | gm4Aliases = [[Module:Gm4Sprite/Aliases]], | ||
effectAliases = [[Module:EffectSprite/Aliases]] | |||
} | } | ||
Line 11: | Line 12: | ||
local vanillaAliases = mw.loadData( aliasData.vanillaAliases ) | local vanillaAliases = mw.loadData( aliasData.vanillaAliases ) | ||
local gm4Aliases = mw.loadData( aliasData.gm4Aliases ) | local gm4Aliases = mw.loadData( aliasData.gm4Aliases ) | ||
local effectAliases = mw.loadData( aliasData.effectAliases ) | |||
local aliases | local aliases | ||
Line 128: | Line 130: | ||
if type == "gm4" then | if type == "gm4" then | ||
aliases = gm4Aliases | aliases = gm4Aliases | ||
elseif type == "effect" then | |||
aliases = effectAliases | |||
else | else | ||
aliases = vanillaAliases | aliases = vanillaAliases | ||
Line 149: | Line 153: | ||
elseif aliases[item].name then | elseif aliases[item].name then | ||
self.__settings.title = aliases[item].name | self.__settings.title = aliases[item].name | ||
end | |||
if aliases[item].name ~= nil then | |||
local itemName = aliases[item].name | |||
self:setPosition(self.__source.ids[itemName].pos) | |||
if self.__source.ids[itemName].spriteSheet then | |||
self.__settings.image = getSpriteSheet(self.__source.ids[itemName].spriteSheet) | |||
end | |||
end | end | ||
else | else | ||
self.__settings.title = item; | self.__settings.title = item; | ||
if self.__source.ids[item] then | |||
self:setPosition(self.__source.ids[item].pos) | |||
if self.__source.ids[item].spriteSheet then | |||
self.__settings.image = getSpriteSheet(self.__source.ids[item].spriteSheet) | |||
end | |||
else | |||
self:setPosition(nil) --will use default | |||
end | |||
end | end | ||
return self | return self | ||
end | end | ||
Line 196: | Line 209: | ||
function Sprite:SetLore(text) | function Sprite:SetLore(text) | ||
self.__settings.lore = text | self.__settings.lore = text | ||
return self | |||
end | |||
function Sprite:HideTooltip() | |||
self.__settings.hideTooltip = true | |||
return self | return self | ||
end | end | ||
Line 239: | Line 257: | ||
sprite:addClass("sprite") | sprite:addClass("sprite") | ||
sprite:addClass("masterTooltip") | |||
if self.__settings.hideTooltip ~= true then | |||
sprite:addClass("masterTooltip") | |||
end | |||
local source = self.__source | local source = self.__source | ||
sprite:addClass(source.settings.classname) | sprite:addClass(source.settings.classname) | ||
sprite:attr( "title", self.__settings.name ) | |||
if self.__settings.hideTooltip ~= true then | |||
sprite:attr( "title", self.__settings.name ) | |||
end | |||
sprite:attr( "data-title", self.__settings.title ) | sprite:attr( "data-title", self.__settings.title ) |
edits