WoW API type: ItemString

From AddOn Studio
Revision as of 02:37, 21 July 2016 by Authors on WoWWiki (talk | contribs) (This revision and previous are available under: CC BY-SA 3.0. See list of authors in previous history below.)
Jump to navigation Jump to search

Warning: Display title "WoW API type: ItemString" overrides earlier display title "itemString".API types

An itemString is used to pass item information as a plain text string, and are used in item tooltips and itemLink hyperlinks.

Format

  • itemID - Item ID that can be used for GetItemInfo calls.
  • enchantId - Permament enchants applied to an item. See list of EnchantIds.
  • gemId1 - Embedded gems re-use EnchantId indices, though gem icons show only for specific values
  • gemId2 (number)
  • gemId3 (number)
  • gemId4 (number)
  • suffixId - Random enchantment ID; may be negative. See list of SuffixIds.
  • uniqueId - Data pertaining to a specific instance of the item.
  • linkLevel - Level of the character supplying the link. This is used to render scaling heirloom item tooltips at the proper level.
  • specializationID - Specialization ID
  • upgradeId - Reforging info. 0 or empty for items that have not been reforged
  • instanceDifficultyId (number)
  • numBonusIds (number)
  • bonusId1 (number)
  • bonusId2 (number)
  • upgradeValue (number)
item:itemId:enchantId:gemId1:gemId2:gemId3:gemId4:
suffixId:uniqueId:linkLevel:specializationID:upgradeId:instanceDifficultyId:
numBonusIds:bonusId1:bonusId2:upgradeValue

Summary

WoW itemStrings are often seen as part of item links in WoW UI text. Item strings consist of the string "item:" followed by 13 colon delimited numbers, which describe the item, its stats, and any enchantments or gems applied to the item.

Examples

item:6948::::::::80::::
The first number is the ItemID for a Template:Loot. The next 7 values are 0 or empty, which tells the client it has no enchants, gems, extra stats, and wasn't made by anyone. The 9th number, 80, means that the link applies to level 80 characters.
item:18832:2564:0:0:0:0:0:0:80:0:0:0:0
The first number is the ItemID for Template:Loot. The second number, enchantId, in this case denotes that it is enchanted with +15 agility.
item:10242:0:0:0:0:0:0:614:0:80:0:0:0:0
The first number is the ItemID for Template:Loot. The seventh number, suffixId, adds to this item's name " of the Monkey" and adds +11 Agility and +11 Stamina.
item:4388:0:0:0:0:0:0:210677200:80:0:0:0:0
The first number is the ItemID for Template:Loot. The eighth number adds the information that this particular item only has 4 uses left, and was made by Kirov.
item:28484:1503:0:2946:2945:0:0:0:80:0:0:0:0
The first number is the ItemID for Template:Loot. The second number, enchantId, is that of +100 HP. The third number denotes an empty blue jewel socket while the fourth and fifth numbers represent yellow jewel sockets occupied by a Template:Loot and a Template:Loot respectively. Jewel sockets can also take normal enchantID's. Bulwark of Kings has a socket bonus, but this is not represented within the itemString.

You can extract the values from a given 'itemString' using the following Lua code:

local _, itemId, enchantId, jewelId1, jewelId2, jewelId3, jewelId4, suffixId, uniqueId,
  linkLevel, specializationID, reforgeId, unknown1, unknown2 = strsplit(":", itemString)

Details

Used to pass between clients and to pass item information from the client to the user interface.

Enchant Ids and Suffix Ids

Adding of enchant, jewel, and bonus stat information to the tooltip appear to be handled on the client side with out any kind of validation. By altering the item string in an item hyperlink you can add any enchant or any bonus stats to any item and still pass it to clients via chat, or display a tooltip for it. The Item name must match that of the itemId combined with the suffix or you will be disconnected if you try to link the item to others. suffixIDs can be negative (see Scaled Random Suffixes below).

NOTE: Even though the EnchantId page lists shaman weapon buffs, player generated Shaman Buffs do not appear in the link when using GetInventoryItemLink().

Unique Ids

UniqueId contains information on the maker of a crafted item, number of charges or uses if applicable, or other information exclusive to one particular manifestation of an item. Items received from quests frequently have a UniqueId value, and occasionally dropped items have one as well. The numbers don't appear to hold any information in and of themselves, and are not consistent in any way across servers like EnchantIds and SecondaryIds. The value appears to be a link to a database entry on the server or client that contains the unique information such as who made an item, which quest it came from, when the quest was delivered, who sold the item on the Auction House, etc. GMs would then be able to track an item should a petition about one be made. UniqueID can have negative values (see Scaled Random Suffixes below).

Addendum: In-game testing indicates that the UniqueId can change from the first loot to successive loots on the same item. To observe this behavior, Master Looter method was used, an item meeting the loot threshold found, and then the loot window closed without giving the item to a raid member. On re-opening the corpse, the value had changed. For example, on the first loot of Shimmering Trousers of the Eagle, the UniqueId value was 0x00009182. On successive loot attempts it was 0x40679182. Note that the low order bytes were maintained. In at least a few observations, negative UniqueId values did not change in successive looting attempts.

On negative UniqueID's: I do not believe that a UniqueID being negative is special in any way. It seems to me that the high 16 bits are simply "random", i.e. 0x0000-0xffff. If this value is >0x8000, it will translate to a negative decimal value (signed 32-bit). --Mikk (T) 09:55, 7 August 2009 (UTC)

Scaled Random Suffixes

Since WoW 2.0, both the SuffixIds and the UniqueIds have the ability to be negative. This indicates a different way of calculating the stats bonuses is being used. Previous to WoW 2.0, every time a new stats bonus was added to a new item, the SuffixId list needed to be updated via a client patch. This limited Blizzard's ability to arbitrarily add new items to the game, since the new data would need to be accompanied by a client patch if it's stats bonus did not already exist.

Post 2.0, a new system of stats bonuses has been implemented via the ItemRandomSuffix table. If the suffixId is negative, it indicates that the suffix of the item is instead one of the new RandomSuffixes, and that the uniqueId will contain an embedded suffixFactor, which can be extracted via the following algorithm.

 local suffixFactor = 0
 local linkType, itemId, enchantId,
       jewelId1, jewelId2, jewelId3, jewelId4,
       suffixId, uniqueId = strsplit(":", itemString)
 suffixId = tonumber(suffixId) or 0
 uniqueId = tonumber(uniqueId) or 0
 if (linkType == 'item') then
     if (suffixId < 0) then
         suffixFactor = bit.band(uniqueId, 65535)
     end
 end

To see how this suffixFactor gets applied to get the final stat bonuses, see the ItemRandomSuffix table.

3.2 wotlk randomstat items changing their suffix factors

In 3.2, wotlk randomstat items got upgraded, i.e. their scaling factors changed.

This means that the high 16 bits of the uniqueid remained the same, but the low 16 bits changed.

If this was a one-time thing, we could have lived with item databases etc becoming slightly wobbly. But that's not the whole story. As soon as you place an item in mail, or AH, or a guild bank, it gets downgraded again. So the uniqueIDs are no longer constant.

Update: It seems that this only happens with items that were actually looted/spawned/crafted before 3.2. --Mikk (T) 22:51, 11 August 2009 (UTC)

Examples: |cff1eff00|Hitem:36050:0:0:0:0:0:-8:-2052980689:76:0:0|h[Crystalsong Bracelets of the Whale]|h|r |cff1eff00|Hitem:36050:0:0:0:0:0:-8:-2052980680:76:0:0|h[Crystalsong Bracelets of the Whale]|h|r

0x85A2002F vs
0x85A20038
Difference: 9

|cff1eff00|Hitem:36156:0:0:0:0:0:-18:1209139262:76:0:0:0:0|h[Wendigo Boots of Agility]|h|r
|cff1eff00|Hitem:36156:0:0:0:0:0:-18:1209139275:76:0:0:0:0|h[Wendigo Boots of Agility]|h|r
0x4812003E vs
0x4812004B
Difference: 13

|cff0070dd|Hitem:44741:0:0:0:0:0:-26:77201509:76:0:0:0:0|h[Mechanized Snow Goggles of Spell Power]|h|r
|cff0070dd|Hitem:44741:0:0:0:0:0:-26:77201534:76:0:0:0:0|h[Mechanized Snow Goggles of Spell Power]|h|r
0x049A0065 vs
0x049A007E
Difference: 25

|cff0070dd|Hitem:44732:0:0:0:0:0:-36:1867317349:76:0:0:0:0|h[Azure Dragonleather Helm of the Sorcerer]|h|r
|cff0070dd|Hitem:44732:0:0:0:0:0:-36:1867317374:76:0:0:0:0|h[Azure Dragonleather Helm of the Sorcerer]|h|r
0x6F4D0065
0x6F4D007E
Difference: 25

|cff1eff00|Hitem:36675:0:0:0:0:0:-44:-1664483297:76:0:0:0:0|h[Sockeye Dagger of the Elder]|h|r
|cff1eff00|Hitem:36675:0:0:0:0:0:-44:-1664483292:76:0:0:0:0|h[Sockeye Dagger of the Elder]|h|r
0x9CCA001F
0x9CCA0024
Difference: 5

For added humor, note that GetItemCount() and PickupItem() will work on both the downgraded and upgraded itemStrings (tested for items in bags), but a SecureActionButton using the "target-item" attribute will only work if given the upgraded itemString.

Changes

  • Patch 2.0 - added jewelId1, jewelId2, jewelId3, jewelId4
  • Patch 3.0 - added linkLevel
  • Patch 4.0.1 - added reforgeId
  • Patch 5.0.4 - parameter count changed from 10 to 11
  • Patch 6.0.2 - parameter count changed from 11 to 12
  • Patch 6.2.0 - added Specialization ID, parameter count changed from 12 to 13
  • Patch 7.0.3 - system generated itemStrings for links have a minimum of 16 parameters. place holder 0s can be removed or left blank to be assumed 0. For example |cff9d9d9d|Hitem:7073:0:0:0:0:0:0:0:80:0:0:0:0|h[Broken Fang]|h|r becomes |cff9d9d9d|Hitem:7073:::::::0:80::::|h[Broken Fang]|h|r.

See also