WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Removing shield from the protected casts. (https://www.wowinterface.com/forums/showthread.php?t=59327)

Deadlyz 11-07-22 06:54 AM

Removing shield from the protected casts.
 
Hello!

I'd like to disable the shield texture for protected casts.

The old classic texture looks terrible with the new UI and Blizzard didn't even bother to position it properly.

Looking for a bored Addon Author to help me!

Thanks in advance! :)

L3n1n 11-07-22 10:55 AM

Didn't test but it should work.

Lua Code:
  1. TargetFrameSpellBar:HookScript("OnShow", function(self)
  2.     if self.BorderShield:IsShown() then
  3.         self.BorderShield:Hide()
  4.     end
  5. end)

Deadlyz 11-07-22 02:39 PM

Quote:

Originally Posted by L3n1n (Post 341514)
Didn't test but it should work.

Lua Code:
  1. TargetFrameSpellBar:HookScript("OnShow", function(self)
  2.     if self.BorderShield:IsShown() then
  3.         self.BorderShield:Hide()
  4.     else
  5. end)

Thanks! I'm getting an error though :(
Lua Code:
  1. 3x FrameXML\Bindings.xml:1 Interface/AddOns/NoShield/NoShield.lua:1 Interface/AddOns/NoShield/NoShield.lua:5: unexpected symbol near ')'

L3n1n 11-07-22 04:40 PM

I did mistake, replace "else" to "end".

Deadlyz 11-08-22 01:38 AM

Quote:

Originally Posted by L3n1n (Post 341521)
I did mistake, replace "else" to "end".

Thanks! It works now, but somehow only hides shields randomly.


Xrystal 11-08-22 06:07 AM

You could try IsVisible() in addition to IsShown()
https://wowpedia.fandom.com/wiki/API...Region_IsShown


You could try just having the Hide() line. Seeing as the function is to show the frame, rather than check if it is shown first just tell it to hide it regardless as your code runs after their code. The test on whether it is Shown or not may be returning false for some reason. But the above may rectify this scenario.

Deadlyz 11-08-22 06:54 AM

Quote:

Originally Posted by Xrystal (Post 341529)
You could try IsVisible() in addition to IsShown()
https://wowpedia.fandom.com/wiki/API...Region_IsShown


You could try just having the Hide() line. Seeing as the function is to show the frame, rather than check if it is shown first just tell it to hide it regardless as your code runs after their code. The test on whether it is Shown or not may be returning false for some reason. But the above may rectify this scenario.

Thanks!

The final version of the code for anyone interested ;)
Lua Code:
  1. TargetFrameSpellBar.BorderShield:SetTexture(0)
  2. FocusFrameSpellBar.BorderShield:SetTexture(0)

SDPhantom 11-08-22 06:02 PM

Quote:

Originally Posted by Deadlyz (Post 341528)
Thanks! It works now, but somehow only hides shields randomly.


The problem is, when a cast stops, the frame is still "Shown" for the duration it's fading. When another spell is cast, OnShow doesn't fire because it never was hidden in the first place.



Quote:

Originally Posted by Xrystal (Post 341529)
You could try IsVisible() in addition to IsShown()
https://wowpedia.fandom.com/wiki/API...Region_IsShown

:IsVisible() implies :IsShown(). The difference is :IsVisible() checks inherited visibility from the parent where :IsShown() only checks the object's shown state.

Deadlyz 11-09-22 07:24 AM

Quote:

Originally Posted by SDPhantom (Post 341534)
The problem is, when a cast stops, the frame is still "Shown" for the duration it's fading. When another spell is cast, OnShow doesn't fire because it never was hidden in the first place.




:IsVisible() implies :IsShown(). The difference is :IsVisible() checks inherited visibility from the parent where :IsShown() only checks the object's shown state.

Thanks for the explanation ;)


All times are GMT -6. The time now is 08:42 PM.

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