Added function to attempt to calculate the next Valor point reset.
This commit is contained in:
parent
da98e2725c
commit
30ac962a65
1 changed files with 77 additions and 28 deletions
|
@ -45,12 +45,12 @@ local function anchor_OnEnter(self)
|
|||
self.tooltip:SetCell(characterLine, 1, character, classColors[class], 'LEFT')
|
||||
|
||||
local valorPointColor
|
||||
if self.db.global.valorPoints[character] == 980 then
|
||||
if self.db.global.valorPoints[character].points == 980 then
|
||||
valorPointColor = flagColors['red']
|
||||
else
|
||||
valorPointColor = flagColors['green']
|
||||
end
|
||||
self.tooltip:SetCell(characterLine,2,self.db.global.valorPoints[character],valorPointColor,'LEFT')
|
||||
self.tooltip:SetCell(characterLine, 2, self.db.global.valorPoints[character].points, valorPointColor, 'LEFT')
|
||||
|
||||
local nextColumn = 3
|
||||
for instance,abbreviation in pairs(trackedInstances) do
|
||||
|
@ -76,7 +76,7 @@ function core:OnInitialize()
|
|||
self.db = LibStub('AceDB-3.0'):New('ChoreTrackerDB', defaults, 'Default')
|
||||
|
||||
local ChoresDisplay = CreateFrame('Frame', 'ChoreTrackerFrame', UIParent)
|
||||
ChoresDisplay:SetPoint('CENTER')
|
||||
ChoresDisplay:SetPoint('TOPLEFT')
|
||||
ChoresDisplay.background = ChoresDisplay:CreateTexture(nil, 'BACKGROUND')
|
||||
ChoresDisplay.background:SetAllPoints(true)
|
||||
ChoresDisplay.background:SetTexture(1, 0.5, 0, 0.5)
|
||||
|
@ -146,7 +146,9 @@ function core:UpdateChores()
|
|||
self.db.global.classes[name] = class:lower()
|
||||
|
||||
--store Valor Points
|
||||
self.db.global.valorPoints[name] = earnedThisWeek
|
||||
self.db.global.valorPoints[name] = {}
|
||||
self.db.global.valorPoints[name].points = earnedThisWeek
|
||||
self.db.global.valorPoints[name].resetTime = 0 -- core:GetNextVPReset()
|
||||
|
||||
--store Saved Instances
|
||||
local savedInstances = GetNumSavedInstances()
|
||||
|
@ -180,3 +182,50 @@ end
|
|||
function core:ResetValorPoints()
|
||||
|
||||
end
|
||||
|
||||
function core:GetNextVPReset()
|
||||
--prepare calendar
|
||||
local currentCalendarSetting = GetCVar('calendarShowResets') -- get current value and store
|
||||
SetCVar('calendarShowResets',1) -- set it to what we want
|
||||
|
||||
--figure out what time the server resets daily information
|
||||
local questReset = GetQuestResetTime()
|
||||
local resetTime = date('*t', questReset)
|
||||
|
||||
--figure out reset day using next BH lockout
|
||||
local _, month, day, year = CalendarGetDate()
|
||||
|
||||
local monthOffset = 0
|
||||
local resetDate = nil
|
||||
while resetDate == nil do
|
||||
local todaysEvents = CalendarGetNumDayEvents(monthOffset, day)
|
||||
|
||||
for i = 1,todaysEvents do
|
||||
if todaysEvents == 0 then
|
||||
break
|
||||
end
|
||||
|
||||
local title,hour,minute = CalendarGetDayEvent(monthOffset, day, i)
|
||||
|
||||
if(title == 'Baradin Hold') then
|
||||
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
|
||||
|
||||
--return calendar
|
||||
SetCVar('calendarShowResets',currentCalendarSetting)
|
||||
|
||||
--and combine for the reset timestamp
|
||||
resetDate.hour = resetTime.hour
|
||||
resetDate.min = resetTime.min
|
||||
resetDate.sec = resetTime.sec
|
||||
return time(resetDate)
|
||||
end
|
Loading…
Reference in a new issue