I'm in the process of polishing up a healer-side heal tracker, so you can track your efficiency and your overhealing percentage. I do this by grabbing the events for periodic and regular heals, and checking the health of the target of the heal. Right now its kinda clunky but its working. Essentially it gives you a short listing of your top 5 or 10 heal targets (by total amount) and gives you an efficiency rating on that user. You can then mouseover the user to get detailed information about each spell you've cast.
I've got two problem I'm trying to work out to keep the code as efficient as possible. Table structure looks like:
table["Player"].total
table["Player"].actual
table["Player"]["Spell"].total
table["Player"]["Spell"].actual
table["Player"]["Spell"].casts
table["Player"]["Spell"].crits
I give detailed stats about each individual spell, so you can gauge your efficiency on each type of heal.
Since the table is keyed, I wasn't able to get it sorted based upon the interior elements, so to cut down on the sort time and memory, I'm building an external table of the keys, and sorting that based upon the info we have. For example:
{"Sagart", "Dewin", "Satrina"}
function (a,b) return healStats.a.total > healStats.b.total end)
And that seems to sort the table well, without too many lookups, but I'm wondering if I'm missing something that could make this easier.
The second issue I'm concerned about is the clunky method to lookup the health of the current target.
Code:
function HealTracker_GetActual(unitName, amount)
local unitID = nil
if unitName == "you" then unitID = "player" end
for i, trialUnit in { "party1", "party2", "party3", "party4" } do
if ( unitName == UnitName(trialUnit) ) then
unitID = trialUnit
end
end
for i=1,40,1 do
local trialUnit = "raid"..i;
if ( unitName == UnitName(trialUnit) ) then
unitID = trialUnit
end
end
if not unitID then return nil end
local missinghp = UnitHealthMax(unitID) - UnitHealth(unitID);
local healState = amount - missinghp;
if healState > 0 then return missinghp else return amount end
end
What I plan for here is building a table once of name to unit for lookup, and updating that on party_change events which looks like it will work fine and improve the code, but I'm wondering if anyone has a better idea.
Thanks!