Code checkup (007) & bugs/annoyances I noticed (in 006, haven't ran 007 yet).
1) The function MySort() is no longer being used and can be removed...
2) CheckSov()
You're testing the variable
caster but this wasn't ever initialised anywhere in the rest of the code. From what I can tell this should have been the next variable declared (and initialised) a bit higher at the UnitDebuff() call.
3) Interesting to see you removed the 3nd ability in line... It's kinda annoying (and time consuming) to predic future events...
4) The range check currently is annoyingin that it checks melee range on all abilities.
I guess it depends what you really expect here... Do you expect a 'in melee range' indicator or a 'out of range for this ability'. It does the 'in melee range' now, which I find annoying if the current ability has a longer range than that.
Add an option for range checking... "Disabled", "Melee range" (and "Spell range").
5) GetBest()
xprio = 1
xcd = pq[1].xcd
I could be missing the point or the clever trick here, but... it would appear to me this should either be...
- xprio = 1 and xcd =
<ArbitraryLargeValue> to make sure you'll be taking the 'if' branch to set the x-variables to the 1st priority item but then you can better do is the next way...
- xprio =
pq[i].priority, xcd = pq[1].xcd
, pq[1].xcd = max(0, pq[i]xcd] - 1.5) and
start the for loop at 2 instead of 1.
Looking at it now. I'm getting the impression it will sometimes have xprio set to 1 where it should have it set to pq[1].priority
6) since the (2) items in the qd table are intended as copies of an item of the pq table...
wouldn't it be more optimal to have qd just be indexes into the pq table rather than actual copies ?
instead of the self:QD() call:
with appropriate changes in UpdateUi() et al.
7) CheckQueue()
v = pq[i]
you're creating a reference to the pq[i] item, but you still end up using pq[i] (as well as v) in the rest of the for loop.
8) CenterHorizontally()
db.x = (UIParent:GetWidth() / 2 - 110 * db.scale) / db.scale
that line (the 110) got me boggled for a while until I realised it's a hardcoded reference to the width of the frame (half of 220)
Hardcoded values are bad, mkay

-> db.x = ( (UIParent:GetWidth() - (self.frame:GetWidth() * db.scale) / 2 ) / db.scale ? (the self.frame:GetWidth() could be wrong though).