Hадо чтобы иконка отображалась в обоих случаях, при наведении, и при клике по итему, есть идеи :D?
https://i.ibb.co/jgdwjcH/image.png
помню была где-то тема про чтото похожее, спруди кидал но найти немогу
Вид для печати
Hадо чтобы иконка отображалась в обоих случаях, при наведении, и при клике по итему, есть идеи :D?
https://i.ibb.co/jgdwjcH/image.png
помню была где-то тема про чтото похожее, спруди кидал но найти немогу
https://forum.wowcircle.net/showthre...=1#post6333539
это почти то что нужно, но нету иконки при наведении
https://i.ibb.co/C0W4yz3/image.png
help please
https://yadi.sk/d/Y32VLkp2goLtsw
Спелл_ИтемИД можешь оттуда выпилить, я его туда запихал для себя!
Вот моёPHP код:
-- icons\ilvl\id tooltip
do
local TOOLTIPS = {ItemRefTooltip,GameTooltip,ShoppingTooltip1,ShoppingTooltip2,ShoppingTooltip3}
local GetItemIcon = GetItemIcon
local GetItemInfo = GetItemInfo
local _G = _G
local function OnTooltipSetSpell(self)
local _,_,spell = self:GetSpell()
if spell and GetSpellInfo(spell) then
local title = _G[self:GetName().."TextLeft1"]
if title then
local _,_,texture = GetSpellInfo(spell)
title:SetFormattedText("|T%s:20:20:0:0:64:64:5:59:5:59:20|t %s",texture,title:GetText())
end
self:AddLine(("|cff3366ffID|r: |cffffffff%d|r"):format(spell))
self:Show()
end
end
local function OnTooltipSetItem(self)
local itemName,link = self:GetItem()
if link and GetItemInfo(link) then
local title
for i = 1,2 do
title = _G[("%sTextLeft%d"):format(self:GetName(),i)]
if title and title:GetText() and title:GetText():find(itemName) then
title:SetFormattedText("|T%s:20:20:0:0:64:64:5:59:5:59:20|t %s",GetItemIcon(link),title:GetText())
break
end
end
local _,_,_,ilvl = GetItemInfo(link)
local id = link:match("|Hitem:(%d+):")
ilvl = ilvl and ("|cff3366ffilvl|r: |cffffffff%d|r"):format(ilvl)
id = id and ("|cff3366ffID|r: |cffffffff%d|r"):format(id)
self:AddDoubleLine(id,ilvl)
self:Show()
end
end
for _,tooltip in pairs(TOOLTIPS) do
tooltip:HookScript("OnTooltipSetSpell",OnTooltipSetSpell)
tooltip:HookScript("OnTooltipSetItem",OnTooltipSetItem)
end
end
- - - Updated - - -
Похожий модуль из сборки дримлолза
PHP код:
local engine, modules, media = select(2, ...):unpack()
local tooltip = modules:LoadModule("Tooltip")
local SetIcon = function(self, icon)
local title = icon and _G[self:GetName().."TextLeft1"]
if title then
title:SetFormattedText("|T%s:20:20:0:0:64:64:5:59:5:59:%d|t %s", icon, 20, title:GetText())
end
end
local Hook = function(method, func)
return function(tooltip)
local modified = false
tooltip:HookScript("OnTooltipCleared", function(self, ...)
modified = false
end)
tooltip:HookScript(method, function(self, ...)
if not modified then
modified = true
func(self, ...)
end
end)
end
end
local hookItem = Hook("OnTooltipSetItem", function(self, ...)
local _, link = self:GetItem()
if link then
SetIcon(self, GetItemIcon(link))
end
end)
local hookSpell = Hook("OnTooltipSetSpell", function(self, ...)
local _, _, id = self:GetSpell()
if id then
SetIcon(self, select(3, GetSpellInfo(id)))
end
end)
local addLine = function(self, id, isItem)
for i = 1, self:NumLines() do
local line = _G["GameTooltipTextLeft"..i]
if not line then break end
local text = line:GetText()
if text and (text:match("ID") or text:match("ID")) then return end
end
if isItem then
self:AddLine("|cFF4488FFID|r "..id)
else
self:AddLine("|cFF4488FFID|r "..id)
end
self:Show()
end
local attachItemTooltip = function(self)
local link = select(2, self:GetItem())
if not link then return end
local id = select(3, strfind(link, "^|%x+|Hitem:(%-?%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%-?%d+):(%-?%d+)"))
if id then addLine(self, id, true) end
end
function tooltip:Init()
for _, tooltip in pairs{GameTooltip, ItemRefTooltip, ItemRefShoppingTooltip1, ItemRefShoppingTooltip2, ShoppingTooltip1, ShoppingTooltip2} do
hookItem(tooltip)
hookSpell(tooltip)
end
hooksecurefunc(GameTooltip, "SetUnitAura", function(self, ...)
local id = select(11, UnitAura(...))
if id then addLine(self, id) end
end)
GameTooltip:HookScript("OnTooltipSetSpell", function(self)
local id = select(3, self:GetSpell())
if id then addLine(self, id) end
end)
hooksecurefunc("SetItemRef", function(link, ...)
local id = tonumber(link:match("spell:(%d+)"))
if id then addLine(ItemRefTooltip, id) end
end)
GameTooltip:HookScript("OnTooltipSetItem", attachItemTooltip)
ItemRefTooltip:HookScript("OnTooltipSetItem", attachItemTooltip)
ItemRefShoppingTooltip1:HookScript("OnTooltipSetItem", attachItemTooltip)
ItemRefShoppingTooltip2:HookScript("OnTooltipSetItem", attachItemTooltip)
ShoppingTooltip1:HookScript("OnTooltipSetItem", attachItemTooltip)
ShoppingTooltip2:HookScript("OnTooltipSetItem", attachItemTooltip)
end
[свернуть]
спасибо!true-story