Quantcast

Handle newly-learned professions

Kevin Lyles [07-20-13 - 14:10]
Handle newly-learned professions
Filename
Locales/enUS/base.lua
WeightsWatcher.lua
diff --git a/Locales/enUS/base.lua b/Locales/enUS/base.lua
index 9748a15..b88d4f5 100644
--- a/Locales/enUS/base.lua
+++ b/Locales/enUS/base.lua
@@ -154,8 +154,9 @@ L["Quiver"] = "Quiver"
 L["Gem"] = "Gem"
 L["Consumable"] = "Consumable"
 L["Recipe"] = "Recipe"
-L["PROF_SKILL_UP"] = "^Your skill in ([A-Z][A-Za-z '-]+) has increased to (%d+)%.$"
-L["REP_CHANGE"] = "^Reputation with ([A-Z][A-Za-z ':-]+) ([di][en]creased) by (%d+)%."
+L["PROF_NEW"] = "^You have gained the ([A-Z][%a '-]+) skill%.$"
+L["PROF_SKILL_UP"] = "^Your skill in ([A-Z][%a '-]+) has increased to (%d+)%.$"
+L["REP_CHANGE"] = "^Reputation with ([A-Z][%a ':-]+) ([di][en]creased) by (%d+)%."
 L["increased"] = "increased"

 -- weights.lua
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index 437239b..141e5ce 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -332,7 +332,15 @@ function WeightsWatcher:eventHandler(event, message, ...)
 				WeightsWatcher.ResetEnchantCache()
 			end
 		else
-			populateProfessions()
+			skill = message:match(L["PROF_NEW"])
+			if skill then
+				if WeightsWatcher.player.professions[skill] then
+					WeightsWatcher.player.professions[skill] = 1
+					WeightsWatcher.ResetEnchantCache()
+				end
+			else
+				populateProfessions()
+			end
 		end
 	elseif event == "CHAT_MSG_COMBAT_FACTION_CHANGE" then
 		-- "Reputation with X (in|de)creased by y."