WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Request: Crowd control icon on default raid frames (https://www.wowinterface.com/forums/showthread.php?t=48418)

llerelol 10-27-13 10:04 PM

Request: Crowd control icon on default raid frames
 
I'm really surprised there's no such an addon.

Here's an example:


And no, I don't wanna use grid or vuhdo or their alternative, i like default raid frames a lot, they just lack this one very important feature.

Wildbreath 10-27-13 11:45 PM

Quote:

Originally Posted by llerelol (Post 286302)
I'm really surprised there's no such an addon.

Here's an example:


And no, I don't wanna use grid or vuhdo or their alternative, i like default raid frames a lot, they just lack this one very important feature.

http://www.wowinterface.com/download...aidFrames.html but i not update this alot time ago

llerelol 10-28-13 04:56 PM

well yeah i know about those, the bad thing it doest display regular buffs\debuffs in the corners as default frames do.

btw i was using your superclassic ui back in S9 and i was loving it, too bad you stopped maintaining it.

ckaotik 12-05-13 08:53 AM

I have something along these lines in a custom addon ... here are the parts that you would probably need. However, I have not tested this code (as standalone). It assumes that any CC effect is on a diminishing return and only shows those.

P.S. Please tell me if this worked for you :)

Requirements:

1) a place to put the code: If you don't happen to have a dummy addon to stuff code into already, you can create one here: http://addon.bool.no
2) DRData-1.0 library, which can be found here: http://www.wowace.com/addons/drdata-1-0/
3) put this in your lua file (or the lua input box on addon.bool.no)
Lua Code:
  1. local DRData = LibStub('DRData-1.0')
  2. local hideDRType = {
  3.     ["ctrlroot"] = true,
  4.     ["shortroot"] = true,
  5.     ["disarm"] = true,
  6.     ["taunt"] = true,
  7.     ["knockback"] = true,
  8. }
  9.  
  10. local isDisabled = nil
  11. local _FRAMES = {}
  12.  
  13. local function UpdateOverlay(self)
  14.     if not self.Overlay then return end
  15.     local display, drType = nil, nil
  16.     for i = 1, 40 do
  17.         local _, _, icon, count, dispelType, _, expires, caster, _, _, spellID, canApplyAura, isBoss = UnitDebuff(self.displayedUnit or self.unit, i)
  18.         local drType = DRData:GetSpellCategory(spellID)
  19.         if drType and not hideDRType[drType] then
  20.             display = true
  21.             break
  22.         end
  23.     end
  24.  
  25.     if display then
  26.         self.Overlay.icon:SetTexture(icon)
  27.         self.Overlay.icon:SetDesaturated( caster == "player" )
  28.         self.Overlay.count:SetText(count == 1 and '' or count)
  29.         local now = GetTime()
  30.         self.Overlay.cooldown:SetCooldown(now, expires - now)
  31.  
  32.         self.Overlay:Show()
  33.     else
  34.         self.Overlay:Hide()
  35.     end
  36. end
  37.  
  38. local isHooked = nil
  39. local Disable = function(self)
  40.     local overlay = self.Overlay
  41.     if overlay then
  42.         for k, frame in ipairs(_FRAMES) do
  43.             if frame == self then
  44.                 tremove(_FRAMES, k)
  45.                 overlay:Hide()
  46.                 break
  47.             end
  48.         end
  49.  
  50.         if #_FRAMES == 0 and isHooked then
  51.             isDisabled = true
  52.         end
  53.     end
  54. end
  55.  
  56. local Enable = function(self)
  57.     local overlay = self.Overlay
  58.     if overlay then
  59.         tinsert(_FRAMES, self)
  60.         isDisabled = nil
  61.         if not isHooked then
  62.             hooksecurefunc("CompactUnitFrame_UpdateDebuffs", UpdateOverlay)
  63.             isHooked = true
  64.         end
  65.     end
  66. end
  67.  
  68. hooksecurefunc("CompactUnitFrame_UpdateVisible", function(frame)
  69.     if not frame.Overlay and frame.unit and not frame.unit:find('pet') then
  70.         local overlay = CreateFrame("Button", "$parentCUFOverlay", frame, "CompactAuraTemplate")
  71.               overlay:SetPoint('CENTER', 0, 0)
  72.               overlay:SetSize(20, 20)
  73.               overlay:EnableMouse(false)
  74.               overlay:EnableMouseWheel(false)
  75.               overlay:Hide()
  76.         frame.Overlay = overlay
  77.         Enable(frame)
  78.     end
  79. end)
