Commit 44aca3cf authored by Ivaria's avatar Ivaria
Browse files

Added safety around color handling for bouquet validators due to strict...

Added safety around color handling for bouquet validators due to strict SetVertexColor validation in 10.x
parent 207cd491
......@@ -775,12 +775,14 @@ function VUHDO_healthBarBouquetCallback(aUnit, anIsActive, anIcon, aCurrValue, a
if tQuota > 0 then
if aColor then
tHealthBar:SetVuhDoColor(aColor);
if aColor["useText"] then
VUHDO_getBarText(tHealthBar):SetTextColor(VUHDO_textColor(aColor));
VUHDO_getLifeText(tHealthBar):SetTextColor(VUHDO_textColor(aColor));
end
end
tHealthBar:SetValue(tQuota);
tHealthBar:SetValue(tQuota);
else
tHealthBar:SetValue(0);
end
......@@ -791,7 +793,7 @@ function VUHDO_healthBarBouquetCallback(aUnit, anIsActive, anIcon, aCurrValue, a
if not tInfo then return; end
-- Targets und targets-of-target, die im Raid sind
tAllButtons = VUHDO_IN_RAID_TARGET_BUTTONS[tInfo["name"]];
tAllButtons = VUHDO_IN_RAID_TARGET_BUTTONS[tInfo["name"]];
if not tAllButtons then return; end
VUHDO_CUSTOM_INFO["fixResolveId"] = aUnit;
......
......@@ -301,7 +301,7 @@ local tDebuffInfo;
local function VUHDO_debuffBarColorValidator(anInfo, _)
if anInfo["charmed"] then
return true, nil, -1, -1, -1, VUHDO_getDebuffColor(anInfo);
elseif 0 ~= anInfo["debuff"] then -- VUHDO_DEBUFF_TYPE_NONE
elseif anInfo["debuff"] and anInfo["debuff"] > 0 then -- VUHDO_DEBUFF_TYPE_NONE
tDebuffInfo = VUHDO_getChosenDebuffInfo(anInfo["unit"]);
return true, tDebuffInfo[1], -1, tDebuffInfo[2], -1, VUHDO_getDebuffColor(anInfo);
else
......
......@@ -105,9 +105,13 @@ local tDestColor = { ["useBackground"] = true, ["useOpacity"] = true };
local tRadio;
local function VUHDO_getBouquetStatusBarColor(anEntry, anInfo, aValue, aMaxValue)
tRadio = anEntry["custom"]["radio"];
if 1 == tRadio then -- solid
tColor = anEntry["color"];
tDestColor["R"], tDestColor["G"], tDestColor["B"], tDestColor["O"] = tColor["R"], tColor["G"], tColor["B"], tColor["O"];
return anEntry["color"];
return tDestColor;
elseif 2 == tRadio then -- class color
tColor = VUHDO_USER_CLASS_COLORS[anInfo["classId"]] or anEntry["color"];
......@@ -136,7 +140,11 @@ local function VUHDO_getBouquetStatusBarColor(anEntry, anInfo, aValue, aMaxValue
tB2 * tInvModi + tB1 * tModi, tO2 * tInvModi + tO1 * tModi;
return tDestColor;
else
return anEntry["color"];
tColor = anEntry["color"];
tDestColor["R"], tDestColor["G"], tDestColor["B"], tDestColor["O"] = tColor["R"], tColor["G"], tColor["B"], tColor["O"];
return tDestColor;
end
end
......
......@@ -831,6 +831,24 @@ end
--
local function VUHDO_clamp(aValue, aMin, aMax)
return math.min(math.max(aValue, aMin), aMax);
end
--
function VUHDO_clampColor(aR, aG, aB, aO)
return aR and VUHDO_clamp(aR, 0, 1), aG and VUHDO_clamp(aG, 0, 1), aB and VUHDO_clamp(aB, 0, 1), aO and VUHDO_clamp(aO, 0, 1);
end
--
function VUHDO_backColor(aColor)
return aColor["R"], aColor["G"], aColor["B"], aColor["O"];
......
......@@ -311,6 +311,10 @@ function VUHDO_rebuildBouquetContextEditors(anIndex)
if (VUHDO_BOUQUET_BUFFS_SPECIAL[tBuffName] ~= nil
and VUHDO_BOUQUET_BUFFS_SPECIAL[tBuffName]["custom_type"] == VUHDO_BOUQUET_CUSTOM_TYPE_STATUSBAR) then
-- VUHDO_BOUQUET_CUSTOM_TYPE_STATUSBAR validators don't provide color checkboxes (e.g. 'useBackground')
-- implicitly force these color flags to 'true' to ensure application of the specified color(s)
tCurrentItem["color"]["useBackground"] = true;
tCurrentItem["color"]["useText"] = true;
tInnerPanel = _G[tPanel:GetName() .. "StatusbarFrame"];
......
......@@ -491,13 +491,21 @@ function VUHDO_refactorStatusbar(tBar)
tBar["SetStatusBarColor"] = function(self, r, g, b, a)
self["texture"]:SetVertexColor(r, g, b, a);
if r and g and b and a then
self["texture"]:SetVertexColor(r, g, b, a);
elseif r and g and b then
self["texture"]:SetVertexColor(r, g, b);
end
end
tBar["SetVuhDoColor"] = function(self, aColor)
self["texture"]:SetVertexColor(aColor["R"], aColor["G"], aColor["B"], aColor["O"]);
if aColor["R"] and aColor["G"] and aColor["B"] and aColor["O"] then
self["texture"]:SetVertexColor(aColor["R"], aColor["G"], aColor["B"], aColor["O"]);
elseif aColor["R"] and aColor["G"] and aColor["B"] then
self["texture"]:SetVertexColor(aColor["R"], aColor["G"], aColor["B"]);
end
end
......
......@@ -16,6 +16,8 @@ Bugfixes:
-- Fixed tracking of ambiguously named HoTs by spell ID
-- Fixed resurrection smart cast for Evoker 'Return' and 'Mass Return'
-- Fixed Evoker debuff abilities ('Naturalize' and 'Expunge')
-- Fixed 'Flag: Debuff, configured' validator when no debuffs present
-- Fixed safe color application for statusbar type bouquet validators
Improvements:
......
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