1
0
Fork 0

Final adjustments prepping for initial release build.

This commit is contained in:
Andrew Tomaka 2011-09-26 16:09:30 -04:00
parent 65d7743bd6
commit d6ba74dca0
1 changed files with 23 additions and 49 deletions

View File

@ -1,14 +1,15 @@
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, LBZ
local db, tooltip, Z, vpResetTime local db, tooltip, vpResetTime
local fontObjects = { }
-- Localization -- Localization
local L = LibStub('AceLocale-3.0'):GetLocale('ChoreTracker') local L = LibStub('AceLocale-3.0'):GetLocale('ChoreTracker')
-- Get localized instances -- Get localized instances
LBZ = LibStub('LibBabble-Zone-3.0') LBZ = LibStub('LibBabble-Zone-3.0')
Z = LBZ:GetLookupTable() local Z = LBZ:GetLookupTable()
local defaults = { local defaults = {
global = {}, global = {},
@ -18,8 +19,6 @@ local defaults = {
}, },
sortType = 1, sortType = 1,
sortDirection = 1, sortDirection = 1,
vertSortDirection = 1,
vpPos = 1,
currentOnTop = false, currentOnTop = false,
instances = { instances = {
[Z['Baradin Hold']] = { abbreviation = 'BH', enable = true, removed = false, }, [Z['Baradin Hold']] = { abbreviation = 'BH', enable = true, removed = false, },
@ -80,45 +79,17 @@ local options = {
get = function(info) return db.profile.sortDirection end, get = function(info) return db.profile.sortDirection end,
set = function(info, value) db.profile.sortDirection = value end, set = function(info, value) db.profile.sortDirection = value end,
}, },
--[[horizontalHeader = {
name = 'Horizontal Sorting',
type = 'header',
order = 5,
},
vpPos = {
name = 'Valor Point Position',
desc = 'Decides the positioning of the Valor Point column.',
type = 'select',
order = 6,
values = { 'Start', 'End' },
get = function(info) return db.profile.vpPos end,
set = function(info, value) db.profile.vpPos = value end,
},
vertSortingDirection = {
name = 'Sorting Direction',
desc = 'Which direction to sort.',
type = 'select',
order = 7,
values = { 'Ascending', 'Descending' },
get = function(info) return db.profile.vertSortDirection end,
set = function(info, value) db.profile.vertSortDirection = value end,
},]]--
}, },
}, },
instances = { instances = {
name = L['Instances'], name = L['Instances'],
type = 'group', type = 'group',
order = 2, order = 2,
args = { args = { },
},
} }
}, },
} }
local classColors = {}
local flagColors = {}
function core:OnInitialize() function core:OnInitialize()
-- Prepare the database if necessary -- Prepare the database if necessary
db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default') db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
@ -158,18 +129,18 @@ function core:OnEnable()
class = 'death knight' class = 'death knight'
end end
classColors[class] = CreateFont('ClassFont' .. class) fontObjects[class] = CreateFont('ClassFont' .. class)
classColors[class]:CopyFontObject(GameTooltipText) fontObjects[class]:CopyFontObject(GameTooltipText)
classColors[class]:SetTextColor(color.r, color.g, color.b) fontObjects[class]:SetTextColor(color.r, color.g, color.b)
end end
flagColors['green'] = CreateFont('FlagFontGreen') fontObjects['green'] = CreateFont('FlagFontGreen')
flagColors['green']:CopyFontObject(GameTooltipText) fontObjects['green']:CopyFontObject(GameTooltipText)
flagColors['green']:SetTextColor(0, 255, 0) fontObjects['green']:SetTextColor(0, 255, 0)
flagColors['red'] = CreateFont('FlagFontRed') fontObjects['red'] = CreateFont('FlagFontRed')
flagColors['red']:CopyFontObject(GameTooltipText) fontObjects['red']:CopyFontObject(GameTooltipText)
flagColors['red']:SetTextColor(255, 0, 0) fontObjects['red']:SetTextColor(255, 0, 0)
-- Setup LDB -- Setup LDB
LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', { LDB = LibStub('LibDataBroker-1.1'):NewDataObject('ChoreTracker', {
@ -234,6 +205,8 @@ function core:OnEnable()
self:RegisterEvent('CALENDAR_UPDATE_EVENT_LIST') self:RegisterEvent('CALENDAR_UPDATE_EVENT_LIST')
self:RegisterEvent('UPDATE_INSTANCE_INFO') self:RegisterEvent('UPDATE_INSTANCE_INFO')
self:RegisterEvent('CHAT_MSG_CURRENCY') self:RegisterEvent('CHAT_MSG_CURRENCY')
-- Need another event to catch instance lockouts. CHAT_MSG_CURRENCY will not fire if you
-- receive no currency (ie. are Valor Point capped).
end end
-- Get calendar events information -- Get calendar events information
@ -265,6 +238,7 @@ end
--[[ FUNCTIONS ]]-- --[[ FUNCTIONS ]]--
function core:DrawInstanceOptions() function core:DrawInstanceOptions()
-- Redraw our instance options everytime they are updated.
options.args.instances.args = { options.args.instances.args = {
instance = { instance = {
name = L['Add instance to track.'], name = L['Add instance to track.'],
@ -341,7 +315,7 @@ function core:UpdateChores()
local name = UnitName('player') local name = UnitName('player')
local _,_,_,earnedThisWeek = GetCurrencyInfo(396) local _,_,_,earnedThisWeek = GetCurrencyInfo(396)
-- Store Valor Points -- Store Valor Points if we were able to establish a reset time.
if vpResetTime ~= nil then if vpResetTime ~= nil then
db.global[realm][name].valorPoints = {} db.global[realm][name].valorPoints = {}
db.global[realm][name].valorPoints.points = earnedThisWeek db.global[realm][name].valorPoints.points = earnedThisWeek
@ -445,7 +419,7 @@ function core:GetNextVPReset()
end end
function core:VerifyInstance(instance) function core:VerifyInstance(instance)
-- User a method similar to GetNextVPReset() to make sure the instance -- Use a method similar to GetNextVPReset() to make sure the instance
-- has a lockout on the calendar -- has a lockout on the calendar
local currentCalendarSetting = GetCVar('calendarShowResets') local currentCalendarSetting = GetCVar('calendarShowResets')
SetCVar('calendarShowResets', 1) SetCVar('calendarShowResets', 1)
@ -585,13 +559,13 @@ function core:DrawTooltip()
for _,information in pairs(tooltipTable) do for _,information in pairs(tooltipTable) do
local characterLine = tooltip:AddLine('') local characterLine = tooltip:AddLine('')
tooltip:SetCell(characterLine, 1, information.name, classColors[information.class], 'LEFT') tooltip:SetCell(characterLine, 1, information.name, fontObjects[information.class], 'LEFT')
local valorPointColor local valorPointColor
if information.valorPoints == 980 then if information.valorPoints == 980 then
valorPointColor = flagColors['red'] valorPointColor = fontObjects['red']
else else
valorPointColor = flagColors['green'] valorPointColor = fontObjects['green']
end end
tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT') tooltip:SetCell(characterLine, 2, information.valorPoints, valorPointColor, 'RIGHT')
@ -600,9 +574,9 @@ function core:DrawTooltip()
if db.profile.instances[instance].enable == true and db.profile.instances[instance].removed == false then if db.profile.instances[instance].enable == true and db.profile.instances[instance].removed == false then
local instanceColor local instanceColor
if information[instance] == 0 then if information[instance] == 0 then
instanceColor = flagColors['green'] instanceColor = fontObjects['green']
else else
instanceColor = flagColors['red'] instanceColor = fontObjects['red']
end end
tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT') tooltip:SetCell(characterLine, nextColumn, information[instance], instanceColor, 'RIGHT')