WoW:API GetMerchantItemInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Returns information about a merchant's item)
 
m (Move page script moved page API GetMerchantItemInfo to API GetMerchantItemInfo without leaving a redirect)
 
(7 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<center>'''GetMerchantItemInfo''' ''-Documentation by [[user:Fenaoin|Fenaoin]]-''</center>
{{wowapi}} __NOTOC__
 
name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(index);
 
Returns information about a merchant's item.
Returns information about a merchant's item.
name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(index)


----
==Parameters==
;''Arguments''
=== Arguments ===
 
<!-- List each argument, together with its type -->
:(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''
 
<!-- 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
:;price : Number - The price of the item (in copper)
:;price : Number - The price of the item (in copper).  Note that if quantity is greater than one (i.e. the item is sold in batches by default), then this is the price per batch, not the unit price.
:;quantity : Number - The quantity that will be purchased
:;quantity : Number - The quantity that will be purchased (the ''batch size'', e.g. 5 for vials)
:;numAvailable : Number - The number of this item that the merchant has in stock. -1 for unlimited stock.
:;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
:;isUsable : Number - Is 1 if the player can use this item, nil otherwise
:;extendedCost : Number - Is 1 if the item has extended (PvP) cost info, nil otherwise


----
== Example ==
;''Example''
  local name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(4);
 
message(name .. " " .. price .. "c");
<!-- If it helps, include an example here, though it's not required if the usage is self-explanatory -->
=== Result ===
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.
A message stating the name and price of the item in merchant slot 4 appears.
 
==See also==
  local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(4);
*[[API GetMerchantItemCostInfo|GetMerchantItemCostInfo]]
 
;''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}}

Latest revision as of 04:46, 15 August 2023

WoW API < GetMerchantItemInfo

Returns information about a merchant's item.

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

Parameters[edit]

Arguments[edit]

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

Returns[edit]

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). Note that if quantity is greater than one (i.e. the item is sold in batches by default), then this is the price per batch, not the unit price.
quantity
Number - The quantity that will be purchased (the batch size, e.g. 5 for vials)
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
extendedCost
Number - Is 1 if the item has extended (PvP) cost info, nil otherwise

Example[edit]

local name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(4);
message(name .. " " .. price .. "c");

Result[edit]

A message stating the name and price of the item in merchant slot 4 appears.

See also[edit]