WoWInterface SVN zz_itemsdb

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 60 to Rev 61
    Reverse comparison

Rev 60 → Rev 61

zz_itemsdb/guildbank.lua
7,6 → 7,7
}
local GuildBankIsOpen = false
local failCount = 0
local lgbc
local function gbagLoop(id)
local res = {}
local dName = modulname.."Count"
49,16 → 50,13
end
local function scanGuildBank(tab)
local itemlist = {}
local empty = true
for slot = 1,14*7 do
for slot = 1,98 do
local texturePath, itemCount, locked, isFiltered = GetGuildBankItemInfo(tab,slot)
if(itemCount>0) then
emtpy = false
local itemLink = GetGuildBankItemLink(tab,slot)
if(itemLink) then
local id = addon:getItemId(itemLink)
if(id) then
empty = false
itemlist[id] = itemlist[id] or {}
itemlist[id]['count'] = itemlist[id]['count'] or 0
itemlist[id]['count'] = itemlist[id]['count'] + itemCount
77,7 → 75,7
return
end
failCount = 0
return empty and nil or itemlist
return count==0 and nil or itemlist
end
function events:GUILDBANKBAGSLOTS_CHANGED(event,...)
if(not addon.checkGID() or not GuildBankIsOpen) then return end
106,6 → 104,33
events[event](self, event, ...)
end
end
local function lgbc_scan(page)
local guildID = addon.getGID()
if(guildID and page) then
local itemlist = {}
for slot, link, stack in lgbc:IteratePage(page) do
local id = addon:getItemId(link)
if(id) then
empty = false
itemlist[id] = itemlist[id] or {}
itemlist[id]['count'] = itemlist[id]['count'] or 0
itemlist[id]['count'] = itemlist[id]['count'] + stack
addon:getName(id)
end
end
modul['db'][guildID][page] = itemlist
end
end
local function lgbc_scanAll()
for page = 1, lgbc:GetNumBankTabs() do
lgbc_scan(page)
end
end
function modul:OnPageSync(event, sender, page, guildName)
print(event, sender, page, guildName)
local guildID = addon.getGID()
lgbc_scan(page)
end
function modul:Delete(id, typ)
self['db'] = addon:GetNamespace(modul.name)
if(typ == self['typ'] and id and id>0) then
118,6 → 143,11
for event,func in pairs(events) do
list[#list+1] = event
end
lgbc = LibStub("LibGuildBankComm-1.0")
if(lgbc) then
print("reg cb")
lgbc.RegisterCallback(self,"GuildBankComm_PageUpdate", "OnPageSync")
end
self.frame = addon:RegisterFunc(list,"OnEvent",OnEvent)
end
function modul:Disable()
125,6 → 155,9
for event,func in pairs(events) do
self.frame:UnregisterEvent(event)
end
if(lgbc) then
lgbc.UnregisterCallback(self, "GuildBankComm_PageUpdate")
end
end
addon['inits'][#addon['inits']+1] = function()
modul.db,modul.status = addon:RegisterModul(modul, modulname)