WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Locale-independent itemType identification? (https://www.wowinterface.com/forums/showthread.php?t=56793)

LudiusMaximus 10-18-18 06:07 PM

Locale-independent itemType identification?
 
Is there a constant for the localized word for "Recipe"?

As GetItemInfo() only returns the localized value for itemType, I cannot think of another way than to hard code the respective word in my addon for every locale.

Any other thoughts?

Xrystal 10-18-18 06:53 PM

If its anywhere it will be here.

https://www.townlong-yak.com/framexm...balStrings.lua

Unfortunately the best match is this line...

AUCTION_CATEGORY_RECIPES = "Recipes"

All the others are part of a sentence.

Kanegasi 10-18-18 07:34 PM

The 12th and 13th return from GetItemInfo is an ID that matches the type and subtype of returns 6 and 7 respectively.

Doing some digging, here are the ID variables ingame you can match to the 12th return:

Code:

LE_ITEM_CLASS_ARMOR = 4
LE_ITEM_CLASS_BATTLEPET = 17
LE_ITEM_CLASS_CONSUMABLE = 0
LE_ITEM_CLASS_CONTAINER = 1
LE_ITEM_CLASS_GEM = 3
LE_ITEM_CLASS_GLYPH = 16
LE_ITEM_CLASS_ITEM_ENHANCEMENT = 8
LE_ITEM_CLASS_KEY = 13
LE_ITEM_CLASS_MISCELLANEOUS = 15
LE_ITEM_CLASS_PROJECTILE = 6
LE_ITEM_CLASS_QUESTITEM = 12
LE_ITEM_CLASS_QUIVER = 11
LE_ITEM_CLASS_REAGENT = 5
LE_ITEM_CLASS_RECIPE = 9
LE_ITEM_CLASS_TRADEGOODS = 7
LE_ITEM_CLASS_WEAPON = 2
LE_ITEM_CLASS_WOW_TOKEN = 18


And here are the variables for the 13th return:

Code:

LE_ITEM_ARMOR_CLOTH = 1
LE_ITEM_ARMOR_COSMETIC = 5
LE_ITEM_ARMOR_GENERIC = 0
LE_ITEM_ARMOR_IDOL = 8
LE_ITEM_ARMOR_LEATHER = 2
LE_ITEM_ARMOR_LIBRAM = 7
LE_ITEM_ARMOR_MAIL = 3
LE_ITEM_ARMOR_PLATE = 4
LE_ITEM_ARMOR_RELIC = 11
LE_ITEM_ARMOR_SHIELD = 6
LE_ITEM_ARMOR_SIGIL = 10
LE_ITEM_ARMOR_TOTEM = 9
LE_ITEM_GEM_AGILITY = 1
LE_ITEM_GEM_ARTIFACTRELIC = 11
LE_ITEM_GEM_CRITICALSTRIKE = 5
LE_ITEM_GEM_HASTE = 7
LE_ITEM_GEM_INTELLECT = 0
LE_ITEM_GEM_MASTERY = 6
LE_ITEM_GEM_MULTIPLESTATS = 10
LE_ITEM_GEM_SPIRIT = 4
LE_ITEM_GEM_STAMINA = 3
LE_ITEM_GEM_STRENGTH = 2
LE_ITEM_GEM_VERSATILITY = 8
LE_ITEM_MISCELLANEOUS_COMPANION_PET = 2
LE_ITEM_MISCELLANEOUS_HOLIDAY = 3
LE_ITEM_MISCELLANEOUS_JUNK = 0
LE_ITEM_MISCELLANEOUS_MOUNT = 5
LE_ITEM_MISCELLANEOUS_OTHER = 4
LE_ITEM_MISCELLANEOUS_REAGENT = 1
LE_ITEM_RECIPE_ALCHEMY = 6
LE_ITEM_RECIPE_BLACKSMITHING = 4
LE_ITEM_RECIPE_BOOK = 0
LE_ITEM_RECIPE_COOKING = 5
LE_ITEM_RECIPE_ENCHANTING = 8
LE_ITEM_RECIPE_ENGINEERING = 3
LE_ITEM_RECIPE_FIRST_AID = 7
LE_ITEM_RECIPE_FISHING = 9
LE_ITEM_RECIPE_INSCRIPTION = 11
LE_ITEM_RECIPE_JEWELCRAFTING = 10
LE_ITEM_RECIPE_LEATHERWORKING = 1
LE_ITEM_RECIPE_TAILORING = 2
LE_ITEM_WEAPON_AXE1H = 0
LE_ITEM_WEAPON_AXE2H = 1
LE_ITEM_WEAPON_BEARCLAW = 11
LE_ITEM_WEAPON_BOWS = 2
LE_ITEM_WEAPON_CATCLAW = 12
LE_ITEM_WEAPON_CROSSBOW = 18
LE_ITEM_WEAPON_DAGGER = 15
LE_ITEM_WEAPON_FISHINGPOLE = 20
LE_ITEM_WEAPON_GENERIC = 14
LE_ITEM_WEAPON_GUNS = 3
LE_ITEM_WEAPON_MACE1H = 4
LE_ITEM_WEAPON_MACE2H = 5
LE_ITEM_WEAPON_POLEARM = 6
LE_ITEM_WEAPON_STAFF = 10
LE_ITEM_WEAPON_SWORD1H = 7
LE_ITEM_WEAPON_SWORD2H = 8
LE_ITEM_WEAPON_THROWN = 16
LE_ITEM_WEAPON_UNARMED = 13
LE_ITEM_WEAPON_WAND = 19
LE_ITEM_WEAPON_WARGLAIVE = 9


Usage source from here: https://www.townlong-yak.com/framexm...pFrame.lua#180

Variables are from my own _G dump, they are not declared in the Interface files.

Xrystal 10-18-18 09:20 PM

d'oh of course .. been a long time since I looked at those values.

As pointed out by Kanegasi the itemType and itemSubtype are numbers and are not needed to be localized.

The following demonstrates how to return a complete list of localized itemtypes as strings. If you put these into an indexed table and then use the GetItemInfo itemType to retrieve the string value it should ( in theory and if memory servers ) return a localized string of that type. Or the alternative keyed table with the localized string as a key returning the number that relates to that value. You may have to test it out to see if it will suit your requirements.
https://wow.gamepedia.com/API_GetAuctionItemClasses

It may help with retrieving info from the tooltip but that is not something I have personally needed to do so can't confirm there.

LudiusMaximus 10-19-18 03:52 PM

Quote:

Originally Posted by Kanegasi (Post 330514)
The 12th and 13th return from GetItemInfo is an ID that matches the type and subtype of returns 6 and 7 respectively.
Doing some digging, here are the ID variables ingame you can match to the 12th return:
Variables are from my own _G dump, they are not declared in the Interface files.

Hey, thanks a lot!!
I must have been up too late yesterday for not spotting itemClassID in the API of GetItemInfo myself.
So thanks for the hint and especially for your ready-made list of variable names.

Also thanks @Xrystal for sharing your thoughts!

LudiusMaximus 01-18-23 05:05 AM

For the record:

The ID variables (e.g. LE_ITEM_CLASS_RECIPE) do not exist any more.
Instead, you now use this Enum table (e.g. Enum.ItemClass.Recipe).

https://wowpedia.fandom.com/wiki/ItemType


All times are GMT -6. The time now is 08:18 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI