Mercurial > wow > buffalo2
diff Modules/Currency.lua @ 126:3de635cda288 v7.3.17102017
- zone checking fix; moveed code into the zone-context pre-hook
author | Nenue |
---|---|
date | Tue, 17 Oct 2017 17:00:10 -0400 |
parents | 3f4794dca91b |
children | 799ec6dce9c3 |
line wrap: on
line diff
--- a/Modules/Currency.lua Sun Oct 15 16:47:22 2017 -0400 +++ b/Modules/Currency.lua Tue Oct 17 17:00:10 2017 -0400 @@ -122,7 +122,10 @@ local zones = info.zones local of = block.Update function block:Update(zone, subZone) - block.debug('Update [Zone]', zone, subZone) + + local zone = GetRealZoneText() + local subZone = GetSubZoneText() + block.debug('Zone Check', zone, subZone) local canShow = ((zone and self.zones[zone]) or (subZone and self.zones[subZone])) and true or false if of then canShow = canShow and of(self) @@ -135,10 +138,8 @@ function module:OnEvent (event, arg) print(self:GetName(), 'OnEvent', event, arg) - self:Update() end -local toUpdate = {} -local wipe = table.wipe + function module:Update(isBatchUpdate) print(self:GetName(), 'Update()') if InCombatLockdown() then @@ -150,8 +151,7 @@ for itemID in pairs(items) do items[itemID].count = 0 end - self.realZoneText = GetRealZoneText() - self.subZoneText = GetSubZoneText() + local canShow = false for i = 0, NUM_BAG_SLOTS do @@ -193,7 +193,7 @@ block:SetWidth(block.Icon:GetWidth() + block.Label:GetStringWidth()+4) totalWidth = totalWidth + block:GetWidth() end - print(block:IsShown(), '|cFF0088FF'..block.name..'|r', block:GetSize()) + print('|cFF0088FF'..block.name..'|r', block:IsShown(), block:GetSize()) end self:UpdateProfile() @@ -244,16 +244,14 @@ end function block:OnEvent(event, ...) - print('|cFF0088FF<'..self.name..'>|r', 'OnEvent', event, ...) - - self:Update(GetRealZoneText(), GetSubZoneText()) + self.debug('OnEvent', event, ...) + self:Update() end function block:Setup() +end -end -function itemBlock:Update(zone, subZone) - self.debug('Update [Item]', zone, subZone) +function itemBlock:Update() if items[self.itemID].count >= 1 then self.Icon:SetTexture(GetItemIcon(self.id)) self.Label:SetFormattedText("%d", items[self.id].count) @@ -262,8 +260,7 @@ return false end -function currencyBlock:Update(zone, subZone) - self.debug('Update [Currency]', zone, subZone) +function currencyBlock:Update() local name, earned, texture, earnedThisWeek, weeklyMax, totalMax = GetCurrencyInfo(self.id) self.Icon:SetTexture(texture) @@ -272,7 +269,5 @@ else self.Label:SetFormattedText("%d", earned) end - - --self:SetWidth(self.Icon:GetWidth() + self.Label:GetStringWidth() + 6) return true end \ No newline at end of file