Thread Tools Display Modes
12-29-22, 09:55 AM   #1
prev
A Kobold Labourer
Join Date: Dec 2022
Posts: 1
(HELP) Dispellable Debuffs Highlighted for non-purge Classes

So prior to Dragonflight I used a script to create the "stealable" glow around dispellable buffs on enemies for classes that don't possess an offensive dispel. With the overhaul of the UI in Dragonflight it no longer works. I attached an image that shows what I mean.



Code that worked before Dragonflight:
Code:
hooksecurefunc('TargetFrame_UpdateAuras', function(self)
	local FrameStealable
	local frameName
	local icon
	local debuffType
	local selfName = self:GetName()
	local isEnemy = UnitIsEnemy(PlayerFrame.unit, self.unit)
	for i = 1, MAX_TARGET_BUFFS do
		_, icon, _, debuffType = UnitBuff(self.unit, i)
		frameName = selfName..'Buff'..i
		if ( icon and ( not self.maxBuffs or i <= self.maxBuffs ) ) then
			frameStealable = _G[frameName..'Stealable']
			if ( isEnemy and debuffType == 'Magic' ) then
				frameStealable:Show()
			else
				frameStealable:Hide()
			end
		end
	end
end)
I don't know alot about LUA but any help is appreciated. Thank you!
Attached Thumbnails
Click image for larger version

Name:	cf036fc84a09be41bcfb19d4e459a842.png
Views:	62
Size:	12.1 KB
ID:	9780  
  Reply With Quote
12-31-22, 05:58 AM   #2
watchout
A Fallenroot Satyr
Join Date: Mar 2008
Posts: 20
What does "no longer work" entail?

Anyway, I'd suggest to verify field and frame names, a lot of names changed with the update

P.S: you have a typo in
Lua Code:
  1. local FrameStealable

