Nenue@125: -- Nenue@125: -- Background data gathering for things that are only available from set places Nenue@125: Nenue@125: Nenue@125: local print = DEVIAN_WORKSPACE and function(...) print('Bank', ...) end or nop Nenue@125: local profileUpdate, needsUpdate Nenue@125: VeneerBankDBMixin = {} Nenue@125: local m = VeneerBankDBMixin Nenue@125: Nenue@125: function m:Setup() Nenue@128: Nenue@128: Nenue@125: self:RegisterEvent('BANKFRAME_OPENED') Nenue@125: self:RegisterEvent('BANKFRAME_CLOSED') Nenue@125: Nenue@125: self:SetPoint('CENTER', UIParent, 'CENTER') Nenue@125: self:SetSize(100,100) Nenue@125: m.Info:SetPoint('CENTER', self, 'CENTER') Nenue@125: Nenue@125: print('Setup()') Nenue@125: Nenue@125: Nenue@125: self.Info:SetFontObject(GameFontNormal) Nenue@125: self.Info:SetText('Setup') Nenue@125: Nenue@125: for k,v in pairs(self) do Nenue@125: print(k,v) Nenue@125: end Nenue@125: end Nenue@125: Nenue@128: local itemsByID = {} Nenue@128: local itemsBySlot = {} Nenue@128: local bankslots = {-1} Nenue@125: function m:OnEvent(event) Nenue@125: print('OnEvent', event) Nenue@128: Nenue@128: for i = 1, NUM_BANKBAGSLOTS do Nenue@128: if not tContains(bankslots, i) then Nenue@128: tinsert(bankslots, i) Nenue@128: end Nenue@128: end Nenue@128: Nenue@128: for _, container in pairs(bankslots) do Nenue@128: for slot = 1, GetContainerNumSlots(container) do Nenue@128: local item = GetContainerItemID() Nenue@128: Nenue@128: local itemID = GetContainerItemID(container, slot) Nenue@128: local texture, count, locked, quality, lootable, link = GetContainerItemInfo(container, slot) Nenue@128: if itemsByID[itemID] then Nenue@128: itemsByID[itemID].count = itemsByID[itemID].count + (count or 1) Nenue@128: if not itemsByID[itemID].texture then Nenue@128: itemsByID[itemID].texture = texture Nenue@128: print('tracked currency tally', itemsByID[itemID].count, '|T'..texture..':16:16|t') Nenue@128: itemsByID[itemID].frame.Icon:SetTexture(texture) Nenue@128: end Nenue@128: end Nenue@128: Nenue@128: itemsBySlot[container] = itemsBySlot[container] or {} Nenue@128: itemsBySlot[container][slot] = itemsBySlot[container][slot] or {} Nenue@128: itemsBySlot[container][slot].texture = texture Nenue@128: itemsBySlot[container][slot].count = count Nenue@128: itemsBySlot[container][slot].quality = quality Nenue@128: itemsBySlot[container][slot].lootable = lootable Nenue@128: itemsBySlot[container][slot].link = link Nenue@128: Nenue@128: end Nenue@128: Nenue@128: end Nenue@125: end Nenue@125: Nenue@125: Nenue@125: Nenue@125: