1
0
Fork 0

Compare commits

...

57 commits

Author SHA1 Message Date
5f7cfc7610 Use CURRENCY_DISPLAY_UPDATE to track Valor Point spending. 2011-12-06 19:13:13 -05:00
da5111170f Probably fix LFR lockouts not resetting. 2011-12-06 17:23:06 -05:00
4cee09a6d4 Fix issue with low level characters. 2011-12-04 03:14:36 -05:00
be3b33f3e4 Track total VP for each character and display if enabled. 2011-12-03 23:01:37 -05:00
4a80527bf5 Add LFR instances to defaults directly from API for localization reasons. 2011-12-03 22:42:03 -05:00
53974a8640 Use LFG_LOCK_INFO_RECEIVED for updating LFR data. 2011-12-03 21:01:07 -05:00
ba5151792f Track the two new LFR Instances. 2011-12-03 06:16:13 -05:00
20156e6f94 Change defaults to account for new 4.3 instances. 2011-12-03 04:38:08 -05:00
0b3278e883 Change max valor points to 1000 2011-12-03 04:26:10 -05:00
0fefdb710d 4.3 TOC Bump 2011-12-03 04:24:05 -05:00
2c5c8735cb TOC Bump for 4.3 2011-12-02 17:10:28 -05:00
64af7e3bc2 Make sure that vpResetTime is refreshed when the UI is reloaded 2011-10-18 14:15:38 -04:00
4262c0cdb6 Include an option that will allow the user to show a realm abbreviation next to their character name. 2011-10-16 01:17:43 -04:00
691540a108 Fixed a bug preventing Valor Points from resetting. 2011-10-11 12:09:45 -04:00
754ad92e27 More scope fixes. 2011-10-08 19:54:12 -04:00
8309a33c8f Several scope fixes. 2011-10-08 19:49:07 -04:00
130467f864 Store all character information at enable instead of recalling everytime it's needed. 2011-10-08 18:26:00 -04:00
2b214a8943 Combine raid instance lockout search functions. 2011-10-08 06:35:16 -04:00
79ba491c9a Various reorganizing. 2011-10-07 19:52:02 -04:00
d7efdbe934 Only update instance lockouts when raid info is fresh. 2011-10-07 02:41:43 -04:00
ad62d9af11 Remove debugging stuff. 2011-10-03 22:41:55 -04:00
b59717d06c Use INSTANCE_ENCOUNTER_ENGAGE_UNIT for better detection. 2011-10-03 22:04:55 -04:00
d47828edf5 RequestLFDPlayerLockInfo() should increase vp update accuracy. 2011-10-01 17:30:12 -04:00
2417f3b9fe Potential fix for an issue when the next vp reset time cannot be calculated. 2011-10-01 17:14:44 -04:00
d6ba74dca0 Final adjustments prepping for initial release build. 2011-09-26 16:09:30 -04:00
65d7743bd6 Fix column issue with rotating through sorting. 2011-09-23 16:04:54 -04:00
79b2b215ce Left click for clycling through sort methods; Right click for options. (column count issue, currently) 2011-09-23 13:22:57 -04:00
f8f20f2229 Add option to place current character at the top of the list. 2011-09-23 08:18:04 -04:00
a4d74ac126 Adding basic Curse description to github README file. 2011-09-23 06:46:01 -04:00
d607cdb3b6 Add localization via AceLocale. 2011-09-23 06:36:34 -04:00
8f02f9760e Automatically use first letter of instance as initial abbreviation. 2011-09-23 01:44:32 -04:00
cb2d4649ce Need to redraw the non-repeating parts of the instance page as well. 2011-09-23 01:43:15 -04:00
aea18de7ed Redraw interface when processing added and removed user instances. 2011-09-23 01:15:44 -04:00
8cb8121d7b Added more options to settings page. Functionality of these options NYI. 2011-09-22 22:56:56 -04:00
c63388354c Show/hide instances based on user preferences. 2011-09-22 06:50:30 -04:00
99b095a519 Validate user added instances before actually adding them. 2011-09-22 06:37:57 -04:00
7d360afb1c Implement non-functioning layout for instance adds/removes. 2011-09-21 12:21:14 -04:00
50edab43d8 Allow user to change the abbreviation for a specific instance. 2011-09-21 11:36:24 -04:00
9b31a2f28f Implemented beginning of options for user selected instances. 2011-09-21 11:05:06 -04:00
3a5412ba73 Added more sorting stuff. 2011-09-21 01:32:59 -04:00
10449cd7cb Fixed an issue that would sometimes not update your instance information correctly. 2011-09-20 18:32:22 -04:00
a512d4cbb8 Move calendar stuff from OnInitialize() to OnEnable(). 2011-09-20 17:42:06 -04:00
460807d179 Random test of LUA error fixing problem 2011-09-20 16:48:39 -04:00
1905d59705 Fix previous bug involving viewing raid resets without using LoadAddOn() 2011-09-20 16:41:54 -04:00
c17d902b62 Current issue with OpenCalendar() preventing Raid Reset listing; revert to LoadAddOn() 2011-09-20 15:25:39 -04:00
fca9fd3c50 Fixed some comment formats. 2011-09-20 14:53:18 -04:00
73a4d7b9fd RequestRaidInfo() and not GetSavedInstanceInfo() 2011-09-20 13:53:25 -04:00
af1693d562 Merge branch 'sorting' 2011-09-20 13:04:58 -04:00
4f7dce48b5 Guarantee instance update by requesting information and then updating when we are told it is ready. 2011-09-20 12:57:51 -04:00
24682f9b5f Minor reordering. 2011-09-20 12:52:40 -04:00
6cd2ee2e21 Added options to select sort field and direction. 2011-09-20 04:12:08 -04:00
070a1641ef Apparently, this is not PHP and you cannot sort lists. 2011-09-20 01:12:22 -04:00
4d11c25c2c Store with name and realm in table to prevent duplicate name issues. 2011-09-19 09:11:10 -04:00
934b03bed9 Use infomration table to create the tooltip. 2011-09-19 08:48:54 -04:00
2106926a1e Create table of information needed in tooltip. 2011-09-19 07:42:17 -04:00
0004b1c785 Meaningless commit to test new branch. 2011-09-19 05:53:40 -04:00
c15bb5c8d5 Make minimap button toggle. 2011-09-19 04:59:17 -04:00
14 changed files with 675 additions and 166 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.hg
.hgignore
.hgtags

View file

@ -8,6 +8,7 @@ externals:
Libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk Libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk
Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0 Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
Libs/AceEvent-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0 Libs/AceEvent-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
Libs/AceLocale-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
Libs/LibBabble-Zone-3.0: svn://svn.wowace.com/wow/libbabble-zone-3-0/mainline/trunk Libs/LibBabble-Zone-3.0: svn://svn.wowace.com/wow/libbabble-zone-3-0/mainline/trunk
Libs/LibQTip-1.0: svn://svn.wowace.com/wow/libqtip-1-0/mainline/trunk Libs/LibQTip-1.0: svn://svn.wowace.com/wow/libqtip-1-0/mainline/trunk
Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0 Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0

View file

@ -1,7 +1,16 @@
ChoreTracker = LibStub('AceAddon-3.0'):NewAddon('ChoreTracker', 'AceConsole-3.0', 'AceEvent-3.0') ChoreTracker = LibStub('AceAddon-3.0'):NewAddon('ChoreTracker', 'AceConsole-3.0', 'AceEvent-3.0')
local core = ChoreTracker local core = ChoreTracker
local LQT, LDB, LDBIcon, LBZ local LQT, LDB, LDBIcon
local db, tooltip, zones, trackedInstances, vpResetTime
-- Localization
local L = LibStub('AceLocale-3.0'):GetLocale('ChoreTracker')
-- Get localized instances
local Z = LibStub('LibBabble-Zone-3.0'):GetLookupTable()
--
local CURRENT_MAX_LEVEL = 85
local MAX_VALOR_POINTS = 1000
local defaults = { local defaults = {
global = {}, global = {},
@ -9,219 +18,508 @@ local defaults = {
minimap = { minimap = {
hide = false, hide = false,
}, },
instances = {}, sortType = 1,
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, },
[Z['Firelands']] = { abbreviation = 'FL', enable = true, removed = false, },
[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, },
},
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 = { local options = {
name = 'ChoreTracker', name = 'ChoreTracker',
type = 'group', type = 'group',
args = { args = {
minimap = { general = {
name = 'Hide Minimap Icon', name = L['Settings'],
desc = 'Removes the icon from your minimap.', type = 'group',
type = 'toggle', order = 1,
get = function(info) return db.profile.minimap.hide end, args = {
set = function(info, value) db.profile.minimap.hide = value LDBIcon[value and 'Hide' or 'Show'](LDBIcon, 'ChoreTracker') end, minimap = {
} name = L['Hide Minimap Icon'],
} desc = L['Removes the icon from your minimap.'],
type = 'toggle',
order = 1,
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,
},
verticalHeader = {
name = L['Vertical Sorting'],
type = 'header',
order = 2,
},
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,
get = function(info) return core.db.profile.currentOnTop end,
set = function(info, value) core.db.profile.currentOnTop = value end,
},
sortType = {
name = L['Sort Field'],
desc = L['Field to sort the tooltip by.'],
type = 'select',
order = 5,
values = { L['Character'], L['Valor Points'], L['Class'] },
get = function(info) return core.db.profile.sortType end,
set = function(info, value) core.db.profile.sortType = value end,
},
sortingDirection = {
name = L['Sorting Direction'],
desc = L['Which direction to sort.'],
type = 'select',
order = 6,
values = { L['Ascending'], L['Descending'] },
get = function(info) return core.db.profile.sortDirection end,
set = function(info, value) core.db.profile.sortDirection = value end,
},
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,
},
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 = {
name = L['Instances'],
type = 'group',
order = 20,
args = { },
},
},
} }
local classColors = {}
local flagColors = {}
function core:OnInitialize() function core:OnInitialize()
-- Prepare the database if necessary self.db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
local level = UnitLevel('player') self.character = {
local realm = GetRealmName() name = UnitName('player'),
local name = UnitName('player') level = UnitLevel('player'),
if db.global[realm] == nil then class = UnitClass('player'),
db.global[realm] = {} realm = GetRealmName(),
}
self.character.class = self.character.class:lower():gsub("%s*(.-)%s*", "%1")
if self.db.global[self.character.realm] == nil then
self.db.global[self.character.realm] = {}
end end
if db.global[realm][name] == nil and level == 85 then if self.db.global[self.character.realm][self.character.name] == nil and self.character.level == CURRENT_MAX_LEVEL then
db.global[realm][name] = {} self.db.global[self.character.realm][self.character.name] = {}
local class = UnitClass('player') self.db.global[self.character.realm][self.character.name].class = self.character.class
class = class:lower() self.db.global[self.character.realm][self.character.name].valorPoints = {
if class == 'deathknight' then total = 0,
class = 'death knight' points = 0,
end
db.global[realm][name].class = class
db.global[realm][name].valorPoints = {
valorPoints = 0,
resetTime = 0, resetTime = 0,
} }
db.global[realm][name].lockouts = {} self.db.global[self.character.realm][self.character.name].lockouts = {}
end end
-- Register events (here for now; track data regardless of whether it is displayed?) if self.db.global[self.character.realm][self.character.name] ~= nil then
local level = UnitLevel('player') if self.db.global[self.character.realm][self.character.name].lfrs == nil and self.character.level == CURRENT_MAX_LEVEL then
if level == 85 then self.db.global[self.character.realm][self.character.name].lfrs = {}
self:RegisterEvent('CALENDAR_UPDATE_EVENT_LIST','GetNextVPReset') end
self:RegisterEvent('UPDATE_INSTANCE_INFO', 'UpdateChores')
self:RegisterEvent('CHAT_MSG_CURRENCY', 'UpdateChores')
end end
-- Get calendar events information -- Add LFR stuff to profile if it isn't there already
OpenCalendar() core:LFRProfileUpdate()
-- Reset data if necessary
core:ResetInstances()
core:ResetValorPoints()
end end
function core:OnEnable() function core:OnEnable()
LQT = LibStub('LibQTip-1.0') LQT = LibStub('LibQTip-1.0')
LBZ = LibStub('LibBabble-Zone-3.0')
self.instanceInfoTime = false
self.vpResetTime = false
-- Setup font strings for later. (RAID_CLASS_COLORS always indexed in English?) -- Setup font strings for later. (RAID_CLASS_COLORS always indexed in English?)
for class,color in pairs(RAID_CLASS_COLORS) do self.fontObjects = { }
for class, color in pairs(RAID_CLASS_COLORS) do
class = class:lower() class = class:lower()
if class == 'deathknight' then
class = 'death knight'
end
classColors[class] = CreateFont('ClassFont' .. class) self.fontObjects[class] = CreateFont('ClassFont' .. class)
classColors[class]:CopyFontObject(GameTooltipText) self.fontObjects[class]:CopyFontObject(GameTooltipText)
classColors[class]:SetTextColor(color.r, color.g, color.b) self.fontObjects[class]:SetTextColor(color.r, color.g, color.b)
end end
flagColors['green'] = CreateFont('FlagFontGreen') self.fontObjects['green'] = CreateFont('FlagFontGreen')
flagColors['green']:CopyFontObject(GameTooltipText) self.fontObjects['green']:CopyFontObject(GameTooltipText)
flagColors['green']:SetTextColor(0, 255, 0) self.fontObjects['green']:SetTextColor(0, 255, 0)
flagColors['red'] = CreateFont('FlagFontRed') self.fontObjects['red'] = CreateFont('FlagFontRed')
flagColors['red']:CopyFontObject(GameTooltipText) self.fontObjects['red']:CopyFontObject(GameTooltipText)
flagColors['red']:SetTextColor(255, 0, 0) self.fontObjects['red']:SetTextColor(255, 0, 0)
-- 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)
-- Setup LDB -- Setup LDB
LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', { LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', {
type = 'data source', type = 'data source',
text = 'ChoreTracker', text = 'ChoreTracker',
icon = 'Interface\\AddOns\\ChoreTracker\\icon', icon = 'Interface\\AddOns\\ChoreTracker\\icon',
OnClick = function() LibStub("AceConfigDialog-3.0"):Open("ChoreTracker") end, OnClick = function(self, button)
OnEnter = function(self) if button == 'RightButton' then
local columnCount = 2 if LibStub("AceConfigDialog-3.0").OpenFrames['ChoreTracker'] then
for instance,abbreviation in pairs(trackedInstances) do LibStub('AceConfigDialog-3.0'):Close('ChoreTracker')
columnCount = columnCount + 1 else
end LibStub('AceConfigDialog-3.0'):Open('ChoreTracker')
tooltip = LQT:Acquire('ChoreTrackerTooltip', columnCount, 'LEFT', 'CENTER', 'RIGHT') end
else
-- Cycle through our sort options
if core.db.profile.sortType == 1 then
core.db.profile.sortType = 2
core:DrawTooltip()
elseif core.db.profile.sortType == 2 then
core.db.profile.sortType = 3
core:DrawTooltip()
else
core.db.profile.sortType = 1
core:DrawTooltip()
end
end
end,
OnEnter = function(self)
core:DrawTooltip() core:DrawTooltip()
tooltip:SmartAnchorTo(self) core.tooltip:SmartAnchorTo(self)
tooltip:Show() core.tooltip:Show()
end, end,
OnLeave = function(self) OnLeave = function(self)
LQT:Release(tooltip) LQT:Release(core.tooltip)
tooltip = nil core.tooltip = nil
end, end,
}) })
-- Deal with minimap -- Deal with minimap
LDBIcon = LibStub('LibDBIcon-1.0') LDBIcon = LibStub('LibDBIcon-1.0')
LDBIcon:Register('ChoreTracker', LDB, db.profile.minimap) LDBIcon:Register('ChoreTracker', LDB, self.db.profile.minimap)
if db.profile.minimap.hide then if self.db.profile.minimap.hide then
LDBIcon:Hide('ChoreTracker') LDBIcon:Hide('ChoreTracker')
else else
LDBIcon:Show('ChoreTracker') LDBIcon:Show('ChoreTracker')
end end
-- Get instances -- Register events
zones = LBZ:GetLookupTable() if self.character.level == CURRENT_MAX_LEVEL then
self:RegisterEvent('PLAYER_ENTERING_WORLD')
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
trackedInstances = { -- Get calendar events information
[zones['Baradin Hold']] = 'BH', OpenCalendar()
[zones['Firelands']] = 'FL',
[zones['The Bastion of Twilight']] = 'BoT',
[zones['Blackwing Descent']] = 'BWD',
[zones['Throne of the Four Winds']] = '4W',
}
-- Add options to Interface Panel -- Reset data if necessary
LibStub('AceConfigRegistry-3.0'):RegisterOptionsTable('ChoreTracker', options) core:ResetRaidLockouts()
local ACD = LibStub('AceConfigDialog-3.0') core:ResetValorPoints()
ACD:AddToBlizOptions('ChoreTracker', 'ChoreTracker') core:ResetLFRLockouts()
end end
function core:UpdateChores()
-- Reset data if necessary
core:ResetInstances()
core:ResetValorPoints()
local realm = GetRealmName()
local name = UnitName('player')
local _,_,_,earnedThisWeek = GetCurrencyInfo(396)
--store Valor Points
if vpResetTime ~= nil then --[[ EVENTS ]]--
db.global[realm][name].valorPoints = {} function core:PLAYER_ENTERING_WORLD()
db.global[realm][name].valorPoints.points = earnedThisWeek self.vpResetTime = core:FindLockout(Z['Baradin Hold'])
db.global[realm][name].valorPoints.resetTime = vpResetTime end
function core:CALENDAR_UPDATE_EVENT_LIST()
self.vpResetTime = core:FindLockout(Z['Baradin Hold'])
end
function core:UPDATE_INSTANCE_INFO()
self.instanceInfoTime = time()
core:UpdateRaidLockouts()
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()
end
-- Might only fire for encounters with a boss frame.
function core:INSTANCE_ENCOUNTER_ENGAGE_UNIT()
RequestRaidInfo()
RequestLFDPlayerLockInfo()
end
--[[ FUNCTIONS ]]--
function core:UpdateValorPoints()
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 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
end
--store Saved Instances function core:ResetValorPoints()
local savedInstances = GetNumSavedInstances() for realm, realmTable in pairs(self.db.global) do
for i = 1, savedInstances do for name in pairs(realmTable) do
local instanceName, _, instanceReset, _, _, _, _, _, _, _, _, defeatedBosses = GetSavedInstanceInfo(i) if self.db.global[realm][name].valorPoints.resetTime < time() then
self.db.global[realm][name].valorPoints.points = 0
if trackedInstances[instanceName] ~= nil then self.db.global[realm][name].valorPoints.resetTime = 0
if instanceReset > 0 then
db.global[realm][name].lockouts[instanceName] = {}
db.global[realm][name].lockouts[instanceName].defeatedBosses = defeatedBosses
db.global[realm][name].lockouts[instanceName].resetTime = time() + instanceReset
else
db.global[realm][name].lockouts[instanceName] = nil
end end
end end
end end
end end
function core:ResetInstances() function core:UpdateRaidLockouts()
for realm,realmTable in pairs(db.global) do 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] = {}
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
end
end
end
end
function core:ResetRaidLockouts()
for realm,realmTable in pairs(self.db.global) do
for name in pairs(realmTable) do for name in pairs(realmTable) do
for instance,instanceTable in pairs(db.global[realm][name].lockouts) do for instance,instanceTable in pairs(self.db.global[realm][name].lockouts) do
if instanceTable.resetTime < time() then if instanceTable.resetTime < time() then
db.global[realm][name].lockouts[instance] = nil self.db.global[realm][name].lockouts[instance] = nil
end end
end end
end end
end end
end end
function core:ResetValorPoints() function core:UpdateLFRLockouts()
for realm,realmTable in pairs(db.global) do 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 name in pairs(realmTable) do
if db.global[realm][name].valorPoints.resetTime < time() then for instance,instanceTable in pairs(self.db.global[realm][name].lfrs) do
db.global[realm][name].valorPoints = { if instanceTable.resetTime < time() then
valorPoints = 0, self.db.global[realm][name].lfrs[instance] = nil
resetTime = 0, end
}
end end
end end
end end
end end
function core:GetNextVPReset() function core:DrawInstanceOptions()
--prepare calendar -- Redraw our instance options everytime they are updated.
local currentCalendarSetting = GetCVar('calendarShowResets') -- get current value and store options.args.instances.args = {
SetCVar('calendarShowResets', 1) -- set it to what we want instance = {
name = L['Add instance to track.'],
desc = L['Enter an instance on a lockout that you would like ChoreTracker to track.'],
type = 'input',
order = 1,
set = function(info, value)
if core:FindLockout(value) then
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
core:DrawInstanceOptions()
else
print('Invalid instance')
end
end,
},
lfrsHeader = {
name = L['Looking for Raid Instances'],
type = 'header',
order = 100,
},
instancesHeader = {
name = L['Instances'],
type = 'header',
order = 500,
},
}
local i = 1
for instance, abbreviation in pairs(self.db.profile.instances) do
if self.db.profile.instances[instance].removed == false then
options.args.instances.args[instance .. 'Enable'] = {
type = 'toggle',
name = instance,
order = 500 + (5 * i) + 0,
get = function(info) return self.db.profile.instances[instance].enable end,
set = function(info, value)
self.db.profile.instances[instance].enable = value
core:DrawInstanceOptions()
end,
}
options.args.instances.args[instance .. 'Abbreviation'] = {
type = 'input',
name = '',
order = 500 + (5 * i) + 1,
width = 'half',
get = function(info) return self.db.profile.instances[instance].abbreviation end,
set = function(info, value) self.db.profile.instances[instance].abbreviation = value end,
}
options.args.instances.args[instance .. 'Remove'] = {
type = 'execute',
name = L['Remove'],
order = 500 + (5 * i) + 2,
width = 'half',
confirm = true,
func = function()
self.db.profile.instances[instance].removed = true
core:DrawInstanceOptions()
end,
}
options.args.instances.args[instance .. 'Spacer'] = {
type = 'description',
name = '',
order = 500 + (5 * i) + 3,
}
i = i + 1
end
end
--figure out what time the server resets daily information 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
end
end
end
function core:FindLockout(instance)
-- We need to have access to the instance lockouts on the calendar.
local currentCalendarSetting = GetCVar('calendarShowResets')
SetCVar('calendarShowResets', 1)
-- Figure out what time the server resets daily information
local questReset = GetQuestResetTime() local questReset = GetQuestResetTime()
local resetTime = date('*t', time() + questReset) local resetTime = date('*t', time() + questReset)
--figure out reset day using next BH lockout -- Figure out reset day using next BH lockout
local _, month, day, year = CalendarGetDate() local _, month, day, year = CalendarGetDate()
local monthOffset = 0 local monthOffset = 0
local resetDate = nil local resetDate = false
while resetDate == nil do while resetDate == false do
local todaysEvents = CalendarGetNumDayEvents(monthOffset, day) local todaysEvents = CalendarGetNumDayEvents(monthOffset, day)
for i = 1,todaysEvents do for i = 1,todaysEvents do
@ -231,7 +529,7 @@ function core:GetNextVPReset()
local title,hour,minute = CalendarGetDayEvent(monthOffset, day, i) local title,hour,minute = CalendarGetDayEvent(monthOffset, day, i)
if title == zones['Baradin Hold'] then if title == instance then
resetDate = { year = year, month = month + monthOffset, day = day } resetDate = { year = year, month = month + monthOffset, day = day }
end end
end end
@ -244,61 +542,219 @@ function core:GetNextVPReset()
end end
end end
--return calendar -- Reset the calendar to the original settings
SetCVar('calendarShowResets', currentCalendarSetting) SetCVar('calendarShowResets', currentCalendarSetting)
--and combine for the reset timestamp -- And combine for the reset timestamp
if(resetDate ~= nil) then if(resetDate ~= false) then
resetDate.hour = resetTime.hour resetDate.hour = resetTime.hour
resetDate.min = resetTime.min resetDate.min = resetTime.min
resetDate.sec = resetTime.sec resetDate.sec = resetTime.sec
vpResetTime = time(resetDate) return time(resetDate)
else else
vpResetTime = nil return false
end end
end end
function core:DrawTooltip() function core:DrawTooltip()
--create the tooltip header -- UpdateChores before we show the tooltip to make sure we have the most recent data
tooltip:AddHeader('') if self.character.level == CURRENT_MAX_LEVEL then
local valorPointColumn = tooltip:AddColumn('LEFT') -- Should not update without being 100% sure our raid info is correct
tooltip:SetCell(1, 1, '') core:UpdateValorPoints()
tooltip:SetCell(1, 2, 'VP') core:UpdateRaidLockouts()
local nextColumn = 3 core:UpdateLFRLockouts()
for instance,abbreviation in pairs(trackedInstances) do
tooltip:SetCell(1, nextColumn, abbreviation, nil, 'CENTER')
nextColumn = nextColumn + 1
end end
for realm in pairs(db.global) do if self.tooltip then
for name in pairs(db.global[realm]) do self.tooltip:ClearAllPoints()
local characterLine = tooltip:AddLine('') self.tooltip:Clear()
local class = db.global[realm][name].class self.tooltip = nil
tooltip:SetCell(characterLine, 1, name, classColors[class], 'LEFT') end
local columnCount = 2
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
columnCount = columnCount + 1
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')
-- Populate a table with the information we want for our tooltip
local tooltipTable = {}
local currentTable = {}
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
local totalVp = self.db.global[realm][name].valorPoints.total
local valorPoints, valorPointColor
valorPoints = db.global[realm][name].valorPoints.points
if valorPoints == nil then if valorPoints == nil then
valorPoints = 0 valorPoints = 0
end end
if valorPoints == 980 then local characterTable = { name = name, realm = realm, class = class, valorPoints = valorPoints, totalVp = totalVp }
valorPointColor = flagColors['red']
else
valorPointColor = flagColors['green']
end
tooltip:SetCell(characterLine, 2, valorPoints, valorPointColor, 'RIGHT')
local nextColumn = 3 for instance in pairs(self.db.profile.instances) do
for instance,abbreviation in pairs(trackedInstances) do local defeatedBosses
if db.global[realm][name].lockouts[instance] ~= nil then if self.db.global[realm][name].lockouts[instance] ~= nil then
local defeatedBosses = db.global[realm][name].lockouts[instance].defeatedBosses defeatedBosses = self.db.global[realm][name].lockouts[instance].defeatedBosses
tooltip:SetCell(characterLine, nextColumn, defeatedBosses, flagColors['red'], 'RIGHT')
else else
tooltip:SetCell(characterLine, nextColumn, '0', flagColors['green'], 'RIGHT') defeatedBosses = 0
end end
characterTable[instance] = defeatedBosses
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
currentTable = characterTable
else
table.insert(tooltipTable, characterTable)
end
end
end
-- Sort table according to options.
local sortTooltip = function(a, b)
local aValue, bValue
if self.db.profile.sortType == 1 then
aValue = a.name:lower()
bValue = b.name:lower()
elseif self.db.profile.sortType == 2 then
aValue = a.valorPoints
bValue = b.valorPoints
elseif self.db.profile.sortType == 3 then
aValue = a.class
bValue = b.class
end
if self.db.profile.sortDirection == 1 then
return aValue < bValue
else
return aValue > bValue
end
end
table.sort(tooltipTable, sortTooltip )
-- Toss the current character on top if it is set that way
if self.db.profile.currentOnTop == true then
table.insert(tooltipTable, 1, currentTable)
end
-- Create a table for the header; vpPos to decide where to place Valor Points column
-- Draw tooltip table then looped through.
-- Draw the tooltip
self.tooltip:AddHeader('')
self.tooltip:SetScale(1)
local valorPointColumn = self.tooltip:AddColumn('LEFT')
self.tooltip:SetCell(1, 1, '')
self.tooltip:SetCell(1, 2, 'VP')
-- Build and sort our headers
local headerTable = { }
--headerTable['Valor Points'] = { abbreviation = 'VP', enable = true, removed = false, }
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
table.insert(headerTable,instanceInfo)
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
for instance,instanceInfo in pairs(headerTable) do
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
information.name = information.name .. '-' .. string.sub(information.realm,0,3)
end
local characterLine = self.tooltip:AddLine('')
self.tooltip:SetCell(characterLine, 1, information.name, self.fontObjects[information.class], 'LEFT')
local valorPointColor
if information.valorPoints == MAX_VALOR_POINTS then
valorPointColor = self.fontObjects['red']
else
valorPointColor = self.fontObjects['green']
end
self.tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT')
local nextColumn = 3
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
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 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
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()
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

View file

@ -1,4 +1,4 @@
## Interface: 42000 ## Interface: 43000
## Title: ChoreTracker ## Title: ChoreTracker
## Version: @project-version@ ## Version: @project-version@
## Author: Gaffer ## Author: Gaffer
@ -14,9 +14,20 @@ Libs\AceConsole-3.0\AceConsole-3.0.xml
Libs\AceConfig-3.0\AceConfig-3.0.xml Libs\AceConfig-3.0\AceConfig-3.0.xml
Libs\AceDB-3.0\AceDB-3.0.xml Libs\AceDB-3.0\AceDB-3.0.xml
Libs\AceEvent-3.0\AceEvent-3.0.xml Libs\AceEvent-3.0\AceEvent-3.0.xml
Libs\AceLocale-3.0\AceLocale-3.0.xml
Libs\LibBabble-Zone-3.0\lib.xml Libs\LibBabble-Zone-3.0\lib.xml
Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
Libs\LibQTip-1.0\lib.xml Libs\LibQTip-1.0\lib.xml
Locale\enUS.lua
Locale\deDE.lua
Locale\esES.lua
Locale\esMX.lua
Locale\frFR.lua
Locale\koKR.lua
Locale\ruRU.lua
Locale\zhCN.lua
Locale\zhTW.lua
ChoreTracker.lua ChoreTracker.lua

