View Single Post
12-25-19, 11:35 PM   #2
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