Thread Tools Display Modes
02-18-19, 08:40 AM   #1
Kekskrümel
An Aku'mai Servant
Join Date: Oct 2010
Posts: 39
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

Last edited by Kekskrümel : 02-18-19 at 10:10 AM.
  Reply With Quote
04-04-19, 11:56 PM   #2
Nightness
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 32
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.

Last edited by Nightness : 04-05-19 at 12:01 AM.
  Reply With Quote
04-05-19, 04:56 AM   #3
Ekaterina
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 65
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
  Reply With Quote
04-05-19, 09:59 PM   #4
Nightness
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Feb 2009
Posts: 32
Nice, thanks! :)

Originally Posted by Ekaterina View Post
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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to disable Addon for specific Class Spec?

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