diff --git a/CHANGELOG2.md b/CHANGELOG2.md new file mode 100644 index 0000000..446c6e2 --- /dev/null +++ b/CHANGELOG2.md @@ -0,0 +1,9 @@ +# Changelog + +This document contains a temporary changelog to keep track of changes made in version 2.0 + +## [2.0] + +### Removed + +* Remove the ability tooltips module, as Midnight has severely handicapped the feature diff --git a/Clicked/Clicked2.toc b/Clicked/Clicked2.toc index c8c8a9a..a993aa2 100644 --- a/Clicked/Clicked2.toc +++ b/Clicked/Clicked2.toc @@ -39,7 +39,6 @@ Core\Utils.lua Core\LocaleUtils.lua Core\StringUtils.lua Core\Serializer.lua -Core\Tooltips.lua Core\Upgrader.lua Conditions\ConditionRegistry.lua diff --git a/Clicked/Config/Addon.lua b/Clicked/Config/Addon.lua index 3337e2b..62aa6f3 100644 --- a/Clicked/Config/Addon.lua +++ b/Clicked/Config/Addon.lua @@ -96,19 +96,6 @@ function AddonOptions:CreateOptionsTable() return Addon.db.profile.options.onKeyDown end }, - tooltips = { - name = Addon.L["Show abilities in unit tooltips"], - desc = Addon.L["If enabled unit tooltips will be augmented to show abilities and keybinds that can be used on the target."], - type = "toggle", - order = 300, - width = "full", - set = function(_, val) - Addon.db.profile.options.tooltips = val - end, - get = function() - return Addon.db.profile.options.tooltips - end - }, bindUnassignedModifiers = { name = Addon.L["Bind unassigned modifier keys automatically"], desc = Addon.L["If enabled, modifier key combinations that aren't bound will be bound to the main key, for example, binding 'Q' will also bind 'SHIFT-Q', 'AlT-Q', and 'CTRL-Q'."], diff --git a/Clicked/Core/BindingProcessor.lua b/Clicked/Core/BindingProcessor.lua index 292c3f1..c67a464 100644 --- a/Clicked/Core/BindingProcessor.lua +++ b/Clicked/Core/BindingProcessor.lua @@ -732,110 +732,6 @@ function Clicked2:IterateActiveBindings() return ipairs(activeBindings) end ---- Get all bindings that, when activated at this moment, will affect the specified unit. This builds a full profile and the resulting table contains all ---- bindings that meet the criteria. ---- ---- This function additionally checks for _similar_ units, for example, if the input unit is `focus` but the `focus` unit is also the `target` unit, it will ---- also include any bindings aimed at the `target` unit. ---- ---- For each binding it also validates that the specified load and target conditions have been met. A binding that is only active in certain shapeshift forms ---- will not be included if the player is not currently in that shapeshift form. ---- ---- For target `friend`/`harm` and `dead`/`nodead` modifiers, a similar check is performed. ---- ---- @param unit string ---- @return Binding[] -function Clicked2:GetBindingsForUnit(unit) - assert(type(unit) == "string", "bad argument #1, expected table but got " .. type(unit)) - - --- @type Binding[] - local result = {} - - --- @type table - local units = { - [unit] = true - } - - -- find other unit types that is valid for this target - for k in pairs(Addon.TargetUnit) do - local u = Addon:GetWoWUnitFromUnit(k) - - if u ~= nil and u ~= unit then - local unitIsUnit = UnitIsUnit(u, unit) - units[u] = not issecretvalue(unitIsUnit) and unitIsUnit - end - end - - --- @param target Binding.Target - --- @return boolean - local function IsTargetValid(target) - if target.hostility == Addon.TargetHostility.HELP and not UnitIsFriend("player", unit) or - target.hostility == Addon.TargetHostility.HARM and UnitIsFriend("player", unit) then - return false - end - - if target.vitals == Addon.TargetVitals.DEAD and not UnitIsDeadOrGhost(unit) or - target.vitals == Addon.TargetVitals.ALIVE and UnitIsDeadOrGhost(unit) then - return false - end - - return true - end - - --- @param binding Binding - --- @return boolean - local function IsBindingValidForUnit(binding) - if binding.actionType ~= Clicked2.ActionType.SPELL and binding.actionType ~= Clicked2.ActionType.ITEM then - return false - end - - if not Addon:IsBindingValidForCurrentState(binding) then - return false - end - - -- hovercast - do - local hovercast = binding.targets.hovercast - local enabled = Addon:IsHovercastEnabled(binding) - - if enabled and IsTargetValid(hovercast) then - local focus = GetMouseFoci() - - for i = 1, #focus do - if focus[i] == WorldFrame then - return false - end - end - - return true - end - end - - -- regular - do - local enabled = Addon:IsMacroCastEnabled(binding) - - if enabled then - local _, target = Clicked2:EvaluateBindingMacro(binding) - - if target ~= nil and units[target] then - return true - end - end - end - - return false - end - - for _, binding in Clicked2:IterateActiveBindings() do - if IsBindingValidForUnit(binding) then - table.insert(result, binding) - end - end - - return result -end - --- @param binding Binding --- @return boolean function Clicked2:IsBindingLoaded(binding) diff --git a/Clicked/Core/Clicked.lua b/Clicked/Core/Clicked.lua index bc23c24..a225ba2 100644 --- a/Clicked/Core/Clicked.lua +++ b/Clicked/Core/Clicked.lua @@ -102,7 +102,6 @@ local function PLAYER_REGEN_DISABLED() openConfigOnCombatExit = Addon.BindingConfig.Window:IsOpen() Addon.BindingConfig.Window:Close() - Addon:AbilityTooltips_Refresh() if Addon:IsCombatProcessRequired() then Clicked2:ProcessActiveBindings() @@ -115,7 +114,6 @@ local function PLAYER_REGEN_ENABLED() isPlayerInCombat = false Addon:ProcessFrameQueue() - Addon:AbilityTooltips_Refresh() if Addon:IsCombatProcessRequired() then Clicked2:ProcessActiveBindings() @@ -228,12 +226,6 @@ local function TRAIT_CONFIG_UPDATED() end) end -local function PLAYER_FOCUS_CHANGED() - Clicked2:LogVerbose("Received event {eventName}", "PLAYER_FOCUS_CHANGED") - - Addon:AbilityTooltips_Refresh() -end - local function PLAYER_LEVEL_CHANGED() Clicked2:LogVerbose("Received event {eventName}", "PLAYER_LEVEL_CHANGED") @@ -272,18 +264,6 @@ local function GROUP_ROSTER_UPDATE() Addon:ReloadBindings("GROUP_ROSTER_UPDATE") end -local function MODIFIER_STATE_CHANGED() - Clicked2:LogVerbose("Received event {eventName}", "MODIFIER_STATE_CHANGED") - - Addon:AbilityTooltips_Refresh() -end - -local function UNIT_TARGET() - Clicked2:LogVerbose("Received event {eventName}", "UNIT_TARGET") - - Addon:AbilityTooltips_Refresh() -end - local function RUNE_UPDATED() Clicked2:LogVerbose("Received event {eventName}", "RUNE_UPDATED") @@ -326,10 +306,6 @@ local function UpdateEventHooks(self, method) method(self, "RUNE_UPDATED", RUNE_UPDATED) end - if Addon.EXPANSION >= Addon.Expansion.TBC then - method(self, "PLAYER_FOCUS_CHANGED", PLAYER_FOCUS_CHANGED) - end - if Addon.EXPANSION <= Addon.Expansion.CATA then method(self, "CHARACTER_POINTS_CHANGED", CHARACTER_POINTS_CHANGED) end @@ -366,8 +342,6 @@ local function UpdateEventHooks(self, method) method(self, "ZONE_CHANGED", ZONE_CHANGED) method(self, "ZONE_CHANGED_INDOORS", ZONE_CHANGED_INDOORS) method(self, "ZONE_CHANGED_NEW_AREA", ZONE_CHANGED_NEW_AREA) - method(self, "MODIFIER_STATE_CHANGED", MODIFIER_STATE_CHANGED) - method(self, "UNIT_TARGET", UNIT_TARGET) method(self, "ITEM_DATA_LOAD_RESULT", ITEM_DATA_LOAD_RESULT) method(self, "ACTIONBAR_SLOT_CHANGED", ACTIONBAR_SLOT_CHANGED) end @@ -395,7 +369,6 @@ function Clicked2:OnInitialize() Addon.ProfileOptions:Initialize() Addon.BlacklistOptions:Initialize() Addon:StatusOutput_Initialize() - Addon:AbilityTooltips_Initialize() AceConsole:RegisterChatCommand("clicked2", HandleChatCommand) AceConsole:RegisterChatCommand("cc2", HandleChatCommand) diff --git a/Clicked/Core/Database.lua b/Clicked/Core/Database.lua index 373121a..feeb4fd 100644 --- a/Clicked/Core/Database.lua +++ b/Clicked/Core/Database.lua @@ -151,7 +151,6 @@ function Clicked2:GetDatabaseDefaults() version = nil, options = { onKeyDown = true, - tooltips = false, bindUnassignedModifiers = false, autoBindActionBar = false, minimap = { diff --git a/Clicked/Core/Tooltips.lua b/Clicked/Core/Tooltips.lua deleted file mode 100644 index 481f1e4..0000000 --- a/Clicked/Core/Tooltips.lua +++ /dev/null @@ -1,220 +0,0 @@ --- Clicked, a World of Warcraft keybind manager. --- Copyright (C) 2026 Kevin Krol --- --- This program is free software: you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . - --- Added in 12.0.0 -local issecretvalue = issecretvalue or function(val) return false end - ---- @class Addon -local Addon = select(2, ...) - ---- @type number? -local lastTooltipUpdateTime - ---- @type string? -local lastTooltipUnit - ---- @type { left: string, right: string }[] -local lineCache = {} - ---- @type boolean -local rebuild - --- Local support functions - ---- Check if the specified `keybind` is valid for the modifier keys that are currently pressed. ---- ---- @param keybind string ---- @return boolean -local function IsKeybindValidForCurrentModifiers(keybind) - --- @type string[] - local mods = {} - - --- @type { [string]: boolean, count: integer } - local current = { - count = 0 - } - - for match in string.gmatch(keybind, "[^-]+") do - table.insert(mods, match) - end - - table.remove(mods, #mods) - - if #mods == 0 and IsModifierKeyDown() then - return false - end - - if IsControlKeyDown() then - current["CTRL"] = true - current.count = current.count + 1 - end - - if IsAltKeyDown() then - current["ALT"] = true - current.count = current.count + 1 - end - - if IsShiftKeyDown() then - current["SHIFT"] = true - current.count = current.count + 1 - end - - if IsMetaKeyDown ~= nil and IsMetaKeyDown() then - current["META"] = true - current.count = current.count + 1 - end - - if #mods ~= current.count then - return false - end - - for _, mod in ipairs(mods) do - if not current[mod] then - return false - end - end - - return true -end - ---- Check if the tooltips module is enabled in the user settings. ---- ---- @return boolean -local function IsTooltipModuleEnabled() - return Addon.db.profile.options.tooltips -end - ---- @param left Binding ---- @param right Binding ---- @return boolean -local function SortBindings(left, right) - return Addon:CompareBindings(left, right) -end - -local function OnTooltipHide() - rebuild = true -end - ---- @param self GameTooltip -local function OnTooltipSetUnit(self) - if self:IsForbidden() or self.GetUnit == nil or not IsTooltipModuleEnabled() then - return - end - - local unit = select(2, self:GetUnit()) - if issecretvalue(unit) or Addon:IsNilOrEmpty(unit) or lastTooltipUpdateTime == GetTime() then - return - end - - rebuild = rebuild or unit ~= lastTooltipUnit - lastTooltipUpdateTime = GetTime() - lastTooltipUnit = unit --[[@as string?]] - - if rebuild then - rebuild = false - - local bindings = Clicked2:GetBindingsForUnit(unit) - table.sort(bindings, SortBindings) - table.wipe(lineCache) - - for _, binding in ipairs(bindings) do - if IsKeybindValidForCurrentModifiers(binding.keybind) then - local left = Addon:GetSimpleSpellOrItemInfo(binding) - local right = Addon:SanitizeKeybind(binding.keybind) - - table.insert(lineCache, { left = left, right = right }) - end - end - end - - if #lineCache > 0 then - self:AddLine(" ") - self:AddLine(Addon.L["Abilities"], 1, 0.85, 0) - - for _, line in ipairs(lineCache) do - self:AddDoubleLine(line.left, line.right, 1, 1, 1, 0, 1, 0) - end - end -end - ---- @param self GameTooltip -local function OnTooltipSetSpell(self) - if self:IsForbidden() or self.GetSpell == nil then - return - end - - local _, spellId = self:GetSpell() - - if spellId == nil or issecretvalue(spellId) then - return - end - - local addedEmptyLine = false - - --- @type Binding - for _, binding in Clicked2:IterateActiveBindings() do - if binding.actionType == Clicked2.ActionType.SPELL and binding.action.spellValue == spellId then - local text = string.format(Addon.L["Bound to %s"], Addon:SanitizeKeybind(binding.keybind)) - - if not addedEmptyLine then - self:AddLine(" ", 1, 1, 1) - addedEmptyLine = true - end - - self:AddLine(text, LIGHTBLUE_FONT_COLOR.r, LIGHTBLUE_FONT_COLOR.g, LIGHTBLUE_FONT_COLOR.b) - end - end -end - --- Private addon API - -function Addon:AbilityTooltips_Initialize() - -- Add a delay here to make sure we're the always at the bottom of the tooltip - C_Timer.After(1, function() - if Addon.EXPANSION >= Addon.Expansion.DF then - TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Unit, OnTooltipSetUnit) - else - GameTooltip:HookScript("OnTooltipSetUnit", OnTooltipSetUnit) - end - - GameTooltip:HookScript("OnHide", OnTooltipHide) - end) - - if Addon.EXPANSION >= Addon.Expansion.DF then - TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Spell, OnTooltipSetSpell) - else - GameTooltip:HookScript("OnTooltipSetSpell", OnTooltipSetSpell) - - if ElvUISpellBookTooltip ~= nil then - ElvUISpellBookTooltip:HookScript("OnTooltipSetSpell", OnTooltipSetSpell) - end - end -end - -function Addon:AbilityTooltips_Refresh() - if not IsTooltipModuleEnabled() then - return - end - - if not GameTooltip:IsForbidden() and GameTooltip:IsShown() and GetTime() ~= lastTooltipUpdateTime then - local _, unit = GameTooltip:GetUnit() - - if not issecretvalue(unit) and not Addon:IsNilOrEmpty(unit) then - rebuild = true - GameTooltip:SetUnit(unit) - end - end -end diff --git a/Clicked/Definitions.lua b/Clicked/Definitions.lua index 57c41aa..8b40b8c 100644 --- a/Clicked/Definitions.lua +++ b/Clicked/Definitions.lua @@ -32,7 +32,6 @@ --- @class Profile.Options --- @field public onKeyDown boolean ---- @field public tooltips boolean --- @field public minimap Profile.Options.Minimap --- @field public bindUnassignedModifiers boolean --- @field public autoBindActionBar boolean diff --git a/Clicked/Locales/enUS.lua b/Clicked/Locales/enUS.lua index c0a1ae3..63c4c4c 100644 --- a/Clicked/Locales/enUS.lua +++ b/Clicked/Locales/enUS.lua @@ -181,8 +181,6 @@ L["Enable minimap icon"] = true L["Enable or disable the minimap icon."] = true L["Enable addon compartment button"] = true L["Enable or disable the addon compartment button."] = true -L["Show abilities in unit tooltips"] = true -L["If enabled unit tooltips will be augmented to show abilities and keybinds that can be used on the target."] = true L["Cast on key down rather than key up"] = true L["This option will make bindings trigger on the 'down' portion of a button press rather than the 'up' portion."] = true L["The frame blacklist can be used if you want to exclude specific unit frames from click-cast functionality."] = true @@ -205,8 +203,6 @@ L["Allow profile sharing"] = true L["Sending profile to %s, progress %d/%d (%d%%)"] = true L["Unable to send a message to %s. Make sure that they are online, have allowed profile sharing, and are on the same realm or a connected realm."] = true L["Waiting for acknowledgement from %s"] = true -L["Bound to %s"] = true -L["Abilities"] = true L["Arena"] = true L["Battleground"] = true L["Cancel"] = true