WoW:API GameTooltip SetInventoryItem: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 58: Line 58:
----
----
{{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|SetInventoryItem]]

Revision as of 15:42, 4 January 2006

Title -Documentation by fitz and Goatus -


hasItem, hasCooldown, repairCost = 
 Tooltip:SetInventoryItem("unit", slot {, nameOnly});


This function sets a tooltip widget to display information for the given unit's given inventory slot.


Arguments


("unit", slot {, nameOnly})
unit
String - the unit whose inventory should be searched
slot
Number - the inventory slot number to search
nameOnly
Unknown - unknown argument

Returns


hasItem, hasCooldown
hasItem
Boolean - is there an item at the given slot?
hasCooldown
Boolean - unknown
repairCost
Number - cost of repairing item

Example


-- See if the player has head gear and if it is broken
function HasHeadGear()
 local headSlot = getglobal("CharacterHeadSlot");
 local hasItem, hasCooldown, repairCost =
  MyTooltip:SetInventoryItem("player", headSlot:GetID());
 if ((hasItem) and (repairCost) and (repairCost > 0)) then
  return true;
 else
  return false;
 end
end



Source

This information was obtained via a Google cached page of a Thottbot index of a now expired official US beta forum post by Angarth. It appears to still be correct.

repairCost info obtained from orginal blizzard lua files (PaperDolFrame.lua and MoneyFrame.lua)


Template:WoW API