2011-08-30 20:29:41 -04:00
|
|
|
ChoreTracker = LibStub('AceAddon-3.0'):NewAddon('ChoreTracker', 'AceConsole-3.0', 'AceEvent-3.0')
|
2011-08-20 07:41:29 -04:00
|
|
|
local core = ChoreTracker
|
2011-10-07 19:52:02 -04:00
|
|
|
local LQT, LDB, LDBIcon
|
2011-09-21 11:05:06 -04:00
|
|
|
|
2011-09-23 06:36:34 -04:00
|
|
|
-- Localization
|
|
|
|
local L = LibStub('AceLocale-3.0'):GetLocale('ChoreTracker')
|
|
|
|
|
2011-09-21 11:05:06 -04:00
|
|
|
-- Get localized instances
|
2011-10-07 19:52:02 -04:00
|
|
|
local Z = LibStub('LibBabble-Zone-3.0'):GetLookupTable()
|
2011-08-21 10:59:28 -04:00
|
|
|
|
2011-10-08 19:49:07 -04:00
|
|
|
--
|
|
|
|
local CURRENT_MAX_LEVEL = 85
|
2011-12-03 04:26:10 -05:00
|
|
|
local MAX_VALOR_POINTS = 1000
|
2011-10-08 19:49:07 -04:00
|
|
|
|
2011-08-20 07:41:29 -04:00
|
|
|
local defaults = {
|
2011-09-16 16:00:16 -04:00
|
|
|
global = {},
|
2011-09-18 08:41:25 -04:00
|
|
|
profile = {
|
|
|
|
minimap = {
|
|
|
|
hide = false,
|
|
|
|
},
|
2011-09-20 04:12:08 -04:00
|
|
|
sortType = 1,
|
|
|
|
sortDirection = 1,
|
2011-09-23 08:18:04 -04:00
|
|
|
currentOnTop = false,
|
2011-10-16 01:17:43 -04:00
|
|
|
showServer = false,
|
2011-12-03 23:01:37 -05:00
|
|
|
showTotalVp = true,
|
2011-09-21 11:05:06 -04:00
|
|
|
instances = {
|
2011-12-03 04:38:08 -05:00
|
|
|
[Z['Dragon Soul']] = { abbreviation = 'DS', enable = true, removed = false, },
|
2011-09-23 01:15:44 -04:00
|
|
|
[Z['Baradin Hold']] = { abbreviation = 'BH', enable = true, removed = false, },
|
|
|
|
[Z['Firelands']] = { abbreviation = 'FL', enable = true, removed = false, },
|
2011-12-03 04:38:08 -05:00
|
|
|
[Z['The Bastion of Twilight']] = { abbreviation = 'BoT', 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, },
|
2011-09-21 11:05:06 -04:00
|
|
|
},
|
2011-12-03 22:42:03 -05:00
|
|
|
lfrs = {}
|
2011-09-18 08:41:25 -04:00
|
|
|
},
|
2011-09-16 16:00:16 -04:00
|
|
|
}
|
|
|
|
|
2011-12-03 22:42:03 -05:00
|
|
|
-- Setup LFR Defaults
|
|
|
|
local RFDungeonCount = GetNumRFDungeons()
|
|
|
|
|
|
|
|
for i = 1, RFDungeonCount do
|
|
|
|
id, instanceName = GetRFDungeonInfo(i)
|
2011-12-03 23:01:37 -05:00
|
|
|
|
2011-12-03 22:42:03 -05:00
|
|
|
defaults.profile.lfrs[instanceName] = { enable = true, removed = false, }
|
|
|
|
defaults.profile.lfrs[instanceName].abbreviation = string.sub(instanceName, 0, 1)
|
|
|
|
end
|
|
|
|
|
2011-09-18 18:12:03 -04:00
|
|
|
local options = {
|
|
|
|
name = 'ChoreTracker',
|
|
|
|
type = 'group',
|
|
|
|
args = {
|
2011-09-21 01:32:59 -04:00
|
|
|
general = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Settings'],
|
2011-09-21 01:32:59 -04:00
|
|
|
type = 'group',
|
|
|
|
order = 1,
|
|
|
|
args = {
|
|
|
|
minimap = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Hide Minimap Icon'],
|
|
|
|
desc = L['Removes the icon from your minimap.'],
|
2011-09-21 01:32:59 -04:00
|
|
|
type = 'toggle',
|
2011-09-22 22:56:56 -04:00
|
|
|
order = 1,
|
2011-10-07 19:52:02 -04:00
|
|
|
get = function(info) return core.db.profile.minimap.hide end,
|
|
|
|
set = function(info, value) core.db.profile.minimap.hide = value LDBIcon[value and 'Hide' or 'Show'](LDBIcon, 'ChoreTracker') end,
|
2011-09-21 01:32:59 -04:00
|
|
|
},
|
2011-09-22 22:56:56 -04:00
|
|
|
verticalHeader = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Vertical Sorting'],
|
2011-09-22 22:56:56 -04:00
|
|
|
type = 'header',
|
|
|
|
order = 2,
|
|
|
|
},
|
2011-09-23 08:18:04 -04:00
|
|
|
currentOnTop = {
|
|
|
|
name = L['Current Character On Top'],
|
|
|
|
desc = L['Place the character you are currently logged in as on the top of the list.'],
|
|
|
|
type = 'toggle',
|
|
|
|
width = 'full',
|
|
|
|
order = 3,
|
2011-10-07 19:52:02 -04:00
|
|
|
get = function(info) return core.db.profile.currentOnTop end,
|
|
|
|
set = function(info, value) core.db.profile.currentOnTop = value end,
|
2011-09-23 08:18:04 -04:00
|
|
|
},
|
2011-09-21 01:32:59 -04:00
|
|
|
sortType = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Sort Field'],
|
|
|
|
desc = L['Field to sort the tooltip by.'],
|
2011-09-21 01:32:59 -04:00
|
|
|
type = 'select',
|
2011-09-23 08:18:04 -04:00
|
|
|
order = 5,
|
2011-09-23 06:36:34 -04:00
|
|
|
values = { L['Character'], L['Valor Points'], L['Class'] },
|
2011-10-07 19:52:02 -04:00
|
|
|
get = function(info) return core.db.profile.sortType end,
|
|
|
|
set = function(info, value) core.db.profile.sortType = value end,
|
2011-09-21 01:32:59 -04:00
|
|
|
},
|
|
|
|
sortingDirection = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Sorting Direction'],
|
|
|
|
desc = L['Which direction to sort.'],
|
2011-09-21 01:32:59 -04:00
|
|
|
type = 'select',
|
2011-09-23 08:18:04 -04:00
|
|
|
order = 6,
|
2011-09-23 06:36:34 -04:00
|
|
|
values = { L['Ascending'], L['Descending'] },
|
2011-10-07 19:52:02 -04:00
|
|
|
get = function(info) return core.db.profile.sortDirection end,
|
|
|
|
set = function(info, value) core.db.profile.sortDirection = value end,
|
2011-09-21 01:32:59 -04:00
|
|
|
},
|
2011-10-16 01:17:43 -04:00
|
|
|
otherHeader = {
|
|
|
|
name = '',
|
|
|
|
type = 'header',
|
|
|
|
order = 20,
|
|
|
|
},
|
|
|
|
showServer = {
|
|
|
|
name = L['Show Server'],
|
|
|
|
desc = L['Show the server abbreviation next to a character name in the list.'],
|
|
|
|
type = 'toggle',
|
|
|
|
width = 'full',
|
|
|
|
order = 21,
|
|
|
|
get = function(info) return core.db.profile.showServer end,
|
|
|
|
set = function(info, value) core.db.profile.showServer = value end,
|
|
|
|
},
|
2011-12-03 23:01:37 -05:00
|
|
|
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,
|
|
|
|
},
|
2011-09-21 01:32:59 -04:00
|
|
|
},
|
2011-09-20 04:12:08 -04:00
|
|
|
},
|
2011-09-21 01:32:59 -04:00
|
|
|
instances = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Instances'],
|
2011-09-21 01:32:59 -04:00
|
|
|
type = 'group',
|
2011-12-03 06:16:13 -05:00
|
|
|
order = 20,
|
2011-09-26 16:09:30 -04:00
|
|
|
args = { },
|
2011-12-03 06:16:13 -05:00
|
|
|
},
|
2011-09-20 17:42:06 -04:00
|
|
|
},
|
2011-09-18 18:12:03 -04:00
|
|
|
}
|
|
|
|
|
2011-09-01 03:16:53 -04:00
|
|
|
function core:OnInitialize()
|
2011-10-07 19:52:02 -04:00
|
|
|
self.db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
|
2011-08-25 03:50:22 -04:00
|
|
|
|
2011-10-08 18:26:00 -04:00
|
|
|
self.character = {
|
|
|
|
name = UnitName('player'),
|
|
|
|
level = UnitLevel('player'),
|
|
|
|
class = UnitClass('player'),
|
2011-10-08 19:49:07 -04:00
|
|
|
realm = GetRealmName(),
|
2011-10-08 18:26:00 -04:00
|
|
|
}
|
2011-10-08 19:49:07 -04:00
|
|
|
self.character.class = self.character.class:lower():gsub("%s*(.-)%s*", "%1")
|
2011-10-08 18:26:00 -04:00
|
|
|
|
|
|
|
if self.db.global[self.character.realm] == nil then
|
|
|
|
self.db.global[self.character.realm] = {}
|
2011-08-25 03:50:22 -04:00
|
|
|
end
|
2011-09-01 03:16:53 -04:00
|
|
|
|
2011-10-08 19:49:07 -04:00
|
|
|
if self.db.global[self.character.realm][self.character.name] == nil and self.character.level == CURRENT_MAX_LEVEL then
|
2011-10-08 18:26:00 -04:00
|
|
|
self.db.global[self.character.realm][self.character.name] = {}
|
2011-08-25 03:50:22 -04:00
|
|
|
|
2011-10-08 18:26:00 -04:00
|
|
|
self.db.global[self.character.realm][self.character.name].class = self.character.class
|
|
|
|
self.db.global[self.character.realm][self.character.name].valorPoints = {
|
2011-12-03 23:01:37 -05:00
|
|
|
total = 0,
|
2011-10-07 19:52:02 -04:00
|
|
|
points = 0,
|
2011-09-01 03:16:53 -04:00
|
|
|
resetTime = 0,
|
|
|
|
}
|
2011-10-08 18:26:00 -04:00
|
|
|
self.db.global[self.character.realm][self.character.name].lockouts = {}
|
2011-08-25 03:50:22 -04:00
|
|
|
end
|
2011-12-03 06:16:13 -05:00
|
|
|
|
2011-12-04 03:14:36 -05:00
|
|
|
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
|
2011-12-03 06:16:13 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Add LFR stuff to profile if it isn't there already
|
|
|
|
core:LFRProfileUpdate()
|
2011-09-18 08:41:25 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
function core:OnEnable()
|
2011-09-18 16:51:56 -04:00
|
|
|
LQT = LibStub('LibQTip-1.0')
|
2011-10-07 19:52:02 -04:00
|
|
|
|
|
|
|
self.instanceInfoTime = false
|
|
|
|
self.vpResetTime = false
|
2011-09-18 08:41:25 -04:00
|
|
|
|
2011-09-18 19:38:31 -04:00
|
|
|
-- Setup font strings for later. (RAID_CLASS_COLORS always indexed in English?)
|
2011-10-07 19:52:02 -04:00
|
|
|
self.fontObjects = { }
|
2011-10-08 18:26:00 -04:00
|
|
|
for class, color in pairs(RAID_CLASS_COLORS) do
|
2011-10-08 19:49:07 -04:00
|
|
|
class = class:lower()
|
2011-08-25 04:38:35 -04:00
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
self.fontObjects[class] = CreateFont('ClassFont' .. class)
|
|
|
|
self.fontObjects[class]:CopyFontObject(GameTooltipText)
|
|
|
|
self.fontObjects[class]:SetTextColor(color.r, color.g, color.b)
|
2011-08-25 04:38:35 -04:00
|
|
|
end
|
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
self.fontObjects['green'] = CreateFont('FlagFontGreen')
|
|
|
|
self.fontObjects['green']:CopyFontObject(GameTooltipText)
|
|
|
|
self.fontObjects['green']:SetTextColor(0, 255, 0)
|
2011-08-25 04:38:35 -04:00
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
self.fontObjects['red'] = CreateFont('FlagFontRed')
|
|
|
|
self.fontObjects['red']:CopyFontObject(GameTooltipText)
|
|
|
|
self.fontObjects['red']:SetTextColor(255, 0, 0)
|
2011-09-01 03:16:53 -04:00
|
|
|
|
2011-10-08 19:49:07 -04:00
|
|
|
-- Setup instance stuff for options
|
|
|
|
core:DrawInstanceOptions()
|
|
|
|
|
|
|
|
-- Add options to Interface Panel
|
|
|
|
LibStub('AceConfigRegistry-3.0'):RegisterOptionsTable('ChoreTracker', options)
|
|
|
|
local ACD = LibStub('AceConfigDialog-3.0')
|
|
|
|
ACD:AddToBlizOptions('ChoreTracker', 'ChoreTracker')
|
|
|
|
options.args.profile = LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db)
|
|
|
|
|
2011-09-18 08:41:25 -04:00
|
|
|
-- Setup LDB
|
2011-09-18 19:38:31 -04:00
|
|
|
LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', {
|
2011-09-18 09:31:48 -04:00
|
|
|
type = 'data source',
|
|
|
|
text = 'ChoreTracker',
|
|
|
|
icon = 'Interface\\AddOns\\ChoreTracker\\icon',
|
2011-09-23 13:22:57 -04:00
|
|
|
OnClick = function(self, button)
|
|
|
|
if button == 'RightButton' then
|
2011-09-19 04:59:17 -04:00
|
|
|
if LibStub("AceConfigDialog-3.0").OpenFrames['ChoreTracker'] then
|
|
|
|
LibStub('AceConfigDialog-3.0'):Close('ChoreTracker')
|
|
|
|
else
|
|
|
|
LibStub('AceConfigDialog-3.0'):Open('ChoreTracker')
|
|
|
|
end
|
2011-09-23 13:22:57 -04:00
|
|
|
else
|
|
|
|
-- Cycle through our sort options
|
2011-10-08 19:49:07 -04:00
|
|
|
if core.db.profile.sortType == 1 then
|
|
|
|
core.db.profile.sortType = 2
|
2011-09-23 13:22:57 -04:00
|
|
|
core:DrawTooltip()
|
2011-10-08 19:49:07 -04:00
|
|
|
elseif core.db.profile.sortType == 2 then
|
|
|
|
core.db.profile.sortType = 3
|
2011-09-23 13:22:57 -04:00
|
|
|
core:DrawTooltip()
|
|
|
|
else
|
2011-10-08 19:49:07 -04:00
|
|
|
core.db.profile.sortType = 1
|
2011-09-23 13:22:57 -04:00
|
|
|
core:DrawTooltip()
|
|
|
|
end
|
|
|
|
end
|
2011-09-19 04:59:17 -04:00
|
|
|
end,
|
2011-09-19 09:11:10 -04:00
|
|
|
OnEnter = function(self)
|
2011-09-18 08:41:25 -04:00
|
|
|
core:DrawTooltip()
|
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
core.tooltip:SmartAnchorTo(self)
|
|
|
|
core.tooltip:Show()
|
2011-09-18 08:41:25 -04:00
|
|
|
end,
|
|
|
|
OnLeave = function(self)
|
2011-10-07 19:52:02 -04:00
|
|
|
LQT:Release(core.tooltip)
|
|
|
|
core.tooltip = nil
|
2011-09-18 08:41:25 -04:00
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Deal with minimap
|
2011-09-18 19:38:31 -04:00
|
|
|
LDBIcon = LibStub('LibDBIcon-1.0')
|
2011-10-07 19:52:02 -04:00
|
|
|
LDBIcon:Register('ChoreTracker', LDB, self.db.profile.minimap)
|
2011-09-18 08:41:25 -04:00
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.db.profile.minimap.hide then
|
2011-09-18 19:38:31 -04:00
|
|
|
LDBIcon:Hide('ChoreTracker')
|
2011-09-18 08:41:25 -04:00
|
|
|
else
|
2011-09-18 19:38:31 -04:00
|
|
|
LDBIcon:Show('ChoreTracker')
|
2011-09-18 08:41:25 -04:00
|
|
|
end
|
2011-09-18 16:51:56 -04:00
|
|
|
|
2011-09-20 17:42:06 -04:00
|
|
|
-- Register events
|
2011-10-08 19:49:07 -04:00
|
|
|
if self.character.level == CURRENT_MAX_LEVEL then
|
2011-10-18 14:15:38 -04:00
|
|
|
self:RegisterEvent('PLAYER_ENTERING_WORLD')
|
|
|
|
|
2011-09-20 17:42:06 -04:00
|
|
|
self:RegisterEvent('CALENDAR_UPDATE_EVENT_LIST')
|
2011-10-07 02:41:43 -04:00
|
|
|
|
|
|
|
self:RegisterEvent('LFG_UPDATE_RANDOM_INFO')
|
2011-12-03 21:01:07 -05:00
|
|
|
self:RegisterEvent('LFG_LOCK_INFO_RECEIVED')
|
2011-09-20 17:42:06 -04:00
|
|
|
self:RegisterEvent('UPDATE_INSTANCE_INFO')
|
2011-10-07 02:41:43 -04:00
|
|
|
|
2011-12-06 19:13:13 -05:00
|
|
|
self:RegisterEvent('CURRENCY_DISPLAY_UPDATE')
|
2011-09-20 17:42:06 -04:00
|
|
|
self:RegisterEvent('CHAT_MSG_CURRENCY')
|
2011-10-03 22:04:55 -04:00
|
|
|
self:RegisterEvent('INSTANCE_ENCOUNTER_ENGAGE_UNIT')
|
2011-09-20 17:42:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
-- Get calendar events information
|
|
|
|
OpenCalendar()
|
|
|
|
|
|
|
|
-- Reset data if necessary
|
2011-10-07 02:41:43 -04:00
|
|
|
core:ResetRaidLockouts()
|
2011-09-20 17:42:06 -04:00
|
|
|
core:ResetValorPoints()
|
2011-12-06 17:23:06 -05:00
|
|
|
core:ResetLFRLockouts()
|
2011-09-20 17:42:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--[[ EVENTS ]]--
|
2011-10-18 14:15:38 -04:00
|
|
|
function core:PLAYER_ENTERING_WORLD()
|
|
|
|
self.vpResetTime = core:FindLockout(Z['Baradin Hold'])
|
|
|
|
end
|
|
|
|
|
2011-09-20 17:42:06 -04:00
|
|
|
function core:CALENDAR_UPDATE_EVENT_LIST()
|
2011-10-08 06:35:16 -04:00
|
|
|
self.vpResetTime = core:FindLockout(Z['Baradin Hold'])
|
2011-08-20 07:41:29 -04:00
|
|
|
end
|
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
function core:UPDATE_INSTANCE_INFO()
|
|
|
|
self.instanceInfoTime = time()
|
2011-10-07 02:41:43 -04:00
|
|
|
core:UpdateRaidLockouts()
|
2011-09-20 17:42:06 -04:00
|
|
|
end
|
|
|
|
|
2011-10-01 17:30:12 -04:00
|
|
|
function core:LFG_UPDATE_RANDOM_INFO()
|
2011-10-07 02:41:43 -04:00
|
|
|
core:UpdateValorPoints()
|
2011-10-01 17:30:12 -04:00
|
|
|
end
|
|
|
|
|
2011-12-03 21:01:07 -05:00
|
|
|
function core:LFG_LOCK_INFO_RECEIVED()
|
|
|
|
core:UpdateLFRLockouts()
|
|
|
|
end
|
|
|
|
|
2011-12-06 19:13:13 -05:00
|
|
|
function core:CURRENCY_DISPLAY_UPDATE()
|
|
|
|
core:UpdateValorPoints()
|
|
|
|
end
|
|
|
|
|
2011-09-20 17:42:06 -04:00
|
|
|
function core:CHAT_MSG_CURRENCY()
|
2011-09-20 13:53:25 -04:00
|
|
|
RequestRaidInfo()
|
2011-10-01 17:30:12 -04:00
|
|
|
RequestLFDPlayerLockInfo()
|
2011-09-20 12:57:51 -04:00
|
|
|
end
|
|
|
|
|
2011-10-03 22:04:55 -04:00
|
|
|
-- Might only fire for encounters with a boss frame.
|
|
|
|
function core:INSTANCE_ENCOUNTER_ENGAGE_UNIT()
|
|
|
|
RequestRaidInfo()
|
|
|
|
RequestLFDPlayerLockInfo()
|
|
|
|
end
|
|
|
|
|
2011-09-20 17:42:06 -04:00
|
|
|
|
|
|
|
--[[ FUNCTIONS ]]--
|
2011-10-07 02:41:43 -04:00
|
|
|
function core:UpdateValorPoints()
|
2011-12-03 23:01:37 -05:00
|
|
|
local _, amount, _, earnedThisWeek = GetCurrencyInfo(396)
|
2011-10-07 02:41:43 -04:00
|
|
|
|
2011-10-08 18:26:00 -04:00
|
|
|
if self.db.global[self.character.realm][self.character.name].valorPoints == nil then
|
|
|
|
self.db.global[self.character.realm][self.character.name].valorPoints = {}
|
2011-10-07 02:41:43 -04:00
|
|
|
end
|
2011-10-08 18:26:00 -04:00
|
|
|
self.db.global[self.character.realm][self.character.name].valorPoints.points = earnedThisWeek
|
2011-12-03 23:01:37 -05:00
|
|
|
self.db.global[self.character.realm][self.character.name].valorPoints.total = amount
|
2011-10-08 18:26:00 -04:00
|
|
|
if self.vpResetTime ~= false then
|
|
|
|
self.db.global[self.character.realm][self.character.name].valorPoints.resetTime = self.vpResetTime
|
2011-10-07 02:41:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function core:ResetValorPoints()
|
2011-10-08 18:26:00 -04:00
|
|
|
for realm, realmTable in pairs(self.db.global) do
|
2011-10-07 02:41:43 -04:00
|
|
|
for name in pairs(realmTable) do
|
2011-10-11 12:09:45 -04:00
|
|
|
if self.db.global[realm][name].valorPoints.resetTime < time() then
|
2011-12-03 23:01:37 -05:00
|
|
|
self.db.global[realm][name].valorPoints.points = 0
|
|
|
|
self.db.global[realm][name].valorPoints.resetTime = 0
|
2011-10-07 02:41:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function core:UpdateRaidLockouts()
|
|
|
|
local savedInstances = GetNumSavedInstances()
|
|
|
|
for i = 1, savedInstances do
|
|
|
|
local instanceName, _, instanceReset, _, _, _, _, _, _, _, _, defeatedBosses = GetSavedInstanceInfo(i)
|
2011-12-03 21:01:07 -05:00
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.db.profile.instances[instanceName] ~= nil then
|
2011-10-07 02:41:43 -04:00
|
|
|
if instanceReset > 0 then
|
2011-10-08 18:26:00 -04:00
|
|
|
self.db.global[self.character.realm][self.character.name].lockouts[instanceName] = {}
|
|
|
|
self.db.global[self.character.realm][self.character.name].lockouts[instanceName].defeatedBosses = defeatedBosses
|
|
|
|
self.db.global[self.character.realm][self.character.name].lockouts[instanceName].resetTime = self.instanceInfoTime + instanceReset
|
2011-10-07 02:41:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function core:ResetRaidLockouts()
|
2011-10-07 19:52:02 -04:00
|
|
|
for realm,realmTable in pairs(self.db.global) do
|
2011-10-07 02:41:43 -04:00
|
|
|
for name in pairs(realmTable) do
|
2011-10-07 19:52:02 -04:00
|
|
|
for instance,instanceTable in pairs(self.db.global[realm][name].lockouts) do
|
2011-10-07 02:41:43 -04:00
|
|
|
if instanceTable.resetTime < time() then
|
2011-10-07 19:52:02 -04:00
|
|
|
self.db.global[realm][name].lockouts[instance] = nil
|
2011-10-07 02:41:43 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-12-03 06:16:13 -05:00
|
|
|
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
|
2011-10-07 02:41:43 -04:00
|
|
|
|
2011-09-23 01:15:44 -04:00
|
|
|
function core:DrawInstanceOptions()
|
2011-09-26 16:09:30 -04:00
|
|
|
-- Redraw our instance options everytime they are updated.
|
2011-09-23 01:43:15 -04:00
|
|
|
options.args.instances.args = {
|
|
|
|
instance = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Add instance to track.'],
|
|
|
|
desc = L['Enter an instance on a lockout that you would like ChoreTracker to track.'],
|
2011-09-23 01:43:15 -04:00
|
|
|
type = 'input',
|
|
|
|
order = 1,
|
|
|
|
set = function(info, value)
|
2011-10-08 06:35:16 -04:00
|
|
|
if core:FindLockout(value) then
|
2011-10-08 19:54:12 -04:00
|
|
|
self.db.profile.instances[value] = { }
|
|
|
|
self.db.profile.instances[value].abbreviation = string.sub(value,0,1)
|
|
|
|
self.db.profile.instances[value].enable = true
|
|
|
|
self.db.profile.instances[value].removed = false
|
2011-09-23 01:43:15 -04:00
|
|
|
core:DrawInstanceOptions()
|
|
|
|
else
|
|
|
|
print('Invalid instance')
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
},
|
2011-12-03 06:16:13 -05:00
|
|
|
lfrsHeader = {
|
|
|
|
name = L['Looking for Raid Instances'],
|
|
|
|
type = 'header',
|
|
|
|
order = 100,
|
|
|
|
},
|
2011-09-23 01:43:15 -04:00
|
|
|
instancesHeader = {
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Instances'],
|
2011-09-23 01:43:15 -04:00
|
|
|
type = 'header',
|
2011-12-03 06:16:13 -05:00
|
|
|
order = 500,
|
2011-09-23 01:43:15 -04:00
|
|
|
},
|
|
|
|
}
|
2011-09-23 01:15:44 -04:00
|
|
|
local i = 1
|
2011-10-07 19:52:02 -04:00
|
|
|
for instance, abbreviation in pairs(self.db.profile.instances) do
|
|
|
|
if self.db.profile.instances[instance].removed == false then
|
2011-09-23 01:15:44 -04:00
|
|
|
options.args.instances.args[instance .. 'Enable'] = {
|
|
|
|
type = 'toggle',
|
|
|
|
name = instance,
|
2011-12-03 06:16:13 -05:00
|
|
|
order = 500 + (5 * i) + 0,
|
2011-10-07 19:52:02 -04:00
|
|
|
get = function(info) return self.db.profile.instances[instance].enable end,
|
2011-09-23 01:15:44 -04:00
|
|
|
set = function(info, value)
|
2011-10-08 19:54:12 -04:00
|
|
|
self.db.profile.instances[instance].enable = value
|
2011-09-23 01:15:44 -04:00
|
|
|
core:DrawInstanceOptions()
|
|
|
|
end,
|
|
|
|
}
|
2011-10-08 18:26:00 -04:00
|
|
|
options.args.instances.args[instance .. 'Abbreviation'] = {
|
2011-09-23 01:15:44 -04:00
|
|
|
type = 'input',
|
|
|
|
name = '',
|
2011-12-03 06:16:13 -05:00
|
|
|
order = 500 + (5 * i) + 1,
|
2011-09-23 01:15:44 -04:00
|
|
|
width = 'half',
|
2011-10-07 19:52:02 -04:00
|
|
|
get = function(info) return self.db.profile.instances[instance].abbreviation end,
|
|
|
|
set = function(info, value) self.db.profile.instances[instance].abbreviation = value end,
|
2011-09-23 01:15:44 -04:00
|
|
|
}
|
|
|
|
options.args.instances.args[instance .. 'Remove'] = {
|
|
|
|
type = 'execute',
|
2011-09-23 06:36:34 -04:00
|
|
|
name = L['Remove'],
|
2011-12-03 06:16:13 -05:00
|
|
|
order = 500 + (5 * i) + 2,
|
2011-09-23 01:15:44 -04:00
|
|
|
width = 'half',
|
|
|
|
confirm = true,
|
|
|
|
func = function()
|
2011-10-08 19:54:12 -04:00
|
|
|
self.db.profile.instances[instance].removed = true
|
2011-09-23 01:15:44 -04:00
|
|
|
core:DrawInstanceOptions()
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
options.args.instances.args[instance .. 'Spacer'] = {
|
|
|
|
type = 'description',
|
|
|
|
name = '',
|
2011-12-03 06:16:13 -05:00
|
|
|
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,
|
2011-09-23 01:15:44 -04:00
|
|
|
}
|
|
|
|
i = i + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-10-08 06:35:16 -04:00
|
|
|
function core:FindLockout(instance)
|
2011-09-20 14:53:18 -04:00
|
|
|
-- We need to have access to the instance lockouts on the calendar.
|
|
|
|
local currentCalendarSetting = GetCVar('calendarShowResets')
|
|
|
|
SetCVar('calendarShowResets', 1)
|
2011-08-30 20:29:41 -04:00
|
|
|
|
2011-09-20 14:53:18 -04:00
|
|
|
-- Figure out what time the server resets daily information
|
2011-08-30 20:29:41 -04:00
|
|
|
local questReset = GetQuestResetTime()
|
2011-08-31 02:17:58 -04:00
|
|
|
local resetTime = date('*t', time() + questReset)
|
2011-08-30 20:29:41 -04:00
|
|
|
|
2011-09-20 14:53:18 -04:00
|
|
|
-- Figure out reset day using next BH lockout
|
2011-08-30 20:29:41 -04:00
|
|
|
local _, month, day, year = CalendarGetDate()
|
|
|
|
|
|
|
|
local monthOffset = 0
|
2011-10-08 06:35:16 -04:00
|
|
|
local resetDate = false
|
|
|
|
while resetDate == false do
|
2011-08-30 20:29:41 -04:00
|
|
|
local todaysEvents = CalendarGetNumDayEvents(monthOffset, day)
|
|
|
|
|
|
|
|
for i = 1,todaysEvents do
|
|
|
|
if todaysEvents == 0 then
|
|
|
|
break
|
|
|
|
end
|
|
|
|
|
|
|
|
local title,hour,minute = CalendarGetDayEvent(monthOffset, day, i)
|
|
|
|
|
2011-10-08 06:35:16 -04:00
|
|
|
if title == instance then
|
2011-08-30 20:29:41 -04:00
|
|
|
resetDate = { year = year, month = month + monthOffset, day = day }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
day = day + 1
|
|
|
|
if day > 31 then
|
|
|
|
if monthOffset == 1 then break end
|
|
|
|
day = 1
|
|
|
|
monthOffset = 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-09-20 14:53:18 -04:00
|
|
|
-- Reset the calendar to the original settings
|
2011-09-01 04:07:22 -04:00
|
|
|
SetCVar('calendarShowResets', currentCalendarSetting)
|
2011-08-30 20:29:41 -04:00
|
|
|
|
2011-09-20 14:53:18 -04:00
|
|
|
-- And combine for the reset timestamp
|
2011-10-08 06:35:16 -04:00
|
|
|
if(resetDate ~= false) then
|
2011-08-31 03:30:12 -04:00
|
|
|
resetDate.hour = resetTime.hour
|
|
|
|
resetDate.min = resetTime.min
|
|
|
|
resetDate.sec = resetTime.sec
|
2011-08-31 11:20:09 -04:00
|
|
|
|
2011-10-08 06:35:16 -04:00
|
|
|
return time(resetDate)
|
2011-08-31 12:51:17 -04:00
|
|
|
else
|
2011-10-08 06:35:16 -04:00
|
|
|
return false
|
2011-08-31 03:30:12 -04:00
|
|
|
end
|
2011-09-01 03:16:53 -04:00
|
|
|
end
|
|
|
|
|
2011-09-18 08:41:25 -04:00
|
|
|
function core:DrawTooltip()
|
2011-09-20 17:42:06 -04:00
|
|
|
-- UpdateChores before we show the tooltip to make sure we have the most recent data
|
2011-10-08 19:49:07 -04:00
|
|
|
if self.character.level == CURRENT_MAX_LEVEL then
|
2011-10-07 02:41:43 -04:00
|
|
|
-- Should not update without being 100% sure our raid info is correct
|
2011-10-07 19:52:02 -04:00
|
|
|
core:UpdateValorPoints()
|
|
|
|
core:UpdateRaidLockouts()
|
2011-12-03 21:01:07 -05:00
|
|
|
core:UpdateLFRLockouts()
|
2011-10-03 22:04:55 -04:00
|
|
|
end
|
2011-09-23 13:22:57 -04:00
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.tooltip then
|
|
|
|
self.tooltip:ClearAllPoints()
|
|
|
|
self.tooltip:Clear()
|
|
|
|
self.tooltip = nil
|
2011-09-23 13:22:57 -04:00
|
|
|
end
|
2011-09-19 09:11:10 -04:00
|
|
|
local columnCount = 2
|
2011-10-07 19:52:02 -04:00
|
|
|
for instance in pairs(self.db.profile.instances) do
|
|
|
|
if self.db.profile.instances[instance].enable == true and self.db.profile.instances[instance].removed == false then
|
2011-09-23 01:43:15 -04:00
|
|
|
columnCount = columnCount + 1
|
|
|
|
end
|
2011-09-01 03:16:53 -04:00
|
|
|
end
|
2011-12-03 06:16:13 -05:00
|
|
|
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
|
2011-10-07 19:52:02 -04:00
|
|
|
self.tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT')
|
2011-09-19 09:11:10 -04:00
|
|
|
|
|
|
|
-- Populate a table with the information we want for our tooltip
|
2011-09-19 07:42:17 -04:00
|
|
|
local tooltipTable = {}
|
2011-09-23 08:18:04 -04:00
|
|
|
local currentTable = {}
|
2011-10-07 19:52:02 -04:00
|
|
|
for realm in pairs(self.db.global) do
|
|
|
|
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
|
2011-12-03 23:01:37 -05:00
|
|
|
local totalVp = self.db.global[realm][name].valorPoints.total
|
2011-09-01 03:16:53 -04:00
|
|
|
|
2011-09-06 12:23:46 -04:00
|
|
|
if valorPoints == nil then
|
|
|
|
valorPoints = 0
|
|
|
|
end
|
2011-12-03 23:01:37 -05:00
|
|
|
local characterTable = { name = name, realm = realm, class = class, valorPoints = valorPoints, totalVp = totalVp }
|
2011-09-01 03:16:53 -04:00
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
for instance in pairs(self.db.profile.instances) do
|
2011-09-19 07:42:17 -04:00
|
|
|
local defeatedBosses
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.db.global[realm][name].lockouts[instance] ~= nil then
|
|
|
|
defeatedBosses = self.db.global[realm][name].lockouts[instance].defeatedBosses
|
2011-09-01 03:16:53 -04:00
|
|
|
else
|
2011-09-19 07:42:17 -04:00
|
|
|
defeatedBosses = 0
|
2011-09-01 03:16:53 -04:00
|
|
|
end
|
2011-09-20 04:12:08 -04:00
|
|
|
characterTable[instance] = defeatedBosses
|
2011-09-19 07:42:17 -04:00
|
|
|
end
|
2011-09-23 08:18:04 -04:00
|
|
|
|
2011-12-03 06:16:13 -05:00
|
|
|
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
|
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
if name == UnitName('player') and self.db.profile.currentOnTop == true then
|
2011-09-23 08:18:04 -04:00
|
|
|
currentTable = characterTable
|
|
|
|
else
|
|
|
|
table.insert(tooltipTable, characterTable)
|
|
|
|
end
|
2011-09-19 07:42:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-09-20 12:52:40 -04:00
|
|
|
-- Sort table according to options.
|
2011-09-20 04:12:08 -04:00
|
|
|
local sortTooltip = function(a, b)
|
2011-09-20 18:32:22 -04:00
|
|
|
local aValue, bValue
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.db.profile.sortType == 1 then
|
2011-09-20 18:32:22 -04:00
|
|
|
aValue = a.name:lower()
|
|
|
|
bValue = b.name:lower()
|
2011-10-07 19:52:02 -04:00
|
|
|
elseif self.db.profile.sortType == 2 then
|
2011-09-20 18:32:22 -04:00
|
|
|
aValue = a.valorPoints
|
|
|
|
bValue = b.valorPoints
|
2011-10-07 19:52:02 -04:00
|
|
|
elseif self.db.profile.sortType == 3 then
|
2011-09-20 18:32:22 -04:00
|
|
|
aValue = a.class
|
|
|
|
bValue = b.class
|
|
|
|
end
|
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.db.profile.sortDirection == 1 then
|
2011-09-20 18:32:22 -04:00
|
|
|
return aValue < bValue
|
|
|
|
else
|
|
|
|
return aValue > bValue
|
2011-09-20 04:12:08 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
table.sort(tooltipTable, sortTooltip )
|
2011-09-19 09:11:10 -04:00
|
|
|
|
2011-09-23 08:18:04 -04:00
|
|
|
-- Toss the current character on top if it is set that way
|
2011-10-07 19:52:02 -04:00
|
|
|
if self.db.profile.currentOnTop == true then
|
2011-09-23 08:18:04 -04:00
|
|
|
table.insert(tooltipTable, 1, currentTable)
|
|
|
|
end
|
|
|
|
|
2011-09-22 22:56:56 -04:00
|
|
|
-- Create a table for the header; vpPos to decide where to place Valor Points column
|
|
|
|
-- Draw tooltip table then looped through.
|
2011-09-19 07:42:17 -04:00
|
|
|
|
2011-09-19 09:11:10 -04:00
|
|
|
-- Draw the tooltip
|
2011-10-07 19:52:02 -04:00
|
|
|
self.tooltip:AddHeader('')
|
|
|
|
self.tooltip:SetScale(1)
|
|
|
|
local valorPointColumn = self.tooltip:AddColumn('LEFT')
|
|
|
|
self.tooltip:SetCell(1, 1, '')
|
|
|
|
self.tooltip:SetCell(1, 2, 'VP')
|
2011-09-23 01:43:15 -04:00
|
|
|
|
|
|
|
-- Build and sort our headers
|
|
|
|
local headerTable = { }
|
|
|
|
--headerTable['Valor Points'] = { abbreviation = 'VP', enable = true, removed = false, }
|
2011-10-07 19:52:02 -04:00
|
|
|
for instance, instanceInfo in pairs(self.db.profile.instances) do
|
|
|
|
if self.db.profile.instances[instance].enable == true and self.db.profile.instances[instance].removed == false then
|
2011-09-23 01:43:15 -04:00
|
|
|
table.insert(headerTable,instanceInfo)
|
2011-09-22 06:50:30 -04:00
|
|
|
end
|
2011-09-01 03:16:53 -04:00
|
|
|
end
|
2011-12-03 06:16:13 -05:00
|
|
|
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
|
2011-09-01 03:16:53 -04:00
|
|
|
|
2011-09-23 01:43:15 -04:00
|
|
|
local nextColumn = 3
|
|
|
|
for instance,instanceInfo in pairs(headerTable) do
|
2011-10-07 19:52:02 -04:00
|
|
|
self.tooltip:SetCell(1, nextColumn, instanceInfo.abbreviation, nil, 'CENTER')
|
2011-09-23 01:43:15 -04:00
|
|
|
nextColumn = nextColumn + 1
|
|
|
|
end
|
2011-12-03 23:01:37 -05:00
|
|
|
|
|
|
|
if self.db.profile.showTotalVp == true then
|
|
|
|
self.tooltip:SetCell(1, nextColumn, 'Total VP')
|
|
|
|
nextColumn = nextColumn + 1
|
|
|
|
end
|
2011-09-23 01:43:15 -04:00
|
|
|
|
2011-09-20 04:12:08 -04:00
|
|
|
for _,information in pairs(tooltipTable) do
|
2011-10-16 01:17:43 -04:00
|
|
|
if self.db.profile.showServer then
|
|
|
|
information.name = information.name .. '-' .. string.sub(information.realm,0,3)
|
|
|
|
end
|
|
|
|
|
2011-10-07 19:52:02 -04:00
|
|
|
local characterLine = self.tooltip:AddLine('')
|
|
|
|
self.tooltip:SetCell(characterLine, 1, information.name, self.fontObjects[information.class], 'LEFT')
|
2011-09-19 08:48:54 -04:00
|
|
|
|
|
|
|
local valorPointColor
|
2011-12-03 04:26:10 -05:00
|
|
|
if information.valorPoints == MAX_VALOR_POINTS then
|
2011-10-07 19:52:02 -04:00
|
|
|
valorPointColor = self.fontObjects['red']
|
2011-09-19 08:48:54 -04:00
|
|
|
else
|
2011-10-07 19:52:02 -04:00
|
|
|
valorPointColor = self.fontObjects['green']
|
2011-09-19 08:48:54 -04:00
|
|
|
end
|
2011-10-07 19:52:02 -04:00
|
|
|
self.tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT')
|
2011-09-19 08:48:54 -04:00
|
|
|
|
|
|
|
local nextColumn = 3
|
2011-10-07 19:52:02 -04:00
|
|
|
for instance, abbreviation in pairs(self.db.profile.instances) do
|
|
|
|
if self.db.profile.instances[instance].enable == true and self.db.profile.instances[instance].removed == false then
|
2011-09-22 06:50:30 -04:00
|
|
|
local instanceColor
|
|
|
|
if information[instance] == 0 then
|
2011-10-07 19:52:02 -04:00
|
|
|
instanceColor = self.fontObjects['green']
|
2011-09-22 06:50:30 -04:00
|
|
|
else
|
2011-10-07 19:52:02 -04:00
|
|
|
instanceColor = self.fontObjects['red']
|
2011-09-22 06:50:30 -04:00
|
|
|
end
|
2011-10-07 19:52:02 -04:00
|
|
|
self.tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')
|
2011-09-22 06:50:30 -04:00
|
|
|
|
|
|
|
nextColumn = nextColumn + 1
|
2011-09-01 03:16:53 -04:00
|
|
|
end
|
|
|
|
end
|
2011-12-03 06:16:13 -05:00
|
|
|
|
|
|
|
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
|
2011-12-03 23:01:37 -05:00
|
|
|
|
|
|
|
if self.db.profile.showTotalVp then
|
|
|
|
self.tooltip:SetCell(characterLine, nextColumn, information.totalVp, self.fontObjects['green'], 'RIGHT')
|
|
|
|
end
|
2011-12-03 06:16:13 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--[[ PROFILE UPDATES ]]--
|
|
|
|
function core:LFRProfileUpdate()
|
|
|
|
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
|
2011-09-01 03:16:53 -04:00
|
|
|
end
|
2011-08-20 07:41:29 -04:00
|
|
|
end
|