Fandom

WoWWiki

API GetTradePlayerItemLink

104,672pages on
this wiki
Add New Page
Talk0 Share
WoW API < GetTradePlayerItemLink

Returns a single value: chat-ready item link.

chatItemLink = GetTradePlayerItemLink(ID);

Parameters Edit

Arguments Edit

(ID)
ID 
numeric - index value of the "player's" (your character) trade slots (starts at 1 and proceeds to 6. 7 may be used for the will-not-be-traded-slot.)

Returns Edit

Returns
chatItemLink
chatItemLink 
String - a string that can be used to link items in the chat log

Example Edit

for i = 1, 7 do
  chatItemLink = GetTradePlayerItemLink(i);
end


DetailsEdit

Remember, chatItemLink(s) are different than itemLink parameters needed by many APIs. To properly extract an itemLink from a chatItemLink, here is a neat function:
--[[ Function: extractItemLinkFromChatItemLink
     Purpose: gets an item link string from a chat item link string
     Note: don't ask questions, it works
  ]]
function extractItemLinkFromChatItemLink(message)
  local _, _, _, _itemLink = string.find(message, "(|H(.+)|h)");
  _, _, _itemLink = string.find(_itemLink, "(.-|h)");
  return _itemLink;
end
Here is a chatItemLink Example:
|cffffffff|Hitem:3771:0:0:0|h[Wild Hog Shank]|h|r
Here is an itemLink Example:
item:3771:0:0:0

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki