Quantcast

Added a quest objective-like message popup when reagents and intermediate items are acquired.

pschifferer [11-05-09 - 23:44]
Added a quest objective-like message popup when reagents and intermediate items are acquired.
Filename
CauldronMain.lua
CauldronQueue.lua
Locale/Cauldron-enUS.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index f18ef17..8e2fba2 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -395,6 +395,17 @@ function Cauldron:OnBagUpdate(event, bagid)
 				-- the item is found in the intermediate list, so recalculate the queue
 				self:debug("OnBagUpdate: set recalc flag");
 				recalc = true;
+
+				local amount = math.min(itemCount, intItem.amount);
+				local str = string.format("%s: %s: %d/%d", L["Intermediate"], item, amount, intItem.amount);
+				UIErrorsFrame:AddMessage(str, 0.0, 0.9, 0.4, 86, 3);
+			else
+				local rItem = CauldronQueue:GetReagentItem(queue, item);
+				if rItem then
+					local amount = math.min(itemCount, rItem.amount);
+					local str = string.format("%s: %s: %d/%d", L["Reagent"], item, amount, rItem.amount);
+					UIErrorsFrame:AddMessage(str, 0.0, 0.9, 0.0, 86, 3);
+				end
 			end

 			-- adjust queue, but only if window is open
diff --git a/CauldronQueue.lua b/CauldronQueue.lua
index c0000fd..0520793 100644
--- a/CauldronQueue.lua
+++ b/CauldronQueue.lua
@@ -493,3 +493,14 @@ function CauldronQueue:GetIntermediateItem(queue, itemName)

 	return queue.intermediate[itemName];
 end
+
+function CauldronQueue:GetReagentItem(queue, itemName)
+
+	-- sanity checks
+	if not queue then
+		Cauldron:error("GetReagentItem: No queue found!");
+		return nil;
+	end
+
+	return queue.reagents[itemName];
+end
diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index a8c6ab5..f44c8e3 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -57,6 +57,7 @@ L["Name"] = true
 L["Search for name"] = true
 L["Reagent"] = true
 L["Search for reagents"] = true
+L["Intermediate"] = true

 L["Sort"] = true
 L["Default"] = true