Use global db space instead of profile.
This commit is contained in:
parent
2dbe9e00df
commit
f54ba6963b
1 changed files with 31 additions and 23 deletions
|
@ -11,7 +11,6 @@ local defaults = {
|
|||
profile = {
|
||||
valorPoints = {},
|
||||
lockouts = {},
|
||||
updated = {},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +21,8 @@ end
|
|||
function core:OnEnable()
|
||||
local name = UnitName('player')
|
||||
|
||||
if self.db.profile.lockouts[name] == nil then
|
||||
self.db.profile.lockouts[name] = {}
|
||||
if self.db.global.lockouts[name] == nil then
|
||||
self.db.global.lockouts[name] = {}
|
||||
end
|
||||
|
||||
self:RegisterChatCommand('ct','ViewChores');
|
||||
|
@ -31,13 +30,13 @@ function core:OnEnable()
|
|||
end
|
||||
|
||||
function core:ViewChores()
|
||||
for k,v in pairs(self.db.profile.valorPoints) do
|
||||
for k,v in pairs(self.db.global.valorPoints) do
|
||||
print(k,'has',v,'Valor Points this week.')
|
||||
end
|
||||
end
|
||||
|
||||
function core:UpdateChores()
|
||||
print('Updating Chores.')
|
||||
--print('Updating Chores.')
|
||||
local level = UnitLevel('player')
|
||||
|
||||
if(level == 85) then
|
||||
|
@ -45,38 +44,47 @@ function core:UpdateChores()
|
|||
local name = UnitName('player')
|
||||
|
||||
--reset data if necessary
|
||||
for k,v in pairs(self.db.profile.lockouts) do
|
||||
for x,y in pairs(self.db.profile.lockouts[k]) do
|
||||
print('Comparing',x,'for',name,':',y.resetTime,'<',time())
|
||||
if y.resetTime < time() then
|
||||
print('Passed resetTime for',k,x)
|
||||
--self.db.profile.lockouts[k][x] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
core:ResetInstances()
|
||||
core:ResetValorPoints()
|
||||
|
||||
--store Valor Points
|
||||
print('Storing',earnedThisWeek,'Valor points for',name)
|
||||
self.db.profile.valorPoints[name] = earnedThisWeek
|
||||
--print('Storing',earnedThisWeek,'Valor points for',name)
|
||||
self.db.global.valorPoints[name] = earnedThisWeek
|
||||
|
||||
--store Saved Instances
|
||||
print('Storing instances for',name)
|
||||
--print('Storing instances for',name)
|
||||
local savedInstances = GetNumSavedInstances()
|
||||
for i = 1, savedInstances do
|
||||
local instanceName,_,instanceReset,_,_,_,_,_,_,_,_,defeatedBosses = GetSavedInstanceInfo(i)
|
||||
|
||||
if trackedInstances[instanceName] == true then
|
||||
if instanceReset > 0 then
|
||||
print('Saving',instanceName,'with',defeatedBosses,'defeated bosses for',name)
|
||||
self.db.profile.lockouts[name][instanceName] = {}
|
||||
self.db.profile.lockouts[name][instanceName].defeatedBosses = defeatedBosses
|
||||
self.db.profile.lockouts[name][instanceName].resetTime = time() + instanceReset
|
||||
--print('Saving',instanceName,'with',defeatedBosses,'defeated bosses for',name)
|
||||
self.db.global.lockouts[name][instanceName] = {}
|
||||
self.db.global.lockouts[name][instanceName].defeatedBosses = defeatedBosses
|
||||
self.db.global.lockouts[name][instanceName].resetTime = time() + instanceReset
|
||||
else
|
||||
print('Resetting',instanceName,'for',name)
|
||||
self.db.profile.lockouts[name][instanceName] = nil
|
||||
--print('Resetting',instanceName,'for',name)
|
||||
self.db.global.lockouts[name][instanceName] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function core:ResetInstances()
|
||||
for k,v in pairs(self.db.global.lockouts) do
|
||||
for x,y in pairs(self.db.global.lockouts[k]) do
|
||||
--print('Comparing',x,'for',k,':',y.resetTime,'<',time())
|
||||
if y.resetTime < time() then
|
||||
--print('Passed resetTime for',k,x)
|
||||
--self.db.global.lockouts[k][x] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function core:ResetValorPoints()
|
||||
|
||||
end
|
Loading…
Reference in a new issue