though that should not affect functionality, only bleed a global variable or two ("_" is a variable name as well, you'll also want to make that local)
  Reply With Quote
01-01-23, 06:21 AM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
A lot has changed with how the TargetFrame shows auras.

Lua Code:
  1. local function TargetFrame_UpdateAuras(self)
  2.     if UnitIsEnemy("player",self.unit) then
  3.         for buff in self.auraPools:GetPool("TargetBuffFrameTemplate"):EnumerateActive() do
  4.             local data=C_UnitAuras.GetAuraDataByAuraInstanceID(buff.unit,buff.auraInstanceID);
  5.             buff.Stealable:SetShown(data.isStealable or data.dispelName=="Magic");
  6.         end
  7.     end
  8. end
  9.  
  10. hooksecurefunc(TargetFrame,"UpdateAuras",TargetFrame_UpdateAuras);
  11. hooksecurefunc(FocusFrame,"UpdateAuras",TargetFrame_UpdateAuras);

First to note, most of TargetFrame's functions were moved to a mixin. This is basically a table that is copied when inherited. The buff/debuff frames are now allocated by frame pools that provide a different way to iterate over them. Lastly, using .auraInstanceID, we can use the new C_UnitAuras.GetAuraDataByAuraInstanceID() to query the buff each individual button is assigned to.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-09-23 at 09:41 PM.
  Reply With Quote
01-09-23, 02:17 PM   #4
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by SDPhantom View Post
A lot has changed with how the TargetFrame shows auras.

Lua Code:
  1. local function TargetFrame_UpdateAuras(self)
  2.     if UnitIsEnemy("player",self.unit) then
  3.         for buff in self.auraPools:GetPool("TargetBuffFrameTemplate"):EnumerateActive() do
  4.             local data=C_UnitAuras.GetAuraDataByAuraInstanceID(buff.unit,buff.auraInstanceID);
  5.             buff.Stealable:SetShown(data.isStealable or data.dispelName=="Magic");
  6.         end
  7.     end
  8. end
  9.  
  10. hooksecurefunc("TargetFrame",UpdateAuras,TargetFrame_UpdateAuras);
  11. hooksecurefunc("FocusFrame",UpdateAuras,TargetFrame_UpdateAuras);

First to note, most of TargetFrame's functions were moved to a mixin. This is basically a table that is copied when inherited. The buff/debuff frames are now allocated by frame pools that provide a different way to iterate over them. Lastly, using .auraInstanceID, we can use the new C_UnitAuras.GetAuraDataByAuraInstanceID() to query the buff each individual button is assigned to.
i recive this error on this script Usage: hooksecurefunc([table,] "function", hookfunc)
  Reply With Quote
01-09-23, 02:33 PM   #5
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Lua Code:
  1. hooksecurefunc(TargetFrame, "UpdateAuras", TargetFrame_UpdateAuras);
  2. hooksecurefunc(FocusFrame, "UpdateAuras" , TargetFrame_UpdateAuras);
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
01-09-23, 09:42 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Don't know how that mistake happened, but I corrected in the original post too.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-09-23, 10:18 PM   #7
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by SDPhantom View Post
Don't know how that mistake happened, but I corrected in the original post too.
thanks you sir
  Reply With Quote
01-09-23, 10:19 PM   #8
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by Fizzlemizz View Post
Lua Code:
  1. hooksecurefunc(TargetFrame, "UpdateAuras", TargetFrame_UpdateAuras);
  2. hooksecurefunc(FocusFrame, "UpdateAuras" , TargetFrame_UpdateAuras);
thanks you sir
  Reply With Quote
01-10-23, 02:22 AM   #9
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
question can thus script be modified instead of enlight magic spells to enlight helpful or harmfull buffs or only one that have above 1min cooldown or buffs that have duration above 10seconds is that possible?

Last edited by Vremon : 01-10-23 at 02:58 AM.
  Reply With Quote
01-14-23, 06:37 AM   #10
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
There's no way to query cooldown info on just any arbitrary ability. That and not all buffs share the same SpellID as the ability that applies it.

Also, the buff update doesn't continuously happen, so duration tracking will have to be written from scratch. Buff updates only fire when the list changes, usually by a buff (re)applying, gaining or losing stacks, dispelled, or expiration.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-14-23, 09:37 AM   #11
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by SDPhantom View Post
There's no way to query cooldown info on just any arbitrary ability. That and not all buffs share the same SpellID as the ability that applies it.

Also, the buff update doesn't continuously happen, so duration tracking will have to be written from scratch. Buff updates only fire when the list changes, usually by a buff (re)applying, gaining or losing stacks, dispelled, or expiration.
actualy u can do like this and its really working

buff.Stealable:SetShown(data.duration >= 10 and (data.expirationTime - GetTime()) < 20 );

only buff that have duration above10 and under 20 and its working
  Reply With Quote
01-15-23, 08:30 AM   #12
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by Vremon View Post
buff.Stealable:SetShown(data.duration >= 10 and (data.expirationTime - GetTime()) < 20 );
For example, target something that has 20+ seconds remaining on the buff. It may or may not update the highlight immediately when the duration falls below 20 seconds. This isn't "working" when it only updates sometimes.

You're going to need either an OnUpdate script or a C_Timer loop periodically calling the code to get reliable updates when filtering by remaining time.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-15-23 at 08:35 AM.
  Reply With Quote
01-18-23, 02:31 AM   #13
Lesteryoung
A Black Drake
Join Date: Aug 2015
Posts: 81
I've been looking for almost exactly what OP describes since 10.0. My old code showed on all targets though.

Phantom, would it be possible to edit your code above to show the stealable glow on all targets, not just enemies. IE, friendly/enemy/self/npc/everything.

If possible, thanks.
  Reply With Quote
01-18-23, 03:49 AM   #14
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by Lesteryoung View Post
I've been looking for almost exactly what OP describes since 10.0. My old code showed on all targets though.

Phantom, would it be possible to edit your code above to show the stealable glow on all targets, not just enemies. IE, friendly/enemy/self/npc/everything.

If possible, thanks.
u replace this line if UnitIsEnemy("player",self.unit) then
with if UnitIsUnit(self.unit) then
  Reply With Quote
01-18-23, 05:10 AM   #15
Lesteryoung
A Black Drake
Join Date: Aug 2015
Posts: 81
Originally Posted by Vremon View Post
u replace this line if UnitIsEnemy("player",self.unit) then
with if UnitIsUnit(self.unit) then
That didn't work, sorry. Just throwing errors.
  Reply With Quote
01-18-23, 06:13 AM   #16
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
What are the errors you're getting?
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-18-23, 07:30 AM   #17
Lesteryoung
A Black Drake
Join Date: Aug 2015
Posts: 81
Usage: UnitIsUnit("unit", "otherUnit")
[string "=[C]"]: in function `UnitIsUnit'
[string "@Interface/AddOns/Tweaks/Glow.lua"]:2: in function <Interface/AddOns/Tweaks/Glow.lua:1>
[string "=[C]"]: in function `UpdateAuras'
[string "@Interface/FrameXML/EditModeSystemTemplates.lua"]:989: in function `UpdateSystemSettingBuffsOnTop'
[string "@Interface/FrameXML/EditModeSystemTemplates.lua"]:1141: in function `UpdateSystemSetting'
[string "@Interface/FrameXML/EditModeSystemTemplates.lua"]:219: in function `UpdateSystem'
[string "@Interface/FrameXML/EditModeManager.lua"]:1031: in function `UpdateSystem'
[string "@Interface/FrameXML/EditModeManager.lua"]:1023: in function <Interface/FrameXML/EditModeManager.lua:1022>
[string "=[C]"]: in function `secureexecuterange'
[string "@Interface/FrameXML/EditModeManager.lua"]:1025: in function `UpdateSystems'
[string "@Interface/FrameXML/EditModeManager.lua"]:895: in function `UpdateLayoutInfo'
[string "@Interface/FrameXML/EditModeManager.lua"]:238: in function <Interface/FrameXML/EditModeManager.lua:235>

Locals:
(*temporary) = "target"


Looks like it's Edit Mode related.
  Reply With Quote
01-19-23, 01:49 AM   #18
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
UnitIsUnit() is expecting two units to compare equality. This is commonly used to check if a firing UNIT_* event is for a script's unitframe. We're already grabbing our unit from the buff frame, there's nothing to compare with here.

If you want to check if a unit exists, you need to use UnitExists(). Considering the hooked function doesn't even fire when the unit doesn't exist, this is also pointless.

This is the updated script without any filtering.

Lua Code:
  1. local function TargetFrame_UpdateAuras(self)
  2.     for buff in self.auraPools:GetPool("TargetBuffFrameTemplate"):EnumerateActive() do
  3.         local data=C_UnitAuras.GetAuraDataByAuraInstanceID(buff.unit,buff.auraInstanceID);
  4.         buff.Stealable:SetShown(data.isStealable or data.dispelName=="Magic");
  5.     end
  6. end
  7.  
  8. hooksecurefunc(TargetFrame,"UpdateAuras",TargetFrame_UpdateAuras);
  9. hooksecurefunc(FocusFrame,"UpdateAuras",TargetFrame_UpdateAuras);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-19-23 at 05:08 AM.
  Reply With Quote
01-19-23, 04:29 AM   #19
Lesteryoung
A Black Drake
Join Date: Aug 2015
Posts: 81
Tyvm for your help, but unfortunately it is still not working.

Now giving this error. I put it into it's own addon folder just to be sure something else wasn't interfering.

Usage: hooksecurefunc([table,] "function", hookfunc)
[string "=[C]"]: in function `hooksecurefunc'
[string "@Interface/AddOns/StealableBorder/core.lua"]:8: in main chunk

Locals:
(*temporary) = <table> {
UpdateOnBarHighlightMarksBySpell = <function> defined @Interface/FrameXML/ActionButton.lua:82
ERR_OUT_OF_CHI = "Not enough chi"
DH_HAVOC_CORE_ABILITY_2 = "Strong melee attack that consumes Fury. If it critical strikes, some Fury is refunded."
MultiCastActionButton6Cooldown = MultiCastActionButton6Cooldown {
}
SettingsSliderOptionsMixin = <table> {
}
GetTrainerServiceTypeFilter = <function> defined =[C]:-1
UNIT_NAMES_COMBATLOG_TOOLTIP = "Color unit names."
HUD_EDIT_MODE_SETTING_ACTION_BAR_HIDE_BAR_ART = "Hide Bar Art"
LE_GAME_ERR_CHAT_RAID_RESTRICTED_TRIAL = 774
SPELL_FAILED_CUSTOM_ERROR_71 = "This partygoer wants to dance with you."
LE_GAME_ERR_PET_SPELL_TARGETS_DEAD = 417
ERROR_CLUB_TICKET_COUNT_AT_MAX_COMMUNITY = "Can't create any more invite links for this community."
RecruitAFriendFrame = RecruitAFriendFrame {
}
TutorialFrameLeft19 = TutorialFrameLeft19 {
}
MultiCastActionButton2Cooldown = MultiCastActionButton2Cooldown {
}
ERR_TRADE_EQUIPPED_BAG = "You can't trade equipped bags."
PVP_RANK_6_1 = "Corporal"
MultiBarLeftButton7 = MultiBarLeftButton7 {
}
OPTION_TOOLTIP_SHOW_MULTIBAR4 = "Attached to the left side of Right Action Bar 1 by default"
LE_GAME_ERR_INVALID_FOLLOW_PVP_COMBAT = 371
MerchantItem1AltCurrencyFrameItem1Text = MerchantItem1AltCurrencyFrameItem1Text {
}
PROFESSIONS_COLUMN_REAGENTS_NONE = "None"
OPTION_TOOLTIP_ACTION_BUTTON_USE_KEY_DOWN = "Action button keybinds will respond on key down, rather than on key up."
BINDING_NAME_NAMEPLATES = "Show Enemy Name Plates"
CHAT_HEADER_SUFFIX = ": "
MultiBarBottomRightButton8Shine5 = MultiBarBottomRightButton8Shine5 {
}
COVENANT_MISSIONS_HEALTH = "Health"
MAIL_LETTER_TOOLTIP = "Click to make a permanent
copy of this letter."
UnitFrameManaBar_UnregisterDefaultEvents = <function> defined @Interface/FrameXML/UnitFrame.lua:898
PVPReadyDialogBottomArt = PVPReadyDialogBottomArt {
}
MultiBar6Button4Flash = MultiBar6Button4Flash {
}
DUNGEON_FLOOR_UPPERBLACKROCKSPIRE3 = "Hall of Blackhand"
CHAT_CONFIG_OTHER_COMBAT = <table> {
}
FCFDockOverflowButton_OnClick = <function> defined @Interface/FrameXML/FloatingChatFrame.lua:2398
TutorialFrameRight19 = TutorialFrameRight19 {
}
MoneyFrame_OnEvent = <function> defined @Interface/FrameXML/MoneyFrame.lua:202
BN_UNABLE_TO_RESOLVE_NAME = "Unable to whisper '%s'. Blizzard services may be unavailable."
AutoCompleteEditBox_OnKeyDown = <function> defined @Interface/FrameXML/AutoComplete.lua:368
CompactRaidFrameManagerDisplayFrameHiddenModeToggleTopRight = CompactRaidFrameManagerDisplayFrameHiddenModeToggleTopRight {
}
LFGTeleport = <function> defined =[C]:-1
LE_GAME_ERR_ONLY_ONE_QUIVER = 36
INT_SPELL_DURATION_HOURS = "%d |4hour:hrs;"
ToggleEncounterJournal = <function> defined @Interface/FrameXML/UIParent.lua:1141
LOSS_OF_CONTROL_DISPLAY_FEAR = "Feared"
OverrideActionBarButton6Shine11 = OverrideActionBarButton6Shine11 {
}
ROGUE_COMBAT_CORE_ABILITY_4 = "Melee attack that spends Combo Points."
JoinSkirmish = <function> defined =[C]:-1
MultiBarRightButton7Shine9 = MultiBarRightButton7Shine9 {
}
BankFrameItem17SearchOverlay = BankFrameItem17SearchOverlay {
}
DMG_LCD = "DMG"
ACTION_SPELL_MISSED_POSSESSIVE = "1"
Is64BitClient = <function> defined =[C]:-1
SecureCmdItemParse = <function> defined @Interface/FrameXML/ChatFrame.lua:1156
SLASH_STOPATTACK1 = "/stopattack"
MultiCastActionButton4HotKey = MultiCastActionButton4HotKey {
}
MultiBar5Button11Shine4 = MultiBar5Button11Shine4 {
}
TutorialFrame_OnMouseDown = <function> defined @Interface/FrameXML/TutorialFrame.lua:262
ContainerFrame4Item16Cooldown = ContainerFrame4Item16Cooldown {
}
MINIMAP_TRACKING_TRAINER_CLASS = "Class Trainer"
SLASH_DISMOUNT2 = "/dismount"
DUNGEON_FLOOR_DRAGONBLIGHTCHROMIESCENARIO2 = "Andorhal"
StanceButton8Shine15 = StanceButton8Shine15 {
}
EMOTE69_CMD1 = "/nosepick"
WowTokenRedemptionFrameBg = WowTokenRedemptionFrameBg {
}
SPELL_FAILED_CUSTOM_ERROR_152 = "You must choose a specialization to use Ascendance."
AutoFollowStatus = AutoFollowStatus {
}
ARENA_CASUAL =
  Reply With Quote
01-19-23, 04:49 AM   #20
Vremon
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jan 2022
Posts: 14
Originally Posted by Lesteryoung View Post
Tyvm for your help, but unfortunately it is still not working.

Now giving this error. I put it into it's own addon folder just to be sure something else wasn't interfering.
its cuz u copyed wrong the code check upside posts
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » (HELP) Dispellable Debuffs Highlighted for non-purge Classes

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