4) put this in your toc file (or click 'Show advanced (TOC) options' and add this line to the toc box):
Code:

## Dependencies: DRData-1.0

Phanx 12-05-13 06:41 PM

Just FYI there is no reason to define variables outside of a loop when they will only be used inside of the loop, and doing it anyway can have unintended consequences depending on what you're using the variables for.

Don't:
Code:

    local icon, count, dispelType, expires, caster, spellID, canApplyAura, isBoss
    for i = 1, 40 do
        _, _, icon, count, dispelType, _, expires, caster, _, _, spellID, canApplyAura, isBoss = UnitDebuff(self.displayedUnit or self.unit, i)

Do:
Code:

    for i = 1, 40 do
      local  _, _, icon, count, dispelType, _, expires, caster, _, _, spellID, canApplyAura, isBoss = UnitDebuff(self.displayedUnit or self.unit, i)

(Also, your code was leaking a global _ variable, which in the past has caused UI-wide breakage. Be careful about any global leakage, but especially _ and other common variable names.)

llerelol 12-06-13 03:15 AM

i'm currently taking a break from wow, but as soon as i return i will test it, thank you.

ckaotik 12-08-13 09:45 AM

Quote:

Originally Posted by Phanx (Post 287787)
(Also, your code was leaking a global _ variable, which in the past has caused UI-wide breakage. Be careful about any global leakage, but especially _ and other common variable names.)

I updated the snippet above, thanks. Mostly I just "ignore" _ as my files usally start with the line
Lua Code:
  1. local addonName, addon, _ = ...
as I'm sure to miss it somewhere. I'm also a big fan of findglobals.lua :) This code suffered a bit as I ripped it right out of it's "natural environment"...

10leej 12-08-13 12:24 PM

So figured i'd give this a shot. Get this error solo out of combat.

Code:

Message: Interface\AddOns\Test\modules\test1.lua:73: attempt to index global 'frame' (a nil value)
Time: 12/08/13 13:22:00
Count: 1
Stack: Interface\AddOns\Test\modules\test1.lua:73: in function <Interface\AddOns\Test\modules\test1.lua:72>
[C]: in function `CompactUnitFrame_UpdateVisible'
Interface\FrameXML\CompactUnitFrame.lua:243: in function `CompactUnitFrame_UpdateAll'
Interface\FrameXML\CompactUnitFrame.lua:166: in function `CompactUnitFrame_SetUpFrame'
...actRaidFrames\Blizzard_CompactRaidFrameContainer.lua:347: in function `CompactRaidFrameContainer_GetUnitFrame'
...actRaidFrames\Blizzard_CompactRaidFrameContainer.lua:317: in function `CompactRaidFrameContainer_AddUnitFrame'
...actRaidFrames\Blizzard_CompactRaidFrameContainer.lua:254: in function `CompactRaidFrameContainer_AddPlayers'
...actRaidFrames\Blizzard_CompactRaidFrameContainer.lua:176: in function `CompactRaidFrameContainer_LayoutFrames'
...actRaidFrames\Blizzard_CompactRaidFrameContainer.lua:130: in function `CompactRaidFrameContainer_TryUpdate'
...actRaidFrames\Blizzard_CompactRaidFrameContainer.lua:95: in function `CompactRaidFrameContainer_SetFlowSortFunction'
...mpactRaidFrames\Blizzard_CompactRaidFrameManager.lua:407: in function <...mpactRaidFrames\Blizzard_CompactRaidFrameManager.lua:402>
...mpactRaidFrames\Blizzard_CompactRaidFrameManager.lua:491: in function `CompactRaidFrameManager_SetSetting'
...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:572: in function `func'
...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:549: in function `CompactUnitFrameProfiles_ApplyProfile'
...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:176: in function `CompactUnitFrameProfiles_ApplyCurrentSettings'
...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:172: in function `CompactUnitFrameProfiles_ActivateRaidProfile'
...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:45: in function `CompactUnitFrameProfiles_ValidateProfilesLoaded'
...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:25: in function <...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:18>

Locals: (*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index global 'frame' (a nil value)"
Enable = <function> defined @Interface\AddOns\Test\modules\test1.lua:60


ckaotik 12-11-13 02:00 PM

Code:

Message: Interface\AddOns\Test\modules\test1.lua:73: attempt to index global 'frame' (a nil value)
Oops, forgot the argument to the function call. Please add the "frame" argument:
Lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateVisible", function(frame)
(I also corrected the snippet in my first post)


All times are GMT -6. The time now is 02:50 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI