WoW:API GameTooltip SetInventoryItem: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Move page script moved page API GameTooltip SetInventoryItem to API GameTooltip SetInventoryItem without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<center>'''Title''' ''-Documentation by [[user:Fitz|fitz]] and [[user:Goatus|Goatus]] -''</center>
{{widgetmethod}}


<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->


  hasItem, hasCooldown, repairCost =  
  hasItem, hasCooldown, repairCost =  
   Tooltip:SetInventoryItem("unit", slot {, nameOnly});
   Tooltip:SetInventoryItem("unit", [[inventorySlotId|invSlot]] {, nameOnly});


<!-- Describe the purpose of the function, though exhausting detail can be saved for a later section -->
<!-- Describe the purpose of the function, though exhausting detail can be saved for a later section -->
Line 17: Line 17:
:("unit", slot {, nameOnly})
:("unit", slot {, nameOnly})
:;unit : String - the unit whose inventory should be searched
:;unit : String - the unit whose inventory should be searched
:;slot : Number - the inventory slot number to search
:;slot : Number - the [[inventorySlotId|inventory slot number]] to search
:;nameOnly : Unknown - unknown argument
:;nameOnly : Unknown - unknown argument


Line 55: Line 55:


repairCost info obtained from orginal blizzard lua files (PaperDolFrame.lua and MoneyFrame.lua)
repairCost info obtained from orginal blizzard lua files (PaperDolFrame.lua and MoneyFrame.lua)
----
{{Template:WoW API}}

Latest revision as of 04:45, 15 August 2023

Widget API ← GameTooltip < SetInventoryItem


hasItem, hasCooldown, repairCost = 
 Tooltip:SetInventoryItem("unit", invSlot {, 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)