Quantcast

Starting to re-enable auto-buy code. It's not ready yet, so don't try it. :-P

pschifferer [10-28-09 - 03:36]
Starting to re-enable auto-buy code.  It's not ready yet, so don't try it. :-P
Filename
CauldronMain.xml
CauldronMainUI.lua
CauldronShoppingList.lua
CauldronShoppingList.xml
CauldronUtil.lua
diff --git a/CauldronMain.xml b/CauldronMain.xml
index 0d34efa..e855c9e 100644
--- a/CauldronMain.xml
+++ b/CauldronMain.xml
@@ -115,6 +115,7 @@
 					<OnEnter>
 						GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
 						GameTooltip:SetTradeSkillItem(self.skillIndex);
+						Cauldron:AppendToTooltip(GameTooltip, self.skillIndex);
 						CursorUpdate(self);
 					</OnEnter>
 					<OnLeave>
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index 1fb665f..8036528 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -246,9 +246,9 @@ function Cauldron:UpdateFilterDropDowns()
 end

 function Cauldron:UpdateSkillList()
---@alpha@
+	--@alpha@
 	self:debug("UpdateSkillList enter");
---@end-alpha@
+	--@end-alpha@

 	local skillName = CURRENT_TRADESKILL;
 	if IsTradeSkillLinked() then
@@ -259,17 +259,17 @@ function Cauldron:UpdateSkillList()
 	if not skillList then
 		return;
 	end
---@alpha@
+	--@alpha@
 	self:debug("UpdateSkillList: skillList="..#skillList);
---@end-alpha@
+	--@end-alpha@

 	local height = 0;

 	-- iterate over the list of skills
 	for i, skillInfo in ipairs(skillList) do
---@alpha@
+		--@alpha@
 		self:debug("UpdateSkillList: i="..i);
---@end-alpha@
+		--@end-alpha@

 		local skillFrame = _G["CauldronSkillItem"..i];

@@ -334,6 +334,9 @@ function Cauldron:UpdateSkillList()
 		elseif skillInfo.available > 0 then
 			nameText = nameText.." ["..skillInfo.available.."]";
 		end
+		if Cauldron:GetAchievementsForSkill(skillInfo) then
+			nameText = nameText.." [A]";
+		end
 		frame:SetText(nameText);
 		if TradeSkillTypeColor then
 			local color = TradeSkillTypeColor[skillInfo.difficulty];
@@ -2193,3 +2196,14 @@ function Cauldron:ConfirmDialog(title, message, okayBtn, okayBtnCB, cancelBtn, c

 	f:Show();
 end
+
+function Cauldron:AppendToTooltip(tooltip, skillIndex)
+	if not tooltip then
+		return;
+	end
+	if not skillIndex then
+		return;
+	end
+
+
+end
diff --git a/CauldronShoppingList.lua b/CauldronShoppingList.lua
index 41ac79e..0e8596d 100644
--- a/CauldronShoppingList.lua
+++ b/CauldronShoppingList.lua
@@ -3,6 +3,8 @@

 CauldronShopping = {};

+local L = LibStub("AceLocale-3.0"):GetLocale("Cauldron")
+
 --[[
 	list = {
 		["<requestor>"] = {
@@ -174,16 +176,14 @@ function CauldronShopping:AutoBuyShoppingItems(list, requestor)
 	end

 	-- iterate over shopping list
-	--[[
-	for r, _ in pairs(list) do
-		for item, amount in pairs(r) do
+	if list[requestor] then
+		for item, amount in pairs(list[requestor]) do
 			-- check if the merchant has the item and it can be purchased
 			if merchant[item] then
 				CauldronShopping:BuyItem(item, merchant[item], amount);
 			end
 		end
 	end
-	--]]

 end

diff --git a/CauldronShoppingList.xml b/CauldronShoppingList.xml
index d96194d..fc48411 100644
--- a/CauldronShoppingList.xml
+++ b/CauldronShoppingList.xml
@@ -190,7 +190,6 @@
 				</Scripts>
 				<NormalTexture file="Interface\AddOns\Cauldron\Artwork\resize"/>
 			</Button>
-			<!--
 			<CheckButton name="$parentAutoBuyButton" hidden="false" inherits="UICheckButtonTemplate" text="">
                 <Size x="18" y="18" />
 				<Anchors>
@@ -232,7 +231,6 @@
 					</OnClick>
 				</Scripts>
 			</CheckButton>
-			-->
 		</Frames>

 		<Scripts>
diff --git a/CauldronUtil.lua b/CauldronUtil.lua
index 656bfa9..d631566 100644
--- a/CauldronUtil.lua
+++ b/CauldronUtil.lua
@@ -248,3 +248,13 @@ function Cauldron:SortTableIndices(t)
 	return a;
 end

+function Cauldron:GetAchievementsForSkill(skillInfo)
+
+	if not skillInfo then
+		return nil;
+	end
+
+	-- TODO
+
+	return nil;
+end