WoWInterface SVN PerfectRaid_QuickHealth

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

PerfectRaid_QuickHealth.lua New file
0,0 → 1,61
local eventFrame = CreateFrame("Frame")
local QuickHealth = LibStub("LibQuickHealth-1.0")
local _G = getfenv(0);
 
-- Map that will contain the units of every guid
local GUIDMap = {};
 
-- This function will regenerate the map
local function RemapGUIDMap()
for key in pairs(GUIDMap) do
GUIDMap[key] = nil;
end
for unit in pairs(PerfectRaid.frames) do
local guid = UnitGUID(unit);
if(not guidMap[guid]) then
guidMap[guid] = {};
end
table.insert(guildMap[guid], unit)
end
end
 
-- env changement code taken from interruptus
local proxyEnv = {
UnitHealth = function(...) return QuickHealth.UnitHealth(QuickHealth, ...); end,
}
 
setmetatable(proxyEnv, {
__index = _G,
__newindex = function (t, k, v) _G[k] = v end,
})
 
local handlerTable = {};
eventFrame:SetScript("OnEvent", function(self, event, ...)
handlerTable[event](...);
end);
 
function handlerTable.PLAYER_LOGIN(self)
local oldEnv = getfenv(PerfectRaid.UNIT_HEALTH);
QuickHealth.RegisterCallback(self, "HealthUpdated", function(event, GUID, newHealth)
setfenv(PerfectRaid.UNIT_HEALTH, proxyEnv);
local unitids = GUIDMap[GUID];
if(unitids) then
for i = 1, #unitids do
PerfectRaid:UNIT_HEALTH("UNIT_HEALTH", unitids[i]);
end
end
setfenv(PerfectRaid.UNIT_HEALTH, oldEnv);
end);
end
 
-- Remap guids when party changed ONLY if we're not in a raid.
function handlerTable:PARTY_MEMBERS_CHANGED()
if(GetNumRaidMembers() > 0) then return end
RemapGUIDMap();
end
 
-- Remap guids when the raid roster gets updated.
handlerTable.RAID_ROSTER_UPDATE = RemapGUIDMap;
eventFrame:RegisterEvent("PARTY_MEMBERS_CHANGED");
eventFrame:RegisterEvent("RAID_ROSTER_UPDATE");
eventFrame:RegisterEvent("PLAYER_LOGIN");
PerfectRaid_QuickHealth.toc New file
0,0 → 1,8
## Interface: 20400
## Title: PerfectRaid_QuickHealth
## Version: wowi:revision
## Author: Cladhaire
## Notes: A plugin for LibQuickHealth (cncfanatics) for PerfectRaid)
 
PerfectRaid_QuickHealth.lua
libs\LibQuickHealth-1.0\LibQuickHealth-1.0.xml
. Property changes : Added: svn:externals + libs/LibQuickHealth-1.0 http://svn.wowace.com/wowace/trunk/LibQuickHealth-1.0/