Quantcast

The current profession is no longer stored on the Player object since it was already stored on the MainPanel.

James D. Callahan III [06-30-10 - 22:44]
The current profession is no longer stored on the Player object since it was already stored on the MainPanel.
Filename
ARL.lua
Frame.lua
Waypoint.lua
diff --git a/ARL.lua b/ARL.lua
index 9bd866a..01ba2cd 100644
--- a/ARL.lua
+++ b/ARL.lua
@@ -420,7 +420,7 @@ function addon:OnInitialize()
 	scan_button:SetScript("OnClick",
 			      function(self, button, down)
 				      local cprof = GetTradeSkillLine()
-				      local current_prof = Player.current_prof
+				      local current_prof = private.ordered_professions[addon.Frame.profession]

 				      if addon.Frame:IsVisible() then
 					      if IsShiftKeyDown() and not IsAltKeyDown() and not IsControlKeyDown() then
@@ -1642,7 +1642,7 @@ do
 		local recipes_total_filtered = 0
 		local recipes_known_filtered = 0
 		local can_display = false
-		local current_profession = Player.current_prof
+		local current_profession = private.ordered_professions[self.Frame.profession]
 		local recipe_list = private.recipe_list
 		local SF = private.recipe_state_flags

@@ -1783,8 +1783,7 @@ do
 			return
 		end

-		-- Set the current profession and its level, and update the cached data.
-		Player.current_prof = current_prof
+		-- Set the current profession level, and update the cached data.
 		Player["ProfessionLevel"] = prof_level

 		-- Make sure we're only updating a profession the character actually knows - this could be a scan from a tradeskill link.
@@ -1796,7 +1795,7 @@ do
 		end

 		-- Get the current profession Specialty
-		local specialty = SpecialtyTable[Player.current_prof]
+		local specialty = SpecialtyTable[current_prof]

 		for index = 1, 25, 1 do
 			local spellName = GetSpellName(index, BOOKTYPE_SPELL)
@@ -1910,9 +1909,9 @@ do
 		Player:SetReputationLevels()

 		if textdump then
-			self:DisplayTextDump(recipe_list, Player.current_prof)
+			self:DisplayTextDump(recipe_list, current_prof)
 		else
-			self.Frame:Display(is_linked)
+			self.Frame:Display(current_prof, is_linked)
 		end
 	end
 end
diff --git a/Frame.lua b/Frame.lua
index ffc758b..ece7ef7 100644
--- a/Frame.lua
+++ b/Frame.lua
@@ -71,7 +71,7 @@ local Player	= private.Player
 -------------------------------------------------------------------------------
 -- Constants
 -------------------------------------------------------------------------------
-local ORDERED_PROFESSIONS = private.ordered_professions
+local ORDERED_PROFESSIONS	= private.ordered_professions

 local FILTERMENU_HEIGHT		= 312

@@ -199,7 +199,7 @@ do
 		local _, _, _, quality_color = GetItemQualityColor(recipe_entry.quality)
 		local recipe_name = recipe_entry.name

-		if Player.current_prof == SPELL_ENCHANTING then
+		if ORDERED_PROFESSIONS[addon.Frame.profession] == SPELL_ENCHANTING then
 			recipe_name = string.gsub(recipe_name, _G.ENSCRIBE.." ", "")
 		end
 		local recipe_string = string.format("%s%s|r", quality_color, recipe_name)
@@ -1366,8 +1366,10 @@ function MainPanel:ToggleState()
 end

 function MainPanel:UpdateTitle()
+	local current_prof = ORDERED_PROFESSIONS[self.profession]
+
 	if not self.is_expanded then
-		self.title_bar:SetFormattedText(SetTextColor(BASIC_COLORS["normal"], "ARL (%s) - %s"), addon.version, Player.current_prof)
+		self.title_bar:SetFormattedText(SetTextColor(BASIC_COLORS["normal"], "ARL (%s) - %s"), addon.version, current_prof)
 		return
 	end
 	local total, active = 0, 0
@@ -1380,7 +1382,7 @@ function MainPanel:UpdateTitle()
 			total = total + 1
 		end
 	end
-	self.title_bar:SetFormattedText(SetTextColor(BASIC_COLORS["normal"], "ARL (%s) - %s (%d/%d %s)"), addon.version, Player.current_prof, active, total, _G.FILTERS)
+	self.title_bar:SetFormattedText(SetTextColor(BASIC_COLORS["normal"], "ARL (%s) - %s (%d/%d %s)"), addon.version, current_prof, active, total, _G.FILTERS)
 end

 -------------------------------------------------------------------------------
@@ -1514,12 +1516,14 @@ do
 		if not pattern then
 			return
 		end
+		local current_prof = ORDERED_PROFESSIONS[MainPanel.profession]
+
 		pattern = pattern:lower()

 		for index, entry in pairs(private.recipe_list) do
 			entry:RemoveState("RELEVANT")

-			if entry.profession == Player.current_prof then
+			if entry.profession == current_prof then
 				local found = false

 				for field in pairs(search_params) do
@@ -4215,7 +4219,7 @@ do
 		"tailor",	-- 12
 	}

-	function MainPanel:Display(is_linked)
+	function MainPanel:Display(profession, is_linked)
 		if InitializeFrame then
 			InitializeFrame()
 			InitializeFrame = nil
@@ -4259,11 +4263,11 @@ do
 		-------------------------------------------------------------------------------
 		local prev_profession = self.profession

-		if Player.current_prof == private.mining_name then
+		if profession == private.mining_name then
 			self.profession = 11 -- Smelting
 		else
 			for index, name in ipairs(ORDERED_PROFESSIONS) do
-				if name == Player.current_prof then
+				if name == profession then
 					self.profession = index
 					break
 				end
diff --git a/Waypoint.lua b/Waypoint.lua
index cbf292d..935e2d9 100644
--- a/Waypoint.lua
+++ b/Waypoint.lua
@@ -390,8 +390,8 @@ function addon:SetupMap(single_recipe)
 	local icontext = "Interface\\AddOns\\AckisRecipeList\\img\\enchant_up"

 	-- Get the proper icon to put on the mini-map
-	--		for i, k in pairs(SORTED_PROFESSIONS) do
-	--			if (k["name"] == Player.current_prof) then
+	--		for i, k in pairs(ORDERED_PROFESSIONS) do
+	--			if (i == MainPanel.profession) then
 	--				icontext = "Interface\\AddOns\\AckisRecipeList\\img\\" .. k["texture"] .. "_up"
 	--				break
 	--			end