Quantcast

Big fix for storage of guild recipes.

Paul Schifferer [12-13-10 - 00:22]
Big fix for storage of guild recipes.
Added rescan to skill update check function.
Filename
CauldronMain.lua
CauldronMainUI.lua
CauldronQueueUI.lua
CauldronTradeskill.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 7933ab3..cf0097e 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -697,6 +697,9 @@ function Cauldron:GetSelectedSkill()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	if (not self.db.realm.userdata[self.vars.playername]) or
 	   (not self.db.realm.userdata[self.vars.playername].skills[skillName]) then
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index 089a0f4..a942c8e 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -191,6 +191,9 @@ function Cauldron:UpdateSearchText()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	if (not skillName or skillName == "UNKNOWN") or
 	   (not self.vars.playername) or
@@ -213,6 +216,9 @@ function Cauldron:UpdateStatus()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local filters = {};
 	local filterTable = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter;
@@ -274,6 +280,9 @@ function Cauldron:UpdateSkillList()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local skillList = Cauldron:GetSkillList(self.vars.playername, skillName);
 	if not skillList then
@@ -738,6 +747,9 @@ function CauldronFilterDropDown_Initialize(self, level)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local info = UIDropDownMenu_CreateInfo();

@@ -1160,6 +1172,9 @@ function CauldronSortDropDown_Initialize(self, level)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local info = UIDropDownMenu_CreateInfo();

@@ -1358,6 +1373,9 @@ function Cauldron:FilterDropDown_Initialize(level)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	UIDropDownMenu_SetText(CauldronFiltersFilterDropDown, L["Filters"]);

