Thread Tools Display Modes
04-18-15, 12:25 AM   #1
tobias1919
A Deviate Faerie Dragon
Join Date: Mar 2015
Posts: 13
Get the primary stats from item link?

Hello! I'll start of by saying i'm really new to lua.

I'm trying to make an addon, which "auto-loots" items that you do not need, on request from a friend of mine.

I've managed to make the addon auto loot items, based on types and subtypes (armor, weapon for types, and mail, plate etc for subtypes) - however, my friend requests for a way to autoloot items with intellect when he's playing a warrior and so on...

#1: I've tried to find a way to scan the tooltip from the itemlink (which i cannot find a decent explenation of - probably because i just don't understand it)

#2: How would it be possible to scan the tooltip for higher level items (when the gear gives both intellect and strength, based on class/specc)?

Would love any help/refferences - or a bit of code to explain how this works! Thanks alot!
  Reply With Quote
04-18-15, 06:07 AM   #2
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
Hi!

The function you're searching for is the API GetItemStats, which returns the stats of an item, given the itemlink or even the name. From the example on the bottom of the page you can learn how to use the function. After using it you only have to check the entrys of the table for the given stats (e.g. "intellect").

While primary stats - such as intellect, stamina, etc. - are unlikely to change their role in future, this may not apply on secondary stats - such as multistrike, critical strike, etc. -, which may become more or less important for each specialization. So, if you're planning on including an auto-loot-system for secondary stats you have to update your addon everytime something's changed.

Cheers,

Odjur

Last edited by odjur84 : 04-19-15 at 01:01 AM.
  Reply With Quote
04-19-15, 02:17 AM   #3
tobias1919
A Deviate Faerie Dragon
Join Date: Mar 2015
Posts: 13
Ahh... right...

Thanks alot for the respons!

Although i had been looking at the API to find a method like that, apperently it must've slipped through the filter of my tired eyes... Thanks again tho, was exactly what i was looking for!
  Reply With Quote
04-19-15, 02:37 AM   #4
odjur84
A Fallenroot Satyr
 
odjur84's Avatar
Join Date: Jan 2015
Posts: 24
You're welcome!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Get the primary stats from item link?

Thread Tools
Display Modes

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