From 596f0b71802bb61047dd5109a79da52444cdea15 Mon Sep 17 00:00:00 2001 From: Wiggen94 Date: Tue, 17 Jun 2025 12:29:30 +0200 Subject: [PATCH 1/2] Added ability to hide hotkeys --- README.md | 1 + RangeColor/RangeColor.lua | 44 ++++++++++++++++++++++++++++---- RangeColor/RangeColorOptions.lua | 9 +++++-- RangeColor/RangeColorOptions.xml | 13 ++++++++-- RangeColor/localization.lua | 3 +++ 5 files changed, 61 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 61fce0e..febbd8a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Change the icon color when out of range, no mana or not usable. # Changelog * Changed default colors +* Added ability to hide hotkeys to not interfere with other addons Based on `RangeColor 1.9` diff --git a/RangeColor/RangeColor.lua b/RangeColor/RangeColor.lua index 56ee7c3..352f393 100644 --- a/RangeColor/RangeColor.lua +++ b/RangeColor/RangeColor.lua @@ -113,6 +113,7 @@ function RangeColor_Initialize() ["Mode"] = 3, ["Filter"] = 1, ["Dash"] = 1, + ["HideHotkeys"] = 0, ["Colors"] = { [1] = {r = 1.0, g = 0.0, b = 0.0}, [2] = {r = 1.0, g = 1.0, b = 1.0}, @@ -166,6 +167,11 @@ function RangeColor_OnEvent() RangeColor_Initialize(); elseif( RangeColor_Save2["Version"] == nil or RangeColor_Save2["Version"] ~= RANGECOLOR_VERSION) then RangeColor_Initialize(); + else + -- Add new settings to existing configurations + if ( RangeColor_Save2["HideHotkeys"] == nil ) then + RangeColor_Save2["HideHotkeys"] = 0; + end end if( DEFAULT_CHAT_FRAME ) then DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00Range Color|r, made by: |cffff3300Edswor|r, Version: |cffffff00"..RANGECOLOR_VERSION.."|r, loaded."); @@ -220,6 +226,11 @@ function RangeColor_ActionButton(elapsed) local normalTexture = getglobal(this:GetName().."NormalTexture"); local isUsable, notEnoughMana = IsUsableAction(ActionButton_GetPagedID(this)); local hotkey = getglobal(this:GetName().."HotKey"); + + -- Check if hotkeys should be hidden + if ( RangeColor_Get("HideHotkeys") == 1 ) then + hotkey:Hide(); + end if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then hotkey:SetVertexColor(0.6, 0.6, 0.6); @@ -277,6 +288,13 @@ function RangeColor_ActionButton_UpdateHotkeys(actionButtonType) local hotkey = getglobal(this:GetName().."HotKey"); local action = actionButtonType..this:GetID(); local text = GetBindingText(GetBindingKey(action), "KEY_"); + + -- Check if hotkeys should be hidden + if ( RangeColor_Get("HideHotkeys") == 1 ) then + hotkey:Hide(); + return; + end + if ( string.len(text)==0 ) then hotkey:Hide(); else @@ -299,11 +317,17 @@ function RangeColor_UpdateHotkeysBar(bar, id) hotkey = getglobal(bar.."Button"..i.."HotKey"); action = "MULTIACTIONBAR"..id.."BUTTON"..i; text = GetBindingText(GetBindingKey(action),"KEY_"); - if ( string.len(text)==0 ) then - hotkey:Hide(); - else - hotkey:SetText(RangeColor_TransformText(text)); - hotkey:Show(); + + -- Check if hotkeys should be hidden + if ( RangeColor_Get("HideHotkeys") == 1 ) then + hotkey:Hide(); + else + if ( string.len(text)==0 ) then + hotkey:Hide(); + else + hotkey:SetText(RangeColor_TransformText(text)); + hotkey:Show(); + end end end end @@ -415,6 +439,11 @@ function RangeColor_FlexBarButton_UpdateUsable(button) local isUsable, notEnoughMana = IsUsableAction(FlexBarButton_GetID(button)); local hotkey = getglobal(button:GetName().."HotKey"); + -- Check if hotkeys should be hidden + if ( RangeColor_Get("HideHotkeys") == 1 ) then + hotkey:Hide(); + end + if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then hotkey:SetVertexColor(0.6, 0.6, 0.6); if ( button.rangeTimer ) then @@ -493,6 +522,11 @@ function RangeColor_Gypsy_ActionButtonUpdateUsable() local isUsable, notEnoughMana = IsUsableAction(Gypsy_ActionButtonGetPagedID(this)); local hotkey = getglobal(this:GetName().."HotKey"); + -- Check if hotkeys should be hidden + if ( RangeColor_Get("HideHotkeys") == 1 ) then + hotkey:Hide(); + end + if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then hotkey:SetVertexColor(0.6, 0.6, 0.6); if ( this.rangeTimer ) then diff --git a/RangeColor/RangeColorOptions.lua b/RangeColor/RangeColorOptions.lua index e8a3760..115162b 100644 --- a/RangeColor/RangeColorOptions.lua +++ b/RangeColor/RangeColorOptions.lua @@ -48,6 +48,7 @@ RangeColorOptionsFrameSliders [RANGECOLOROPTIONS_SLIDER1.name] = { index = 1, Ra RangeColorOptionsFrameEvents = { }; RangeColorOptionsFrameEvents [RANGECOLOROPTIONS_CHECK1.name] = { index = 1, tooltipText = RANGECOLOROPTIONS_CHECK1.tooltipText, RangeColorVar = "Filter"}; RangeColorOptionsFrameEvents [RANGECOLOROPTIONS_CHECK2.name] = { index = 2, tooltipText = RANGECOLOROPTIONS_CHECK2.tooltipText, RangeColorVar = "Dash"}; +RangeColorOptionsFrameEvents [RANGECOLOROPTIONS_CHECK3.name] = { index = 3, tooltipText = RANGECOLOROPTIONS_CHECK3.tooltipText, RangeColorVar = "HideHotkeys"}; function RangeColorOptions_OnLoad() @@ -137,10 +138,14 @@ function RangeColorOptions_CheckButtonOnClick() else enable = 0; end - if ( value.RangeColorVar ) then - RangeColor_Set(value.RangeColorVar, enable); + if ( value.RangeColorVar ) then + RangeColor_Set(value.RangeColorVar, enable); + -- If hide hotkeys setting changed, update all hotkeys immediately + if ( value.RangeColorVar == "HideHotkeys" ) then + RangeColor_UpdateHotkeys(); end end + end end if ( not RangeColorOptionsFrame_CheckButton1:GetChecked() ) then OptionsFrame_DisableCheckBox(RangeColorOptionsFrame_CheckButton2); diff --git a/RangeColor/RangeColorOptions.xml b/RangeColor/RangeColorOptions.xml index 3f9a027..a738db4 100644 --- a/RangeColor/RangeColorOptions.xml +++ b/RangeColor/RangeColorOptions.xml @@ -118,7 +118,7 @@ - + @@ -526,7 +526,7 @@ - + @@ -613,6 +613,15 @@ + + + + + + + + + diff --git a/RangeColor/localization.lua b/RangeColor/localization.lua index 1eae7f1..7a37351 100644 --- a/RangeColor/localization.lua +++ b/RangeColor/localization.lua @@ -26,6 +26,7 @@ if (GetLocale() == "enUS") then RANGECOLOROPTIONS_SLIDER1 = { name="Display", minText="Hotkey", maxText="Icon", tooltipText = "Shade the hotkey, the icon, or both"}; RANGECOLOROPTIONS_CHECK1 = { name = "Filter", tooltipText = "Show 'Shift' as 'S', same for 'Alt', 'Ctrl', etc."}; RANGECOLOROPTIONS_CHECK2 = { name = "Dash", tooltipText = "Show 'S-1' as 'S1', Filter must be activated."}; + RANGECOLOROPTIONS_CHECK3 = { name = "Hide Hotkeys", tooltipText = "Hide all hotkey text on action buttons."}; RANGECOLOROPTIONS_RESETTOOLTIPTEXT = "This will reset all the options to an initial value." -- myAddons Help @@ -59,6 +60,7 @@ if (GetLocale() == "deDE") then RANGECOLOROPTIONS_SLIDER1 = { name="Display", minText="Tastenk\195\188rzel", maxText="Icon", tooltipText = "Schattierung des Tastenk\195\188rzels, des Icons oder beider"}; RANGECOLOROPTIONS_CHECK1 = { name = "Filter", tooltipText = "Show 'Shift' as 'S', same for 'Alt', 'Ctrl', etc."}; RANGECOLOROPTIONS_CHECK2 = { name = "Dash", tooltipText = "Show 'S-1' as 'S1', Filter must be activated."}; + RANGECOLOROPTIONS_CHECK3 = { name = "Tastenk\195\188rzel verstecken", tooltipText = "Versteckt alle Tastenk\195\188rzel auf Aktionsschaltfl\195\164chen."}; RANGECOLOROPTIONS_RESETTOOLTIPTEXT = "This will reset all the options to an initial value." -- myAddons Help @@ -92,6 +94,7 @@ if (GetLocale() == "frFR") then RANGECOLOROPTIONS_SLIDER1 = { name="Display", minText="Hotkey", maxText="Icon", tooltipText = "Assombrir le raccourci, l'ic\195\180, ou les deux"}; RANGECOLOROPTIONS_CHECK1 = { name = "Filter", tooltipText = "Affiche 'S' au lieu de 'Shift', de m\195\170me pour 'Alt', 'Ctrl', etc."}; RANGECOLOROPTIONS_CHECK2 = { name = "Dash", tooltipText = "Affiche 'S1' au lieu de 'S-1'. Le filtre doit \195\170tre activ\195\169."}; + RANGECOLOROPTIONS_CHECK3 = { name = "Masquer les raccourcis", tooltipText = "Masque tout le texte des raccourcis sur les boutons d'action."}; RANGECOLOROPTIONS_RESETTOOLTIPTEXT = "This will reset all the options to an initial value." -- myAddons Help From 6155f9161ee09c4eaf445463372c29e2e6ffb55c Mon Sep 17 00:00:00 2001 From: "Mr. Alchemist" <3815426+alchem1ster@users.noreply.github.com> Date: Fri, 20 Jun 2025 02:36:25 +0300 Subject: [PATCH 2/2] Fix for long change state timeout On some servers (for example, Turtle-WoW), a bug occurs when an action is possible (or impossible), but RangeColor still does not know about it due to the difference in rangeTimer delta. --- RangeColor/RangeColor.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/RangeColor/RangeColor.lua b/RangeColor/RangeColor.lua index 352f393..9fa7230 100644 --- a/RangeColor/RangeColor.lua +++ b/RangeColor/RangeColor.lua @@ -235,6 +235,7 @@ function RangeColor_ActionButton(elapsed) if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then hotkey:SetVertexColor(0.6, 0.6, 0.6); if ( this.rangeTimer ) then + this.rangeTimer = this.rangeTimer - elapsed; if ( this.rangeTimer <= elapsed ) then if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) then icon:SetVertexColor(RangeColor_Save2["Colors"][1].r, RangeColor_Save2["Colors"][1].g, RangeColor_Save2["Colors"][1].b); @@ -251,15 +252,18 @@ function RangeColor_ActionButton(elapsed) normalTexture:SetVertexColor(RangeColor_Save2["Colors"][8].r, RangeColor_Save2["Colors"][8].g, RangeColor_Save2["Colors"][8].b); end end + this.rangeTimer = TOOLTIP_UPDATE_TIME; end end else if ( this.rangeTimer ) then + this.rangeTimer = this.rangeTimer - elapsed; if ( this.rangeTimer <= elapsed ) then if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) then icon:SetVertexColor(1.0, 1.0, 1.0); normalTexture:SetVertexColor(1.0, 1.0, 1.0); end + this.rangeTimer = TOOLTIP_UPDATE_TIME; end end if ( IsActionInRange(ActionButton_GetPagedID(this)) == 0 ) then @@ -447,6 +451,7 @@ function RangeColor_FlexBarButton_UpdateUsable(button) if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then hotkey:SetVertexColor(0.6, 0.6, 0.6); if ( button.rangeTimer ) then + button.rangeTimer = button.rangeTimer - elapsed; if ( button.rangeTimer < 0 ) then if ( IsActionInRange(FlexBarButton_GetID(button)) == 0 ) then icon:SetVertexColor(RangeColor_Save2["Colors"][1].r, RangeColor_Save2["Colors"][1].g, RangeColor_Save2["Colors"][1].b); @@ -463,15 +468,18 @@ function RangeColor_FlexBarButton_UpdateUsable(button) normalTexture:SetVertexColor(RangeColor_Save2["Colors"][8].r, RangeColor_Save2["Colors"][8].g, RangeColor_Save2["Colors"][8].b); end end + button.rangeTimer = TOOLTIP_UPDATE_TIME; end end else if ( button.rangeTimer ) then + button.rangeTimer = button.rangeTimer - elapsed; if ( button.rangeTimer < 0 ) then if ( IsActionInRange(FlexBarButton_GetID(button)) == 0 ) then icon:SetVertexColor(1.0, 1.0, 1.0); normalTexture:SetVertexColor(1.0, 1.0, 1.0); end + button.rangeTimer = TOOLTIP_UPDATE_TIME; end end if ( IsActionInRange(FlexBarButton_GetID(button)) == 0 ) then @@ -530,6 +538,7 @@ function RangeColor_Gypsy_ActionButtonUpdateUsable() if ( (RangeColor_Get("Mode")==3) or (RangeColor_Get("Mode")==2 and hotkey:GetText()==nil)) then hotkey:SetVertexColor(0.6, 0.6, 0.6); if ( this.rangeTimer ) then + this.rangeTimer = this.rangeTimer - elapsed; if ( this.rangeTimer < 0 ) then if ( IsActionInRange(Gypsy_ActionButtonGetPagedID(this)) == 0 ) then icon:SetVertexColor(RangeColor_Save2["Colors"][1].r, RangeColor_Save2["Colors"][1].g, RangeColor_Save2["Colors"][1].b); @@ -546,15 +555,18 @@ function RangeColor_Gypsy_ActionButtonUpdateUsable() normalTexture:SetVertexColor(RangeColor_Save2["Colors"][8].r, RangeColor_Save2["Colors"][8].g, RangeColor_Save2["Colors"][8].b); end end + this.rangeTimer = TOOLTIP_UPDATE_TIME; end end else if ( this.rangeTimer ) then + this.rangeTimer = this.rangeTimer - elapsed; if ( this.rangeTimer < 0 ) then if ( IsActionInRange(Gypsy_ActionButtonGetPagedID(this)) == 0 ) then icon:SetVertexColor(1.0, 1.0, 1.0); normalTexture:SetVertexColor(1.0, 1.0, 1.0); end + this.rangeTimer = TOOLTIP_UPDATE_TIME; end end if ( IsActionInRange(Gypsy_ActionButtonGetPagedID(this)) == 0 ) then