From fee51f0cae09e5bb49c862e773582490f2bfd62b Mon Sep 17 00:00:00 2001 From: pschifferer Date: Thu, 19 Feb 2009 17:47:31 +0000 Subject: [PATCH] Added the ability to shift-click on queue reagent items to replace their quantity in the shopping list instead of adding. Added a "restore defaults" item to the filter drop down. Added the ability to shift-click on an item name (not icon) in the skill list to link the recipe instead of the item. Caused the shopping list to update when acquiring items. --- CauldronMain.lua | 21 ++++++++++++++++----- CauldronMain.xml | 14 +++++++++----- CauldronMainUI.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ CauldronShoppingList.lua | 6 +++--- Locale/Cauldron-enUS.lua | 3 +++ 5 files changed, 75 insertions(+), 13 deletions(-) diff --git a/CauldronMain.lua b/CauldronMain.lua index 4845c99..9556efb 100644 --- a/CauldronMain.lua +++ b/CauldronMain.lua @@ -123,6 +123,7 @@ function Cauldron:OnEnable() --@end-alpha@ self:InitPlayer(); + self:RegisterEvent("TRADE_SKILL_SHOW", "OnTradeShow"); self:RegisterEvent("TRADE_SKILL_UPDATE", "OnSkillUpdate"); self:RegisterEvent("TRADE_SKILL_CLOSE", "OnTradeClose"); @@ -147,6 +148,7 @@ function Cauldron:OnEnable() self:RegisterEvent("CRAFT_CLOSE", "OnCraftClose"); -- self:RegisterEvent("PLAYER_LOGOUT"); self:RegisterEvent("UI_ERROR_MESSAGE", "OnError"); + self:HookTooltips(); --@alpha@ @@ -303,18 +305,24 @@ function Cauldron:OnBagUpdate(event, bagid) return; end - -- check if the item acquired is in the intermediate list + -- check if the item acquired is in the intermediate list or shopping list local items = Cauldron:GetItemDeltas(bagid); + local recalc = false; for item, itemCount in pairs(items) do if itemCount > 0 then + -- adjust shopping list + CauldronShopping:RemoveFromList(self.db.realm.shopping, self.vars.playername, item, itemCount); + + -- adjust intermediate list local queue = self.db.realm.userdata[self.vars.playername].queue; local intItem = CauldronQueue:GetIntermediateItem(queue, item); - if intItem then + if intItem and (not recalc) then -- the item is found in the intermediate list, so recalculate the queue CauldronQueue:CalculateAllRequiredItems(queue); Cauldron:UpdateQueue(); - - return; + + recalc = true; +-- return; end end end @@ -663,7 +671,10 @@ function Cauldron:GetQueue(player) return queue; end -function Cauldron:AddItemToShoppingList(itemName, amount) +function Cauldron:AddItemToShoppingList(itemName, amount, replace) + if replace then + CauldronShopping:RemoveFromList(self.db.realm.shopping, self.vars.playername, itemName); + end CauldronShopping:AddToList(self.db.realm.shopping, self.vars.playername, itemName, amount); Cauldron:ShowShoppingList(); end diff --git a/CauldronMain.xml b/CauldronMain.xml index 6fb5708..bfa0cbc 100644 --- a/CauldronMain.xml +++ b/CauldronMain.xml @@ -107,7 +107,7 @@ -- self.hasItem = 1; - HandleModifiedItemClick(GetTradeSkillItemLink(self.skillIndex)); + HandleModifiedItemClick(self.itemLink); Cauldron:SkillItem_OnClick(self, button, down); @@ -145,7 +145,7 @@ -