--- /dev/null
+local normalBarColor = CreateColor(0.3, 0.3, 0.3);
+local normalBackColor = {0.7, 0.7, 0.7};
+local UnitGroupRolesAssigned = UnitGroupRolesAssigned;
+local CompactUnitFrame_UpdateHealthColor = CompactUnitFrame_UpdateHealthColor;
+local CompactRaidFrameContainer_ApplyToFrames = CompactRaidFrameContainer_ApplyToFrames;
+
+-- TODO remove 1px border
+hooksecurefunc("CompactRaidFrameContainer_LayoutFrames", function(frame)
+ if not frame then return end
+ CompactRaidFrameContainer_ApplyToFrames(frame, "normal", function(frame)
+ if frame then
+ -- Health bar color --
+ -- used in CompactUnitFrame_UpdateHealthColor, might not be set prior
+ frame.optionTable.healthBarColorOverride = normalBarColor;
+ frame.background:SetColorTexture(unpack(normalBackColor));
+ -- Power bar display --
+ local role = UnitGroupRolesAssigned(frame.unit);
+ local options = DefaultCompactUnitFrameSetupOptions;
+ if options.displayPowerBar and role ~= "HEALER" then
+ frame.healthBar:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
+ frame.powerBar:Hide();
+ end
+ end
+ end);
+end);
+-- TODO have colors in global addon object only in one place
local normalBarColor = CreateColor(0.3, 0.3, 0.3);
local dispelBarColor = CreateColor(1, 0.5, 0);
local normalBackColor = {0.7, 0.7, 0.7};
local dispelBackColor = {0.5, 0.2, 0};
local UnitDebuff = UnitDebuff;
local CompactUnitFrame_UpdateHealthColor = CompactUnitFrame_UpdateHealthColor;
-local CompactRaidFrameContainer_ApplyToFrames = CompactRaidFrameContainer_ApplyToFrames;
-
-hooksecurefunc("CompactRaidFrameContainer_LayoutFrames", function(frame)
- if not frame then return end
- CompactRaidFrameContainer_ApplyToFrames(frame, "normal", function(frame)
- if frame then
- -- used in CompactUnitFrame_UpdateHealthColor, might not be set prior
- frame.optionTable.healthBarColorOverride = normalBarColor;
- frame.background:SetColorTexture(unpack(normalBackColor));
- end
- end);
-end);
hooksecurefunc("CompactUnitFrame_UpdateDispellableDebuffs", function(frame)
if frame and not frame:IsForbidden() and frame:GetName():match("^CompactRaidFrame%d") then
-- try to find dispellable debuff
if UnitDebuff(frame.displayedUnit, 1, "RAID") ~= nil then
frame.optionTable.healthBarColorOverride = dispelBarColor;
- if frame.background then
- frame.background:SetColorTexture(unpack(dispelBackColor));
- end
+ frame.background:SetColorTexture(unpack(dispelBackColor));
else
frame.optionTable.healthBarColorOverride = normalBarColor;
- if frame.background then
- frame.background:SetColorTexture(unpack(normalBackColor));
- end
+ frame.background:SetColorTexture(unpack(normalBackColor));
end
-- update color
CompactUnitFrame_UpdateHealthColor(frame);
## Interface: 70300
## Title: Raid Frame Customization
-## Version: 1.13
-## Author: Szandos, Jack, schyrio
+## Version: 1.0
+## Author: schyrio
## Notes: Customization to the standard raid frames
## SavedVariables: IndicatorsDB
RaidFrameIndicators.lua
RaidFrameIndicatorsConfig.lua
-RaidFrameNames.lua
-RaidFrameHealth.lua
RaidFrameColors.lua
-RaidFramePowerBars.lua
+UnitFrameSetupHook.lua
+UpdateNameHook.lua
+UpdateStatusTextHook.lua
+LayoutFramesHook.lua
+++ /dev/null
-local UnitIsConnected = UnitIsConnected;
-local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
-local UnitHealthMax = UnitHealthMax;
-local UnitHealth = UnitHealth;
-
-hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(frame)
- if frame and not frame:IsForbidden() then
- local frameName = frame:GetName();
- if frameName and frameName:match("^CompactRaidFrame%d") and frame.unit then
- -- conditions taken from CompactUnitFrame.lua
- if not UnitIsConnected(frame.unit) or UnitIsDeadOrGhost(frame.displayedUnit) then
- return;
- elseif (frame.optionTable.healthText == "losthealth") then
- -- only losthealth option is condensed
- local healthLost = UnitHealthMax(frame.displayedUnit) - UnitHealth(frame.displayedUnit);
- if healthLost <= 0 then return end
-
- local prettyHealth;
- if healthLost > 1200000000 then -- 1.2B
- local h1b = healthLost / 1000000000;
- local h100m = (healthLost % 1000000000) / 100000000;
- prettyHealth = string.format("-%d.%dB", h1b, h100m);
- elseif healthLost > 1200000 then -- 1.2M
- prettyHealth = string.format("-%dM", healthLost / 1000000);
- elseif healthLost > 1000 then -- 1K
- prettyHealth = string.format("-%dK", healthLost / 1000);
- else
- prettyHealth = string.format("-%d", healthLost)
- end
-
- frame.statusText:SetText(prettyHealth);
- end
- end
- end
-end);
DEFAULT_CHAT_FRAME:AddMessage("Indicators: ".. tostring(s));
end
--- Hide buff/debuff icons
-local function hideBlizzardBuffs(frame)
- -- used in CompactUnitFrame_UpdateAuras (Buffs, Debuffs, DispellableDebuffs)
- if frame.optionTable.displayBuffs then
- frame.optionTable.displayBuffs = false
- end
- if frame.optionTable.displayDebuffs then
- frame.optionTable.displayDebuffs = false
- end
- -- TODO
- if frame.optionTable.displayDispelDebuffs then
- frame.optionTable.displayDispelDebuffs = false
- end
-end
-hooksecurefunc("DefaultCompactUnitFrameSetup", hideBlizzardBuffs);
-
-- Set the appearance of the FontStrings
local function setupIndicatorAppearance(frame)
local frameName = frame:GetName();
+++ /dev/null
-local UnitName = UnitName;
-
-hooksecurefunc("CompactUnitFrame_UpdateName", function(frame)
- if frame and not frame:IsForbidden() then
- local frameName = frame:GetName();
- if frameName and frameName:match("^CompactRaidFrame%d") and frame.unit and frame.name then
- local name, _;
- name, _ = UnitName(frame.unit)
- if name then
- frame.name:SetFont(STANDARD_TEXT_FONT, 12, "")
- frame.name:SetText(name)
- end
- end
- end
-end);
+++ /dev/null
-local UnitGroupRolesAssigned = UnitGroupRolesAssigned;
-local CompactRaidFrameContainer_ApplyToFrames = CompactRaidFrameContainer_ApplyToFrames;
-
--- TODO remove 1px border
-hooksecurefunc("CompactRaidFrameContainer_LayoutFrames", function(frame)
- if not frame then return end
- CompactRaidFrameContainer_ApplyToFrames(frame, "normal", function(frame)
- if not frame or not frame.unit then return end
- local role = UnitGroupRolesAssigned(frame.unit);
- local options = DefaultCompactUnitFrameSetupOptions;
- if options.displayPowerBar and role ~= "HEALER" then
- -- Fix healthbar size
- frame.healthBar:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -1, 1);
- frame.powerBar:Hide();
- -- Fix borders
- if options.displayBorder then
- frame.horizDivider:Hide();
- end
- end
- end);
-end);
--- /dev/null
+hooksecurefunc("DefaultCompactUnitFrameSetup", function(frame)
+ -- used in CompactUnitFrame_UpdateAuras (Buffs, Debuffs, DispellableDebuffs)
+ frame.optionTable.displayBuffs = false;
+ frame.optionTable.displayDebuffs = false;
+ frame.optionTable.displayDispelDebuffs = false;
+ -- Unit name font
+ frame.name:SetFont(STANDARD_TEXT_FONT, 12, "");
+end);
--- /dev/null
+local UnitName = UnitName;
+
+hooksecurefunc("CompactUnitFrame_UpdateName", function(frame)
+ if frame and not frame:IsForbidden() and frame:GetName():match("^CompactRaidFrame%d") then
+ local name, _;
+ name, _ = UnitName(frame.unit);
+ if name then
+ frame.name:SetText(name);
+ end
+ end
+end);
--- /dev/null
+local UnitIsConnected = UnitIsConnected;
+local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
+local UnitHealthMax = UnitHealthMax;
+local UnitHealth = UnitHealth;
+local format = string.format
+
+hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(frame)
+ if frame and not frame:IsForbidden() and frame:GetName():match("^CompactRaidFrame%d") then
+ -- conditions taken from CompactUnitFrame.lua
+ if not UnitIsConnected(frame.unit) or UnitIsDeadOrGhost(frame.displayedUnit) then
+ return;
+ elseif (frame.optionTable.healthText == "losthealth") then
+ -- only losthealth option is condensed
+ local healthLost = UnitHealthMax(frame.displayedUnit) - UnitHealth(frame.displayedUnit);
+ if healthLost <= 0 then return end
+
+ local prettyHealth;
+ if healthLost > 1200000000 then -- 1.2B
+ local h1b = healthLost / 1000000000;
+ local h100m = (healthLost % 1000000000) / 100000000;
+ prettyHealth = format("-%d.%dB", h1b, h100m);
+ elseif healthLost > 1200000 then -- 1.2M
+ prettyHealth = format("-%dM", healthLost / 1000000);
+ elseif healthLost > 1000 then -- 1K
+ prettyHealth = format("-%dK", healthLost / 1000);
+ else
+ prettyHealth = format("-%d", healthLost)
+ end
+
+ frame.statusText:SetText(prettyHealth);
+ end
+ end
+end);