annotate Modules/Bank.lua @ 131:15a7f27b11e6 v7.3.2-20111027

- Fixed an infinite loop occurring with Artifact XP calculations on fresh 110 toons - Fixed combat state response - Mask out redundant cheevos (Cutting Edge/AotC and end boss)
author Nenue
date Mon, 20 Nov 2017 12:01:52 -0500
parents 799ec6dce9c3
children
rev   line source
Nenue@125 1 --
Nenue@125 2 -- Background data gathering for things that are only available from set places
Nenue@125 3
Nenue@125 4
Nenue@125 5 local print = DEVIAN_WORKSPACE and function(...) print('Bank', ...) end or nop
Nenue@125 6 local profileUpdate, needsUpdate
Nenue@125 7 VeneerBankDBMixin = {}
Nenue@125 8 local m = VeneerBankDBMixin
Nenue@125 9
Nenue@125 10 function m:Setup()
Nenue@128 11
Nenue@128 12
Nenue@125 13 self:RegisterEvent('BANKFRAME_OPENED')
Nenue@125 14 self:RegisterEvent('BANKFRAME_CLOSED')
Nenue@125 15
Nenue@125 16 self:SetPoint('CENTER', UIParent, 'CENTER')
Nenue@125 17 self:SetSize(100,100)
Nenue@125 18 m.Info:SetPoint('CENTER', self, 'CENTER')
Nenue@125 19
Nenue@125 20 print('Setup()')
Nenue@125 21
Nenue@125 22
Nenue@125 23 self.Info:SetFontObject(GameFontNormal)
Nenue@125 24 self.Info:SetText('Setup')
Nenue@125 25
Nenue@125 26 for k,v in pairs(self) do
Nenue@125 27 print(k,v)
Nenue@125 28 end
Nenue@125 29 end
Nenue@125 30
Nenue@128 31 local itemsByID = {}
Nenue@128 32 local itemsBySlot = {}
Nenue@128 33 local bankslots = {-1}
Nenue@125 34 function m:OnEvent(event)
Nenue@125 35 print('OnEvent', event)
Nenue@128 36
Nenue@128 37 for i = 1, NUM_BANKBAGSLOTS do
Nenue@128 38 if not tContains(bankslots, i) then
Nenue@128 39 tinsert(bankslots, i)
Nenue@128 40 end
Nenue@128 41 end
Nenue@128 42
Nenue@128 43 for _, container in pairs(bankslots) do
Nenue@128 44 for slot = 1, GetContainerNumSlots(container) do
Nenue@128 45 local item = GetContainerItemID()
Nenue@128 46
Nenue@128 47 local itemID = GetContainerItemID(container, slot)
Nenue@128 48 local texture, count, locked, quality, lootable, link = GetContainerItemInfo(container, slot)
Nenue@128 49 if itemsByID[itemID] then
Nenue@128 50 itemsByID[itemID].count = itemsByID[itemID].count + (count or 1)
Nenue@128 51 if not itemsByID[itemID].texture then
Nenue@128 52 itemsByID[itemID].texture = texture
Nenue@128 53 print('tracked currency tally', itemsByID[itemID].count, '|T'..texture..':16:16|t')
Nenue@128 54 itemsByID[itemID].frame.Icon:SetTexture(texture)
Nenue@128 55 end
Nenue@128 56 end
Nenue@128 57
Nenue@128 58 itemsBySlot[container] = itemsBySlot[container] or {}
Nenue@128 59 itemsBySlot[container][slot] = itemsBySlot[container][slot] or {}
Nenue@128 60 itemsBySlot[container][slot].texture = texture
Nenue@128 61 itemsBySlot[container][slot].count = count
Nenue@128 62 itemsBySlot[container][slot].quality = quality
Nenue@128 63 itemsBySlot[container][slot].lootable = lootable
Nenue@128 64 itemsBySlot[container][slot].link = link
Nenue@128 65
Nenue@128 66 end
Nenue@128 67
Nenue@128 68 end
Nenue@125 69 end
Nenue@125 70
Nenue@125 71
Nenue@125 72
Nenue@125 73