Quantcast

Added the version number to the frame's title bar.

pschifferer [02-28-09 - 15:36]
Added the version number to the frame's title bar.
Made the shopping list auto-update when items are added to the queue.
Fixed an issue with the shopping list not updating when items are acquired.
Filename
CauldronMain.lua
CauldronMain.xml
CauldronMainUI.lua
Locale/Cauldron-enUS.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 976df4e..297c91d 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -139,7 +139,7 @@ function Cauldron:OnEnable()
 --	self:RegisterEvent("BANKFRAME_CLOSED");
 --	self:RegisterEvent("PLAYERBANKSLOTS_CHANGED");
 --	self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED");
---	self:RegisterEvent("MERCHANT_SHOW");
+	self:RegisterEvent("MERCHANT_SHOW", "OnMerchantShow");
 --	self:RegisterEvent("MERCHANT_UPDATE");
 --	self:RegisterEvent("MERCHANT_CLOSED");
 	self:RegisterEvent("BAG_UPDATE", "OnBagUpdate");
@@ -305,9 +305,9 @@ function Cauldron:OnBagUpdate(event, bagid)
 	self:debug("OnBagUpdate enter");
 --@end-alpha@

-	if (not CauldronFrame) or (not CauldronFrame:IsShown()) then
-		return;
-	end
+--	if (not CauldronFrame) or (not CauldronFrame:IsShown()) then
+--		return;
+--	end

 	-- check if the item acquired is in the intermediate list or shopping list
 	local items = Cauldron:GetItemDeltas(bagid);
@@ -396,6 +396,18 @@ function Cauldron:OnCraftClose()
 --@end-alpha@
 end

+function Cauldron:OnMerchantShow()
+--@alpha@
+	self:debug("OnMerchantShow enter");
+--@end-alpha@
+
+--	TODO
+
+--@alpha@
+	self:debug("OnMerchantShow exit");
+--@end-alpha@
+end
+
 function Cauldron:OnError()
 --@alpha@
 	self:debug("OnError enter");
@@ -472,6 +484,9 @@ function Cauldron:QueueAllTradeSkillItem()
 			CauldronQueue:AddItem(self.db.realm.userdata[self.vars.playername].queue, skillInfo, queueAmount);

 			Cauldron:UpdateQueue();
+
+			-- update the shopping list
+			Cauldron:UpdateShoppingListFromQueue();
 		else
 			-- self:info("No amount to queue for "..skillInfo.name..".");
 		end
@@ -495,6 +510,11 @@ function Cauldron:QueueTradeSkillItem()
 			amount = 1;
 		end
 		CauldronQueue:AddItem(self.db.realm.userdata[self.vars.playername].queue, skillInfo, amount);
+
+		Cauldron:UpdateQueue();
+
+		-- update the shopping list
+		Cauldron:UpdateShoppingListFromQueue();
 	end

 --@alpha@
@@ -715,6 +735,15 @@ function Cauldron:RemoveShoppingListItem(requestor, itemName)
 --	end
 end

+function Cauldron:UpdateShoppingListFromQueue()
+	local items = CauldronQueue:GetReagents(self.db.realm.userdata[self.vars.playername].queue);
+	if items then
+		for i,item in ipairs(items) do
+			Cauldron:AddItemToShoppingList(item.name, item.amount, true);
+		end
+	end
+end
+
 function Cauldron:LocaleString(str)
 	return L[str];
 end
@@ -748,10 +777,6 @@ function Cauldron:HookTooltips()
 --@end-alpha@
 end

-----------------------------------------------------------------------
--- Tooltip hook functions
-----------------------------------------------------------------------
-
 function Cauldron:SetTradeSkillItem(tooltip, itemIndex, reagentIndex)
 	local link;
 	local name;
diff --git a/CauldronMain.xml b/CauldronMain.xml
index 3c94dc8..68f8d2c 100644
--- a/CauldronMain.xml
+++ b/CauldronMain.xml
@@ -1162,9 +1162,20 @@
                             <OnLoad>
                                 getglobal(self:GetName()):Disable();
                             </OnLoad>
+							<OnEnter>
+								GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT");
+								GameTooltip:ClearLines();
+								GameTooltip:AddLine(Cauldron:LocaleString("Click to queue the listed amount of this item"));
+								GameTooltip:AddLine(Cauldron:LocaleString("Shift-click to queue the listed potential amount of this item"));
+								GameTooltip:Show();
+								CursorUpdate(self);
+							</OnEnter>
+							<OnLeave>
+								GameTooltip:Hide();
+								ResetCursor();
+							</OnLeave>
                             <OnClick>
                             	Cauldron:QueueAllTradeSkillItem();
-								Cauldron:UpdateQueue();
                             	Cauldron:UpdateButtons();
                             </OnClick>
                         </Scripts>
@@ -1316,7 +1327,6 @@
                             </OnLoad>
 							<OnClick>
 								Cauldron:QueueTradeSkillItem();
-								Cauldron:UpdateQueue();
                             	Cauldron:UpdateButtons();
 							</OnClick>
                         </Scripts>
@@ -1386,6 +1396,7 @@
                 self:SetBackdropColor(.05,.05,.05,.8);
                 self:SetBackdropBorderColor(.4,.4,.4,1);
                 tinsert(UISpecialFrames, self:GetName());
+                CauldronFrameTitleText:SetText(Cauldron:LocaleString("Cauldron").." v"..Cauldron.version);
             </OnLoad>
             <OnShow>
                 PlaySound("igCharacterInfoOpen");
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index c967d13..d880aef 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -544,7 +544,7 @@ function Cauldron:UpdateQueue()
 	self:debug("UpdateQueue enter");
 --@end-alpha@

-	if not CauldronFrame:IsShown() then
+	if (not CauldronFrame) or (not CauldronFrame:IsShown()) then
 		return;
 	end

diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index 7dcaa09..be19c91 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -107,6 +107,9 @@ L["Remove this item from the shopping list"] = true

 L["Available at vendor"] = true

+L["Click to queue the listed amount of this item"] = true
+L["Shift-click to queue the listed potential amount of this item"] = true
+
 -- error messages
 L["Crafting %1$s requires the %2$s skill."] = true