WoW:API GetMerchantItemInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Returns information about a merchant's item)
 
m (Added second category link.)
Line 1: Line 1:
<center>'''GetMerchantItemInfo''' ''-Documentation by [[user:Fenaoin|Fenaoin]]-''</center>
<center>'''GetMerchantItemInfo''' - ''Documentation by [[User:Fenaoin|Fenaoin]]''</center>
 
name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(index);


== Synopsis ==
Returns information about a merchant's item.
Returns information about a merchant's item.


----
name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(index)
;''Arguments''


<!-- List each argument, together with its type -->
== Arguments ==
:(index)
:(index)
:;index : Number - The index of the item in the merchant's inventory
:;index : Number - The index of the item in the merchant's inventory


----
== Returns ==
;''Returns''
:name, texture, price, quantity, numAvailable, isUsable


<!-- List each return value, together with its type -->
:name, texture, price, quantity, numAvailable, isUsable
:;name : String - The name of the item
:;name : String - The name of the item
:;texture : String - The texture that represents the item's icon
:;texture : String - The texture that represents the item's icon
Line 24: Line 21:
:;isUsable : Number - Is 1 if the player can use this item, nil otherwise
:;isUsable : Number - Is 1 if the player can use this item, nil otherwise


----
== Example ==
;''Example''
:Let's say that we want to get info about the item in slot 4. The item is an alchemy recipe that costs 18 silver and the player does not have a high enough skill to use it yet. The item is in limited supply and 2 are in stock.
 
<!-- begin code -->
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
Let's say that we want to get info about the item in slot 4. The item is an alchemy recipe that costs 18 silver and the player does not have a high enough skill to use it yet. The item is in limited supply and 2 are in stock.
 
  local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(4);
  local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(4);
 
<!-- end code -->
;''Result''
==== Result ====
 
:In this case, we would get:
In this case, we would get:
<!-- begin code -->
  name        -> Recipe: Great Rage Potion
  name        -&gt; Recipe: Great Rage Potion
  texture      -> Interface\Icons\INV_Scroll_03
  texture      -&gt; Interface\Icons\INV_Scroll_03
  price        -> 1800
  price        -&gt; 1800
  quantity    -> 1
  quantity    -&gt; 1
  numAvailable -> 2
  numAvailable -&gt; 2
  isUsable    -> nil
  isUsable    -&gt; nil
 
<!-- end code -->
----
----
__NOTOC__
{{Template:WoW API}}
{{Template:WoW API}}
[[Category:API Item Functions|GetMerchantItemInfo]]
[[Category:API Merchant Functions|GetMerchantItemInfo]]

Revision as of 07:15, 29 March 2005

GetMerchantItemInfo - Documentation by Fenaoin

Synopsis

Returns information about a merchant's item.

name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(index)

Arguments

(index)
index
Number - The index of the item in the merchant's inventory

Returns

name, texture, price, quantity, numAvailable, isUsable
name
String - The name of the item
texture
String - The texture that represents the item's icon
price
Number - The price of the item (in copper)
quantity
Number - The quantity that will be purchased
numAvailable
Number - The number of this item that the merchant has in stock. -1 for unlimited stock.
isUsable
Number - Is 1 if the player can use this item, nil otherwise

Example

Let's say that we want to get info about the item in slot 4. The item is an alchemy recipe that costs 18 silver and the player does not have a high enough skill to use it yet. The item is in limited supply and 2 are in stock.
local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(4);

Result

In this case, we would get:
name         -> Recipe: Great Rage Potion
texture      -> Interface\Icons\INV_Scroll_03
price        -> 1800
quantity     -> 1
numAvailable -> 2
isUsable     -> nil

Template:WoW API