Thread Tools Display Modes
10-15-14, 08:49 AM   #1
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
How can I tell if an item has bonus armor?

Until the WoD patch I've been detecting items with "wrong" stats (e.g. spirit for rogues) using GetItemStats, but it appears that regular armor and bonus armor both return the same value (RESISTANCE0_NAME).
This means I can't use this method to tell whether this item is right for a rogue (because all helmets have some armor) or it's wrong for a rogue (because only tank rings have armor on them), unless I differentiate between ring/ neck/ trinket items and everything else.

So, is there another way to get stats that can tell the difference between armor and bonus armor?
Does it make sense to parse item tooltips for it? If so, what's a good way of telling whether bonus armor comes from an enchant/ gem or from the item itself?
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
10-15-14, 09:02 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
If we assume all gear with the same item level and type has the same amount of base armor, then all you need to do is figure out the formula and check if the item has more armor than expected.

A wowhead search returns no rings, trinkets or amulets with armor on them, so I'm not sure how big of an issue this really is.

If you have a link to an item that actually does have bonus armor, it would help.

If I remember correctly it turns the armor line green in the tooltip, so wouldn't be very difficult to strip out, and you can remove the enchants from the item link before creating the tooltip if that's a problem.

Last edited by semlar : 10-15-14 at 09:04 AM.
  Reply With Quote
10-15-14, 09:23 AM   #3
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Here's one item with bonus armor on it: http://www.wowhead.com/item=81139
The base armor calculation's a bit messy since it depends on the armor type and such, but I guess it could be done. The tooltip might be simpler, especially since I don't support multiple languages anyway. It really is absurd though if there's no direct way of getting this from the API...

Shields may be the worst, by the way, since they have base armor and they might have bonus armor, and GetItemStats just returns the sum of both of those.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
10-15-14, 10:49 AM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Ah, I see that "bonus armor" is a separate search item than "armor".

Interestingly, it does appear on rogue leather pvp sets, but no leather items above level 70.

Unless there's an api function for this that I don't know about, I think your only option is scraping the tooltip.

Either pull the armor line out of the tooltip and compare it with the value returned by GetItemStats, or loop over the secondary stats and check against the global string BONUS_ARMOR, ITEM_MOD_EXTRA_ARMOR_SHORT or STAT_BONUS_ARMOR (whatever's most likely to match the tooltip text, they're all identical in english).
  Reply With Quote
10-15-14, 11:00 AM   #5
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
These string names will be useful, thanks!
(Where do I search for those things, by the way?)
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
10-15-14, 11:04 AM   #6
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
GlobalStrings.lua from the frameXML provides a lot of localized globals.

I usually check the online repository tekkub has on github because I'm lazy.
  Reply With Quote
10-15-14, 12:01 PM   #7
Mazzop
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 74
i read that in file ItemBonus.db2 you can find bonusID, so can parse item link with that id
but dunno where that file is Please tell me if someone know or paste that file somewhere, will need it for my addon
  Reply With Quote
10-15-14, 12:24 PM   #8
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
The db2 files used to be stored in the game's MPQ archives, but unfortunately 6.0 has replaced MPQs with the new CASC system. I haven't found any program that can read the new files yet.
  Reply With Quote
10-15-14, 12:44 PM   #9
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
CASCExplorer
LuaCASC
  Reply With Quote
10-15-14, 12:58 PM   #10
Mazzop
A Cliff Giant
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 74
and how to open db2 file? got that exacted and cannot open or attach here
  Reply With Quote
10-15-14, 01:01 PM   #11
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I'm not going to get into that because I had to write a python script to parse those files, I have no idea if there are db2 viewers.
  Reply With Quote
10-15-14, 02:14 PM   #12
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
CASC Explorer seems to work pretty well.

As for DB2/DBC files, I've found TOM_RUS' DBC Viewer (source - binary) works reasonably well. The only problem is figuring out what each column means and what data type it is.

There's also foxlit's DBC/DB2 Lua module (part of LuaCASC).

Last edited by Choonstertwo : 10-30-14 at 12:53 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How can I tell if an item has bonus armor?


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