Quantcast
WoWInterface - View Single Post - Getting item details on hover
View Single Post
08-04-20, 08:25 PM   #11
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,276
Lua Code:
  1. local myTestingKeybindingItemName, myTestingKeybindingItemLink, myTestingKeybindingItemID
  2.  
  3. local function addItemToTable(itemLink)
  4.     if not myTestingKeybindingTableOfItems then
  5.         myTestingKeybindingTableOfItems = {}
  6.     end
  7.     local found
  8.     for k, v in pairs(myTestingKeybindingTableOfItems) do
  9.         if v == itemLink then
  10.             print("Item all ready listed")
  11.             found = true
  12.             break
  13.         end
  14.     end
  15.     if not found then
  16.         table.insert(myTestingKeybindingTableOfItems, 1, itemLink)
  17.         print("Item added to list",itemLink)
  18.     end
  19. end
  20.  
  21. SLASH_MYTEST1 = "/qwe"
  22. function SlashCmdList.MYTEST(msg, editbox)
  23.     if #myTestingKeybindingTableOfItems == 0 then
  24.         print("empty table")
  25.     else
  26.         for k, v in pairs(myTestingKeybindingTableOfItems) do
  27.             print("item", k, v)
  28.         end
  29.     end
  30. end
  31.  
  32. local myTestingKeybindingButton = CreateFrame("BUTTON", "WalkerbomyTest")
  33. SetBindingClick("F5", "WalkerbomyTest", "b1")
  34. SetBindingClick("G", "WalkerbomyTest", "b3")
  35. myTestingKeybindingButton:SetScript("OnClick", function(self, button)
  36.     if button == "b1" then
  37.         addItemToTable(myTestingKeybindingItemLink)
  38.         print("F5 button clicked", myTestingKeybindingItemLink, myTestingKeybindingItemID)
  39.     elseif button == "b3" then
  40.         print("G button clicked")
  41.     end
  42. end)
  43.  
  44. GameTooltip:HookScript("OnTooltipSetItem", function(self)
  45.     myTestingKeybindingItemName, myTestingKeybindingItemLink = self:GetItem()
  46.     myTestingKeybindingItemID = tonumber(strmatch(myTestingKeybindingItemLink, "item:(%d+):"))
  47. end)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-04-20 at 08:46 PM.
  Reply With Quote