From e21711e684e3b6a82bae79487933d58f92278bb6 Mon Sep 17 00:00:00 2001 From: atomaka Date: Wed, 31 Aug 2011 02:17:58 -0400 Subject: [PATCH] Need to add current timestamp to resetTime to get daily reset. --- ChoreTracker.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ChoreTracker.lua b/ChoreTracker.lua index c0d3ef5..01953b4 100644 --- a/ChoreTracker.lua +++ b/ChoreTracker.lua @@ -44,13 +44,19 @@ local function anchor_OnEnter(self) local class = self.db.global.classes[character] self.tooltip:SetCell(characterLine, 1, character, classColors[class], 'LEFT') - local valorPointColor - if self.db.global.valorPoints[character].points == 980 then + local valorPointColor,valorPoints + if self.db.global.valorPoints[character] == nil then + valorPoints = 0 + else + valorPoints = self.db.global.valorPoints[character].points + end + + if valorPoints == 980 then valorPointColor = flagColors['red'] else valorPointColor = flagColors['green'] end - self.tooltip:SetCell(characterLine, 2, self.db.global.valorPoints[character].points, valorPointColor, 'LEFT') + self.tooltip:SetCell(characterLine, 2, valorPoints, valorPointColor, 'LEFT') local nextColumn = 3 for instance,abbreviation in pairs(trackedInstances) do @@ -121,6 +127,9 @@ function core:OnEnable() if self.db.global.lockouts[name] == nil then self.db.global.lockouts[name] = {} end + if self.db.global.valorPoints[name] == nil then + self.db.global.valorPoints[name] = {} + end self:RegisterChatCommand('ct', 'ViewChores'); self:RegisterEvent('UPDATE_INSTANCE_INFO', 'UpdateChores') @@ -144,11 +153,13 @@ function core:UpdateChores() --set class if not already set local class = UnitClass('player') self.db.global.classes[name] = class:lower() + local vpReset = core:GetNextVPReset() --store Valor Points + print(name,earnedThisWeek,vpReset) self.db.global.valorPoints[name] = {} self.db.global.valorPoints[name].points = earnedThisWeek - self.db.global.valorPoints[name].resetTime = 0 -- core:GetNextVPReset() + self.db.global.valorPoints[name].resetTime = vpReset --store Saved Instances local savedInstances = GetNumSavedInstances() @@ -190,7 +201,7 @@ function core:GetNextVPReset() --figure out what time the server resets daily information local questReset = GetQuestResetTime() - local resetTime = date('*t', questReset) + local resetTime = date('*t', time() + questReset) --figure out reset day using next BH lockout local _, month, day, year = CalendarGetDate() @@ -227,5 +238,6 @@ function core:GetNextVPReset() resetDate.hour = resetTime.hour resetDate.min = resetTime.min resetDate.sec = resetTime.sec + print(resetDate.hour,resetDate.min,resetDate.sec) return time(resetDate) end \ No newline at end of file