Quantcast

Added an increment button to main items in the queue.

pschifferer [11-06-09 - 22:41]
Added an increment button to main items in the queue.
Modified the sorting logic for intermediate items so that items that can be made now are moved to the top of the list.
Filename
CauldronMain.lua
CauldronMain.xml
CauldronMainUI.lua
CauldronQueue.lua
Locale/Cauldron-enUS.lua
diff --git a/CauldronMain.lua b/CauldronMain.lua
index 7830967..3973fcb 100644
--- a/CauldronMain.lua
+++ b/CauldronMain.lua
@@ -896,6 +896,10 @@ function Cauldron:DecreaseItemCount(name)
 	CauldronQueue:AdjustItemCount(Cauldron:GetQueue(), name, -1);
 end

+function Cauldron:IncreaseItemCount(name)
+	CauldronQueue:AdjustItemCount(Cauldron:GetQueue(), name, 1);
+end
+
 function Cauldron:GetQueue(player)
 --@alpha@
 	self:debug("GetQueue enter");
diff --git a/CauldronMain.xml b/CauldronMain.xml
index 5809d55..c6e3ee0 100644
--- a/CauldronMain.xml
+++ b/CauldronMain.xml
@@ -427,6 +427,43 @@
 				<DisabledTexture file="Interface\Buttons\UI-PlusButton-Disabled" />
 				<HighlightTexture file="Interface\Buttons\UI-PlusButton-Hilight" alphaMode="ADD" />
             </Button>
+			<Button name="$parentIncrementCount" hidden="true" inherits="ClassTrainerSkillButtonTemplate">
+				<Size x="23" y="22" />
+                <Anchors>
+                    <Anchor point="TOPRIGHT">
+                        <Offset x="-32" y="-2"/>
+                    </Anchor>
+                </Anchors>
+				<Scripts>
+					<OnLoad>
+						self:RegisterForClicks("AnyUp");
+					</OnLoad>
+                	<OnEnter>
+                		self:GetParent().inHoverButtons = true;
+
+						GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
+						GameTooltip:ClearLines();
+						GameTooltip:AddLine(Cauldron:LocaleString("Increase the amount of this item"));
+						GameTooltip:Show();
+						CursorUpdate(self);
+                	</OnEnter>
+                	<OnLeave>
+                		self:GetParent().inHoverButtons = false;
+
+                		GameTooltip:Hide();
+                		ResetCursor();
+                	</OnLeave>
+					<OnClick>
+						Cauldron:IncreaseItemCount(self:GetParent().itemName);
+						Cauldron:UpdateQueue();
+                    	Cauldron:UpdateButtons();
+					</OnClick>
+				</Scripts>
+				<NormalTexture file="Interface\Buttons\UI-PlusButton-Up" />
+				<PushedTexture file="Interface\Buttons\UI-PlusButton-Down" />
+				<DisabledTexture file="Interface\Buttons\UI-PlusButton-Disabled" />
+				<HighlightTexture file="Interface\Buttons\UI-PlusButton-Hilight" alphaMode="ADD" />
+			</Button>
 			<Button name="$parentDecrementCount" hidden="true" inherits="ClassTrainerSkillButtonTemplate">
 				<Size x="23" y="22" />
                 <Anchors>
@@ -553,6 +590,7 @@
     				_G[self:GetName().."DecreasePriority"]:Show();
     				_G[self:GetName().."IncreasePriority"]:Show();
     				_G[self:GetName().."DecrementCount"]:Show();
+    				_G[self:GetName().."IncrementCount"]:Show();
     			end
     			if self.shoppable then
     				_G[self:GetName().."AddToShoppingList"]:Show();
@@ -564,6 +602,7 @@
     				_G[self:GetName().."DecreasePriority"]:Hide();
     				_G[self:GetName().."IncreasePriority"]:Hide();
     				_G[self:GetName().."DecrementCount"]:Hide();
+    				_G[self:GetName().."IncrementCount"]:Hide();
     				_G[self:GetName().."AddToShoppingList"]:Hide();
 				end
     		</OnLeave>
diff --git a/CauldronMainUI.lua b/CauldronMainUI.lua
index 99e6dd4..d399cae 100644
--- a/CauldronMainUI.lua
+++ b/CauldronMainUI.lua
@@ -882,11 +882,12 @@ function Cauldron:UpdateQueue()
 			-- set name and difficulty color
 			frame = _G["CauldronQueueIntItem"..i.."ItemName"];
 			local nameText = queueInfo.name;
-			if skillInfo and (skillInfo.available > 0) then
-				nameText = nameText.." ["..skillInfo.available.."]";
-			end
-			frame:SetText(nameText);
 			if skillInfo then
+				if (skillInfo.available > 0) then
+					nameText = nameText.." ["..skillInfo.available.."]";
+				end
+				frame:SetText(nameText);
+
 				local color = TradeSkillTypeColor[skillInfo.difficulty];
 				if color then
 					frame:SetFontObject(color.font);
diff --git a/CauldronQueue.lua b/CauldronQueue.lua
index 0520793..8059500 100644
--- a/CauldronQueue.lua
+++ b/CauldronQueue.lua
@@ -102,7 +102,13 @@ function CauldronQueue:GetIntermediates(queue)
 --				table.insert(items, item);
 --			end
 --		else
-			table.insert(items, item);
+			local t = CopyTable(item);
+			local skillInfo = Cauldron:GetSkillInfo(t.tradeskill, t.name);
+			if skillInfo and (skillInfo.available > 0) then
+				-- increase the priority of items that can be crafted, so that they appear at the top of the list
+				t.priority = t.priority + 1000;
+			end
+			table.insert(items, t);
 --		end
 	end

diff --git a/Locale/Cauldron-enUS.lua b/Locale/Cauldron-enUS.lua
index f44c8e3..773434a 100644
--- a/Locale/Cauldron-enUS.lua
+++ b/Locale/Cauldron-enUS.lua
@@ -123,7 +123,7 @@ L["Shift-click to move to the bottom of the queue"] = true
 L["Add this item to the shopping list"] = true
 L["Shift-click will replace the count in the shopping list with this amount"] = true
 L["Decrease the amount of this item"] = true
-
+L["Increase the amount of this item"] = true
 L["Remove this item from the shopping list"] = true

 L["Available at vendor"] = true