Event when a profession is abandonned - WoWInterface
Thread Tools Display Modes
09-13-08, 06:33 AM   #1
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 30
Event when a profession is abandonned

It would be great to send a CHAT_MSG_SKILL event when a profession is abandonned, currently only SKILL_LINES_CHANGED is sent, but since event is triggered a bit too often, it does not allow proper monitoring of professions.

Thus at this point, it's easier to detect when a new profession is gained than to detect when it's abandonned. If a chat message was sent with a parameter like this:

ERR_SKILL_ABANDONNED_S = "You have abandonned the %s skill."; -- %s is the skill name

I think it would be much easier


PS: If you guys know valid workarounds, I'm open to suggestions.

Edit: I hooked AbandonSkill to do the trick, but I still think an event would be better

Last edited by Thaoky : 09-13-08 at 06:57 AM.
  Reply With Quote
09-13-08, 06:50 AM   #2
Premium Member
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
You could hook
  Reply With Quote
09-13-08, 11:06 AM   #3
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 30
Yeah, that's what I did in the end, and it was rather easy after all. But I guess an event would be more natural

I had started with SKILL_LINES_CHANGED, but it was triggered so often that the solution I was about to come up with would have been dirty, so I rolled back and started to look for another solution. Here's what I did, if by any chance anyone is interested.

local Orig_AbandonSkill = AbandonSkill

function AbandonSkill(index, ...)
  local skillName = GetSkillLineInfo(index)
  Orig_AbandonSkill(index, ...)

  -- do whatever here with skillName
  Reply With Quote
09-11-18, 06:28 AM   #4
A Flamescale Wyrmkin
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 126
Another way to see if a player will be removing a skill , as a pre-check and post check you can use the following. Since this is the popup they get before a skill is removed.

hooksecurefunc("StaticPopup_Show", function(event, skillName, skillLine)
  if (event == "UNLEARN_SKILL") then
    --do something here, but remember they haven't accepted yet, grab skillName and skillLine
But if you want to grab the OnAccept of the dialog above you can do the following.

hooksecurefunc(StaticPopupDialogs["UNLEARN_SKILL"], "OnAccept", function(self, data)
	--do something here

To be honest AbandonSkill is the best way to do it. But just wanted to post another possible way of checking for player intentions.
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }
  Reply With Quote

WoWInterface » Developer Discussions » Wish List » Event when a profession is abandonned

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