From eafba1fd91c2165cfe30e827fbc81527fa65d50b Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 6 May 2016 16:06:20 +0200 Subject: [PATCH] Probably fixed dr comparer errors, also possibly fixed other errors. --- Vect.lua | 3 --- data/drs.lua | 51 ++++++++++++++++++++++++--------------------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/Vect.lua b/Vect.lua index f3654e5..1cd34f0 100644 --- a/Vect.lua +++ b/Vect.lua @@ -1,8 +1,5 @@ --TODOS: ---Bug: have to check if dr is completed on adding it, also do the same with drs (reassign should update them too, because probably thats the cause for ---the comparer error, onupdate is called null out drs while its comparing) - --Option to show pet cds on possible master (eg spell lock on all locks) --document the db these will be needed: diff --git a/data/drs.lua b/data/drs.lua index c7ba981..cd02f48 100644 --- a/data/drs.lua +++ b/data/drs.lua @@ -35,6 +35,7 @@ function Vect:DRDebuffGained(spellID, dstGUID, isPlayer) drCat } else + Vect:UpdateDRs(dstGUID); local cd = 18; local currentTime = GetTime(); local endTime = currentTime + cd; @@ -90,6 +91,7 @@ function Vect:DRDebuffFaded(spellID, dstGUID, isPlayer) drCat } else + Vect:UpdateDRs(dstGUID); local cd = 18; local currentTime = GetTime(); local endTime = currentTime + cd; @@ -135,6 +137,8 @@ function Vect:ReassignDRs(which) end if not self.drs[self.targets[whichs]] then return end; + --update then + Vect:UpdateDRs(self.targets[whichs]); --sort them local tmp = Vect:SortDRs(whichs); --let's fill them up @@ -303,35 +307,28 @@ function Vect:MoveDRTimersStop(which) end end - - function Vect:VOnDRTimerUpdate(which) - --check if we have dr for that unit - if not self.drs[self.targets[which]] then return end - local t = GetTime(); - --let's check if one of the cooldowns finished - for k, v in pairs(self.drs[self.targets[which]]) do - if v[7] == true and v[2] <= t then - self.drs[self.targets[which]][v[8]] = nil; - --we have to update every three, because if somebody is targeted and focused since sorting is - --implemented it triggers only one update, probably it had bugs before too, but got unnoticed - self:ReassignDRs("targetdr"); - self:ReassignDRs("focusdr"); - self:ReassignDRs("selfdr"); - end + if Vect:UpdateDRs(self.targets[which]) then + --we have to update every three, because if somebody is targeted and focused since sorting is + --implemented it triggers only one update, probably it had bugs before too, but got unnoticed + self:ReassignDRs("targetdr"); + self:ReassignDRs("focusdr"); + self:ReassignDRs("selfdr"); end end -function Vect:getDRNumXOffset(size, drNumSize, drNumPos) - local db = Vect.db.profile; - - - return 0; -end - -function Vect:getDRNumYOffset(size, drNumSize, drNumPos) - local db = Vect.db.profile; - - - return 0; +function Vect:UpdateDRs(unitGUID) + if not unitGUID then return end; + --check if we have dr for that unit + if not self.drs[unitGUID] then return end + local t = GetTime(); + local found = false; + --let's check if one of the cooldowns finished + for k, v in pairs(self.drs[unitGUID]) do + if v[7] == true and v[2] <= t then + self.drs[unitGUID][v[8]] = nil; + fount = true; + end + end + return found; end