WoW:API GetTradePlayerItemLink: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 54: Line 54:
__NOTOC__
__NOTOC__
{{Template:WoW API}}
{{Template:WoW API}}
<!-- Update the category to the appropriate subsection, and be sure to put the function name as the label for the category link. Multiple subcategories are okay if appropriate, please dont link functions to the API Functions category directly. -->
[[Category:API Functions|Empty Template]]

Revision as of 15:43, 4 January 2006

Title -Documentation by Michael88P-

Returns a single value: chat-ready item link.

chatItemLink = GetTradePlayerItemLink(ID);

Parameters

Arguments

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

Returns

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

Example

for i = 0, 6 do
  chatItemLink = GetTradePlayerItemLink(i);
end


Details

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

Template:WoW API