From a92ffd977982bc7a1f35db41c2b0e9cc18514040 Mon Sep 17 00:00:00 2001 From: pschifferer Date: Fri, 30 Oct 2009 02:29:26 +0000 Subject: [PATCH] Added merchant close callback to close the shopping list when the merchant window closes, only if the shopping list is empty. Added a check on merchant open to only open the shopping list (and subsequently execute auto-buy) if there are items in the list. --- CauldronMain.lua | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/CauldronMain.lua b/CauldronMain.lua index 1687d82..f3e6673 100644 --- a/CauldronMain.lua +++ b/CauldronMain.lua @@ -193,7 +193,7 @@ function Cauldron:OnEnable() -- self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED"); self:RegisterEvent("MERCHANT_SHOW", "OnMerchantShow"); -- self:RegisterEvent("MERCHANT_UPDATE"); --- self:RegisterEvent("MERCHANT_CLOSED"); + self:RegisterEvent("MERCHANT_CLOSED", "OnMerchantClose"); self:RegisterEvent("BAG_UPDATE", "OnBagUpdate"); -- self:RegisterEvent("TRAINER_CLOSED"); -- self:RegisterEvent("PLAYER_REGEN_DISABLED"); @@ -477,10 +477,13 @@ function Cauldron:OnMerchantShow() self:debug("OnMerchantShow enter"); --@end-alpha@ - Cauldron:ShowShoppingList(); - - if Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy then - CauldronShopping:AutoBuyShoppingItems(Cauldron.db.realm.shopping, Cauldron.vars.playername); + -- check if there's anything in the shopping list + if CauldronShopping:ContainsItems(Cauldron.db.realm.shopping) then + Cauldron:ShowShoppingList(); + + if Cauldron.db.realm.userdata[Cauldron.vars.playername].options.autoBuy then + CauldronShopping:AutoBuyShoppingItems(Cauldron.db.realm.shopping, Cauldron.vars.playername); + end end --@alpha@ @@ -488,6 +491,20 @@ function Cauldron:OnMerchantShow() --@end-alpha@ end +function Cauldron:OnMerchantClose() +--@alpha@ + self:debug("OnMerchantClose enter"); +--@end-alpha@ + + if not CauldronShopping:ContainsItems(Cauldron.db.realm.shopping) then + Cauldron:HideShoppingList(); + end + +--@alpha@ + self:debug("OnMerchantClose exit"); +--@end-alpha@ +end + function Cauldron:OnBankOpened() --@alpha@ self:debug("OnBankOpened enter"); -- 1.7.9.5