Compare commits
6 Commits
Author | SHA1 | Date |
---|---|---|
Andrew Tomaka | 5f7cfc7610 | |
Andrew Tomaka | da5111170f | |
Andrew Tomaka | 4cee09a6d4 | |
Andrew Tomaka | be3b33f3e4 | |
Andrew Tomaka | 4a80527bf5 | |
Andrew Tomaka | 53974a8640 |
|
@ -22,6 +22,7 @@ local defaults = {
|
|||
sortDirection = 1,
|
||||
currentOnTop = false,
|
||||
showServer = false,
|
||||
showTotalVp = true,
|
||||
instances = {
|
||||
[Z['Dragon Soul']] = { abbreviation = 'DS', enable = true, removed = false, },
|
||||
[Z['Baradin Hold']] = { abbreviation = 'BH', enable = true, removed = false, },
|
||||
|
@ -30,14 +31,20 @@ local defaults = {
|
|||
[Z['Blackwing Descent']] = { abbreviation = 'BWD', 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, },
|
||||
}
|
||||
lfrs = {}
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup LFR Defaults
|
||||
local RFDungeonCount = GetNumRFDungeons()
|
||||
|
||||
for i = 1, RFDungeonCount do
|
||||
id, instanceName = GetRFDungeonInfo(i)
|
||||
|
||||
defaults.profile.lfrs[instanceName] = { enable = true, removed = false, }
|
||||
defaults.profile.lfrs[instanceName].abbreviation = string.sub(instanceName, 0, 1)
|
||||
end
|
||||
|
||||
local options = {
|
||||
name = 'ChoreTracker',
|
||||
type = 'group',
|
||||
|
@ -101,6 +108,15 @@ local options = {
|
|||
get = function(info) return core.db.profile.showServer end,
|
||||
set = function(info, value) core.db.profile.showServer = value end,
|
||||
},
|
||||
showTotalVp = {
|
||||
name = L['Show Total VP'],
|
||||
desc = L['Show the total valor points for all characters in the tooltip.'],
|
||||
type = 'toggle',
|
||||
width = 'full',
|
||||
order = 22,
|
||||
get = function(info) return core.db.profile.showTotalVp end,
|
||||
set = function(info, value) core.db.profile.showTotalVp = value end,
|
||||
},
|
||||
},
|
||||
},
|
||||
instances = {
|
||||
|
@ -132,14 +148,17 @@ function core:OnInitialize()
|
|||
|
||||
self.db.global[self.character.realm][self.character.name].class = self.character.class
|
||||
self.db.global[self.character.realm][self.character.name].valorPoints = {
|
||||
total = 0,
|
||||
points = 0,
|
||||
resetTime = 0,
|
||||
}
|
||||
self.db.global[self.character.realm][self.character.name].lockouts = {}
|
||||
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 = {}
|
||||
if self.db.global[self.character.realm][self.character.name] ~= nil then
|
||||
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
|
||||
end
|
||||
|
||||
-- Add LFR stuff to profile if it isn't there already
|
||||
|
@ -234,8 +253,10 @@ function core:OnEnable()
|
|||
self:RegisterEvent('CALENDAR_UPDATE_EVENT_LIST')
|
||||
|
||||
self:RegisterEvent('LFG_UPDATE_RANDOM_INFO')
|
||||
self:RegisterEvent('LFG_LOCK_INFO_RECEIVED')
|
||||
self:RegisterEvent('UPDATE_INSTANCE_INFO')
|
||||
|
||||
self:RegisterEvent('CURRENCY_DISPLAY_UPDATE')
|
||||
self:RegisterEvent('CHAT_MSG_CURRENCY')
|
||||
self:RegisterEvent('INSTANCE_ENCOUNTER_ENGAGE_UNIT')
|
||||
end
|
||||
|
@ -246,6 +267,7 @@ function core:OnEnable()
|
|||
-- Reset data if necessary
|
||||
core:ResetRaidLockouts()
|
||||
core:ResetValorPoints()
|
||||
core:ResetLFRLockouts()
|
||||
end
|
||||
|
||||
|
||||
|
@ -263,13 +285,20 @@ end
|
|||
function core:UPDATE_INSTANCE_INFO()
|
||||
self.instanceInfoTime = time()
|
||||
core:UpdateRaidLockouts()
|
||||
core:UpdateLFRLockouts()
|
||||
end
|
||||
|
||||
function core:LFG_UPDATE_RANDOM_INFO()
|
||||
core:UpdateValorPoints()
|
||||
end
|
||||
|
||||
function core:LFG_LOCK_INFO_RECEIVED()
|
||||
core:UpdateLFRLockouts()
|
||||
end
|
||||
|
||||
function core:CURRENCY_DISPLAY_UPDATE()
|
||||
core:UpdateValorPoints()
|
||||
end
|
||||
|
||||
function core:CHAT_MSG_CURRENCY()
|
||||
RequestRaidInfo()
|
||||
RequestLFDPlayerLockInfo()
|
||||
|
@ -284,12 +313,13 @@ end
|
|||
|
||||
--[[ FUNCTIONS ]]--
|
||||
function core:UpdateValorPoints()
|
||||
local _, _, _, earnedThisWeek = GetCurrencyInfo(396)
|
||||
local _, amount, _, earnedThisWeek = GetCurrencyInfo(396)
|
||||
|
||||
if self.db.global[self.character.realm][self.character.name].valorPoints == nil then
|
||||
self.db.global[self.character.realm][self.character.name].valorPoints = {}
|
||||
end
|
||||
self.db.global[self.character.realm][self.character.name].valorPoints.points = earnedThisWeek
|
||||
self.db.global[self.character.realm][self.character.name].valorPoints.total = amount
|
||||
if self.vpResetTime ~= false then
|
||||
self.db.global[self.character.realm][self.character.name].valorPoints.resetTime = self.vpResetTime
|
||||
end
|
||||
|
@ -299,10 +329,8 @@ function core:ResetValorPoints()
|
|||
for realm, realmTable in pairs(self.db.global) do
|
||||
for name in pairs(realmTable) do
|
||||
if self.db.global[realm][name].valorPoints.resetTime < time() then
|
||||
self.db.global[realm][name].valorPoints = {
|
||||
points = 0,
|
||||
resetTime = 0,
|
||||
}
|
||||
self.db.global[realm][name].valorPoints.points = 0
|
||||
self.db.global[realm][name].valorPoints.resetTime = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -312,7 +340,7 @@ function core:UpdateRaidLockouts()
|
|||
local savedInstances = GetNumSavedInstances()
|
||||
for i = 1, savedInstances do
|
||||
local instanceName, _, instanceReset, _, _, _, _, _, _, _, _, defeatedBosses = GetSavedInstanceInfo(i)
|
||||
|
||||
|
||||
if self.db.profile.instances[instanceName] ~= nil then
|
||||
if instanceReset > 0 then
|
||||
self.db.global[self.character.realm][self.character.name].lockouts[instanceName] = {}
|
||||
|
@ -363,7 +391,6 @@ function core:ResetLFRLockouts()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
function core:DrawInstanceOptions()
|
||||
-- Redraw our instance options everytime they are updated.
|
||||
options.args.instances.args = {
|
||||
|
@ -536,6 +563,7 @@ function core:DrawTooltip()
|
|||
-- Should not update without being 100% sure our raid info is correct
|
||||
core:UpdateValorPoints()
|
||||
core:UpdateRaidLockouts()
|
||||
core:UpdateLFRLockouts()
|
||||
end
|
||||
|
||||
if self.tooltip then
|
||||
|
@ -563,11 +591,12 @@ function core:DrawTooltip()
|
|||
for name in pairs(self.db.global[realm]) do
|
||||
local valorPoints = self.db.global[realm][name].valorPoints.points
|
||||
local class = self.db.global[realm][name].class
|
||||
local totalVp = self.db.global[realm][name].valorPoints.total
|
||||
|
||||
if valorPoints == nil then
|
||||
valorPoints = 0
|
||||
end
|
||||
local characterTable = { name = name, realm = realm, class = class, valorPoints = valorPoints }
|
||||
local characterTable = { name = name, realm = realm, class = class, valorPoints = valorPoints, totalVp = totalVp }
|
||||
|
||||
for instance in pairs(self.db.profile.instances) do
|
||||
local defeatedBosses
|
||||
|
@ -653,6 +682,11 @@ function core:DrawTooltip()
|
|||
self.tooltip:SetCell(1, nextColumn, instanceInfo.abbreviation, nil, 'CENTER')
|
||||
nextColumn = nextColumn + 1
|
||||
end
|
||||
|
||||
if self.db.profile.showTotalVp == true then
|
||||
self.tooltip:SetCell(1, nextColumn, 'Total VP')
|
||||
nextColumn = nextColumn + 1
|
||||
end
|
||||
|
||||
for _,information in pairs(tooltipTable) do
|
||||
if self.db.profile.showServer then
|
||||
|
@ -698,13 +732,16 @@ function core:DrawTooltip()
|
|||
nextColumn = nextColumn + 1
|
||||
end
|
||||
end
|
||||
|
||||
if self.db.profile.showTotalVp then
|
||||
self.tooltip:SetCell(characterLine, nextColumn, information.totalVp, self.fontObjects['green'], 'RIGHT')
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue