diff --git a/AuctionFaster.toc b/AuctionFaster.toc index 4e962fd..8a66f28 100644 --- a/AuctionFaster.toc +++ b/AuctionFaster.toc @@ -1,8 +1,8 @@ ## Title: AuctionFaster ## Notes: Super Fast AuctionHouse Addon -## Version: 1.13.8 +## Version: 1.13.9 ## Author: Kaminaris -## Interface: 11302 +## Interface: 11305 ## SavedVariables: AuctionFasterDb ## X-Curse-Project-ID: 292892 ## X-WoWI-ID: 24771 diff --git a/main.lua b/main.lua index b1c1899..2f8190a 100644 --- a/main.lua +++ b/main.lua @@ -23,33 +23,25 @@ function AuctionFaster:OnInitialize() self.db.auctionDb = {}; end - if self.db.enableToolTips then - self:EnableModule('Tooltip'); + if not self.db.enableToolTips then + local tooltips = self:GetModule('Tooltips'); + tooltips:Attach(); end -- These modules must be enabled on start, they handle events themselves - self:EnableModule('ItemCache'); - self:EnableModule('Inventory'); - self:EnableModule('Auctions'); - self:EnableModule('ChainBuy'); - self:EnableModule('Tutorial'); + --self:EnableModule('ItemCache'); + --self:EnableModule('Inventory'); + --self:EnableModule('Auctions'); + --self:EnableModule('ChainBuy'); + --self:EnableModule('Tutorial'); end function AuctionFaster:AUCTION_HOUSE_SHOW() if self.db.enabled then - self:EnableModule('Sell'); - self:EnableModule('Buy'); - if not self.onTabClickHooked then self:Hook('AuctionFrameTab_OnClick', true); self.onTabClickHooked = true; end - - if self.db.defaultTab == 'SELL' then - AuctionFrameTab_OnClick(self.auctionTabs[1].tabButton); - elseif self.db.defaultTab == 'BUY' then - AuctionFrameTab_OnClick(self.auctionTabs[2].tabButton); - end end end diff --git a/modules/tooltip.lua b/modules/tooltip.lua index 961d8d3..b0f667f 100644 --- a/modules/tooltip.lua +++ b/modules/tooltip.lua @@ -7,7 +7,7 @@ local ItemCache = AuctionFaster:GetModule('ItemCache'); local StdUi = LibStub('StdUi'); local L = LibStub('AceLocale-3.0'):GetLocale('AuctionFaster'); -function Tooltip:OnEnable() +function Tooltip:Attach() if not self:IsHooked(GameTooltip, 'OnTooltipSetItem') then self:HookScript(GameTooltip, 'OnTooltipSetItem', 'UpdateTooltip'); if BattlePetTooltipTemplate_SetBattlePet then @@ -22,7 +22,7 @@ function Tooltip:OnEnable() end end -function Tooltip:OnDisable() +function Tooltip:Detach() if self:IsHooked(GameTooltip, 'OnTooltipSetItem') then self:Unhook(GameTooltip, 'OnTooltipSetItem'); if BattlePetTooltipTemplate_SetBattlePet then diff --git a/tabs/buy/functions.lua b/tabs/buy/functions.lua index 1a93414..c93e723 100644 --- a/tabs/buy/functions.lua +++ b/tabs/buy/functions.lua @@ -19,8 +19,27 @@ local format = string.format; local TableInsert = tinsert; function Buy:OnEnable() - self:AddBuyAuctionHouseTab(); - self:InterceptLinkClick(); + self:RegisterEvent('AUCTION_HOUSE_SHOW'); + self:RegisterEvent('AUCTION_HOUSE_CLOSED'); +end + +Buy.initialized = false; +function Buy:AUCTION_HOUSE_SHOW() + if AuctionFaster.db.enabled then + if not self.initialized then + self:AddBuyAuctionHouseTab(); + self:InterceptLinkClick(); + self.initialized = true; + end + + if AuctionFaster.db.defaultTab == 'BUY' then + AuctionFrameTab_OnClick(self.auctionTabs[2].tabButton); + end + end +end + +function Buy:AUCTION_HOUSE_CLOSED() + self:UnregisterEvent('AUCTION_ITEM_LIST_UPDATE'); end function Buy:OnShow() @@ -39,10 +58,6 @@ function Buy:OnHide() self:UnregisterEvent('AUCTION_ITEM_LIST_UPDATE'); end -function Buy:OnDisable() - self:UnregisterEvent('AUCTION_ITEM_LIST_UPDATE'); -end - ---------------------------------------------------------------------------- --- Searching functions ---------------------------------------------------------------------------- diff --git a/tabs/sell/functions.lua b/tabs/sell/functions.lua index 950cb49..b3a212f 100644 --- a/tabs/sell/functions.lua +++ b/tabs/sell/functions.lua @@ -22,7 +22,22 @@ local Sell = AuctionFaster:GetModule('Sell'); local format = string.format; function Sell:OnEnable() - self:AddSellAuctionHouseTab(); + self:RegisterEvent('AUCTION_HOUSE_SHOW'); + self:RegisterEvent('AUCTION_HOUSE_CLOSED'); +end + +Sell.initialized = false; +function Sell:AUCTION_HOUSE_SHOW() + if AuctionFaster.db.enabled then + if not self.initialized then + self:AddSellAuctionHouseTab(); + self.initialized = true; + end + + if AuctionFaster.db.defaultTab == 'SELL' then + AuctionFrameTab_OnClick(self.auctionTabs[1].tabButton); + end + end end function Sell:OnShow() @@ -36,7 +51,7 @@ function Sell:OnHide() --self:UnregisterEvent('AUCTION_ITEM_LIST_UPDATE'); end -function Sell:OnDisable() +function Sell:AUCTION_HOUSE_CLOSED() self:OnHide(); end