Cleanup code
This commit is contained in:
parent
07687e1b03
commit
ec7cffd606
|
@ -17,8 +17,8 @@ local function scanVoid()
|
|||
if(playerID) then
|
||||
local itemlist = {}
|
||||
local empty = true
|
||||
for tab=1,2 do
|
||||
for slot=1,80 do
|
||||
for tab = 1, 2 do
|
||||
for slot = 1, 80 do
|
||||
local id, icon = GetVoidItemInfo(tab, slot)
|
||||
if(id) then
|
||||
id = tonumber(id)
|
||||
|
@ -31,10 +31,10 @@ local function scanVoid()
|
|||
end
|
||||
end
|
||||
local count = 0
|
||||
for k,v in pairs(itemlist) do
|
||||
for k, v in pairs(itemlist) do
|
||||
count = count + 1
|
||||
end
|
||||
if(count==0 and failCount<3) then
|
||||
if(count == 0 and failCount < 3) then
|
||||
C_Timer.After(.2, scanVoid)
|
||||
failCount = failCount + 1
|
||||
return
|
||||
|
@ -43,7 +43,6 @@ local function scanVoid()
|
|||
modul['db'][playerID][0] = itemlist
|
||||
end
|
||||
end
|
||||
|
||||
local function bagLoop(id, res)
|
||||
for k, v in pairs(modul['db']) do
|
||||
local units = child:GetNamespace('units')
|
||||
|
@ -71,14 +70,14 @@ function modul.Search(id, res)
|
|||
if(playerID) then
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
end
|
||||
return playerID and bagLoop(id,res) or res
|
||||
return playerID and bagLoop(id, res) or res
|
||||
end
|
||||
function modul.Output(input, sum, b)
|
||||
if(b[dName] and b[dName]>0) then
|
||||
input[#input+1] = format("Void %s",b[dName])
|
||||
input[#input + 1] = format("Void %s", b[dName])
|
||||
sum = sum + b[dName]
|
||||
end
|
||||
return input,sum
|
||||
return input, sum
|
||||
end
|
||||
function events:VOID_STORAGE_CLOSE()
|
||||
voidOpen = false
|
||||
|
@ -93,7 +92,6 @@ events.ITEM_UNLOCKED = scanVoid
|
|||
events.VOID_TRANSFER_DONE = scanVoid
|
||||
local function OnEvent(self, event, ...)
|
||||
local playerID = child.getPID()
|
||||
-- print(modulname, event, ...)
|
||||
if(playerID and type(events[event])=='function') then
|
||||
modul['db'] = child:GetNamespace(modul.name)
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
|
@ -109,7 +107,7 @@ end
|
|||
function modul:Enable()
|
||||
self['status'] = true
|
||||
local list = {}
|
||||
for event,func in pairs(events) do
|
||||
for event, func in pairs(events) do
|
||||
list[#list+1] = event
|
||||
end
|
||||
for i = 1, #list do
|
||||
|
@ -128,7 +126,7 @@ child:IgnoreBCC(modulname)
|
|||
local init = {
|
||||
Setup = function(self)
|
||||
db = child['db']
|
||||
modul.db,modul.status = child:RegisterModul(modul, modulname)
|
||||
modul.db, modul.status = child:RegisterModul(modul, modulname)
|
||||
if(modul.status) then
|
||||
modul:Enable()
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue