Quantcast Click cast on oUF raid frames - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-14-19, 10:47 PM   #1
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 114
Click cast on oUF raid frames

Lua Code:
  1. local wheelBindingIndex = {
  2.     ["MOUSEWHEELUP"] = 6,
  3.     ["ALT-MOUSEWHEELUP"] = 7,
  4.     ["CTRL-MOUSEWHEELUP"] = 8,
  5.     ["SHIFT-MOUSEWHEELUP"] = 9,
  6.     ["MOUSEWHEELDOWN"] = 10,
  7.     ["ALT-MOUSEWHEELDOWN"] = 11,
  8.     ["CTRL-MOUSEWHEELDOWN"] = 12,
  9.     ["SHIFT-MOUSEWHEELDOWN"] = 13,
  10. }
  11.  
  12. local onEnterString = "self:ClearBindings();"
  13. local onLeaveString = onEnterString
  14. for keyString, keyIndex in pairs(wheelBindingIndex) do
  15.     onEnterString = format("%sself:SetBindingClick(0, \"%s\", self:GetName(), \"Button%d\");", onEnterString, keyString, keyIndex)
  16. end
  17.  
  18. local function setupMouseWheelCast(self)
  19.     local found
  20.     for _, data in pairs(NDuiDB["RaidClickSets"]) do
  21.         local key = unpack(data)
  22.         if strmatch(key, L["Wheel"]) then
  23.             found = true
  24.             break
  25.         end
  26.     end
  27.  
  28.     if found then
  29.         self:SetAttribute("clickcast_onenter", onEnterString)
  30.         self:SetAttribute("clickcast_onleave", onLeaveString)
  31.     end
  32. end
  33.  
  34. local function setupClickSets(self)
  35.     if self.clickCastRegistered then return end
  36.  
  37.     setupMouseWheelCast(self)
  38.  
  39.     for _, data in pairs(NDuiDB["RaidClickSets"]) do
  40.         local key, modKey, value = unpack(data)
  41.         if key == KEY_BUTTON1 and modKey == "SHIFT" then self.focuser = true end
  42.  
  43.         for _, v in ipairs(keyList) do
  44.             if v[1] == key and v[2] == modKey then
  45.                 if tonumber(value) then
  46.                     local name = GetSpellInfo(value)
  47.                     self:SetAttribute(format(v[3], "type"), "spell")
  48.                     self:SetAttribute(format(v[3], "spell"), name)
  49.                 elseif value == "target" then
  50.                     self:SetAttribute(format(v[3], "type"), "target")
  51.                 elseif value == "focus" then
  52.                     self:SetAttribute(format(v[3], "type"), "focus")
  53.                 elseif value == "follow" then
  54.                     self:SetAttribute(format(v[3], "type"), "macro")
  55.                     self:SetAttribute(format(v[3], "macrotext"), "/follow mouseover")
  56.                 elseif strmatch(value, "/") then
  57.                     self:SetAttribute(format(v[3], "type"), "macro")
  58.                     self:SetAttribute(format(v[3], "macrotext"), value)
  59.                 end
  60.                 break
  61.             end
  62.         end
  63.     end
  64.  
  65.     self:RegisterForClicks("AnyDown")
  66.     self:UnregisterEvent("PLAYER_REGEN_ENABLED", setupClickSets)
  67.  
  68.     self.clickCastRegistered = true
  69. end
  70.  
  71. local function CreateClickSets(self)
  72.     if InCombatLockdown() then
  73.         self:RegisterEvent("PLAYER_REGEN_ENABLED", setupClickSets, true)
  74.     else
  75.         setupClickSets(self)
  76.     end
  77. end

I'm currently using the code above to setup clickcast on raidframes.
But the "self:ClearBindings();" seems like not functioning well lately.
Do mousewheel would bind to a random raid unit button, and override my mousewheel camera zooming.
The only solution is an UI reload.
Anything I can do to avoid this?

Last edited by siweia : 07-17-19 at 12:39 PM.
  Reply With Quote
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Click cast on oUF raid frames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off