diff --git a/Interface/AddOns/SVUI/SVUI.toc b/Interface/AddOns/SVUI/SVUI.toc index 9890dc7..1161d43 100644 --- a/Interface/AddOns/SVUI/SVUI.toc +++ b/Interface/AddOns/SVUI/SVUI.toc @@ -5,7 +5,7 @@ ## Notes: Supervillain UI [|cff9911FFCore Framework|r]. ## SavedVariables: SVUI_Global, SVUI_Errors ## SavedVariablesPerCharacter: SVUI_Profile, SVUI_Cache, SVUI_Filters, SVUI_Layouts -## OptionalDeps: Blizzard_DebugTools, Blizzard_PetJournal, Blizzard_ObjectiveTracker, SharedMedia +## OptionalDeps: Blizzard_DebugTools, Blizzard_PetJournal, Blizzard_ObjectiveTracker, Blizzard_CombatText, SharedMedia ## X-SVUIName: SuperVillain UI ## X-SVUISchema: Core ## X-oUF: oUF_Villain diff --git a/Interface/AddOns/SVUI/data/defaults.lua b/Interface/AddOns/SVUI/data/defaults.lua index e8c3cba..cb3672b 100644 --- a/Interface/AddOns/SVUI/data/defaults.lua +++ b/Interface/AddOns/SVUI/data/defaults.lua @@ -26,12 +26,7 @@ local defaultCenterWidth = min(defaultDockWidth, 800); local function safename(id) local n = GetSpellInfo(id) if not n then - if type(id) == "string" then - n = id - else - --SV:Debugger('|cffFF9900SVUI:|r Spell not found: (#ID) '..id) - n = "Voodoo Doll"; - end + return false end return n end @@ -171,14 +166,6 @@ SV.defaults["media"] = { ["personal"] = {0, 1, 0.5, 0.25}, ["others"] = {0, 1, 0, 0.25}, ["absorbs"] = {1, 1, 0, 0.25} - }, - ["spellcolor"] = { - [safename(2825)] = {0.98, 0.57, 0.11}, --Bloodlust - [safename(32182)] = {0.98, 0.57, 0.11}, --Heroism - [safename(80353)] = {0.98, 0.57, 0.11}, --Time Warp - [safename(90355)] = {0.98, 0.57, 0.11}, --Ancient Hysteria - --[safename(84963)] = {0.98, 0.57, 0.11}, --Inquisition - [safename(86659)] = {0.98, 0.57, 0.11}, --Guardian of Ancient Kings } } }; diff --git a/Interface/AddOns/SVUI/data/filterdefaults.lua b/Interface/AddOns/SVUI/data/filterdefaults.lua index 18df59d..6b33810 100644 --- a/Interface/AddOns/SVUI/data/filterdefaults.lua +++ b/Interface/AddOns/SVUI/data/filterdefaults.lua @@ -47,6 +47,8 @@ local FilterIDs = { ["Raid"] = [[116281,116784,116417,116942,116161,117708,118303,118048,118135,117878,117949,116835,116778,116525,122761,122760,122740,123812,123180,123474,122835,123081,122125,121885,121949,117436,118091,117519,122752,123011,116161,123121,119985,119086,119775,122151,138349,137371,136767,137641,137359,137972,136903,136753,137633,137731,133767,133768,136050,138569,134691,137440,137408,137360,135000,143436,143579,147383,146124,144851,144358,144774,147207,144215,143990,144330,143494,142990,143919,143766,143773,146589,143777,143385,143974,145183]] }; +local InitAuraBars = [[2825,32182,80353,90355,86659]] + SV.filterdefaults["BlackList"] = {}; SV.filterdefaults["WhiteList"] = {}; SV.filterdefaults["Defense"] = {}; @@ -70,6 +72,15 @@ for k, x in pairs(FilterIDs) do SV.filterdefaults[k] = src end +for id in InitAuraBars:gmatch("([^,]+)") do + if(id) then + local spellID = tonumber(id); + if(safename(spellID)) then + SV.filterdefaults["AuraBars"][id] = {0.98, 0.57, 0.11} + end + end +end + function SV:SanitizeFilters() local filter = SV.filters.BuffWatch for id, watchData in pairs(filter) do diff --git a/Interface/AddOns/SVUI/libs/LibActionButton-1.0/LibActionButton-1.0.lua b/Interface/AddOns/SVUI/libs/LibActionButton-1.0/LibActionButton-1.0.lua index a3773e7..9fd011f 100644 --- a/Interface/AddOns/SVUI/libs/LibActionButton-1.0/LibActionButton-1.0.lua +++ b/Interface/AddOns/SVUI/libs/LibActionButton-1.0/LibActionButton-1.0.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2010, Hendrik "nevcairiel" Leppkes <h.leppkes@gmail.com> +Copyright (c) 2010-2014, Hendrik "nevcairiel" Leppkes <h.leppkes@gmail.com> All rights reserved. @@ -29,12 +29,33 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]] local MAJOR_VERSION = "LibActionButton-1.0" -local MINOR_VERSION = 20 +local MINOR_VERSION = 57 if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end local lib, oldversion = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) if not lib then return end +-- Lua functions +local _G = _G +local type, error, tostring, tonumber, assert, select = type, error, tostring, tonumber, assert, select +local setmetatable, wipe, unpack, pairs, next = setmetatable, wipe, unpack, pairs, next +local str_match, format, tinsert, tremove = string.match, format, tinsert, tremove + +-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded +-- List them here for Mikk's FindGlobals script +-- Note: No WoW API function get upvalued to allow proper interaction with any addons that try to hook them. +-- GLOBALS: LibStub, CreateFrame, InCombatLockdown, ClearCursor, GetCursorInfo, GameTooltip, GameTooltip_SetDefaultAnchor +-- GLOBALS: GetBindingKey, GetBindingText, SetBinding, SetBindingClick, GetCVar, GetMacroInfo +-- GLOBALS: PickupAction, PickupItem, PickupMacro, PickupPetAction, PickupSpell, PickupCompanion, PickupEquipmentSet +-- GLOBALS: CooldownFrame_SetTimer, UIParent, IsSpellOverlayed, SpellFlyout, GetMouseFocus, SetClampedTextureRotation +-- GLOBALS: GetActionInfo, GetActionTexture, HasAction, GetActionText, GetActionCount, GetActionCooldown, IsAttackAction +-- GLOBALS: IsAutoRepeatAction, IsEquippedAction, IsCurrentAction, IsConsumableAction, IsUsableAction, IsStackableAction, IsActionInRange +-- GLOBALS: GetSpellLink, GetMacroSpell, GetSpellTexture, GetSpellCount, GetSpellCooldown, IsAttackSpell, IsCurrentSpell +-- GLOBALS: FindSpellBookSlotBySpellID, IsUsableSpell, IsConsumableSpell, IsSpellInRange, IsAutoRepeatSpell +-- GLOBALS: GetItemIcon, GetItemCount, GetItemCooldown, IsEquippedItem, IsCurrentItem, IsUsableItem, IsConsumableItem, IsItemInRange +-- GLOBALS: GetActionCharges, IsItemAction, GetSpellCharges +-- GLOBALS: RANGE_INDICATOR, ATTACK_BUTTON_FLASH_TIME, TOOLTIP_UPDATE_TIME + local KeyBound = LibStub("LibKeyBound-1.0", true) local CBH = LibStub("CallbackHandler-1.0") @@ -43,6 +64,13 @@ lib.eventFrame:UnregisterAllEvents() lib.buttonRegistry = lib.buttonRegistry or {} lib.activeButtons = lib.activeButtons or {} +lib.actionButtons = lib.actionButtons or {} +lib.nonActionButtons = lib.nonActionButtons or {} + +lib.unusedOverlayGlows = lib.unusedOverlayGlows or {} +lib.numOverlays = lib.numOverlays or 0 + +lib.ACTION_HIGHLIGHT_MARKS = lib.ACTION_HIGHLIGHT_MARKS or setmetatable({}, { __index = ACTION_HIGHLIGHT_MARKS }) lib.callbacks = lib.callbacks or CBH:New(lib) @@ -77,33 +105,23 @@ local type_meta_map = { custom = Custom_MT } -local ButtonRegistry, ActiveButtons = lib.buttonRegistry, lib.activeButtons +local ButtonRegistry, ActiveButtons, ActionButtons, NonActionButtons = lib.buttonRegistry, lib.activeButtons, lib.actionButtons, lib.nonActionButtons -local Update, UpdateButtonState, UpdateUsable, UpdateCount, UpdateCooldown, UpdateTooltip +local Update, UpdateButtonState, UpdateUsable, UpdateCount, UpdateCooldown, UpdateTooltip, UpdateNewAction local StartFlash, StopFlash, UpdateFlash, UpdateHotkeys, UpdateRangeTimer, UpdateOverlayGlow local UpdateFlyout, ShowGrid, HideGrid, UpdateGrid, SetupSecureSnippets, WrapOnClick +local ShowOverlayGlow, HideOverlayGlow, GetOverlayGlow, OverlayGlowAnimOutFinished +local HookCooldown local InitializeEventHandler, OnEvent, ForAllButtons, OnUpdate - -local SPELL_POWER_HOLY_POWER = SPELL_POWER_HOLY_POWER; -local HAND_OF_LIGHT = GetSpellInfo(90174); -local PLAYERCLASS = select(2, UnitClass('player')) -local HOLY_POWER_SPELLS = { - [85256] = GetSpellInfo(85256), --Templar's Verdict - [53385] = GetSpellInfo(53385), --Divine Storm - [53600] = GetSpellInfo(53600), --Shield of the Righteous -}; - - local DefaultConfig = { outOfRangeColoring = "button", - tooltip = "enable", + tooltip = "enabled", showGrid = false, colors = { range = { 0.8, 0.1, 0.1 }, - mana = { 0.5, 0.5, 1.0 }, - hp = { 0.5, 0.5, 1.0 } + mana = { 0.5, 0.5, 1.0 } }, hideElements = { macro = false, @@ -112,6 +130,7 @@ local DefaultConfig = { }, keyBoundTarget = false, clickOnDown = false, + flyoutDirection = "UP", } --- Create a new action button. @@ -155,18 +174,15 @@ function lib:CreateButton(id, name, header, config) SetupSecureSnippets(button) WrapOnClick(button) - -- Store all sub frames on the button object for easier access - button.icon = _G[name .. "Icon"] - button.flash = _G[name .. "Flash"] - button.FlyoutBorder = _G[name .. "FlyoutBorder"] - button.FlyoutBorderShadow = _G[name .. "FlyoutBorderShadow"] - button.FlyoutArrow = _G[name .. "FlyoutArrow"] - button.hotkey = _G[name .. "HotKey"] - button.count = _G[name .. "Count"] - button.actionName = _G[name .. "Name"] - button.border = _G[name .. "Border"] - button.cooldown = _G[name .. "Cooldown"] - button.normalTexture = _G[name .. "NormalTexture"] + -- adjust hotkey style for better readability + button.HotKey:SetFont(button.HotKey:GetFont(), 13, "OUTLINE") + button.HotKey:SetVertexColor(0.75, 0.75, 0.75) + + -- adjust count/stack size + button.Count:SetFont(button.Count:GetFont(), 16, "OUTLINE") + + -- hook Cooldown stuff for alpha fix in 6.0 + HookCooldown(button) -- Store the button in the registry, needed for event and OnUpdate handling if not next(ButtonRegistry) then @@ -287,8 +303,8 @@ function SetupSecureSnippets(button) -- We can only use a handful of the possible things on the cursor -- return false for all those we can't put on buttons - self:SetAttribute(format("labtype-%d", state), kind) - self:SetAttribute(format("labaction-%d", state), value) + self:SetAttribute(format("labtype-%s", state), kind) + self:SetAttribute(format("labaction-%s", state), value) -- update internal state self:RunAttribute("UpdateState", state) -- send a notification to the insecure code @@ -358,6 +374,13 @@ function Generic:ClearSetPoint(...) self:SetPoint(...) end +function Generic:NewHeader(header) + self.header = header + self:SetParent(header) + SetupSecureSnippets(self) + WrapOnClick(self) +end + ----------------------------------------------------------- --- state management @@ -390,7 +413,7 @@ function Generic:SetState(state, kind, action) if tonumber(action) then action = format("item:%s", action) else - local itemString = string.match(itemLink, "^|c%x+|H(item[%d:]+)|h%[") + local itemString = str_match(action, "^|c%x+|H(item[%d:]+)|h%[") if itemString then action = itemString end @@ -434,7 +457,7 @@ end function Generic:ButtonContentsChanged(state, kind, value) state = tostring(state) - self.state_types[state] = kind or "emtpy" + self.state_types[state] = kind or "empty" self.state_actions[state] = value lib.callbacks:Fire("OnButtonContentsChanged", self, state, self.state_types[state], self.state_actions[state]) self:UpdateAction(self) @@ -467,6 +490,10 @@ function Generic:AddToMasque(group) self.MasqueSkinned = true end +function Generic:UpdateAlpha() + UpdateCooldown(self) +end + ----------------------------------------------------------- --- frame scripts @@ -494,31 +521,6 @@ local function PickupAny(kind, target, detail, ...) end end -function Generic:OnUpdate(elapsed) - if not GetCVarBool('lockActionBars') then return; end - - self.lastupdate = (self.lastupdate or 0) + elapsed; - if (self.lastupdate < .2) then return end - self.lastupdate = 0 - - local isDragKeyDown - if GetModifiedClick("PICKUPACTION") == 'ALT' then - isDragKeyDown = IsAltKeyDown() - elseif GetModifiedClick("PICKUPACTION") == 'CTRL' then - isDragKeyDown = IsControlKeyDown() - elseif GetModifiedClick("PICKUPACTION") == 'SHIFT' then - isDragKeyDown = IsShiftKeyDown() - end - - if isDragKeyDown and (self.clickState == 'AnyDown' or self.clickState == nil) then - self.clickState = 'AnyUp' - self:RegisterForClicks(self.clickState) - elseif self.clickState == 'AnyUp' and not isDragKeyDown then - self.clickState = 'AnyDown' - self:RegisterForClicks(self.clickState) - end -end - function Generic:OnEnter() if self.config.tooltip ~= "disabled" and (self.config.tooltip ~= "nocombat" or not InCombatLockdown()) then UpdateTooltip(self) @@ -526,15 +528,15 @@ function Generic:OnEnter() if KeyBound then KeyBound:Set(self) end - - if self.config.clickOnDown then - self:SetScript('OnUpdate', Generic.OnUpdate) + + if self._state_type == "action" and self.NewActionTexture then + lib.ACTION_HIGHLIGHT_MARKS[self._state_action] = false + UpdateNewAction(self) end end function Generic:OnLeave() GameTooltip:Hide() - self:SetScript('OnUpdate', nil) end -- Insecure drag handler to allow clicking on the button with an action on the cursor @@ -573,13 +575,13 @@ function Generic:PostClick() self._old_type = nil end local oldType, oldAction = self._state_type, self._state_action - local a, b, c = GetCursorInfo() + local kind, data, subtype, extra = GetCursorInfo() self.header:SetFrameRef("updateButton", self) self.header:Execute(format([[ local frame = self:GetFrameRef("updateButton") - control:RunFor(frame, frame:GetAttribute("OnReceiveDrag"), %s, %s, %s) + control:RunFor(frame, frame:GetAttribute("OnReceiveDrag"), %s, %s, %s, %s) control:RunFor(frame, frame:GetAttribute("UpdateState"), %s) - ]], formatHelper(a), formatHelper(b), formatHelper(c), formatHelper(self:GetAttribute("state")))) + ]], formatHelper(kind), formatHelper(data), formatHelper(subtype), formatHelper(extra), formatHelper(self:GetAttribute("state")))) PickupAny("clear", oldType, oldAction) end self._receiving_drag = nil @@ -619,14 +621,17 @@ function Generic:UpdateConfig(config) if self.config.outOfRangeColoring == "hotkey" then self.outOfRange = nil elseif oldconfig and oldconfig.outOfRangeColoring == "hotkey" then - self.hotkey:SetVertexColor(0.6, 0.6, 0.6) + self.HotKey:SetVertexColor(0.75, 0.75, 0.75) end if self.config.hideElements.macro then - self.actionName:Show() + self.Name:Hide() else - self.actionName:Hide() + self.Name:Show() end + + self:SetAttribute("flyoutDirection", self.config.flyoutDirection) + UpdateHotkeys(self) UpdateGrid(self) Update(self) @@ -636,10 +641,10 @@ end ----------------------------------------------------------- --- event handler -function ForAllButtons(method, onlyWithAction, ...) +function ForAllButtons(method, onlyWithAction) assert(type(method) == "function") for button in next, (onlyWithAction and ActiveButtons or ButtonRegistry) do - method(button, ...) + method(button) end end @@ -650,11 +655,11 @@ function InitializeEventHandler() lib.eventFrame:RegisterEvent("ACTIONBAR_HIDEGRID") --lib.eventFrame:RegisterEvent("ACTIONBAR_PAGE_CHANGED") --lib.eventFrame:RegisterEvent("UPDATE_BONUS_ACTIONBAR") - --lib.eventFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR") lib.eventFrame:RegisterEvent("ACTIONBAR_SLOT_CHANGED") lib.eventFrame:RegisterEvent("UPDATE_BINDINGS") lib.eventFrame:RegisterEvent("UPDATE_SHAPESHIFT_FORM") - + lib.eventFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR") + lib.eventFrame:RegisterEvent("ACTIONBAR_UPDATE_STATE") lib.eventFrame:RegisterEvent("ACTIONBAR_UPDATE_USABLE") lib.eventFrame:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN") @@ -666,8 +671,8 @@ function InitializeEventHandler() lib.eventFrame:RegisterEvent("PLAYER_LEAVE_COMBAT") lib.eventFrame:RegisterEvent("START_AUTOREPEAT_SPELL") lib.eventFrame:RegisterEvent("STOP_AUTOREPEAT_SPELL") - lib.eventFrame:RegisterUnitEvent("UNIT_ENTERED_VEHICLE", "player") - lib.eventFrame:RegisterUnitEvent("UNIT_EXITED_VEHICLE", "player") + lib.eventFrame:RegisterEvent("UNIT_ENTERED_VEHICLE") + lib.eventFrame:RegisterEvent("UNIT_EXITED_VEHICLE") lib.eventFrame:RegisterEvent("COMPANION_UPDATE") lib.eventFrame:RegisterEvent("UNIT_INVENTORY_CHANGED") lib.eventFrame:RegisterEvent("LEARNED_SPELL_IN_TAB") @@ -675,36 +680,37 @@ function InitializeEventHandler() lib.eventFrame:RegisterEvent("PET_STABLE_SHOW") lib.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW") lib.eventFrame:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE") + lib.eventFrame:RegisterEvent("SPELL_UPDATE_CHARGES") + lib.eventFrame:RegisterEvent("UPDATE_SUMMONPETS_ACTION") -- With those two, do we still need the ACTIONBAR equivalents of them? - lib.eventFrame:RegisterEvent("SPELL_UPDATE_CHARGES") lib.eventFrame:RegisterEvent("SPELL_UPDATE_COOLDOWN") lib.eventFrame:RegisterEvent("SPELL_UPDATE_USABLE") lib.eventFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") + lib.eventFrame:RegisterEvent("LOSS_OF_CONTROL_ADDED") + lib.eventFrame:RegisterEvent("LOSS_OF_CONTROL_UPDATE") + lib.eventFrame:Show() lib.eventFrame:SetScript("OnUpdate", OnUpdate) end function OnEvent(frame, event, arg1, ...) - if event == "UNIT_INVENTORY_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then + if (event == "UNIT_INVENTORY_CHANGED" and arg1 == "player") or event == "LEARNED_SPELL_IN_TAB" then local tooltipOwner = GameTooltip:GetOwner() if ButtonRegistry[tooltipOwner] then tooltipOwner:SetTooltip() end elseif event == "ACTIONBAR_SLOT_CHANGED" then - --print("Update from: "..event) for button in next, ButtonRegistry do if button._state_type == "action" and (arg1 == 0 or arg1 == tonumber(button._state_action)) then Update(button) end end - elseif event == "PLAYER_ENTERING_WORLD" or event == "UPDATE_SHAPESHIFT_FORM" then - --print("Update from: "..event) - ForAllButtons(Update) - elseif event == "ACTIONBAR_PAGE_CHANGED" or event == "UPDATE_BONUS_ACTIONBAR" or event == "UPDATE_OVERRIDE_ACTIONBAR" then - --print("Update from: "..event) + elseif event == "PLAYER_ENTERING_WORLD" or event == "UPDATE_SHAPESHIFT_FORM" or event == "UPDATE_VEHICLE_ACTIONBAR" then ForAllButtons(Update) + elseif event == "ACTIONBAR_PAGE_CHANGED" or event == "UPDATE_BONUS_ACTIONBAR" then + -- TODO: Are these even needed? elseif event == "ACTIONBAR_SHOWGRID" then ShowGrid() elseif event == "ACTIONBAR_HIDEGRID" then @@ -713,13 +719,43 @@ function OnEvent(frame, event, arg1, ...) ForAllButtons(UpdateHotkeys) elseif event == "PLAYER_TARGET_CHANGED" then UpdateRangeTimer() - elseif event == "ACTIONBAR_UPDATE_STATE" or event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITED_VEHICLE" or - (event == "COMPANION_UPDATE" and arg1 == "MOUNT") then + elseif (event == "ACTIONBAR_UPDATE_STATE") or + ((event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITED_VEHICLE") and (arg1 == "player")) or + ((event == "COMPANION_UPDATE") and (arg1 == "MOUNT")) then ForAllButtons(UpdateButtonState, true) - elseif event == "ACTIONBAR_UPDATE_USABLE" or event == "SPELL_UPDATE_USABLE" then - ForAllButtons(UpdateUsable, true) - elseif event == "ACTIONBAR_UPDATE_COOLDOWN" or event == "SPELL_UPDATE_COOLDOWN" then - ForAllButtons(UpdateCooldown, true) + elseif event == "ACTIONBAR_UPDATE_USABLE" then + for button in next, ActionButtons do + UpdateUsable(button) + end + elseif event == "SPELL_UPDATE_USABLE" then + for button in next, NonActionButtons do + UpdateUsable(button) + end + elseif event == "ACTIONBAR_UPDATE_COOLDOWN" then + for button in next, ActionButtons do + UpdateCooldown(button) + if GameTooltip:GetOwner() == button then + UpdateTooltip(button) + end + end + elseif event == "SPELL_UPDATE_COOLDOWN" then + for button in next, NonActionButtons do + UpdateCooldown(button) + if GameTooltip:GetOwner() == button then + UpdateTooltip(button) + end + end + elseif event == "LOSS_OF_CONTROL_ADDED" then + for button in next, ActiveButtons do + UpdateCooldown(button) + if GameTooltip:GetOwner() == button then + UpdateTooltip(button) + end + end + elseif event == "LOSS_OF_CONTROL_UPDATE" then + for button in next, ActiveButtons do + UpdateCooldown(button) + end elseif event == "TRADE_SKILL_SHOW" or event == "TRADE_SKILL_CLOSE" or event == "ARCHAEOLOGY_CLOSED" then ForAllButtons(UpdateButtonState, true) elseif event == "PLAYER_ENTER_COMBAT" then @@ -752,14 +788,28 @@ function OnEvent(frame, event, arg1, ...) for button in next, ActiveButtons do local spellId = button:GetSpellId() if spellId and spellId == arg1 then - ActionButton_ShowOverlayGlow(button) + ShowOverlayGlow(button) + else + if button._state_type == "action" then + local actionType, id = GetActionInfo(button._state_action) + if actionType == "flyout" and FlyoutHasSpell(id, arg1) then + ShowOverlayGlow(button) + end + end end end elseif event == "SPELL_ACTIVATION_OVERLAY_GLOW_HIDE" then for button in next, ActiveButtons do local spellId = button:GetSpellId() if spellId and spellId == arg1 then - ActionButton_HideOverlayGlow(button) + HideOverlayGlow(button) + else + if button._state_type == "action" then + local actionType, id = GetActionInfo(button._state_action) + if actionType == "flyout" and FlyoutHasSpell(id, arg1) then + HideOverlayGlow(button) + end + end end end elseif event == "PLAYER_EQUIPMENT_CHANGED" then @@ -769,7 +819,19 @@ function OnEvent(frame, event, arg1, ...) end end elseif event == "SPELL_UPDATE_CHARGES" then - ForAllButtons(Update) + ForAllButtons(UpdateCount, true) + elseif event == "UPDATE_SUMMONPETS_ACTION" then + for button in next, ActiveButtons do + if button._state_type == "action" then + local actionType, id = GetActionInfo(button._state_action) + if actionType == "summonpet" then + local texture = GetActionTexture(button._state_action) + if texture then + button.icon:SetTexture(texture) + end + end + end + end end end @@ -783,13 +845,13 @@ function OnUpdate(_, elapsed) for button in next, ActiveButtons do -- Flashing if button.flashing == 1 and flashTime <= 0 then - if button.flash:IsShown() then - button.flash:Hide() + if button.Flash:IsShown() then + button.Flash:Hide() else - button.flash:Show() + button.Flash:Show() end end - + -- Range if rangeTimer <= 0 then local inRange = button:IsInRange() @@ -799,18 +861,18 @@ function OnUpdate(_, elapsed) if button.config.outOfRangeColoring == "button" then UpdateUsable(button) elseif button.config.outOfRangeColoring == "hotkey" then - local hotkey = button.hotkey + local hotkey = button.HotKey if hotkey:GetText() == RANGE_INDICATOR then - if inRange then + if inRange == false then hotkey:Show() else hotkey:Hide() end end - if button.outOfRange then + if inRange == false then hotkey:SetVertexColor(unpack(button.config.colors.range)) else - hotkey:SetVertexColor(0.6, 0.6, 0.6) + hotkey:SetVertexColor(0.75, 0.75, 0.75) end end end @@ -863,6 +925,10 @@ end ----------------------------------------------------------- --- KeyBound integration +function Generic:GetBindingAction() + return self.config.keyBoundTarget or "CLICK "..self:GetName()..":LeftButton" +end + function Generic:GetHotkey() local name = "CLICK "..self:GetName()..":LeftButton" local key = GetBindingKey(self.config.keyBoundTarget or name) @@ -904,6 +970,7 @@ function Generic:SetKey(key) else SetBindingClick(key, self:GetName(), "LeftButton") end + lib.callbacks:Fire("OnKeybindingChanged", self, key) end local function clearBindings(binding) @@ -917,6 +984,7 @@ function Generic:ClearBindings() clearBindings(self.config.keyBoundTarget) end clearBindings("CLICK "..self:GetName()..":LeftButton") + lib.callbacks:Fire("OnKeybindingChanged", self, nil) end ----------------------------------------------------------- @@ -937,41 +1005,47 @@ function Generic:UpdateAction(force) end function Update(self) - local test = self:GetName() if self:HasAction() then ActiveButtons[self] = true + if self._state_type == "action" then + ActionButtons[self] = true + NonActionButtons[self] = nil + else + ActionButtons[self] = nil + NonActionButtons[self] = true + end self:SetAlpha(1.0) UpdateButtonState(self) UpdateUsable(self) UpdateCooldown(self) UpdateFlash(self) - self.count:SetAlpha(1) else ActiveButtons[self] = nil + ActionButtons[self] = nil + NonActionButtons[self] = nil if gridCounter == 0 and not self.config.showGrid then self:SetAlpha(0.0) end - self.count:SetAlpha(0) self.cooldown:Hide() + self:SetChecked(false) end -- Add a green border if button is an equipped item if self:IsEquipped() and not self.config.hideElements.equipped then - self.border:SetVertexColor(0, 1.0, 0, 0.35) - self.border:Show() + self.Border:SetVertexColor(0, 1.0, 0, 0.35) + self.Border:Show() else - self.border:Hide() + self.Border:Hide() end -- Update Action Text if not self:IsConsumableOrStackable() then - self.actionName:SetText(self:GetActionText()) + self.Name:SetText(self:GetActionText()) else - self.actionName:SetText("") + self.Name:SetText("") end - - -- Update icon and hotkey + -- Update icon and hotkey local texture = self:GetTexture() if texture then self.icon:SetTexture(texture) @@ -979,20 +1053,20 @@ function Update(self) self.rangeTimer = - 1 self:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") if not self.LBFSkinned and not self.MasqueSkinned then - self.normalTexture:SetTexCoord(0, 0, 0, 0) + self.NormalTexture:SetTexCoord(0, 0, 0, 0) end else self.icon:Hide() self.cooldown:Hide() self.rangeTimer = nil self:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") - if self.hotkey:GetText() == RANGE_INDICATOR then - self.hotkey:Hide() + if self.HotKey:GetText() == RANGE_INDICATOR then + self.HotKey:Hide() else - self.hotkey:SetVertexColor(0.6, 0.6, 0.6) + self.HotKey:SetVertexColor(0.75, 0.75, 0.75) end if not self.LBFSkinned and not self.MasqueSkinned then - self.normalTexture:SetTexCoord(-0.15, 1.15, -0.15, 1.17) + self.NormalTexture:SetTexCoord(-0.15, 1.15, -0.15, 1.17) end end @@ -1004,6 +1078,8 @@ function Update(self) UpdateOverlayGlow(self) + UpdateNewAction(self) + if GameTooltip:GetOwner() == self then UpdateTooltip(self) end @@ -1035,24 +1111,6 @@ function UpdateButtonState(self) lib.callbacks:Fire("OnButtonState", self) end -local function IsHolyPowerAbility(actionId) - if not actionId or type(actionId) ~= 'number' then return false; end - local actionType, id = GetActionInfo(actionId); - if actionType == 'macro' then - local macroSpell = GetMacroSpell(id); - if macroSpell then - for spellId, spellName in pairs(HOLY_POWER_SPELLS) do - if macroSpell == spellName then - return true; - end - end - end - else - return HOLY_POWER_SPELLS[id]; - end - return false; -end - function UpdateUsable(self) -- TODO: make the colors configurable -- TODO: allow disabling of the whole recoloring @@ -1060,50 +1118,110 @@ function UpdateUsable(self) self.icon:SetVertexColor(unpack(self.config.colors.range)) else local isUsable, notEnoughMana = self:IsUsable() - local action = self._state_action - if PLAYERCLASS == 'PALADIN' and IsHolyPowerAbility(action) and not(UnitPower('player', SPELL_POWER_HOLY_POWER) >= 3 or UnitBuff('player', HAND_OF_LIGHT)) then - self.icon:SetVertexColor(unpack(self.config.colors.hp)) - elseif isUsable then + if isUsable then self.icon:SetVertexColor(1.0, 1.0, 1.0) - --self.normalTexture:SetVertexColor(1.0, 1.0, 1.0) + --self.NormalTexture:SetVertexColor(1.0, 1.0, 1.0) elseif notEnoughMana then self.icon:SetVertexColor(unpack(self.config.colors.mana)) - --self.normalTexture:SetVertexColor(0.5, 0.5, 1.0) + --self.NormalTexture:SetVertexColor(0.5, 0.5, 1.0) else self.icon:SetVertexColor(0.4, 0.4, 0.4) - --self.normalTexture:SetVertexColor(1.0, 1.0, 1.0) + --self.NormalTexture:SetVertexColor(1.0, 1.0, 1.0) end end lib.callbacks:Fire("OnButtonUsable", self) end function UpdateCount(self) - local actionCount, charges, maxCharges = 0, 0, 0 - local isItemAction = false - - if self._state_action and type(self._state_action) == "number" then - charges, maxCharges = GetActionCharges(self._state_action) - actionCount = self:GetCount() - isItemAction = IsItemAction(self._state_action) - end - - self.cooldown:SetParent(self) - if self:IsConsumableOrStackable() or (not isItemAction and actionCount > 0) then - if actionCount > (self.maxDisplayCount or 9999) then - self.count:SetText("*") + if not self:HasAction() then + self.Count:SetText("") + return + end + if self:IsConsumableOrStackable() then + local count = self:GetCount() + if count > (self.maxDisplayCount or 9999) then + self.Count:SetText("*") else - self.count:SetText(actionCount) + self.Count:SetText(count) end - elseif maxCharges > 1 then - self.count:SetText(charges) else - self.count:SetText("") + local charges, maxCharges, chargeStart, chargeDuration = self:GetCharges() + if charges and maxCharges and maxCharges > 0 then + self.Count:SetText(charges) + else + self.Count:SetText("") + end + end +end + +local function SetCooldownHook(cooldown, ...) + local effectiveAlpha = cooldown:GetEffectiveAlpha() + local start, duration = ... + + if start ~= 0 or duration ~= 0 then + -- update swipe alpha + cooldown.__metaLAB.SetSwipeColor(cooldown, cooldown.__SwipeR, cooldown.__SwipeG, cooldown.__SwipeB, cooldown.__SwipeA * effectiveAlpha) + + -- only draw bling and edge if alpha is over 50% + cooldown:SetDrawBling(effectiveAlpha > 0.5) + if effectiveAlpha < 0.5 then + cooldown:SetDrawEdge(false) + end + + -- ensure the swipe isn't drawn on fully faded bars + if effectiveAlpha <= 0.0 then + cooldown:SetDrawSwipe(false) + end end + + return cooldown.__metaLAB.SetCooldown(cooldown, ...) +end + +local function SetSwipeColorHook(cooldown, r, g, b, a) + local effectiveAlpha = cooldown:GetEffectiveAlpha() + cooldown.__SwipeR, cooldown.__SwipeG, cooldown.__SwipeB, cooldown.__SwipeA = r, g, b, (a or 1) + return cooldown.__metaLAB.SetSwipeColor(cooldown, r, g, b, a * effectiveAlpha) +end + +function HookCooldown(button) + if not button.cooldown.__metaLAB then + button.cooldown.__metaLAB = getmetatable(button.cooldown).__index + button.cooldown.__SwipeR, button.cooldown.__SwipeG, button.cooldown.__SwipeB, button.cooldown.__SwipeA = 0, 0, 0, 0.8 + + button.cooldown.SetCooldown = SetCooldownHook + button.cooldown.SetSwipeColor = SetSwipeColorHook + end +end + +function OnCooldownDone(self) + self:SetScript("OnCooldownDone", nil) + UpdateCooldown(self:GetParent()) end function UpdateCooldown(self) + local locStart, locDuration = self:GetLossOfControlCooldown() local start, duration, enable, charges, maxCharges = self:GetCooldown() - CooldownFrame_SetTimer(self.cooldown, start, duration, enable, charges, maxCharges) + + if (locStart + locDuration) > (start + duration) then + if self.cooldown.currentCooldownType ~= COOLDOWN_TYPE_LOSS_OF_CONTROL then + self.cooldown:SetEdgeTexture("Interface\\Cooldown\\edge-LoC") + self.cooldown:SetHideCountdownNumbers(true) + self.cooldown.currentCooldownType = COOLDOWN_TYPE_LOSS_OF_CONTROL + self.cooldown:SetSwipeColor(0.17, 0, 0, 0.8) + end + CooldownFrame_SetTimer(self.cooldown, locStart, locDuration, 1, nil, nil, true) + else + if self.cooldown.currentCooldownType ~= COOLDOWN_TYPE_NORMAL then + self.cooldown:SetEdgeTexture("Interface\\Cooldown\\edge") + self.cooldown:SetHideCountdownNumbers(false) + self.cooldown.currentCooldownType = COOLDOWN_TYPE_NORMAL + self.cooldown:SetSwipeColor(0, 0, 0, 0.8) + end + if locStart > 0 then + self.cooldown:SetScript("OnCooldownDone", OnCooldownDone) + end + CooldownFrame_SetTimer(self.cooldown, start, duration, enable, charges, maxCharges) + end end function StartFlash(self) @@ -1114,7 +1232,7 @@ end function StopFlash(self) self.flashing = 0 - self.flash:Hide() + self.Flash:Hide() UpdateButtonState(self) end @@ -1141,27 +1259,101 @@ end function UpdateHotkeys(self) local key = self:GetHotkey() - if not key or key == "" or not self.config.hideElements.hotkey then - self.hotkey:SetText(RANGE_INDICATOR) - self.hotkey:SetPoint("TOPRIGHT", 0, -3); - self.hotkey:Hide() - else - self.hotkey:SetText(key) - self.hotkey:SetPoint("TOPRIGHT", 0, -3); - self.hotkey:Show() + if not key or key == "" or self.config.hideElements.hotkey then + self.HotKey:SetText(RANGE_INDICATOR) + self.HotKey:SetPoint("TOPLEFT", self, "TOPLEFT", 1, - 2) + self.HotKey:Hide() + else + self.HotKey:SetText(key) + self.HotKey:SetPoint("TOPLEFT", self, "TOPLEFT", - 2, - 2) + self.HotKey:Show() + end +end + +local function OverlayGlow_OnHide(self) + if self.animOut:IsPlaying() then + self.animOut:Stop() + OverlayGlowAnimOutFinished(self.animOut) + end +end + +function GetOverlayGlow() + local overlay = tremove(lib.unusedOverlayGlows); + if not overlay then + lib.numOverlays = lib.numOverlays + 1 + overlay = CreateFrame("Frame", "LAB10ActionButtonOverlay"..lib.numOverlays, UIParent, "ActionBarButtonSpellActivationAlert") + overlay.animOut:SetScript("OnFinished", OverlayGlowAnimOutFinished) + overlay:SetScript("OnHide", OverlayGlow_OnHide) + end + return overlay +end + +function ShowOverlayGlow(self) + if self.overlay then + if self.overlay.animOut:IsPlaying() then + self.overlay.animOut:Stop() + self.overlay.animIn:Play() + end + else + self.overlay = GetOverlayGlow() + local frameWidth, frameHeight = self:GetSize() + self.overlay:SetParent(self) + self.overlay:ClearAllPoints() + --Make the height/width available before the next frame: + self.overlay:SetSize(frameWidth * 1.4, frameHeight * 1.4) + self.overlay:SetPoint("TOPLEFT", self, "TOPLEFT", -frameWidth * 0.2, frameHeight * 0.2) + self.overlay:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", frameWidth * 0.2, -frameHeight * 0.2) + self.overlay.animIn:Play() end +end - if self.postKeybind then - self.postKeybind(nil, self) +function HideOverlayGlow(self) + if self.overlay then + if self.overlay.animIn:IsPlaying() then + self.overlay.animIn:Stop() + end + if self:IsVisible() then + self.overlay.animOut:Play() + else + OverlayGlowAnimOutFinished(self.overlay.animOut) + end end end +function OverlayGlowAnimOutFinished(animGroup) + local overlay = animGroup:GetParent() + local actionButton = overlay:GetParent() + overlay:Hide() + tinsert(lib.unusedOverlayGlows, overlay) + actionButton.overlay = nil +end + function UpdateOverlayGlow(self) local spellId = self:GetSpellId() if spellId and IsSpellOverlayed(spellId) then - ActionButton_ShowOverlayGlow(self) + ShowOverlayGlow(self) else - ActionButton_HideOverlayGlow(self) + HideOverlayGlow(self) + end +end + +hooksecurefunc("MarkNewActionHighlight", function(action, flag) + lib.ACTION_HIGHLIGHT_MARKS[action] = flag + for button in next, ButtonRegistry do + if button._state_type == "action" and action == tonumber(button._state_action) then + UpdateNewAction(button) + end + end +end) + +function UpdateNewAction(self) + -- special handling for "New Action" markers + if self.NewActionTexture then + if self._state_type == "action" and lib.ACTION_HIGHLIGHT_MARKS[self._state_action] then + self.NewActionTexture:Show() + else + self.NewActionTexture:Hide() + end end end @@ -1209,9 +1401,6 @@ function UpdateFlyout(self) -- return here, otherwise flyout is hidden return end - if self.FlyoutUpdateFunc then - self.FlyoutUpdateFunc(nil, self) - end end self.FlyoutArrow:Hide() end @@ -1235,6 +1424,7 @@ end Generic.HasAction = function(self) return nil end Generic.GetActionText = function(self) return "" end Generic.GetTexture = function(self) return nil end +Generic.GetCharges = function(self) return nil end Generic.GetCount = function(self) return 0 end Generic.GetCooldown = function(self) return 0, 0, 0 end Generic.IsAttack = function(self) return nil end @@ -1243,15 +1433,27 @@ Generic.IsCurrentlyActive = function(self) return nil end Generic.IsAutoRepeat = function(self) return nil end Generic.IsUsable = function(self) return nil end Generic.IsConsumableOrStackable = function(self) return nil end -Generic.IsInRange = function(self) return nil end +Generic.IsUnitInRange = function(self, unit) return nil end +Generic.IsInRange = function(self) + local unit = self:GetAttribute("unit") + if unit == "player" then + unit = nil + end + local val = self:IsUnitInRange(unit) + -- map 1/0 to true false, since the return values are inconsistent between actions and spells + if val == 1 then val = true elseif val == 0 then val = false end + return val +end Generic.SetTooltip = function(self) return nil end Generic.GetSpellId = function(self) return nil end +Generic.GetLossOfControlCooldown = function(self) return 0, 0 end ----------------------------------------------------------- --- Action Button Action.HasAction = function(self) return HasAction(self._state_action) end Action.GetActionText = function(self) return GetActionText(self._state_action) end Action.GetTexture = function(self) return GetActionTexture(self._state_action) end +Action.GetCharges = function(self) return GetActionCharges(self._state_action) end Action.GetCount = function(self) return GetActionCount(self._state_action) end Action.GetCooldown = function(self) return GetActionCooldown(self._state_action) end Action.IsAttack = function(self) return IsAttackAction(self._state_action) end @@ -1259,8 +1461,8 @@ Action.IsEquipped = function(self) return IsEquippedAction(self._st Action.IsCurrentlyActive = function(self) return IsCurrentAction(self._state_action) end Action.IsAutoRepeat = function(self) return IsAutoRepeatAction(self._state_action) end Action.IsUsable = function(self) return IsUsableAction(self._state_action) end -Action.IsConsumableOrStackable = function(self) return IsConsumableAction(self._state_action) or IsStackableAction(self._state_action) end -Action.IsInRange = function(self) return IsActionInRange(self._state_action, self:GetAttribute("unit")) end +Action.IsConsumableOrStackable = function(self) return IsConsumableAction(self._state_action) or IsStackableAction(self._state_action) or (not IsItemAction(self._state_action) and GetActionCount(self._state_action) > 0) end +Action.IsUnitInRange = function(self, unit) return IsActionInRange(self._state_action, unit) end Action.SetTooltip = function(self) return GameTooltip:SetAction(self._state_action) end Action.GetSpellId = function(self) local actionType, id, subType = GetActionInfo(self._state_action) @@ -1271,12 +1473,14 @@ Action.GetSpellId = function(self) return spellId end end +Action.GetLossOfControlCooldown = function(self) return GetActionLossOfControlCooldown(self._state_action) end ----------------------------------------------------------- --- Spell Button Spell.HasAction = function(self) return true end Spell.GetActionText = function(self) return "" end Spell.GetTexture = function(self) return GetSpellTexture(self._state_action) end +Spell.GetCharges = function(self) return GetSpellCharges(self._state_action) end Spell.GetCount = function(self) return GetSpellCount(self._state_action) end Spell.GetCooldown = function(self) return GetSpellCooldown(self._state_action) end Spell.IsAttack = function(self) return IsAttackSpell(FindSpellBookSlotBySpellID(self._state_action), "spell") end -- needs spell book id as of 4.0.1.13066 @@ -1285,7 +1489,7 @@ Spell.IsCurrentlyActive = function(self) return IsCurrentSpell(self._state Spell.IsAutoRepeat = function(self) return IsAutoRepeatSpell(FindSpellBookSlotBySpellID(self._state_action), "spell") end -- needs spell book id as of 4.0.1.13066 Spell.IsUsable = function(self) return IsUsableSpell(self._state_action) end Spell.IsConsumableOrStackable = function(self) return IsConsumableSpell(self._state_action) end -Spell.IsInRange = function(self) return IsSpellInRange(FindSpellBookSlotBySpellID(self._state_action), "spell", self:GetAttribute("unit")) end -- needs spell book id as of 4.0.1.13066 +Spell.IsUnitInRange = function(self, unit) return IsSpellInRange(FindSpellBookSlotBySpellID(self._state_action), "spell", unit) end -- needs spell book id as of 4.0.1.13066 Spell.SetTooltip = function(self) return GameTooltip:SetSpellByID(self._state_action) end Spell.GetSpellId = function(self) return self._state_action end @@ -1298,6 +1502,7 @@ end Item.HasAction = function(self) return true end Item.GetActionText = function(self) return "" end Item.GetTexture = function(self) return GetItemIcon(self._state_action) end +Item.GetCharges = function(self) return nil end Item.GetCount = function(self) return GetItemCount(self._state_action, nil, true) end Item.GetCooldown = function(self) return GetItemCooldown(getItemId(self._state_action)) end Item.IsAttack = function(self) return nil end @@ -1306,7 +1511,7 @@ Item.IsCurrentlyActive = function(self) return IsCurrentItem(self._state_a Item.IsAutoRepeat = function(self) return nil end Item.IsUsable = function(self) return IsUsableItem(self._state_action) end Item.IsConsumableOrStackable = function(self) return IsConsumableItem(self._state_action) end -Item.IsInRange = function(self) return IsItemInRange(self._state_action, self:GetAttribute("unit")) end +Item.IsUnitInRange = function(self, unit) return IsItemInRange(self._state_action, unit) end Item.SetTooltip = function(self) return GameTooltip:SetHyperlink(self._state_action) end Item.GetSpellId = function(self) return nil end @@ -1316,6 +1521,7 @@ Item.GetSpellId = function(self) return nil end Macro.HasAction = function(self) return true end Macro.GetActionText = function(self) return (GetMacroInfo(self._state_action)) end Macro.GetTexture = function(self) return (select(2, GetMacroInfo(self._state_action))) end +Macro.GetCharges = function(self) return nil end Macro.GetCount = function(self) return 0 end Macro.GetCooldown = function(self) return 0, 0, 0 end Macro.IsAttack = function(self) return nil end @@ -1324,7 +1530,7 @@ Macro.IsCurrentlyActive = function(self) return nil end Macro.IsAutoRepeat = function(self) return nil end Macro.IsUsable = function(self) return nil end Macro.IsConsumableOrStackable = function(self) return nil end -Macro.IsInRange = function(self) return nil end +Macro.IsUnitInRange = function(self, unit) return nil end Macro.SetTooltip = function(self) return nil end Macro.GetSpellId = function(self) return nil end @@ -1333,6 +1539,7 @@ Macro.GetSpellId = function(self) return nil end Custom.HasAction = function(self) return true end Custom.GetActionText = function(self) return "" end Custom.GetTexture = function(self) return self._state_action.texture end +Custom.GetCharges = function(self) return nil end Custom.GetCount = function(self) return 0 end Custom.GetCooldown = function(self) return 0, 0, 0 end Custom.IsAttack = function(self) return nil end @@ -1341,7 +1548,7 @@ Custom.IsCurrentlyActive = function(self) return nil end Custom.IsAutoRepeat = function(self) return nil end Custom.IsUsable = function(self) return true end Custom.IsConsumableOrStackable = function(self) return nil end -Custom.IsInRange = function(self) return nil end +Custom.IsUnitInRange = function(self, unit) return nil end Custom.SetTooltip = function(self) return GameTooltip:SetText(self._state_action.tooltip) end Custom.GetSpellId = function(self) return nil end Custom.RunCustom = function(self, unit, button) return self._state_action.func(self, unit, button) end @@ -1357,5 +1564,13 @@ if oldversion and next(lib.buttonRegistry) then if oldversion < 12 then WrapOnClick(button) end + if oldversion < 23 then + if button.overlay then + button.overlay:Hide() + ActionButton_HideOverlayGlow(button) + button.overlay = nil + UpdateOverlayGlow(button) + end + end end end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Druidness/oUF_Druidness.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Druidness/oUF_Druidness.lua index 236bbfe..97f9064 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Druidness/oUF_Druidness.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_Druidness/oUF_Druidness.lua @@ -49,16 +49,6 @@ local TextColors = { [5]={0.1,1,0.1} }; -local function FivePointsAlarm(points) - if not CombatText_AddMessage then return end - if(points == 5 and not ALERTED) then - CombatText_AddMessage("5 Points", CombatText_StandardScroll, 0.1, 0.5, 1, "crit") - ALERTED = true - elseif(ALERTED and points < 5) then - ALERTED = false - end -end - local UPDATE_VISIBILITY = function(self, event) local bar = self.Druidness local chicken = bar.Chicken @@ -243,10 +233,6 @@ local UPDATE_POINTS = function(self, event, unit) end end - if((GetShapeshiftForm() == 3) and (current > 0)) then - FivePointsAlarm(current) - end - if(bar.PostUpdate) then return bar:PostUpdate(current) end diff --git a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HyperCombo/oUF_HyperCombo.lua b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HyperCombo/oUF_HyperCombo.lua index 9468c11..7d3d46b 100644 --- a/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HyperCombo/oUF_HyperCombo.lua +++ b/Interface/AddOns/SVUI/libs/oUF_Villain/Plugins/oUF_HyperCombo/oUF_HyperCombo.lua @@ -28,8 +28,6 @@ local wipe = _G.wipe; local GetShapeshiftForm = _G.GetShapeshiftForm; local UnitHasVehicleUI = _G.UnitHasVehicleUI; local UnitBuff = _G.UnitBuff; -local CombatText_AddMessage = _G.CombatText_AddMessage; -local CombatText_StandardScroll = _G.CombatText_StandardScroll; local MAX_COMBO_POINTS = _G.MAX_COMBO_POINTS; local GetSpellInfo = _G.GetSpellInfo; local GetComboPoints = _G.GetComboPoints; diff --git a/Interface/AddOns/SVUI/packages/bag/components/sorting.lua b/Interface/AddOns/SVUI/packages/bag/components/sorting.lua index af3454a..0f1d039 100644 --- a/Interface/AddOns/SVUI/packages/bag/components/sorting.lua +++ b/Interface/AddOns/SVUI/packages/bag/components/sorting.lua @@ -661,8 +661,8 @@ do moveRetries, lastItemID, lockStop, lastDestination, lastMove = 0, nil, nil, nil, nil self:SetScript("OnUpdate", nil) self:Hide() - if(message and CombatText_AddMessage) then - CombatText_AddMessage(message, CombatText_StandardScroll, 1, 0.35, 0) + if(message) then + SV:SCTMessage(message, CombatText_StandardScroll, 1, 0.35, 0) end end diff --git a/Interface/AddOns/SVUI/packages/unit/elements/auras.lua b/Interface/AddOns/SVUI/packages/unit/elements/auras.lua index 01267fb..091e2bf 100644 --- a/Interface/AddOns/SVUI/packages/unit/elements/auras.lua +++ b/Interface/AddOns/SVUI/packages/unit/elements/auras.lua @@ -362,12 +362,12 @@ local ColorizeAuraBars = function(self) local auraBar = bars[i] if not auraBar:IsVisible()then break end local color - local spellName = auraBar.statusBar.aura.name; local spellID = auraBar.statusBar.aura.spellID; - if(SV.filters["Defense"][spellName]) then + local filterKey = tostring(spellID) + if(SV.filters["Defense"][filterKey]) then color = oUF_Villain.colors.shield_bars - elseif(SV.db.media.unitframes.spellcolor[spellName]) then - color = SV.db.media.unitframes.spellcolor[spellName] + elseif(SV.filters.AuraBars[filterKey]) then + color = SV.filters.AuraBars[filterKey] end if color then auraBar.statusBar:SetStatusBarColor(unpack(color)) diff --git a/Interface/AddOns/SVUI/system/core.lua b/Interface/AddOns/SVUI/system/core.lua index c64a1f7..8768b13 100644 --- a/Interface/AddOns/SVUI/system/core.lua +++ b/Interface/AddOns/SVUI/system/core.lua @@ -357,6 +357,11 @@ function SVUI:Debugger(msg) _sendmessage(msg, outbound) end +function SVUI:SCTMessage(...) + if not CombatText_AddMessage then return end + CombatText_AddMessage(...) +end + function SVUI:AddonMessage(msg) local outbound = (messagePattern):format(self.NameID) _sendmessage(msg, outbound) diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/filters/aurabar.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/filters/aurabar.lua index 55fa8d1..12466d0 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/filters/aurabar.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/filters/aurabar.lua @@ -52,6 +52,7 @@ local tempFilterTable = {}; local NONE = _G.NONE; ns.FilterOptionGroups['AuraBars'] = function(selectedSpell) + local FILTER = SV.filters.AuraBars; local RESULT = { type = "group", name = 'AuraBars', @@ -71,8 +72,8 @@ ns.FilterOptionGroups['AuraBars'] = function(selectedSpell) SV:AddonMessage(L["Value must be a number"]) elseif(not GetSpellInfo(spellID)) then SV:AddonMessage(L["Not valid spell id"]) - elseif not SV.db.media.unitframes.spellcolor[spellID] then - SV.db.media.unitframes.spellcolor[spellID] = false + elseif not FILTER[spellID] then + FILTER[spellID] = false end MOD:SetUnitFrame("player") MOD:SetUnitFrame("target") @@ -88,26 +89,27 @@ ns.FilterOptionGroups['AuraBars'] = function(selectedSpell) guiInline = true, disabled = function() local EMPTY = true; - for g in pairs(SV.db.media.unitframes.spellcolor) do + for g in pairs(FILTER) do EMPTY = false; end return EMPTY end, values = function() wipe(tempFilterTable) - for g in pairs(SV.db.media.unitframes.spellcolor)do - tempFilterTable[g] = g - end + for id, filterData in pairs(FILTER) do + if(type(id) == 'string') then + local spellID = tonumber(id) + local auraName = GetSpellInfo(spellID) + if(auraName) then + tempFilterTable[id] = auraName + end + end + end return tempFilterTable end, get = function(key) return "" end, set = function(key, value) - if SV.db.media.unitframes.spellcolor[value] then - SV.db.media.unitframes.spellcolor[value] = false; - SV:AddonMessage(L["You may not remove a spell from a default filter that is not customly added. Setting spell to false instead."]) - else - SV.db.media.unitframes.spellcolor[value] = nil - end + FILTER[value] = nil MOD:SetUnitFrame("player") MOD:SetUnitFrame("target") MOD:SetUnitFrame("focus") @@ -126,8 +128,10 @@ ns.FilterOptionGroups['AuraBars'] = function(selectedSpell) values = function() wipe(tempFilterTable) tempFilterTable[""] = NONE; - for g in pairs(SV.db.media.unitframes.spellcolor)do - tempFilterTable[g] = g + for stringID,color in pairs(FILTER) do + local spellID = tonumber(stringID) + local auraName = GetSpellInfo(spellID) + tempFilterTable[stringID] = auraName end return tempFilterTable end @@ -139,9 +143,10 @@ ns.FilterOptionGroups['AuraBars'] = function(selectedSpell) end; ns.FilterSpellGroups['AuraBars'] = function(selectedSpell) + local FILTER = SV.filters.AuraBars; local RESULT; - if(selectedSpell and (SV.db.media.unitframes.spellcolor[selectedSpell] ~= nil)) then + if(selectedSpell and (FILTER[selectedSpell] ~= nil)) then RESULT = { type = "group", name = selectedSpell, @@ -153,19 +158,15 @@ ns.FilterSpellGroups['AuraBars'] = function(selectedSpell) type = "color", order = 1, get = function(key) - local abColor = SV.db.media.unitframes.spellcolor[selectedSpell] - if type(abColor) == "boolean"then + local abColor = FILTER[selectedSpell] + if type(abColor) == "boolean" then return 0, 0, 0, 1 else return abColor[1], abColor[2], abColor[3], abColor[4] end end, set = function(key, r, g, b) - if type(SV.db.media.unitframes.spellcolor[selectedSpell]) ~= "table"then - SV.db.media.unitframes.spellcolor[selectedSpell] = {} - end - local abColor = {r, g, b} - SV.db.media.unitframes.spellcolor[selectedSpell] = abColor + FILTER[selectedSpell] = {r, g, b} MOD:SetUnitFrame("player") MOD:SetUnitFrame("target") MOD:SetUnitFrame("focus") @@ -176,7 +177,7 @@ ns.FilterSpellGroups['AuraBars'] = function(selectedSpell) order = 2, name = L["Restore Defaults"], func = function(key, value) - SV.db.media.unitframes.spellcolor[selectedSpell] = false; + FILTER[selectedSpell] = false; MOD:SetUnitFrame("player") MOD:SetUnitFrame("target") MOD:SetUnitFrame("focus") diff --git a/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua b/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua index 4a373a9..cbcb131 100644 --- a/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua +++ b/Interface/AddOns/SVUI_CraftOMatic/SVUI_CraftOMatic.lua @@ -107,11 +107,6 @@ local FARM_ICON = [[Interface\AddOns\SVUI_CraftOMatic\artwork\LABORER-FARMING]] LOCAL FUNCTIONS ########################################################## ]]-- -local function SendModeMessage(...) - if not CombatText_AddMessage then return end - CombatText_AddMessage(...) -end - local function onMouseWheel(self, delta) if (delta > 0) then self:ScrollUp() @@ -273,7 +268,7 @@ function PLUGIN:EndJobModes() --if self.Docklet:IsShown() then self.Docklet.DockButton:Click() end self:ChangeModeGear() self.ModeAlert:Hide(); - SendModeMessage("Mode Disabled", CombatText_StandardScroll, 1, 0.35, 0); + SV:SCTMessage("Mode Disabled", CombatText_StandardScroll, 1, 0.35, 0); PlaySound("UndeadExploration"); self:CraftingReset() end diff --git a/Interface/AddOns/SVUI_CraftOMatic/components/archaeology.lua b/Interface/AddOns/SVUI_CraftOMatic/components/archaeology.lua index ce80d6d..39e4f8d 100644 --- a/Interface/AddOns/SVUI_CraftOMatic/components/archaeology.lua +++ b/Interface/AddOns/SVUI_CraftOMatic/components/archaeology.lua @@ -213,11 +213,6 @@ local function GetTitleAndSkill() end return msg end - -local function SendModeMessage(...) - if not CombatText_AddMessage then return end - CombatText_AddMessage(...) -end --[[ ########################################################## EVENT HANDLER @@ -282,7 +277,7 @@ do local sites = ArchaeologyMapUpdateAll(); if(sites and sites > 0) then ArchSiteFound = true - SendModeMessage("Digsite Located", CombatText_StandardScroll, 0.91, 0.78, 0.12); + SV:SCTMessage("Digsite Located", CombatText_StandardScroll, 0.91, 0.78, 0.12); else ArchSiteFound = nil end @@ -393,7 +388,7 @@ function PLUGIN.Archaeology:Enable() end EnableListener() PLUGIN.ModeAlert:Show() - SendModeMessage("Archaeology Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); + SV:SCTMessage("Archaeology Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); end function PLUGIN.Archaeology:Disable() diff --git a/Interface/AddOns/SVUI_CraftOMatic/components/cooking.lua b/Interface/AddOns/SVUI_CraftOMatic/components/cooking.lua index 1a03a9f..8405f72 100644 --- a/Interface/AddOns/SVUI_CraftOMatic/components/cooking.lua +++ b/Interface/AddOns/SVUI_CraftOMatic/components/cooking.lua @@ -80,11 +80,6 @@ local function GetTitleAndSkill() msg = msg .. " (|cff00ddff" .. skillRank .. "|r)"; end return msg -end - -local function SendModeMessage(...) - if not CombatText_AddMessage then return end - CombatText_AddMessage(...) end local function FindPierre() @@ -218,7 +213,7 @@ function PLUGIN.Cooking:Enable() end EnableListener() PLUGIN.ModeAlert:Show() - SendModeMessage("Cooking Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); + SV:SCTMessage("Cooking Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); end function PLUGIN.Cooking:Disable() diff --git a/Interface/AddOns/SVUI_CraftOMatic/components/fishing.lua b/Interface/AddOns/SVUI_CraftOMatic/components/fishing.lua index c0adf55..e27e124 100644 --- a/Interface/AddOns/SVUI_CraftOMatic/components/fishing.lua +++ b/Interface/AddOns/SVUI_CraftOMatic/components/fishing.lua @@ -111,11 +111,6 @@ local refPoles = { LOCAL FUNCTIONS ########################################################## ]]-- -local function SendModeMessage(...) - if not CombatText_AddMessage then return end - CombatText_AddMessage(...) -end - local function GetFishingSkill() local fishing = select(4, GetProfessions()) if (fishing) then @@ -345,7 +340,7 @@ function PLUGIN.Fishing:Enable() end EnableListener() PLUGIN.ModeAlert:Show() - SendModeMessage("Fishing Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); + SV:SCTMessage("Fishing Mode Enabled", CombatText_StandardScroll, 0.28, 0.9, 0.1); end function PLUGIN.Fishing:Disable() diff --git a/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua b/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua index 31f41cb..93ec42c 100644 --- a/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua +++ b/Interface/AddOns/SVUI_FightOMatic/SVUI_FightOMatic.lua @@ -74,15 +74,6 @@ function SVUISayIncoming() end --[[ ########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function HeadsUpAlarm(...) - if not CombatText_AddMessage then return end - CombatText_AddMessage(...) -end ---[[ -########################################################## MUNGLUNCH's FAVORITE EMOTE GENERATOR ########################################################## ]]-- @@ -343,18 +334,18 @@ local function SaveEnemyScan(guid, timestamp) ["time"] = enemy.timestamp } local msg = ("Killed By: %s"):format(enemy.name); - HeadsUpAlarm(msg, CombatText_StandardScroll, enemy.colors.r, enemy.colors.g, enemy.colors.b, "sticky"); + SV:SCTMessage(msg, CombatText_StandardScroll, enemy.colors.r, enemy.colors.g, enemy.colors.b, "sticky"); PLUGIN:UpdateSummary() end local function KilledEnemyHandler(guid) local enemy = PLUGIN.cache[guid] if(enemy and enemy.name) then - HeadsUpAlarm(("Killed Mortal Enemy: %s"):format(enemy.name), CombatText_StandardScroll, 0.2, 1, 0.1, "sticky"); + SV:SCTMessage(("Killed Mortal Enemy: %s"):format(enemy.name), CombatText_StandardScroll, 0.2, 1, 0.1, "sticky"); end enemy = EnemyCache[guid] if(enemy) then - HeadsUpAlarm(("Killed Enemy: %s"):format(enemy.name), CombatText_StandardScroll, 0.1, 0.8, 0); + SV:SCTMessage(("Killed Enemy: %s"):format(enemy.name), CombatText_StandardScroll, 0.1, 0.8, 0); end end @@ -375,10 +366,10 @@ local function EnemyAlarm(name, class, colors, kos) local msg if(kos) then msg = ("Mortal Enemy Detected!: %s"):format(name); - HeadsUpAlarm(msg, CombatText_StandardScroll, 1, 0, 0) + SV:SCTMessage(msg, CombatText_StandardScroll, 1, 0, 0) elseif(class and colors) then msg = ("%s Detected"):format(class); - HeadsUpAlarm(msg, CombatText_StandardScroll, colors.r, colors.g, colors.b) + SV:SCTMessage(msg, CombatText_StandardScroll, colors.r, colors.g, colors.b) end AlertedCache[name] = true end @@ -386,7 +377,7 @@ end local function StealthAlarm(spell, name) local msg = ("%s Detected!"):format(spell); - HeadsUpAlarm(msg, CombatText_StandardScroll, 1, 0.5, 0); + SV:SCTMessage(msg, CombatText_StandardScroll, 1, 0.5, 0); print(("%s has %sed nearby!"):format(name, spell)) if(self.db.annoyingEmotes) then Stealth_Emote(name) @@ -602,7 +593,7 @@ local function ParseIncomingLog(timestamp, event, eGuid, eName, pGuid) if(pGuid == playerGUID and not AlertedCache[eName]) then AlertedCache[eName] = true local incoming = ("%s Attacking You!"):format(eName); - HeadsUpAlarm(incoming, CombatText_StandardScroll, 1, 0.05, 0, "crit") + SV:SCTMessage(incoming, CombatText_StandardScroll, 1, 0.05, 0, "crit") end end end @@ -668,7 +659,7 @@ function PLUGIN:EventDistributor(event, ...) local timestamp = time() AddEnemyScan(guid, timestamp) elseif(self.cache[guid] and self.cache[guid].name) then - --HeadsUpAlarm("Kill On Sight!", CombatText_StandardScroll, 1, 0, 0, "crit") + --SV:SCTMessage("Kill On Sight!", CombatText_StandardScroll, 1, 0, 0, "crit") if(self.db.annoyingEmotes) then KOS_Emote() end diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/blackmarket.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/blackmarket.lua index 5889155..5bcef82 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/blackmarket.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/blackmarket.lua @@ -27,23 +27,48 @@ local Schema = PLUGIN.Schema; BLACKMARKET PLUGINR ########################################################## ]]-- +local function ChangeTab(tab) + tab.Left:SetAlpha(0) + if tab.Middle then + tab.Middle:SetAlpha(0) + end + tab.Right:SetAlpha(0) +end + +local _hook_ScrollFrameUpdate = function() + local self = BlackMarketScrollFrame; + local buttons = self.buttons; + local offset = HybridScrollFrame_GetOffset(self) + local itemCount = C_BlackMarket.GetNumItems() + for i = 1, #buttons do + local button = buttons[i]; + if(button) then + local indexOffset = offset + i; + if(not button.Panel) then + button:RemoveTextures() + button:SetStylePanel("Button") + PLUGIN:ApplyItemButtonStyle(button.Item) + end + if indexOffset <= itemCount then + local name, texture = C_BlackMarket.GetItemInfoByIndex(indexOffset) + if(name) then + button.Item.IconTexture:SetTexture(texture) + end + end + end + end +end + local function BlackMarketStyle() if PLUGIN.db.blizzard.enable ~= true or PLUGIN.db.blizzard.bmah ~= true then return end - local ChangeTab = function(p) - p.Left:SetAlpha(0) - if p.Middle then - p.Middle:SetAlpha(0) - end - p.Right:SetAlpha(0) - end + PLUGIN:ApplyWindowStyle(BlackMarketFrame) - BlackMarketFrame:RemoveTextures() - BlackMarketFrame:SetStylePanel("Default", "Halftone") BlackMarketFrame.Inset:RemoveTextures() BlackMarketFrame.Inset:SetStylePanel("Fixed", "Inset") + PLUGIN:ApplyCloseButtonStyle(BlackMarketFrame.CloseButton) PLUGIN:ApplyScrollFrameStyle(BlackMarketScrollFrameScrollBar, 4) @@ -59,36 +84,11 @@ local function BlackMarketStyle() BlackMarketBidPriceGold.Panel:SetPointToScale("TOPLEFT", -2, 0) BlackMarketBidPriceGold.Panel:SetPointToScale("BOTTOMRIGHT", -2, 0) BlackMarketFrame.BidButton:SetStylePanel("Button") - hooksecurefunc("BlackMarketScrollFrame_Update", function() - local buttons = BlackMarketScrollFrame.buttons; - local r = #buttons; - local s = HybridScrollFrame_GetOffset(BlackMarketScrollFrame) - local t = C_BlackMarket.GetNumItems() - for b = 1, r do - local u = buttons[b] - local v = s+b; - if not u.styled then - u:RemoveTextures() - u:SetStylePanel("Button") - PLUGIN:ApplyItemButtonStyle(u.Item) - u.styled = true - end - if v <= t then - local w, x = C_BlackMarket.GetItemInfoByIndex(v) - if w then - u.Item.IconTexture:SetTexture(x) - end - end - end - end) + + hooksecurefunc("BlackMarketScrollFrame_Update", _hook_ScrollFrameUpdate) + BlackMarketFrame.HotDeal:RemoveTextures() PLUGIN:ApplyItemButtonStyle(BlackMarketFrame.HotDeal.Item) - for b = 1, BlackMarketFrame:GetNumRegions()do - local y = select(b, BlackMarketFrame:GetRegions()) - if y and y:GetObjectType() == "FontString" and y:GetText() == BLACK_MARKET_TITLE then - y:ClearAllPoints()y:SetPoint("TOP", BlackMarketFrame, "TOP", 0, -4) - end - end end --[[ ##########################################################