WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to disable Addon for specific Class Spec? (https://www.wowinterface.com/forums/showthread.php?t=57024)

Kekskrümel 02-18-19 08:40 AM

How to disable Addon for specific Class Spec?
 
Hi,

I would like to modify https://www.curseforge.com/wow/addon...-mode-targeter to disable the addon for holy paladin and mistweaver monk.

Sadly I am a noob in programing.

I can read some parts and "addonTable:Disable(OPTIONS)" should disable the addon in the code.

Is there any function to detect the mentioned class specs?

If so how can I use this and there does it need to be placed in the code?

Thx

Nightness 04-04-19 11:56 PM

I'm looking into this...
 
I'm looking into this for my MagnetButtons addon. I will let you know when I know... Crazy day, but if you want a go at figuring it out, I will quickly explain what to look for... create a frame and set a script for OnEvent, and RegisterAllEvents()... Somewhere in there lies a way to detect spec changes.

Worst case, use an OnUpdate frame event handler to constantly check your current role, and call some callback function when it changes.

Ekaterina 04-05-19 04:56 AM

You'd want to register for PLAYER_SPECIALIZATION_CHANGED

You can get the current spec with GetSpecialization(). Below is an example of usage from wowpedia:
Lua Code:
  1. local currentSpec = GetSpecialization()
  2. if currentSpec then
  3.    local _, currentSpecName = GetSpecializationInfo(currentSpec)
  4.    print("Your current spec:", currentSpecName)
  5. else
  6.    print("You do not currently have a spec.")
  7. end

wow.gamepedia.com/API_GetSpecialization

Nightness 04-05-19 09:59 PM

Nice, thanks! :)
 
Quote:

Originally Posted by Ekaterina (Post 331864)
You'd want to register for PLAYER_SPECIALIZATION_CHANGED

You can get the current spec with GetSpecialization(). Below is an example of usage from wowpedia:
Lua Code:
  1. local currentSpec = GetSpecialization()
  2. if currentSpec then
  3.    local _, currentSpecName = GetSpecializationInfo(currentSpec)
  4.    print("Your current spec:", currentSpecName)
  5. else
  6.    print("You do not currently have a spec.")
  7. end

wow.gamepedia.com/API_GetSpecialization

Better than my answer and helps me too, thanks


All times are GMT -6. The time now is 07:34 AM.

vBulletin © 2019, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI