Skip inactive modules for searches moved to moduls.lua
This commit is contained in:
parent
56008a83b0
commit
b4f403c23b
|
@ -46,8 +46,8 @@ local function scanAllBags(delayed)
|
|||
end
|
||||
end
|
||||
local function bagLoop(id, res)
|
||||
local units = child:GetNamespace('units')
|
||||
for k, v in pairs(modul['db']) do
|
||||
local units = child:GetNamespace('units')
|
||||
if(units[k]) then
|
||||
local playerID = child.getPID()
|
||||
if(playerID and units[k]['faction'] == units[playerID]['faction']) then
|
||||
|
@ -69,7 +69,6 @@ local function bagLoop(id, res)
|
|||
return res
|
||||
end
|
||||
function modul.Search(id, res)
|
||||
if(not module.status) then return res end
|
||||
local playerID = child.getPID()
|
||||
if(playerID) then
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
|
|
|
@ -147,7 +147,6 @@ local function OnEvent(self, event, ...)
|
|||
end
|
||||
end
|
||||
function modul.Search(id,res)
|
||||
if(not module.status) then return res end
|
||||
local playerID = child.getPID()
|
||||
if(playerID) then
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
|
|
|
@ -8,6 +8,7 @@ local modul = {
|
|||
['name'] = modulname
|
||||
}
|
||||
local db
|
||||
local desc = format('%sCount', modulname)
|
||||
local playerID = false
|
||||
function child:getPID()
|
||||
if(playerID) then
|
||||
|
@ -36,6 +37,10 @@ function child:getPID()
|
|||
}
|
||||
return playerID
|
||||
end
|
||||
function child:ResetPID()
|
||||
playerID = nil
|
||||
child:getPID()
|
||||
end
|
||||
local function scanChar()
|
||||
local itemlist = {}
|
||||
local empty = true
|
||||
|
@ -51,7 +56,6 @@ local function scanChar()
|
|||
return empty and nil or itemlist
|
||||
end
|
||||
local function bagLoop(id,res)
|
||||
local dName = modulname.."Count"
|
||||
for k,v in pairs(modul['db']) do
|
||||
local units = child:GetNamespace('units')
|
||||
if(units[k]) then
|
||||
|
@ -62,9 +66,9 @@ local function bagLoop(id,res)
|
|||
for a,b in pairs(list) do
|
||||
if(a == id) then
|
||||
res[unitname] = res[unitname] or {
|
||||
[dName] = 0
|
||||
[desc] = 0
|
||||
}
|
||||
res[unitname][dName] = (res[unitname][dName] or 0) + b['count']
|
||||
res[unitname][desc] = (res[unitname][desc] or 0) + b['count']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -74,7 +78,6 @@ local function bagLoop(id,res)
|
|||
return res
|
||||
end
|
||||
function modul.Search(id, res)
|
||||
if(not module.status) then return res end
|
||||
local playerID = child.getPID()
|
||||
if(playerID) then
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
|
@ -82,7 +85,6 @@ function modul.Search(id, res)
|
|||
return playerID and bagLoop(id,res) or res
|
||||
end
|
||||
function modul.Output(input,sum,b)
|
||||
local desc = modulname..'Count'
|
||||
if(b[desc] and b[desc]>0) then
|
||||
input[#input+1] = format("Equip %s",b[desc])
|
||||
sum = sum + b[desc]
|
||||
|
|
|
@ -72,7 +72,6 @@ local function gbagLoop(id)
|
|||
return res
|
||||
end
|
||||
function modul.Search2(id, res, mode)
|
||||
if(not module.status) then return res end
|
||||
local guildID = child.getGID()
|
||||
if(guildID) then
|
||||
modul['db'][guildID] = modul['db'][guildID] or {}
|
||||
|
|
|
@ -123,7 +123,6 @@ local function bagLoop(id, res)
|
|||
return res
|
||||
end
|
||||
function modul.Search(id, res)
|
||||
if(not module.status) then return res end
|
||||
local playerID = child.getPID()
|
||||
if(playerID) then
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
|
|
|
@ -67,7 +67,6 @@ local function bagLoop(id, res)
|
|||
return res
|
||||
end
|
||||
function modul.Search(id, res)
|
||||
if(not module.status) then return res end
|
||||
local playerID = child.getPID()
|
||||
if(playerID) then
|
||||
modul['db'][playerID] = modul['db'][playerID] or {}
|
||||
|
|
|
@ -46,8 +46,8 @@ function child:specialoutput(tooltip, id)
|
|||
end
|
||||
end
|
||||
function child:specialoutput2(id, res)
|
||||
for k,modul in pairs(moduls) do
|
||||
if(type(modul.Search2)=='function') then
|
||||
for k, modul in pairs(moduls) do
|
||||
if(type(modul.Search2) == 'function') then
|
||||
res = modul.Search2(id, res, true)
|
||||
end
|
||||
end
|
||||
|
@ -56,7 +56,7 @@ end
|
|||
function child:Search(id)
|
||||
local res = {}
|
||||
for _, modul in pairs(moduls) do
|
||||
if(type(modul.Search)=='function') then
|
||||
if(modul.status and type(modul.Search) == 'function') then
|
||||
res = modul.Search(id, res)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue