Commit 783135d8 authored by Ivaria's avatar Ivaria
Browse files

Merge branch 'omicron/vuhdo-fade_per_hot'

parents 880ccf7e 06f6f8d3
......@@ -2,7 +2,6 @@ local _;
local huge = math.huge;
local format = format;
local sIsFade;
local sIsWarnColor;
local sIsSwiftmend;
local sHotSetup;
......@@ -78,8 +77,6 @@ local VUHDO_getBarIconCharge;
local VUHDO_getBarIconClockOrStub;
local VUHDO_backColor;
local VUHDO_textColor;
local VUHDO_UIFrameFlash;
local VUHDO_UIFrameFlashStop;
local VUHDO_PANEL_SETUP;
local VUHDO_CAST_ICON_DIFF;
......@@ -116,10 +113,6 @@ function VUHDO_customHotsInitLocalOverrides()
sBarColors = VUHDO_PANEL_SETUP["BAR_COLORS"];
sHotCols = sBarColors["HOTS"];
sIsFade = sHotCols["isFadeOut"];
VUHDO_UIFrameFlash = sHotCols["isFlashWhenLow"] and _G["VUHDO_UIFrameFlash"] or function() end;
VUHDO_UIFrameFlashStop = sHotCols["isFlashWhenLow"] and _G["VUHDO_UIFrameFlashStop"] or function() end;
sIsWarnColor = sHotCols["WARNING"]["enabled"];
sHotSetup = VUHDO_PANEL_SETUP["HOTS"];
......@@ -205,6 +198,9 @@ local function VUHDO_customizeHotIcons(aButton, aHotName, aRest, aTimes, anIcon,
tIcon = VUHDO_getBarIcon(aButton, anIndex);
if not tIcon then return end; -- Noch nicht erstellt von redraw
local VUHDO_UIFrameFlash = tHotCfg["isFlashWhenLow"] and _G["VUHDO_UIFrameFlash"] or function() end;
local VUHDO_UIFrameFlashStop = tHotCfg["isFlashWhenLow"] and _G["VUHDO_UIFrameFlashStop"] or function() end;
if not aRest then
VUHDO_UIFrameFlashStop(tIcon);
VUHDO_getBarIconFrame(aButton, anIndex):Hide();
......@@ -249,7 +245,7 @@ local function VUHDO_customizeHotIcons(aButton, aHotName, aRest, aTimes, anIcon,
return;
elseif aRest > 0 then
tIcon:SetAlpha((aRest < 10 and sIsFade) and tHotCfg["O"] * aRest * 0.1 or tHotCfg["O"]);
tIcon:SetAlpha((aRest < 10 and tHotCfg["isFadeOut"]) and tHotCfg["O"] * aRest * 0.1 or tHotCfg["O"]);
if aRest < 10 or tHotCfg["isFullDuration"] then
tDuration = (tHotCfg["countdownMode"] == 2 and aRest < sHotCols["WARNING"]["lowSecs"])
......@@ -265,7 +261,7 @@ local function VUHDO_customizeHotIcons(aButton, aHotName, aRest, aTimes, anIcon,
tClock:SetCooldown(tStarted, aDuration);
tClock:SetAttribute("started", tStarted);
end
tIcon:SetAlpha((sIsFade and aRest < 10) and tHotCfg["O"] * aRest * 0.1 or tHotCfg["O"]);
tIcon:SetAlpha((tHotCfg["isFadeOut"] and aRest < 10) and tHotCfg["O"] * aRest * 0.1 or tHotCfg["O"]);
if aRest > 5 then
VUHDO_UIFrameFlashStop(tIcon);
......
......@@ -404,6 +404,8 @@ local function VUHDO_makeHotColor(...)
tColor["isClock"] = false;
tColor["countdownMode"] = 1;
tColor["useOpacity"] = false;
tColor["isFadeOut"] = false;
tColor["isFlashWhenLow"] = false;
return tColor;
end
......@@ -2463,8 +2465,6 @@ local VUHDO_DEFAULT_PANEL_SETUP = {
["HOTS"] = {
["useColorText"] = true,
["useColorBack"] = true,
["isFadeOut"] = false,
["isFlashWhenLow"] = false,
["showShieldAbsorb"] = true,
["isPumpDivineAegis"] = false,
["WARNING"] = {
......@@ -2795,7 +2795,8 @@ function VUHDO_loadDefaultPanelSetup()
VUHDO_PANEL_SETUP[tPanelNum] = VUHDO_ensureSanity("VUHDO_PANEL_SETUP[" .. tPanelNum .. "]", VUHDO_PANEL_SETUP[tPanelNum], VUHDO_DEFAULT_PER_PANEL_SETUP);
end
VUHDO_upgradePanelSetup(VUHDO_PANEL_SETUP)
VUHDO_PANEL_SETUP = VUHDO_ensureSanity("VUHDO_PANEL_SETUP", VUHDO_PANEL_SETUP, VUHDO_DEFAULT_PANEL_SETUP);
VUHDO_DEFAULT_PANEL_SETUP = VUHDO_compressAndPackTable(VUHDO_DEFAULT_PANEL_SETUP);
VUHDO_DEFAULT_PER_PANEL_SETUP = VUHDO_compressAndPackTable(VUHDO_DEFAULT_PER_PANEL_SETUP);
......@@ -2803,7 +2804,25 @@ function VUHDO_loadDefaultPanelSetup()
VUHDO_fixHotSettings();
end
-- upgrade the panel setup to a newer version of the data model in a way that
-- preserves the users setup the best
function VUHDO_upgradePanelSetup(panelSetup)
-- Initialize per-hot setting for flash & fade by using the global setting
-- (if it exists) as default
local hotColors = panelSetup["BAR_COLORS"]["HOTS"] -- Original location of isFadeOut and isFlashWhenLow
local globalFade = hotColors["isFadeOut"]
local globalFlash = hotColors["isFlashWhenLow"]
local hotColorsSlot
for _, hotId in ipairs({1, 2, 3, 4, 5, 9, 10}) do
hotColorsSlot = panelSetup["BAR_COLORS"]["HOT" .. hotId] -- New per-hot location
if globalFade ~= nil and hotColorsSlot["isFadeOut"] == nil then
hotColorsSlot["isFadeOut"] = globalFade
end
if globalFlash ~= nil and hotColorsSlot["isFlashWhenLow"] == nil then
hotColorsSlot["isFlashWhenLow"] = globalFlash
end
end
end
local VUHDO_DEFAULT_BUFF_CONFIG = {
["VERSION"] = 4,
......
......@@ -353,7 +353,7 @@ VUHDO_I18N_TT.K255 = "Select at what time warning color will be applied and exte
VUHDO_I18N_TT.K256 = "Check to have an outline around HoT counter and timer texts.";
VUHDO_I18N_TT.K257 = "Check to have a shadow behind HoT counter and timer texts.";
VUHDO_I18N_TT.K258 = "Check to to show warning color if HoT remaining duration is less than configured to the left.";
VUHDO_I18N_TT.K260 = "Check to fade out HoT icons/squares when HoT is running out.";
VUHDO_I18N_TT.K260 = "Check to fade out the HoT icon/square when the HoT is running out.";
VUHDO_I18N_TT.K261 = "Select a color for your self-defined debuffs";
VUHDO_I18N_TT.K262 = "Check to have also debuff icon flying in.";
VUHDO_I18N_TT.K263 = "This option selects what debuffs you want to see.";
......@@ -568,7 +568,7 @@ VUHDO_I18N_TT.K509 = "Shows direction arrow even if unit is not out of range.";
VUHDO_I18N_TT.K510 = "Select a color for HoT Square 7";
VUHDO_I18N_TT.K511 = "Hides Blizz UI standard raid frames.";
VUHDO_I18N_TT.K512 = "Create VuhDo internal key assignments. No empty macro slot will be needed, keys can be assigned differently outside VuhDo panels.";
VUHDO_I18N_TT.K513 = "Makes the HoT icons flash shortly before HoT expires";
VUHDO_I18N_TT.K513 = "Makes this HoT icon flash shortly before the HoT expires";
VUHDO_I18N_TT.K514 = "Show tooltips for custom debuffs";
VUHDO_I18N_TT.K515 = "Show total HP of player.";
VUHDO_I18N_TT.K516 = "Disable to avoid runtime errors from blizz standard ui incoming. Enable if you don't experience any problem.";
......@@ -1164,3 +1164,5 @@ VUHDO_I18N_FOCUS_HARM = "Focus unit (hostile only)";
VUHDO_I18N_MOUSEOVER_HARM = "Mouseover unit (hostile only)";
VUHDO_I18N_MOUSEOVER_TARGET_HARM = "Mouseover's target unit (hostile only)";
VUHDO_I18N_MOUSEOVER_TARGET_TARGET_HARM = "Mouseover's target's target unit (hostile only)";
VUHDO_I18N_CLOCK = "Clock";
......@@ -28,6 +28,26 @@ end
--
function VUHDO_initHotFadeCheckButton(aButton)
VUHDO_lnfSetModel(aButton, "VUHDO_PANEL_SETUP.BAR_COLORS.HOT"
.. VUHDO_getNumbersFromString(aButton:GetName(), 1)[1]
.. ".isFadeOut");
VUHDO_lnfSetTooltip(aButton, VUHDO_I18N_TT.K260);
end
--
function VUHDO_initHotFlashCheckButton(aButton)
VUHDO_lnfSetModel(aButton, "VUHDO_PANEL_SETUP.BAR_COLORS.HOT"
.. VUHDO_getNumbersFromString(aButton:GetName(), 1)[1]
.. ".isFlashWhenLow");
VUHDO_lnfSetTooltip(aButton, VUHDO_I18N_TT.K513);
end
--
function VUHDO_colorsHotsSetSwatchHotName(aTexture, aHotNum)
tHotName = VUHDO_PANEL_SETUP["HOTS"]["SLOTS"][aHotNum] or "";
......
......@@ -81,6 +81,36 @@
</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentFadeCheckButton" inherits="VuhDoCheckBoxTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="210" y="0" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_initHotFadeCheckButton(self);
</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentFlashCheckButton" inherits="VuhDoCheckBoxTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="252" y="0" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_initHotFlashCheckButton(self);
</OnLoad>
</Scripts>
</CheckButton>
</Frames>
</Frame>
......@@ -316,172 +346,157 @@
</Scripts>
</CheckButton>
<CheckButton name="$parentFadeCheckButton" text="VUHDO_I18N_FADE_OUT" inherits="VuhDoCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="344" y="-50" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.HOTS.isFadeOut");
VUHDO_lnfSetTooltip(self, VUHDO_I18N_TT.K260);
</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentFlashCheckButton" text="VUHDO_I18N_FLASH" inherits="VuhDoCheckButtonTemplate">
<Frame name="$parentExpiryLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="344" y="-88" />
<AbsDimension x="364" y="-302" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
VUHDO_lnfSetModel(self, "VUHDO_PANEL_SETUP.BAR_COLORS.HOTS.isFlashWhenLow");
VUHDO_lnfSetTooltip(self, VUHDO_I18N_TT.K513);
</OnLoad>
</Scripts>
</CheckButton>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_EXPIRY_WARNING" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentBackgroundLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentOffLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="364" y="-34" />
<AbsDimension x="80" y="-24" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_BACKGROUND" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_COUNTDOWN_OFF" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
q
<Frame name="$parentExpiryLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentSecLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="364" y="-302" />
<AbsDimension x="150" y="-24" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_EXPIRY_WARNING" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_SECS" justifyH="CENTER" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentOffLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentdSecLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="80" y="-24" />
<AbsDimension x="173" y="-24" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_COUNTDOWN_OFF" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_SECS_10" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentSecLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentDurationLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="150" y="-24" />
<AbsDimension x="245" y="-17" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_SECS" justifyH="CENTER" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_FULL_DURATION" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentdSecLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentClockLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="173" y="-24" />
<AbsDimension x="250" y="-31" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_SECS_10" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_CLOCK" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentDurationLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentFadeLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="245" y="-17" />
<AbsDimension x="346" y="-17" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="VUHDO_I18N_FULL_DURATION" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_FADE_OUT" justifyH="LEFT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentClockLabel" inherits="VuhDoLabelFrameTemplate">
<Frame name="$parentFlashLabel" inherits="VuhDoLabelFrameTemplate">
<Size>
<AbsDimension x="75" y="18" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="250" y="-31" />
<AbsDimension x="387" y="-31" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" text="Clock" justifyH="RIGHT" inherits="VuDoDefaultFontTemplate">
<FontString name="$parentLabel" text="VUHDO_I18N_FLASH" justifyH="LEFT" inherits="VuDoDefaultFontTemplate">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentHot1RadiGroup" inherits="VuhDoHotTimerRadioGroup">
<Anchors>
<Anchor point="TOPLEFT">
......
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