Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: ninja159 on May 24, 2016, 06:31:48 pm

Title: [QUESTION] [BC] [Lua] Options for addon
Post by: ninja159 on May 24, 2016, 06:31:48 pm
Hello, how i can add status of my custom currency (from DB) to addon, and how i can add list of items to addon, when the player moves the mouse pops up a detailed description of item , thanks for answer
Title: Re: [QUESTION] [BC] [Lua] Options for addon
Post by: stoneharry on May 24, 2016, 09:54:20 pm
Quote from: "ninja159"
Hello, how i can add status of my custom currency (from DB) to addon, and how i can add list of items to addon, when the player moves the mouse pops up a detailed description of item , thanks for answer

Well, for example, to display an item/spell in a tooltip on mouseover of an image in 3.3.5a:

Code: [Select]
local function OnEnterFrame(self, motion)
GameTooltip:Hide()
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if (self.type == 1) then
GameTooltip:SetHyperlink("spell:"..self.id)
elseif (self.type == 2) then
if (self.gemSpell ~= 0) then
GameTooltip:SetHyperlink("spell:"..self.gemSpell)
else
GameTooltip:SetHyperlink("item:"..self.id)
end
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType,
itemStackCount, itemEquipLoc, itemTexture, itemSellPrice =
GetItemInfo(self.id)
self:SetBackdrop({bgFile = itemTexture,
edgeFile = "",
tile = false, tileSize = 68, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }});
end
GameTooltip:SetFrameLevel(5)
GameTooltip:Show()
end