Quantcast

In MainPanel:SetProfession(): Added a short-circuit - if Player.current_prof is Mining, set MainPanel.profession to 11 (smelting).

James D. Callahan III [03-12-10 - 09:56]
In MainPanel:SetProfession(): Added a short-circuit - if Player.current_prof is Mining, set MainPanel.profession to 11 (smelting).
Filename
Frame.lua
diff --git a/Frame.lua b/Frame.lua
index 131f467..84c1eb4 100644
--- a/Frame.lua
+++ b/Frame.lua
@@ -990,14 +990,24 @@ function MainPanel:ToggleState()
 	self:UpdateTitle()
 end

-function MainPanel:SetProfession()
-	for k, v in pairs(SORTED_PROFESSIONS) do
-		if v.name == Player.current_prof then
-			self.profession = k
-			break
+do
+	local MINING_SPELL = GetSpellInfo(32606)
+
+	function MainPanel:SetProfession()
+		if Player.current_prof == MINING_SPELL then
+			self.profession = 11 -- Smelting
+		else
+			for k, v in pairs(SORTED_PROFESSIONS) do
+				if v.name == Player.current_prof then
+					self.profession = k
+					break
+				else
+					addon:Printf("Skipping %s", Player.current_prof)
+				end
+			end
 		end
+		self.mode_button:ChangeTexture(SORTED_PROFESSIONS[self.profession].texture)
 	end
-	self.mode_button:ChangeTexture(SORTED_PROFESSIONS[self.profession].texture)
 end

 function MainPanel:SetPosition()