1
0
Fork 0

Track the two new LFR Instances.

This commit is contained in:
Andrew Tomaka 2011-12-03 06:16:13 -05:00
parent 20156e6f94
commit ba5151792f

View file

@ -30,6 +30,11 @@ local defaults = {
[Z['Blackwing Descent']] = { abbreviation = 'BWD', enable = false, removed = false, }, [Z['Blackwing Descent']] = { abbreviation = 'BWD', enable = false, removed = false, },
[Z['Throne of the Four Winds']] = { abbreviation = '4W', enable = false, removed = false, }, [Z['Throne of the Four Winds']] = { abbreviation = '4W', enable = false, removed = false, },
}, },
lfrs = {
-- needs localized
['The Siege of Wyrmrest Temple'] = { abbreviation = 'SoWT', enable = true, removed = false, },
['Fall of Deathwing'] = { abbreviation = 'FoD', enable = true, removed = false, },
}
}, },
} }
@ -101,9 +106,9 @@ local options = {
instances = { instances = {
name = L['Instances'], name = L['Instances'],
type = 'group', type = 'group',
order = 2, order = 20,
args = { }, args = { },
} },
}, },
} }
@ -132,6 +137,13 @@ function core:OnInitialize()
} }
self.db.global[self.character.realm][self.character.name].lockouts = {} self.db.global[self.character.realm][self.character.name].lockouts = {}
end end
if self.db.global[self.character.realm][self.character.name].lfrs == nil and self.character.level == CURRENT_MAX_LEVEL then
self.db.global[self.character.realm][self.character.name].lfrs = {}
end
-- Add LFR stuff to profile if it isn't there already
core:LFRProfileUpdate()
end end
function core:OnEnable() function core:OnEnable()
@ -251,6 +263,7 @@ end
function core:UPDATE_INSTANCE_INFO() function core:UPDATE_INSTANCE_INFO()
self.instanceInfoTime = time() self.instanceInfoTime = time()
core:UpdateRaidLockouts() core:UpdateRaidLockouts()
core:UpdateLFRLockouts()
end end
function core:LFG_UPDATE_RANDOM_INFO() function core:LFG_UPDATE_RANDOM_INFO()
@ -269,8 +282,6 @@ function core:INSTANCE_ENCOUNTER_ENGAGE_UNIT()
end end
--[[ FUNCTIONS ]]-- --[[ FUNCTIONS ]]--
function core:UpdateValorPoints() function core:UpdateValorPoints()
local _, _, _, earnedThisWeek = GetCurrencyInfo(396) local _, _, _, earnedThisWeek = GetCurrencyInfo(396)
@ -324,6 +335,33 @@ function core:ResetRaidLockouts()
end end
end end
function core:UpdateLFRLockouts()
local RFDungeonCount = GetNumRFDungeons()
for i = 1, RFDungeonCount do
id, instanceName = GetRFDungeonInfo(i)
_, defeatedBosses = GetLFGDungeonNumEncounters(id)
if self.db.profile.lfrs[instanceName] ~= nil then
self.db.global[self.character.realm][self.character.name].lfrs[instanceName] = {}
self.db.global[self.character.realm][self.character.name].lfrs[instanceName].defeatedBosses = defeatedBosses
self.db.global[self.character.realm][self.character.name].lfrs[instanceName].resetTime = self.vpResetTime
end
end
end
function core:ResetLFRLockouts()
for realm,realmTable in pairs(self.db.global) do
for name in pairs(realmTable) do
for instance,instanceTable in pairs(self.db.global[realm][name].lfrs) do
if instanceTable.resetTime < time() then
self.db.global[realm][name].lfrs[instance] = nil
end
end
end
end
end
function core:DrawInstanceOptions() function core:DrawInstanceOptions()
@ -346,10 +384,15 @@ function core:DrawInstanceOptions()
end end
end, end,
}, },
lfrsHeader = {
name = L['Looking for Raid Instances'],
type = 'header',
order = 100,
},
instancesHeader = { instancesHeader = {
name = L['Instances'], name = L['Instances'],
type = 'header', type = 'header',
order = 2, order = 500,
}, },
} }
local i = 1 local i = 1
@ -358,7 +401,7 @@ function core:DrawInstanceOptions()
options.args.instances.args[instance .. 'Enable'] = { options.args.instances.args[instance .. 'Enable'] = {
type = 'toggle', type = 'toggle',
name = instance, name = instance,
order = 4 * i, order = 500 + (5 * i) + 0,
get = function(info) return self.db.profile.instances[instance].enable end, get = function(info) return self.db.profile.instances[instance].enable end,
set = function(info, value) set = function(info, value)
self.db.profile.instances[instance].enable = value self.db.profile.instances[instance].enable = value
@ -368,7 +411,7 @@ function core:DrawInstanceOptions()
options.args.instances.args[instance .. 'Abbreviation'] = { options.args.instances.args[instance .. 'Abbreviation'] = {
type = 'input', type = 'input',
name = '', name = '',
order = 4 * i + 1, order = 500 + (5 * i) + 1,
width = 'half', width = 'half',
get = function(info) return self.db.profile.instances[instance].abbreviation end, get = function(info) return self.db.profile.instances[instance].abbreviation end,
set = function(info, value) self.db.profile.instances[instance].abbreviation = value end, set = function(info, value) self.db.profile.instances[instance].abbreviation = value end,
@ -376,7 +419,7 @@ function core:DrawInstanceOptions()
options.args.instances.args[instance .. 'Remove'] = { options.args.instances.args[instance .. 'Remove'] = {
type = 'execute', type = 'execute',
name = L['Remove'], name = L['Remove'],
order = 4 * i + 2, order = 500 + (5 * i) + 2,
width = 'half', width = 'half',
confirm = true, confirm = true,
func = function() func = function()
@ -387,7 +430,48 @@ function core:DrawInstanceOptions()
options.args.instances.args[instance .. 'Spacer'] = { options.args.instances.args[instance .. 'Spacer'] = {
type = 'description', type = 'description',
name = '', name = '',
order = 4 * i + 3, order = 500 + (5 * i) + 3,
}
i = i + 1
end
end
i = 1
for instance, abbreviation in pairs(self.db.profile.lfrs) do
if self.db.profile.lfrs[instance].removed == false then
options.args.instances.args[instance .. 'Enable'] = {
type = 'toggle',
name = instance,
order = 100 + (5 * i) + 0,
get = function(info) return self.db.profile.lfrs[instance].enable end,
set = function(info, value)
self.db.profile.lfrs[instance].enable = value
core:DrawInstanceOptions()
end,
}
options.args.instances.args[instance .. 'Abbreviation'] = {
type = 'input',
name = '',
order = 100 + (5 * i) + 1,
width = 'half',
get = function(info) return self.db.profile.lfrs[instance].abbreviation end,
set = function(info, value) self.db.profile.lfrs[instance].abbreviation = value end,
}
options.args.instances.args[instance .. 'Remove'] = {
type = 'execute',
name = L['Remove'],
order = 100 + (5 * i) + 2,
width = 'half',
confirm = true,
func = function()
self.db.profile.lfrs[instance].removed = true
core:DrawInstanceOptions()
end,
}
options.args.instances.args[instance .. 'Spacer'] = {
type = 'description',
name = '',
order = 100 + (5 * i) + 3,
} }
i = i + 1 i = i + 1
end end
@ -465,6 +549,11 @@ function core:DrawTooltip()
columnCount = columnCount + 1 columnCount = columnCount + 1
end end
end end
for instance in pairs(self.db.profile.lfrs) do
if self.db.profile.lfrs[instance].enable == true and self.db.profile.lfrs[instance].removed == false then
columnCount = columnCount + 1
end
end
self.tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT') self.tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
-- Populate a table with the information we want for our tooltip -- Populate a table with the information we want for our tooltip
@ -490,6 +579,16 @@ function core:DrawTooltip()
characterTable[instance] = defeatedBosses characterTable[instance] = defeatedBosses
end end
for instance in pairs(self.db.profile.lfrs) do
local defeatedBosses
if self.db.global[realm][name].lfrs[instance] ~= nil then
defeatedBosses = self.db.global[realm][name].lfrs[instance].defeatedBosses
else
defeatedBosses = 0
end
characterTable[instance] = defeatedBosses
end
if name == UnitName('player') and self.db.profile.currentOnTop == true then if name == UnitName('player') and self.db.profile.currentOnTop == true then
currentTable = characterTable currentTable = characterTable
else else
@ -543,6 +642,11 @@ function core:DrawTooltip()
table.insert(headerTable,instanceInfo) table.insert(headerTable,instanceInfo)
end end
end end
for instance, instanceInfo in pairs(self.db.profile.lfrs) do
if self.db.profile.lfrs[instance].enable == true and self.db.profile.lfrs[instance].removed == false then
table.insert(headerTable,instanceInfo)
end
end
local nextColumn = 3 local nextColumn = 3
for instance,instanceInfo in pairs(headerTable) do for instance,instanceInfo in pairs(headerTable) do
@ -580,5 +684,40 @@ function core:DrawTooltip()
nextColumn = nextColumn + 1 nextColumn = nextColumn + 1
end end
end end
for instance, abbreviation in pairs(self.db.profile.lfrs) do
if self.db.profile.lfrs[instance].enable == true and self.db.profile.lfrs[instance].removed == false then
local instanceColor
if information[instance] == 0 then
instanceColor = self.fontObjects['green']
else
instanceColor = self.fontObjects['red']
end
self.tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
nextColumn = nextColumn + 1
end
end
end
end
--[[ PROFILE UPDATES ]]--
function core:LFRProfileUpdate()
print('updating lfrs')
for realm,realmTable in pairs(self.db.global) do
for name in pairs(realmTable) do
if self.db.global[realm][name].lfrs == nil then
self.db.global[realm][name].lfrs = {}
end
for instance in pairs(self.db.profile.lfrs) do
if self.db.global[realm][name].lfrs[instance] == nil then
self.db.global[realm][name].lfrs[instance] = {}
self.db.global[realm][name].lfrs[instance].defeatedBosses = 0
self.db.global[realm][name].lfrs[instance].resetTime = 0
end
end
end
end end
end end