Cooldown overlays/tooltips + toybox items
Basskip opened this issue · 7 comments
Stumbled across your fantastic addon recently, looks like you're mostly developing it for yourself but I had a couple enhancement requests and figured it couldn't hurt to ask. Totally understand if you don't have the time/inclination to add them.
Would it be possible to add a cooldown overlay or cooldown information to the tooltip for items like Jeeves?
(Item in bags on the right, flyout macro 'Utils' on the left)
Toybox items work in terms of their actions, but show as desaturated (presumably because they aren't actually in your inventory) and show both the item and toybox versions of the tooltip if that makes sense
In comparison just dragging a toybox item onto my bars or sticking it in a regular macro only shows
Hey, yes, I did it for myself primarily, but I'll look into these when I have time. I am busy next week, and focus is on the new raids, so I don't have expected date to fix these. Toybox is probably an easier fix. The cooldown might be tricky, as the original retail flyout has no cooldown (and i tried to copy that UI), therefore I might have to plan stuff.
Had a chance to play around with the cooldown overlays today
Initially I was running into a LUA error - it wasn't happy with trying to call GetItemCooldown
Lua Error
`Message: .../CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua:616: attempt to call global 'GetItemCooldown' (a nil value) Time: Thu Nov 9 21:54:25 2023 Count: 1 Stack: .../CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua:616: attempt to call global 'GetItemCooldown' (a nil value) [string "@Interface/AddOns/CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua"]:616: in function `FlyoutButtonUpdateCooldown' [string "@Interface/AddOns/CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua"]:591: in function `updateCooldown' [string "@Interface/AddOns/CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua"]:592: in function `FlyoutButtonUpdate' [string "@Interface/AddOns/CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua"]:476: in function `FlyoutUpdateButtons' [string "@Interface/AddOns/CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua"]:414: in function <.../CustomFlyout/Libs/LibFlyoutFrame/LibFlyoutFrame.lua:410> [string "=[C]"]: in function `Show' [string "@Interface/FrameXML/RestrictedFrames.lua"]:374: in function `Show' [string " -- self, button, down if button=="RightButton" then return end local flyout = self:GetFrameRef("CustomFlyout")
local action = self:RunAttribute("$funcCalculateAction", button)
local buttonActions, macroid = self:RunAttribute("$funcGetFlyoutActions", action)
local flyoutVisible = flyout:IsVisible()
if flyout:GetParent() == self
then
flyout:Hide()
end
if not buttonActions then return end
do
local RESERVED = nil
do
local input = buttonActions
local stack=newtable()
local pos = 1
local len = strlen(input)
local state = newtable(false, nil) -- PUSH table.insert(stack, state) state = newtable(isdict, lastkey) -- POP state = table.remove(stack, #stack)
repeat
local symbol = strsub(input, pos, pos)
local valuetype, value = true, nil
if symbol == "i"
then
local _, e, v = strfind(input, "^(%-?%d+%.?%d*)e", pos+1)
pos = e+1
value = tonumber(v)
elseif symbol == "b"
then
local v = strsub(input, pos+1, pos+1) == "1"
pos = pos+3
value = v
elseif symbol == "l"
then
pos = pos+1
valuetype = false
table.insert(stack, state)
state = newtable(false, nil)
table.insert(stack, newtable())
elseif symbol == "d"
then
pos = pos+1
valuetype = false
table.insert(stack, state)
state = newtable(true, nil)
table.insert(stack, newtable())
elseif symbol == "e"
then
pos = pos+1
value = table.remove(stack, #stack)
state = table.remove(stack, #stack)
state = newtable(state[1],state[2])
else
local start, e, len = strfind(input, "^(%d+):", pos)
if len
then
len = tonumber(len)
pos = e+1
local v = strsub(input, pos, pos+len-1)
value = v
pos = pos+len
else
break
end
end
if valuetype
then
if #stack>0
then
if state[1]
then
if state[2]
then
stack[#stack][state[2]]=value
state[2] = nil
else
state[2] = value
end
else
table.insert(stack[#stack], value)
end
else
table.insert(stack, state)
table.insert(stack, value)
end
end
until pos>len
RESERVED = stack[2]
end
buttonActions = RESERVED
end
local CUSTOMFLYOUT_DEFAULT_SPACING = 4
local CUSTOMFLYOUT_INITIAL_SPACING = 7
local CUSTOMFLYOUT_FINAL_SPACING = 4
flyout:Hide()
if flyout:GetParent() ~= self or not flyoutVisible
then
local direction = self:GetAttribute("$direction") or flyout:GetAttribute("$directionAction"..action) or flyout:GetAttribute("$directionMacro"..macroid) or self:GetAttribute("$defaultdirection") or "UP"
local distance = self:GetAttribute("$distance") or flyout:GetAttribute("distanceAction"..action) or flyout:GetAttribute("distanceMacro"..macroid) or 3
local cooldown = self:GetAttribute("$cooldown") or flyout:GetAttribute("$cooldownAction"`
Seems to work fine if I swap it to C_Container.GetItemCooldown, do you have something I don't that's affecting the API namespaces?
Thanks so much for taking the time to add this stuff, super appreciated
Ah, yes I have. I made a generic wrapper that keeps the older API alive for a bunch of legacy addons and completely forgot blizz changed it few patches earlier. Thanks for testing, this is why I usually try to test it with a clean environment, but now I relied on you.
https://github.com/mullerdavid/wow_LegacyAPI