Mercurial > wow > buffalo2
diff Modules/Currency.lua @ 133:86621c60512b v7.3.2-20171222
- Fixed AP calc tooltip appearing while hidden
- Fixed PaperDoll relic tooltips missing nether crucible info
author | Nenue |
---|---|
date | Fri, 22 Dec 2017 20:36:40 -0500 |
parents | 15a7f27b11e6 |
children | 414e37af1b1b |
line wrap: on
line diff
--- a/Modules/Currency.lua Mon Nov 20 12:02:18 2017 -0500 +++ b/Modules/Currency.lua Fri Dec 22 20:36:40 2017 -0500 @@ -14,14 +14,10 @@ local currencyBlock = {} -local zoneEvents = { - "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED" -} -local currencyEvents = { - 'CURRENCY_DISPLAY_UPDATE', 'CHAT_MSG_CURRENCY' -} -local itemEvents = { - 'CHAT_MSG_LOOT', 'BAG_UPDATE' +local events = { + 'CHAT_MSG_LOOT', + "ZONE_CHANGED_NEW_AREA", "ZONE_CHANGED_INDOORS", "ZONE_CHANGED", + 'BAG_UPDATE', 'CURRENCY_DISPLAY_UPDATE', 'CHAT_MSG_CURRENCY', } local blocks = { @@ -87,6 +83,11 @@ function module:OnLoad () Veneer:AddHandler(self) + for _, event in ipairs(events) do + self:RegisterEvent(event) + end + + for name, info in pairs(blocks) do local block = CreateFrame('Frame', nil, self, 'VeneerCurrencyTemplate') block.name = name @@ -100,6 +101,8 @@ end block.id = info.itemID or info.currencyID + block:SetScript('OnEnter', itemBlock.OnEnter or block.OnEnter) + block:SetScript('OnLeave', itemBlock.OnLeave or block.OnLeave) if info.itemID then local itemID = info.itemID @@ -108,17 +111,14 @@ frame = block } block.Update = itemBlock.Update - RegisterEvents(block, itemEvents) elseif info.currencyID then local currencyID = info.currencyID block.Update = currencyBlock.Update - RegisterEvents(self, currencyEvents) end if info.zones then - RegisterEvents(self, zoneEvents) local zones = info.zones local of = block.Update function block:Update() @@ -157,7 +157,6 @@ end local canShow = false - if BagBrother then for i, bag in pairs(BagBrother.Player) do if type(bag) == 'table' then @@ -193,6 +192,7 @@ local itemID = GetContainerItemID(i, j) local texture, count = GetContainerItemInfo(i,j) if items[itemID] then + items[itemID].count = items[itemID].count + (count or 1) if not items[itemID].texture then items[itemID].texture = texture @@ -278,13 +278,6 @@ end end -function block:OnEvent(event, ...) - self.debug('OnEvent', event, ...) - self:Update() -end - -function block:Setup() -end function itemBlock:Update() if items[self.itemID].count >= 1 then