Quantcast
WoWInterface - View Single Post - Highlighting lifebloom with pandemic
View Single Post
06-03-18, 10:33 PM   #9
tehmoku
A Fallenroot Satyr
Join Date: May 2007
Posts: 23
So, for anyone potentially following the thread..

I have finished this finally, and have working code for BfA. (A couple things were removed from UnitBuff, namely spell rank, so this code won't specifically work on live but it's easily fixable if you so choose)

The only, and major problem is that this doesn't update often enough when I need it to. If anyone has any suggestions on how I can update it more frequently, I'm open to suggestion. It updates every time an aura gets updated (applied or removed), but for this to be truly perfect it would probably need to update at least every half second with lifebloom up, regardless of anything else.

As a result, sometimes even though LB can be manually "bloomed" at 5.5 seconds, the highlight won't appear until after that. The amount of time after that varies depending on how often auras are being updated for the unit.

Lua Code:
  1. --Target Frame
  2. function TargetFrame_UpdateAuras_Hook(self)
  3.     local frame, frameName
  4.     local selfName = self:GetName()
  5.  
  6.     for i = 1, MAX_TARGET_BUFFS do
  7.     local buffName, icon, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal,
  8.     spellId, canApplyAura, isBossDebuff, casterIsPlayer, nameplateShowAll, timeMod, _ = UnitBuff(self.unit, i, nil)
  9.  
  10.         if buffName then
  11.             if spellId == 33763 and casterIsPlayer then
  12.                 frameName = selfName.."Buff"..(i)
  13.                 frame = _G[frameName]
  14.                 if frame and icon and (not self.maxBuffs or i <= self.maxBuffs) then
  15.                     local timeRemaining = (expirationTime - GetTime()) / timeMod
  16.                     local refreshTime = duration * 0.3
  17.                     local frameStealable = _G[frameName.."Stealable"]
  18.  
  19.                     if timeRemaining <= refreshTime then
  20.                         frameStealable:Show()
  21.                     else
  22.                         frameStealable:Hide()
  23.                     end
  24.                 end
  25.                 break
  26.             end
  27.         else
  28.             break
  29.         end
  30.     end
  31. end
  32. hooksecurefunc("TargetFrame_UpdateAuras", TargetFrame_UpdateAuras_Hook)
  33.  
  34. --Compact Unit Frame
  35. function CompactUnitFrame_UtilSetBuff_Hook(buffFrame, unit, index, filter)
  36.     local buffName, icon, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal,
  37.     spellId, canApplyAura, isBossDebuff, casterIsPlayer, nameplateShowAll, timeMod, _ = UnitBuff(unit, index, filter)
  38.  
  39.     if spellId == 33763 and casterIsPlayer then
  40.         local timeRemaining = (expirationTime - GetTime()) / timeMod
  41.         local refreshTime = duration * 0.3
  42.  
  43.     if not buffFrame.highlight then
  44.         local highlight = buffFrame:CreateTexture(nil, "OVERLAY")
  45.         highlight:SetTexture([[Interface\TargetingFrame\UI-TargetingFrame-Stealable]])
  46.         highlight:SetPoint("TOPLEFT", -3, 3)
  47.         highlight:SetPoint("BOTTOMRIGHT", 3, -3)
  48.         highlight:SetBlendMode("ADD")
  49.         buffFrame.highlight = highlight
  50.     end
  51.  
  52.     if timeRemaining <= refreshTime then
  53.         buffFrame.highlight:Show()
  54.     else
  55.         buffFrame.highlight:Hide()
  56.     end
  57.  
  58.     elseif buffFrame.highlight then
  59.         buffFrame.highlight:Hide()
  60.     end
  61. end
  62. hooksecurefunc("CompactUnitFrame_UtilSetBuff", CompactUnitFrame_UtilSetBuff_Hook)

Last edited by tehmoku : 06-04-18 at 03:19 PM.
  Reply With Quote