Thread Tools Display Modes
12-25-19, 11:35 PM   #1
Roeshambo
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Jul 2019
Posts: 5
I've always found the easiest way to get stats for an item is using tooltips. You can create a tooltip but never display it, simply pushing the item link to it in a function is sufficient. You can also obtain spell damage type with the text just using patterns.

Code:
local scantip = CreateFrame("GameTooltip", "MyScanningTooltip", nil, "GameTooltipTemplate")
scantip:SetOwner(UIParent, "ANCHOR_NONE")

local function MyGetItemStats(link)
   scantip:SetHyperlink(link)
   for i=2, scantip:NumLines() do   -- can skip first line since it's just the item name.. or not. up to you
       local text = _G["MyScanningTooltipTextLeft"..i]:GetText())
       -- do stuff with text
   end
end
You can get a better idea as to what it's doing by mousing over an item in game and using:
/script for i=1, GameTooltip:NumLines() do print(_G["GameTooltipTextLeft"..i]:GetText()) end

Hopefully I'm getting the premise of your intent correct 0_o.

Last edited by Roeshambo : 12-25-19 at 11:38 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » GetItemStats empty response (WOW Classic)


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off