Module:InventorySlot: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
(Should allow arbitrary html be inserted into the slots. Mainly used for specialized items)
Line 14: Line 14:


function UISlot:SetItem(item)
function UISlot:SetItem(item)
if string.sub(item,1,1) == '<' then
-- If the item is already html just save that
self.__html = item
return self
end
if item == "" then item = nil end
if item == "" then item = nil end
self.__sprite = item and Sprite:Item(item) --nil if item = nil else get sprite
self.__sprite = item and Sprite:Item(item) --nil if item = nil else get sprite
Line 54: Line 60:
else
else
slot = mw.html.create("div")
slot = mw.html.create("div")
end
if self.__html then
return slot:wikitext(self.__html)
end
end


Line 59: Line 69:


if self.__sprite then
if self.__sprite then
self.__sprite:GenerateHTML(slot)
local spriteDiv = self.__sprite:GenerateHTML(slot)
end
end
if self.__large then
if self.__large then