4
Locale/deDE.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "deDE")
if not L then return end
--@localization(locale="deDE", format="lua_additive_table", handle-subnamespaces="concat")@

3
Locale/enUS.lua Normal file
View file

@ -0,0 +1,3 @@
local L = LibStub('AceLocale-3.0'):NewLocale('ChoreTracker', 'enUS', true, true)
--@localization(locale='enUS', format='lua_additive_table', same-key-is-true=true, handle-subnamespaces='concat')@

4
Locale/esES.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "esES")
if not L then return end
--@localization(locale="esES", format="lua_additive_table", handle-subnamespaces="concat")@

4
Locale/esMX.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "esMX")
if not L then return end
--@localization(locale="esMX", format="lua_additive_table", handle-subnamespaces="concat")@

4
Locale/frFR.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "frFR")
if not L then return end
--@localization(locale="frFR", format="lua_additive_table", handle-subnamespaces="concat")@

4
Locale/koKR.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "koKR")
if not L then return end
--@localization(locale="koKR", format="lua_additive_table", handle-subnamespaces="concat")@

4
Locale/ruRU.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "ruRU")
if not L then return end
--@localization(locale="ruRU", format="lua_additive_table", handle-subnamespaces="concat")@

4
Locale/zhCN.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "zhCN")
if not L then return end
--@localization(locale="zhCN", format="lua_additive_table", handle-subnamespaces="concat")@

4
Locale/zhTW.lua Normal file
View file

@ -0,0 +1,4 @@
local L = LibStub("AceLocale-3.0"):NewLocale("BalerocHealers", "zhTW")
if not L then return end
--@localization(locale="zhTW", format="lua_additive_table", handle-subnamespaces="concat")@

3
README
View file

@ -0,0 +1,3 @@
As leveling gets easier in World of Warcraft, more and more people are playing more and more alts. And for every alt you add, there are more chores to be done. You have to do your Molten Front dailies on your Hunter, make sure you get your Priest into a Firelands, get that new level 85 Mage into a BWD, and, of course, knock out a Baradin Hold on every 85. Unfortunately, it is incredibly difficult to keep track of all this.
ChoreTracker attempts to solve this problem for you by providing a table of all of your characters with their current Valor Points, Raid Instance locks, and more. Make sure you never miss a Chore again!