Commit 3382ea16 authored by Ivaria's avatar Ivaria
Browse files

Misc fixes around custom debuff settings - closes CurseForge ticket 342

parent 657c10d1
## Interface: 60000
## Title: VuhDo ['vu:du:]
## Author: Iza@Gilneas, humfras
## Version: 3.6
## Version: 3.60
## Notes: Raid Frames providing click-heal functionality, buff and debuff control, main tank management and much more
## SavedVariablesPerCharacter: VUHDO_CONFIG, VUHDO_PANEL_SETUP, VUHDO_SPELL_ASSIGNMENTS, VUHDO_HOSTILE_SPELL_ASSIGNMENTS, VUHDO_MM_SETTINGS, VUHDO_PLAYER_TARGETS, VUHDO_MAINTANK_NAMES, VUHDO_BUFF_SETTINGS, VUHDO_POWER_TYPE_COLORS, VUHDO_SPELLS_KEYBOARD, VUHDO_SPELL_CONFIG, VUHDO_BUFF_ORDER, VUHDO_SPEC_LAYOUTS, VUHDO_GROUP_SIZE, VUHDO_RAID, VUHDO_INDICATOR_CONFIG
## SavedVariables: VUHDO_PROFILES, VUHDO_MANUAL_ROLES, VUHDO_SPELL_LAYOUTS, VUHDO_USER_CLASS_COLORS, VUHDO_DEBUFF_BLACKLIST, VUHDO_BOUQUETS, VUHDO_COMBAT_LOG_TRACE, VUHDO_GLOBAL_CONFIG, VUHDO_DEBUG
......
......@@ -74,7 +74,7 @@ local tButton;
local tIsAnim;
local function VUHDO_animateDebuffIcon(aButton, anIconInfo, aNow, anIconIndex, anIsInit, aUnit)
tCuDeStoConfig = sCuDeStoredSettings[anIconInfo[3]] or sStaticConfig;
tCuDeStoConfig = sCuDeStoredSettings[anIconInfo[3]] or sCuDeStoredSettings[tostring(anIconInfo[7])] or sStaticConfig;
tIsAnim = tCuDeStoConfig["animate"] and VUHDO_MAY_DEBUFF_ANIM;
tTimeStamp = anIconInfo[2];
tAliveTime = anIsInit and 0 or aNow - tTimeStamp;
......@@ -152,7 +152,7 @@ local tSlot;
local tOldest;
local tTimestamp;
local tFrame, tIconInfo;
function VUHDO_addDebuffIcon(aUnit, anIcon, aName, anExpiry, aStacks, aDuration, anIsBuff)
function VUHDO_addDebuffIcon(aUnit, anIcon, aName, anExpiry, aStacks, aDuration, anIsBuff, aSpellId)
if not VUHDO_DEBUFF_ICONS[aUnit] then
VUHDO_DEBUFF_ICONS[aUnit] = { };
end
......@@ -169,7 +169,7 @@ function VUHDO_addDebuffIcon(aUnit, anIcon, aName, anExpiry, aStacks, aDuration,
end
end
end
tIconInfo = { anIcon, -1, aName, anExpiry, aStacks, aDuration };
tIconInfo = { anIcon, -1, aName, anExpiry, aStacks, aDuration, aSpellId };
VUHDO_DEBUFF_ICONS[aUnit][tSlot] = tIconInfo;
for _, tButton in pairs(VUHDO_getUnitButtonsSafe(aUnit)) do
......
......@@ -189,15 +189,15 @@ end
local tIconIndex = 0;
local tIconArray;
local tIconArrayDispenser = { };
local function VUHDO_getOrCreateIconArray(anIcon, aExpiry, aStacks, aDuration, anIsBuff)
local function VUHDO_getOrCreateIconArray(anIcon, aExpiry, aStacks, aDuration, anIsBuff, aSpellId)
tIconIndex = tIconIndex + 1;
if #tIconArrayDispenser < tIconIndex then
tIconArray = { anIcon, aExpiry, aStacks, aDuration, anIsBuff };
tIconArray = { anIcon, aExpiry, aStacks, aDuration, anIsBuff, aSpellId };
tIconArrayDispenser[tIconIndex] = tIconArray;
else
tIconArray = tIconArrayDispenser[tIconIndex];
tIconArray[1], tIconArray[2], tIconArray[3], tIconArray[4], tIconArray[5]
= anIcon, aExpiry, aStacks, aDuration, anIsBuff;
tIconArray[1], tIconArray[2], tIconArray[3], tIconArray[4], tIconArray[5], tIconArray[6]
= anIcon, aExpiry, aStacks, aDuration, anIsBuff, aSpellId;
end
return tIconArray;
......@@ -234,7 +234,7 @@ setmetatable(VUHDO_UNIT_DEBUFF_INFOS, {
local sCurChosenType;
local sCurChosenName;
local sCurSoundName;
local sCurChosenSpellId;
local sCurIsStandard;
local sCurIcons = { };
......@@ -248,7 +248,7 @@ local function VUHDO_initDebuffInfos(aUnit)
sCurChosenType = VUHDO_DEBUFF_TYPE_NONE;
sCurChosenName = "";
sCurSoundName = nil;
sCurChosenSpellId = nil;
sCurIsStandard = false;
tIconIndex = 0;
twipe(sCurIcons);
......@@ -271,6 +271,8 @@ local tIsRelevant;
local tNow;
local tUnitDebuffInfo;
local tType;
local tDebuffSettings;
local tCurChosenStoredName;
function VUHDO_determineDebuff(aUnit)
tInfo = (VUHDO_RAID or sEmpty)[aUnit];
......@@ -290,16 +292,15 @@ function VUHDO_determineDebuff(aUnit)
if (tExpiry or 0) == 0 then tExpiry = (sCurIcons[tName] or sEmpty)[2] or tNow; end
-- Custom Debuff?
tDebuffConfig = VUHDO_CUSTOM_DEBUFF_CONFIG[tName] or VUHDO_CUSTOM_DEBUFF_CONFIG[tostring(tSpellId or -1)] or sEmpty;
tDebuffConfig = VUHDO_CUSTOM_DEBUFF_CONFIG[tName] or VUHDO_CUSTOM_DEBUFF_CONFIG[tostring(tSpellId)] or sEmpty;
if tDebuffConfig[1] then -- Farbe?
sCurChosenType, sCurChosenName, sCurSoundName = 6, tName, tName; -- VUHDO_DEBUFF_TYPE_CUSTOM
sCurChosenType, sCurChosenName, sCurChosenSpellId = 6, tName, tSpellId; -- VUHDO_DEBUFF_TYPE_CUSTOM
end
if sCurIcons[tName] then tStacks = tStacks + sCurIcons[tName][3]; end
if tDebuffConfig[2] then -- Icon?
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks, tDuration, false);
sCurSoundName = tName;
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks, tDuration, false, tSpellId);
end
tType = VUHDO_DEBUFF_TYPES[tTypeString];
......@@ -322,7 +323,7 @@ function VUHDO_determineDebuff(aUnit)
if sIsUseDebuffIcon and (tIsBossDebuff or not sIsUseDebuffIconBossOnly)
and (sIsNotRemoveableOnlyIcons or tAbility ~= nil) then
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks, tDuration, false);
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks, tDuration, false, tSpellId);
sCurIsStandard = true;
end
......@@ -338,29 +339,32 @@ function VUHDO_determineDebuff(aUnit)
tName, _, tIcon, tStacks, _, tDuration, tExpiry, _, _, _, tSpellId = UnitBuff(aUnit, tCnt);
if not tIcon then break; end
tDebuffConfig = VUHDO_CUSTOM_DEBUFF_CONFIG[tName] or VUHDO_CUSTOM_DEBUFF_CONFIG[tostring(tSpellId or -1)] or sEmpty;
tDebuffConfig = VUHDO_CUSTOM_DEBUFF_CONFIG[tName] or VUHDO_CUSTOM_DEBUFF_CONFIG[tostring(tSpellId)] or sEmpty;
if tDebuffConfig[1] then -- Set color
sCurChosenType, sCurChosenName, sCurSoundName = 6, tName, tName; -- VUHDO_DEBUFF_TYPE_CUSTOM
sCurChosenType, sCurChosenName, sCurChosenSpellId = 6, tName, tSpellId; -- VUHDO_DEBUFF_TYPE_CUSTOM
end
if tDebuffConfig[2] then -- Set icon
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks or 0, tDuration, true);
sCurSoundName = tName;
sCurIcons[tName] = VUHDO_getOrCreateIconArray(tIcon, tExpiry, tStacks or 0, tDuration, true, tSpellId);
end
end
-- Gained new custom debuff?
-- note we only play sounds for debuff customs with isIcon set to true
for tName, tDebuffInfo in pairs(sCurIcons) do
if not VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName] then
VUHDO_UNIT_CUSTOM_DEBUFFS[aUnit][tName] = { tDebuffInfo[2], tDebuffInfo[3] };
VUHDO_addDebuffIcon(aUnit, tDebuffInfo[1], tName, tDebuffInfo[2], tDebuffInfo[3], tDebuffInfo[4], tDebuffInfo[5]);
VUHDO_addDebuffIcon(aUnit, tDebuffInfo[1], tName, tDebuffInfo[2], tDebuffInfo[3], tDebuffInfo[4], tDebuffInfo[5], tDebuffInfo[6]);
if not VUHDO_IS_CONFIG and VUHDO_MAY_DEBUFF_ANIM then
-- the key used to store the debuff settings is either the debuff name or spell ID
tDebuffSettings = sAllDebuffSettings[tName] or sAllDebuffSettings[tostring(tDebuffInfo[6])];
if not VUHDO_IS_CONFIG and VUHDO_MAY_DEBUFF_ANIM and tSoundDebuff then
if sAllDebuffSettings[tSoundDebuff] then -- Spezieller custom debuff sound?
VUHDO_playDebuffSound(sAllDebuffSettings[tSoundDebuff]["SOUND"]);
elseif VUHDO_CONFIG["CUSTOM_DEBUFF"]["SOUND"] then -- Allgemeiner custom debuff sound?
if tDebuffSettings then -- particular custom debuff sound?
VUHDO_playDebuffSound(tDebuffSettings["SOUND"]);
elseif VUHDO_CONFIG["CUSTOM_DEBUFF"]["SOUND"] then -- default custom debuff sound?
VUHDO_playDebuffSound(VUHDO_CONFIG["CUSTOM_DEBUFF"]["SOUND"]);
end
end
......@@ -403,7 +407,15 @@ function VUHDO_determineDebuff(aUnit)
sCurChosenType = VUHDO_DEBUFF_TYPE_MISSING_BUFF;
end
return sCurChosenType, sCurChosenName;
-- we need to return the actual key the debuff settings are stored under
-- this is either the debuff name or the debuff spell ID
if sAllDebuffSettings[sCurChosenName] then
tCurChosenStoredName = sCurChosenName;
elseif sAllDebuffSettings[tostring(sCurChosenSpellId)] then
tCurChosenStoredName = tostring(sCurChosenSpellId);
end
return sCurChosenType, tCurChosenStoredName;
end
local VUHDO_determineDebuff = VUHDO_determineDebuff;
......
......@@ -106,17 +106,21 @@ function VUHDO_customDebuffUpdateEditBox(anEditBox)
VUHDO_setComboModel(tComboBox, "VUHDO_CONFIG.CUSTOM_DEBUFF.STORED_SETTINGS." .. tValue .. ".SOUND", VUHDO_SOUNDS);
VUHDO_lnfComboBoxInitFromModel(tComboBox);
tColorSwatch = _G[tPanelName .. "ColorTexture"];
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isColor) then
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color == nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
end
VUHDO_lnfSetModel(tColorSwatch, "VUHDO_CONFIG.CUSTOM_DEBUFF.STORED_SETTINGS." .. tValue .. ".color");
else
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color = nil;
VUHDO_lnfSetModel(tColorSwatch, "VUHDO_PANEL_SETUP.BAR_COLORS.DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM);
end
tColorSwatch = _G[tPanelName .. "ColorTexture"];
VUHDO_lnfSetModel(tColorSwatch, "VUHDO_CONFIG.CUSTOM_DEBUFF.STORED_SETTINGS." .. tValue .. ".color");
VUHDO_lnfInitColorSwatch(tColorSwatch, VUHDO_I18N_COLOR, VUHDO_I18N_COLOR);
VUHDO_lnfColorSwatchInitFromModel(tColorSwatch);
......@@ -217,8 +221,6 @@ function VUHDO_saveCustomDebuffOnClick(aButton)
tPanelName = aButton:GetParent():GetName();
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue] = { };
tCheckButton = _G[tPanelName .. "IconCheckButton"];
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].isIcon = VUHDO_forceBooleanValue(tCheckButton:GetChecked());
......@@ -247,9 +249,11 @@ function VUHDO_saveCustomDebuffOnClick(aButton)
tColorSwatch = _G[tPanelName .. "ColorTexture"];
if (VUHDO_COLOR_SWATCH_MODEL == nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
if (VUHDO_COLOR_SWATCH_MODEL == nil) then
if (VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color == nil) then
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_PANEL_SETUP.BAR_COLORS["DEBUFF" .. VUHDO_DEBUFF_TYPE_CUSTOM]);
end
else
VUHDO_CONFIG["CUSTOM_DEBUFF"]["STORED_SETTINGS"][tValue].color
= VUHDO_deepCopyTable(VUHDO_COLOR_SWATCH_MODEL);
......
......@@ -818,3 +818,42 @@ function VUHDO_getCurrentKeyModifierString()
IsControlKeyDown() and "ctrl" or "",
IsShiftKeyDown() and "shift" or "");
end
-- Helper to serialize a table to a string for pretty printing
-- Taken from Lua Users Wiki: http://lua-users.org/wiki/TableUtils
function VUHDO_tableValueToString(v)
if "string" == type( v ) then
v = string.gsub( v, "\n", "\\n" )
if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then
return "'" .. v .. "'"
end
return '"' .. string.gsub(v,'"', '\\"' ) .. '"'
else
return "table" == type( v ) and VUHDO_tableToString( v ) or
tostring( v )
end
end
function VUHDO_tableKeyToString(k)
if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then
return k
else
return "[" .. VUHDO_tableValueToString( k ) .. "]"
end
end
function VUHDO_tableToString(tbl)
local result, done = {}, {}
for k, v in ipairs( tbl ) do
table.insert( result, VUHDO_tableValueToString( v ) )
done[ k ] = true
end
for k, v in pairs( tbl ) do
if not done[ k ] then
table.insert( result,
VUHDO_tableKeyToString( k ) .. "=" .. VUHDO_tableValueToString( v ) )
end
end
return "{" .. table.concat( result, "," ) .. "}"
end
Version 3.6.
Version 3.60.
Bugfixes:
-- Fixed bug where saving custom debuff settings would reset the custom debuff color
-- Fixed bug where custom debuffs added by spell ID did not have all settings applied
-- Fixed bug where custom debuffs were not playing sounds when selected
-- Fixed bug where isInSameZone check always returned true
-- BuffWatch now correctly ignores other players outside the players zone
-- Global scanner perf bump when 'same zone' limit selected
......@@ -57,15 +60,16 @@ Features:
TODO:
-- Added Priest spell Holy Nova support for AOE advisor
-- Added Priest spell Holy Nova support for cluster indicator
-- Updated combat log event processing for multistrike
-- SWING_DAMAGE/SPELL_DAMAGE/SPELL_PERIODIC_DAMAGE has new params after crushing (isOffHand, multistrike)
-- SPELL_HEAL/SPELL_PERIODIC_HEAL has new param after critical (multistrike)
-- SPELL_MISSED/SPELL_PERIODIC_MISSED/RANGE_MISSED/SWING_MISSED has new param after isOffHand (multistrike)
-- Added new instance difficulties
-- Tools > Profiles > Activate due to group size
-- Move > Hold to Test
-- Updated incoming/over heal estimation
-- Not a bug in VuhDo - UnitGetIncomingHeals appears to return bogus values on beta
-- Appears to not bw a bug in VuhDo
-- UnitGetIncomingHeals API seems to return bogus values on beta/PTR
-- Updated AOE advisor spell bases
-- Healing spell base values have been removed (eg. H = Cx + B is now H = Cx)
-- Need to empirically test coefficients shown on beta tooltips
......
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