![]() |
#1 |
pulling stats off an item
Hello all,
Is there any way to pull the number value for a stat off of an inspected item. For instance when I inspect an item, and I use Inspect.Item.Detail, will it give me a number for strength, or will it just say there is strength on it. Any assistance with this would be great. Thanks for your time. |
|
![]() |
![]() |
![]() |
#2 |
According to the Addon API documentation of Inspect.Item.Detail:
Code:
stats: The base stats of this item. Members may include "block", "critAttack", "critSpell", "deflect", "dexterity", "dodge", "endurance", "energyMax", "energyRegen", "focus", "hit", "intelligence", "manaMax", "manaRegen", "movement", "parry", "powerAttack", "powerMax", "powerRegen", "powerSpell", "resistAir", "resistDeath", "resistEarth", "resistFire", "resistLife", "resistWater", "stealth", "stealthDetect", "strength", "wisdom", "xp", "valor", "toughness", and "vengeance". Code:
local itemStrength = Inspect.Item.Detail(item).stats.strength Code:
local itemDetail = Inspect.Item.Detail(item) local itemStrength = itemDetail and itemDetail.stats and itemDetail.stats.strength or 0 |
|
![]() |
![]() |
![]() |
#3 |
well I copy and pasted the code as you suggested, but it only returns a value of 0, which is what I was getting before as well. Any other suggestions? Or is there just no way to get the value of a stat into a variable?
Last edited by pedenspeed : 12-02-12 at 11:18 AM. |
|
![]() |
![]() |
![]() |
#4 |
What are just using as value for the item variable?
Just tried this and it works for me: Code:
local item = Utility.Item.Slot.Equipment("helmet") local itemDetail = Inspect.Item.Detail(item) local itemStrength = itemDetail and itemDetail.stats and itemDetail.stats.strength or 0 |
|
![]() |
![]() |
![]() |
#5 | |
Quote:
|
||
![]() |
![]() |
![]() |
#6 |
I think what you are looking for is the following event:
Event.Tooltip this will trigger every time the tooltip is changed. Once fired, you will need to use Inspect.Tooltip This will get the entire tooltip object. In this object there is a type property that will hold "item" or "itemtype" for you to key off of... others tooltip types are "unit", "buff", and "ability" Then use the code posted to pass the item... Example: Code:
function scrapeTooltip() local ttType = "" local ttItem = nil ttType, ttItem = Inspect.Tooltip() if ttType == "item" then TTGetItem(ttItem) elseif ttType then print(string.format("Type: %s", ttType)) end end function TTGetItem(itm) local itemDetail = Inspect.Item.Detail(itm) local itemStrength = itemDetail and itemDetail.stats and itemDetail.stats.strength or 0 if itemStrength then print(string.format("Strength: %s", itemStrength)) end end table.insert(Event.Tooltip, {scrapeTooltip, "Tester", "Tester_Init"}) Last edited by Bullarky : 01-11-13 at 08:36 PM. |
|
![]() |
![]() |
![]() |
![]() | Riftui » Developer Discussions » Lua Help » pulling stats off an item |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|