WoW:API GetMerchantItemInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (cat)
({{wowapi}}, format)
Line 1: Line 1:
<center>'''GetMerchantItemInfo''' - ''Documentation by [[User:Fenaoin|Fenaoin]]''</center>
{{wowapi}} __NOTOC__
 
== Synopsis ==
Returns information about a merchant's item.
Returns information about a merchant's item.
  name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(index)
  name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(index)


== Arguments ==
==Parameters==
:(index)
=== Arguments ===
 
:;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
 
:;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 22: Line 15:


== 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 -->
  local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(4);
  local name, texture, price, quantity, numAvailable, isUsable = GetMerchantItemInfo(4);
<!-- end code -->
message(name .. " " .. price .. "c");
==== Result ====
=== Result ===
:In this case, we would get:
A message stating the name and price of the item in merchant slot 4 appears.
<!-- begin code -->
name         -&gt; Recipe: Great Rage Potion
texture      -&gt; Interface\Icons\INV_Scroll_03
price       -&gt; 1800
quantity    -&gt; 1
numAvailable -&gt; 2
isUsable    -&gt; nil
<!-- end code -->
----
__NOTOC__
{{Template:WoW API}}

Revision as of 23:22, 23 December 2006

WoW API < GetMerchantItemInfo

Returns information about a merchant's item.

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

Parameters

Arguments

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

Returns

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

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

Result

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