@@ -1687,6 +1705,9 @@ function Cauldron:FilterDropDown_Reset()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	--[[
 	-- sorting
@@ -1723,6 +1744,9 @@ function Cauldron:FilterDropDown_SetSort(sort)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 --	local sort = info.arg1;
 	local filter = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter;
@@ -1797,6 +1821,9 @@ function Cauldron:FilterDropDown_SetSlot(slot)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	Cauldron:info("set slot: "..tostring(slot));

@@ -1820,6 +1847,9 @@ function Cauldron:FilterDropDown_SetSubclass(subclass, subslot)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	Cauldron:info("set subclass: "..tostring(subclass)..", subslot: "..tostring(subslot));

@@ -1946,6 +1976,9 @@ function Cauldron:ReagentsFilterNormalCheck()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local checked = true;

@@ -1964,6 +1997,9 @@ function Cauldron:FilterDropDown_SetReagentFilter(info)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local reagents = info.arg1;
 	local filter = Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter;
@@ -1997,6 +2033,9 @@ function Cauldron:FilterDropDown_ToggleDifficulty(info)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.filter[info.arg1] = not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[CURRENT_TRADESKILL].window.filter[info.arg1];

@@ -2013,6 +2052,9 @@ function Cauldron:InvSlotDropDown_Initialize(level)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	UIDropDownMenu_SetText(CauldronFiltersInvSlotDropDown, L["Slots"]);

@@ -2058,6 +2100,9 @@ function Cauldron:SlotsFilterAllCheck()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local checked = true;

@@ -2083,6 +2128,9 @@ function Cauldron:InvSlotDropDown_SetSlot(info)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	Cauldron:debug("InvSlotDropDown_SetSlot: info.arg1="..info.arg1);

@@ -2136,6 +2184,9 @@ function Cauldron:CategoryDropDown_Initialize(level)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	UIDropDownMenu_SetText(CauldronFiltersCategoryDropDown, L["Categories"]);

@@ -2191,6 +2242,9 @@ function Cauldron:CategoriesFilterAllCheck()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local checked = true;

@@ -2213,6 +2267,9 @@ function Cauldron:CategoryDropDown_SetCategory(info)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	if info.arg1 == "all" or info.arg1 == "none" then
 		for name, _ in pairs(Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName].window.categories) do
@@ -2245,6 +2302,9 @@ function Cauldron:CollapseAllButton_OnClick(button)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

     local expand = true;
     local skillCount = 0;
@@ -2286,6 +2346,9 @@ function Cauldron:CollapseItemButton_OnClick(button)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local skillInfo = button.skillInfo;

@@ -2322,6 +2385,9 @@ function Cauldron:SkillItem_OnClick(frame, button, down)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	-- select this frame
 	if frame.skillIndex then
@@ -2340,6 +2406,9 @@ function Cauldron:TradeSkillFilter_OnTextChanged(frame)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	if (not skillName or skillName == "UNKNOWN") or
 	   (not self.vars.playername) or
@@ -2382,6 +2451,9 @@ function Cauldron:FavoriteItemButton_OnClick(button)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	local skillInfo = button.skillInfo;

diff --git a/CauldronQueueUI.lua b/CauldronQueueUI.lua
index a54e710..2621997 100644
--- a/CauldronQueueUI.lua
+++ b/CauldronQueueUI.lua
@@ -13,7 +13,7 @@ function Cauldron:UpdateQueue()
 	local itemQueue = {};

 	local skillName = CURRENT_TRADESKILL;
-	if not IsTradeSkillLinked() then
+	if not IsTradeSkillLinked() and not IsTradeSkillGuild() then
 		itemQueue = CauldronQueue:GetItems(queue);
 	end

diff --git a/CauldronTradeskill.lua b/CauldronTradeskill.lua
index db52a4c..156612d 100644
--- a/CauldronTradeskill.lua
+++ b/CauldronTradeskill.lua
@@ -15,6 +15,9 @@ function Cauldron:NeedsSkillUpdate()
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	-- initialize the trade skill entry
 	if not Cauldron.db.realm.userdata[Cauldron.vars.playername].skills[skillName] then
@@ -39,6 +42,10 @@ function Cauldron:NeedsSkillUpdate()
 	local numTradeSkills = GetNumTradeSkills();
 	local name, rank, maxRank = GetTradeSkillLine();

+	if skillDB.rescan and skillDB.rescan.failedRecipes and (#skillDB.rescan.failedRecipes > 0) then
+		return true;
+	end
+
 	if (tonumber(numTradeSkills) ~= tonumber(skillDB.skillCount)) then
 --		Cauldron:info("skill count mismatch; update needed");
 		return true;
@@ -84,6 +91,9 @@ function Cauldron:UpdateSkills()
 		if IsTradeSkillLinked() then
 			skillName = "Linked-"..skillName;
 		end
+		if IsTradeSkillGuild() then
+			skillName = "Guild-"..skillName;
+		end

 		-- initialize the trade skill entry
 		if not self.db.realm.userdata[self.vars.playername].skills[skillName] then
@@ -715,7 +725,7 @@ function Cauldron:GetSkillInfoForItem(item)

 	for tradeskill, list in pairs(self.db.realm.userdata[self.vars.playername].skills) do
 		-- skip linked skills
-		if not (string.find(tradeskill, "Linked-")) then
+		if not (string.find(tradeskill, "Linked-")) and not (string.find(tradeskill, "Guild-")) then
 			for _, recipeInfo in pairs(list.recipes) do
 				local name, _ = GetItemInfo(recipeInfo.itemLink);
 				if name == item then
@@ -737,7 +747,7 @@ function Cauldron:GetSkillInfoForLink(recipeLink)

 	for tradeskill, list in pairs(self.db.realm.userdata[self.vars.playername].skills) do
 		-- skip linked skills
-		if not (string.find(tradeskill, "Linked-")) then
+		if not (string.find(tradeskill, "Linked-")) and not (string.find(tradeskill, "Guild-")) then
 			for _, recipeInfo in pairs(list.recipes) do
 				local id = Cauldron:GetIdFromLink(recipeLink);
 				local recipeId = Cauldron:GetIdFromLink(recipeInfo.recipeLink);
@@ -760,7 +770,7 @@ function Cauldron:GetSkillInfoByIndex(itemIndex)

 	for tradeskill, list in pairs(self.db.realm.userdata[self.vars.playername].skills) do
 		-- skip linked skills
-		if not (string.find(tradeskill, "Linked-")) then
+		if not (string.find(tradeskill, "Linked-")) and not (string.find(tradeskill, "Guild-")) then
 			for _, recipeInfo in pairs(list.recipes) do
 				if recipeInfo.index == itemIndex then
 					return recipeInfo;
@@ -855,6 +865,9 @@ function Cauldron:GetReagentsForSkill(skillInfo)
 	if IsTradeSkillLinked() then
 		skillName = "Linked-"..skillName;
 	end
+	if IsTradeSkillGuild() then
+		skillName = "Guild-"..skillName;
+	end

 	-- check if the reagents are already populated
 	if #skillInfo.reagents > 0 then