Commit 45cde961 authored by Ivaria's avatar Ivaria
Browse files

Added debuff absorb overlay bar to display healing absorption amount

parent 7f03c688
......@@ -40,12 +40,9 @@ local VUHDO_THREAT_CFG;
local VUHDO_IN_RAID_TARGET_BUTTONS;
local VUHDO_INTERNAL_TOGGLES;
local abs = abs;
local floor = floor;
local strfind = strfind;
local strbyte = strbyte;
local GetRaidTargetIndex = GetRaidTargetIndex;
local UnitIsUnit = UnitIsUnit;
local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs;
local pairs = pairs;
local twipe = table.wipe;
local format = format;
......@@ -113,6 +110,7 @@ end
local tIncColor = { ["useBackground"] = true };
local tShieldColor = { ["useBackground"] = true };
local tOvershieldColor = { ["useBackground"] = true };
local tHealAbsorbColor = { ["useBackground"] = true };
......@@ -307,6 +305,104 @@ local VUHDO_updateShieldBar = VUHDO_updateShieldBar;
--
local tInfo;
local tAllButtons;
local tHealAbsorbRemain;
local tHealAbsorbOpacity;
local tHealthBar, tHealthBarWidth, tHealthBarHeight, tHealthDeficit;
local tHealAbsorbBar, tHealAbsorbBarSize, tHealAbsorbBarSizePercent, tHealAbsorbBarOffset, tHealAbsorbBarOffsetPercent;
local tOrientation;
function VUHDO_updateHealAbsorbBar(aUnit)
if not VUHDO_CONFIG["SHOW_HEAL_ABSORB_BAR"] then
return;
end
tInfo = VUHDO_RAID[aUnit];
tAllButtons = VUHDO_getUnitButtons(VUHDO_resolveVehicleUnit(aUnit));
if not tInfo or not tAllButtons or not tInfo["connected"] or tInfo["dead"] or tInfo["healthmax"] <= 0 then
return;
end
tOrientation = VUHDO_getStatusbarOrientationString("HEALTH_BAR");
tHealAbsorbRemain = min(UnitGetTotalHealAbsorbs(aUnit) or 0, tInfo["health"]);
tHealthDeficit = tInfo["healthmax"] - tInfo["health"];
tHealAbsorbBarSizePercent = tHealAbsorbRemain / tInfo["healthmax"];
tHealAbsorbBarOffsetPercent = tHealthDeficit / tInfo["healthmax"];
for _, tButton in pairs(tAllButtons) do
tHealthBar = VUHDO_getHealthBar(tButton, 1);
tHealAbsorbBar = VUHDO_getHealAbsorbBarTexture(tHealthBar);
if VUHDO_CONFIG["SHOW_HEAL_ABSORB_BAR"] and (tHealAbsorbRemain > 0) then
tHealAbsorbBar.tileSize = 32;
tHealAbsorbBar:SetParent(tHealthBar);
tHealAbsorbBar:ClearAllPoints();
tHealAbsorbColor["R"], tHealAbsorbColor["G"], tHealAbsorbColor["B"], tHealAbsorbOpacity = tHealthBar:GetStatusBarColor();
tHealAbsorbColor = VUHDO_getDiffColor(tHealAbsorbColor, VUHDO_PANEL_SETUP["BAR_COLORS"]["HEAL_ABSORB"]);
if tHealAbsorbColor["O"] and tHealAbsorbOpacity then
tHealAbsorbColor["O"] = tHealAbsorbColor["O"] * tHealAbsorbOpacity * (tHealthBar:GetAlpha() or 1);
end
VUHDO_setTextureColor(tHealAbsorbBar, tHealAbsorbColor);
tHealthBarWidth, tHealthBarHeight = tHealthBar:GetSize();
if (not sIsInvertGrowth and tOrientation == "HORIZONTAL") or (sIsInvertGrowth and tOrientation == "HORIZONTAL_INV") then
-- VUHDO_STATUSBAR_LEFT_TO_RIGHT
tHealAbsorbBarSize = tHealAbsorbBarSizePercent * tHealthBarWidth;
tHealAbsorbBarOffset = tHealAbsorbBarOffsetPercent * tHealthBarWidth;
tHealAbsorbBar:SetPoint("TOPRIGHT", tHealthBar, "TOPRIGHT", tHealAbsorbBarOffset * -1, 0);
tHealAbsorbBar:SetPoint("BOTTOMRIGHT", tHealthBar, "BOTTOMRIGHT", tHealAbsorbBarOffset * -1, 0);
tHealAbsorbBar:SetWidth(tHealAbsorbBarSize);
tHealAbsorbBar:SetTexCoord(0, tHealAbsorbBarSize / tHealAbsorbBar.tileSize, 0, tHealthBarHeight / tHealAbsorbBar.tileSize);
elseif (not sIsInvertGrowth and tOrientation == "HORIZONTAL_INV") or (sIsInvertGrowth and tOrientation == "HORIZONTAL") then
-- VUHDO_STATUSBAR_RIGHT_TO_LEFT
tHealAbsorbBarSize = tHealAbsorbBarSizePercent * tHealthBarWidth;
tHealAbsorbBarOffset = tHealAbsorbBarOffsetPercent * tHealthBarWidth;
tHealAbsorbBar:SetPoint("TOPLEFT", tHealthBar, "TOPLEFT", tHealAbsorbBarOffset, 0);
tHealAbsorbBar:SetPoint("BOTTOMLEFT", tHealthBar, "BOTTOMLEFT", tHealAbsorbBarOffset, 0);
tHealAbsorbBar:SetWidth(tHealAbsorbBarSize);
tHealAbsorbBar:SetTexCoord(0, tHealAbsorbBarSize / tHealAbsorbBar.tileSize, 0, tHealthBarHeight / tHealAbsorbBar.tileSize);
elseif (not sIsInvertGrowth and tOrientation == "VERTICAL") or (sIsInvertGrowth and tOrientation == "VERTICAL_INV") then
-- VUHDO_STATUSBAR_BOTTOM_TO_TOP
tHealAbsorbBarSize = tHealAbsorbBarSizePercent * tHealthBarHeight;
tHealAbsorbBarOffset = tHealAbsorbBarOffsetPercent * tHealthBarHeight;
tHealAbsorbBar:SetPoint("TOPLEFT", tHealthBar, "TOPLEFT", 0, tHealAbsorbBarOffset * -1);
tHealAbsorbBar:SetPoint("TOPRIGHT", tHealthBar, "TOPRIGHT", 0, tHealAbsorbBarOffset * -1);
tHealAbsorbBar:SetHeight(tHealAbsorbBarSize);
tHealAbsorbBar:SetTexCoord(0, tHealthBarWidth / tHealAbsorbBar.tileSize, 0, tHealAbsorbBarSize / tHealAbsorbBar.tileSize);
else -- (not sIsInvertGrowth and tOrientation == "VERTICAL_INV") or (sIsInvertGrowth and tOrientation == "VERTICAL")
-- VUHDO_STATUSBAR_TOP_TO_BOTTOM
tHealAbsorbBarSize = tHealAbsorbBarSizePercent * tHealthBarHeight;
tHealAbsorbBarOffset = tHealAbsorbBarOffsetPercent * tHealthBarHeight;
tHealAbsorbBar:SetPoint("BOTTOMLEFT", tHealthBar, "BOTTOMLEFT", 0, tHealAbsorbBarOffset);
tHealAbsorbBar:SetPoint("BOTTOMRIGHT", tHealthBar, "BOTTOMRIGHT", 0, tHealAbsorbBarOffset);
tHealAbsorbBar:SetHeight(tHealAbsorbBarSize);
tHealAbsorbBar:SetTexCoord(0, tHealthBarWidth / tHealAbsorbBar.tileSize, 0, tHealAbsorbBarSize / tHealAbsorbBar.tileSize);
end
tHealAbsorbBar:Show();
else
tHealAbsorbBar:Hide();
end
end
end
local VUHDO_updateHealAbsorbBar = VUHDO_updateHealAbsorbBar;
--
local tAllButtons;
local tHealthPlusInc;
......@@ -345,6 +441,7 @@ local function VUHDO_updateIncHeal(aUnit)
end
VUHDO_updateShieldBar(aUnit, tHealthPlusInc, tAmountInc);
VUHDO_updateHealAbsorbBar(aUnit, tHealthPlusInc, tAmountInc);
end
......
......@@ -542,6 +542,7 @@ local VUHDO_DEFAULT_CONFIG = {
["SHOW_TEXT_OVERHEAL"] = true,
["SHOW_SHIELD_BAR"] = true,
["SHOW_OVERSHIELD_BAR"] = false,
["SHOW_HEAL_ABSORB_BAR"] = true,
["RANGE_CHECK_DELAY"] = 260,
......@@ -2336,6 +2337,11 @@ local VUHDO_DEFAULT_PANEL_SETUP = {
["TR"] = 0.35, ["TG"] = 0.52, ["TB"] = 1, ["TO"] = 1,
["useText"] = false, ["useBackground"] = true, ["useOpacity"] = true,
},
["HEAL_ABSORB"] = {
["R"] = 1, ["G"] = 0.4, ["B"] = 0.4, ["O"] = 1,
["TR"] = 0.35, ["TG"] = 0.52, ["TB"] = 1, ["TO"] = 1,
["useText"] = false, ["useBackground"] = true, ["useOpacity"] = true,
},
["DIRECTION"] = {
["R"] = 1, ["G"] = 0.4, ["B"] = 0.4, ["O"] = 1,
["useBackground"] = true,
......
......@@ -488,6 +488,12 @@ function VUHDO_OnEvent(_, anEvent, anArg1, anArg2, anArg3, anArg4, anArg5, anArg
end
end
elseif "UNIT_HEAL_ABSORB_AMOUNT_CHANGED" == anEvent then
if (VUHDO_RAID or tEmptyRaid)[anArg1] then
VUHDO_updateBouquetsForEvent(anArg1, 36); -- VUHDO_UPDATE_SHIELD
VUHDO_updateHealAbsorbBar(anArg1);
end
elseif "UNIT_SPELLCAST_SUCCEEDED" == anEvent then
if (VUHDO_RAID or tEmptyRaid)[anArg1] then VUHDO_spellcastSucceeded(anArg1, anArg3); end
......@@ -988,10 +994,12 @@ function VUHDO_updateGlobalToggles()
VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_SHIELD] =
VUHDO_PANEL_SETUP["BAR_COLORS"]["HOTS"]["showShieldAbsorb"]
or VUHDO_CONFIG["SHOW_SHIELD_BAR"]
or VUHDO_CONFIG["SHOW_SHIELD_BAR"]
or VUHDO_CONFIG["SHOW_HEAL_ABSORB_BAR"]
or VUHDO_isAnyoneInterstedIn(VUHDO_UPDATE_SHIELD);
VUHDO_UnRegisterEvent(VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_SHIELD], "UNIT_ABSORB_AMOUNT_CHANGED");
VUHDO_UnRegisterEvent(VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_SHIELD], "UNIT_HEAL_ABSORB_AMOUNT_CHANGED");
VUHDO_INTERNAL_TOGGLES[VUHDO_UPDATE_SPELL_TRACE] = VUHDO_CONFIG["SHOW_SPELL_TRACE"]
or VUHDO_isAnyoneInterstedIn(VUHDO_UPDATE_SPELL_TRACE);
......@@ -1533,7 +1541,7 @@ local VUHDO_ALL_EVENTS = {
"INCOMING_RESURRECT_CHANGED",
"PET_BATTLE_CLOSE", "PET_BATTLE_OPENING_START",
"PLAYER_REGEN_ENABLED", "PLAYER_REGEN_DISABLED",
"UNIT_ABSORB_AMOUNT_CHANGED",
"UNIT_ABSORB_AMOUNT_CHANGED", "UNIT_HEAL_ABSORB_AMOUNT_CHANGED",
"INCOMING_SUMMON_CHANGED",
"UNIT_PHASE",
"PLAYER_SPECIALIZATION_CHANGED",
......
......@@ -1146,3 +1146,6 @@ VUHDO_I18N_DEBUFF_SHOW_ONLY_FOR_FRIENDLY_TOOLTIP = "Shows debuffs only for frien
VUHDO_I18N_SHOW_OVERSHIELD = "Show\nOvershield";
VUHDO_I18N_OVERSHIELD_BAR = "Overshield Bar";
VUHDO_I18N_SHOW_HEAL_ABSORB = "Show\nHeal Absorb";
VUHDO_I18N_HEAL_ABSORB_BAR = "Heal Absorb Bar";
......@@ -8,7 +8,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="20" y="-288" />
<AbsDimension x="352" y="-13" />
</Offset>
</Anchor>
</Anchors>
......@@ -61,12 +61,12 @@
<Frame name="$parentLifeLeftPanel" inherits="VuhDoPanelTemplate">
<Size>
<AbsDimension x="278" y="169" />
<AbsDimension x="248" y="142" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="230" y="-268" />
<AbsDimension x="13" y="-302" />
</Offset>
</Anchor>
</Anchors>
......@@ -85,7 +85,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="34" y="-43" />
<AbsDimension x="20" y="-26" />
</Offset>
</Anchor>
</Anchors>
......@@ -102,7 +102,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="34" y="-81" />
<AbsDimension x="20" y="-64" />
</Offset>
</Anchor>
</Anchors>
......@@ -119,7 +119,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="34" y="-119" />
<AbsDimension x="20" y="-102" />
</Offset>
</Anchor>
</Anchors>
......@@ -136,7 +136,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="144" y="-43" />
<AbsDimension x="130" y="-26" />
</Offset>
</Anchor>
</Anchors>
......@@ -155,12 +155,12 @@
<Frame name="$parentNormalModePanel" inherits="VuhDoPanelTemplate">
<Size>
<AbsDimension x="321" y="245" />
<AbsDimension x="321" y="283" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="113" y="-13" />
<AbsDimension x="13" y="-13" />
</Offset>
</Anchor>
</Anchors>
......@@ -227,7 +227,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="247" y="-200" />
<AbsDimension x="247" y="-238" />
</Offset>
</Anchor>
</Anchors>
......@@ -242,7 +242,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="192" y="-200" />
<AbsDimension x="192" y="-238" />
</Offset>
</Anchor>
</Anchors>
......@@ -257,7 +257,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="136" y="-200" />
<AbsDimension x="136" y="-238" />
</Offset>
</Anchor>
</Anchors>
......@@ -313,6 +313,50 @@
</Scripts>
</CheckButton>
<CheckButton name="$parentHealAbsorbOpacCheckBox" inherits="VuhDoCheckBoxTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="247" y="-200" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.HEAL_ABSORB.useOpacity");
</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentHealAbsorbTextCheckBox" inherits="VuhDoCheckBoxTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="192" y="-200" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.HEAL_ABSORB.useText");
</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentHealAbsorbBackCheckBox" inherits="VuhDoCheckBoxTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="136" y="-200" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.HEAL_ABSORB.useBackground");
</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentShieldOpacCheckBox" inherits="VuhDoCheckBoxTemplate">
<Anchors>
......@@ -525,7 +569,7 @@
</Scripts>
</Frame>
<Frame name="$parentRangeTexture" inherits="VuhDoContextColorSwatchTexture">
<Frame name="$parentHealAbsorbTexture" inherits="VuhDoContextColorSwatchTexture">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
......@@ -533,6 +577,23 @@
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.HEAL_ABSORB");
VUHDO_lnfInitColorSwatch(self, VUHDO_I18N_HEAL_ABSORB_BAR, VUHDO_I18N_HEAL_ABSORB_BAR);
VUHDO_lnfSetTooltip(self, nil);
</OnLoad>
</Scripts>
</Frame>
<Frame name="$parentRangeTexture" inherits="VuhDoContextColorSwatchTexture">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="13" y="-238" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.OUTRANGED");
......
......@@ -9,7 +9,7 @@
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="125" y="-180" />
<AbsDimension x="43" y="-200" />
</Offset>
</Anchor>
</Anchors>
......@@ -158,7 +158,7 @@
<Frame name="$parentShieldPanel" inherits="VuhDoPanelTemplate">
<Size>
<AbsDimension x="126" y="113" />
<AbsDimension x="126" y="152" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
......@@ -202,6 +202,23 @@
</Scripts>
</CheckButton>
<CheckButton name="$parentHealAbsorbBarCheckButton" text="VUHDO_I18N_SHOW_HEAL_ABSORB" inherits="VuhDoCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="13" y="-109" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_CONFIG.SHOW_HEAL_ABSORB_BAR");
VUHDO_lnfSetTooltip(self, nil);
</OnLoad>
</Scripts>
</CheckButton>
<Frame name="$parentTitleLabel" inherits="VuhDoLabelFrameTemplate">
<Layers>
<Layer>
......
......@@ -450,9 +450,12 @@
</Frames>
<Layers>
<Layer level="OVERLAY" textureSubLevel="5">
<Layer level="OVERLAY" textureSubLevel="4">
<Texture name="$parentOvsBar" hidden="true" file="Interface\AddOns\VuhDo\Images\overshield_bar" hWrapMode="REPEAT" vWrapMode="REPEAT"> </Texture>
</Layer>
<Layer level="OVERLAY" textureSubLevel="5">
<Texture name="$parentHeAbBar" hidden="true" file="Interface\AddOns\VuhDo\Images\overshield_bar" hWrapMode="REPEAT" vWrapMode="REPEAT"> </Texture>
</Layer>
<Layer level="OVERLAY" textureSubLevel="6">
<Texture name="$parentAggro" hidden="true" file="Interface\AddOns\VuhDo\Images\aggro">
<Size>
......
......@@ -464,6 +464,15 @@ end
--
function VUHDO_getHealAbsorbBarTexture(aHealthBar)
return _G[aHealthBar:GetName() .. "HeAbBar"];
end
--
local VUHDO_STATUSBAR_LEFT_TO_RIGHT = 1;
local VUHDO_STATUSBAR_RIGHT_TO_LEFT = 2;
......
......@@ -371,4 +371,5 @@ function VUHDO_parseCombatLogShieldAbsorb(aMessage, aSrcGuid, aDstGuid, aShieldN
VUHDO_updateBouquetsForEvent(tUnit, 36); -- VUHDO_UPDATE_SHIELD
VUHDO_updateShieldBar(tUnit);
VUHDO_updateHealAbsorbBar(tUnit);
end
......@@ -10,10 +10,10 @@ Known issues:
Bugfixes:
-- Fixed debuff absorb tracking for Sylvanas 'Veil of Darkness'
Improvements:
-- Added debuff absorb overlay bar to display healing absorption amount
--------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment