Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
56 changes: 51 additions & 5 deletions RangeColor/RangeColor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -220,10 +226,16 @@ 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);
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);
Expand All @@ -240,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
Expand Down Expand Up @@ -277,6 +292,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
Expand All @@ -299,11 +321,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
Expand Down Expand Up @@ -415,9 +443,15 @@ 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
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);
Expand All @@ -434,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
Expand Down Expand Up @@ -493,9 +530,15 @@ 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
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);
Expand All @@ -512,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
Expand Down
9 changes: 7 additions & 2 deletions RangeColor/RangeColorOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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);
Expand Down
13 changes: 11 additions & 2 deletions RangeColor/RangeColorOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<Frame name="RangeColorOptionsFrame" toplevel="true" frameStrata="MEDIUM" movable="true"
enableMouse="true" hidden="true" parent="UIParent">
<Size>
<AbsDimension x="460" y="340" />
<AbsDimension x="460" y="370" />
</Size>
<Anchors>
<Anchor point="CENTER" />
Expand Down Expand Up @@ -526,7 +526,7 @@
</Frame>
<Frame name="RangeColorOptionsFrame_GeneralFrame" inherits="OptionFrameBoxTemplate">
<Size>
<AbsDimension x="420" y="80" />
<AbsDimension x="420" y="100" />
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="RangeColorOptionsFrame_NotUsableFrame">
Expand Down Expand Up @@ -613,6 +613,15 @@
</Anchor>
</Anchors>
</CheckButton>
<CheckButton name="RangeColorOptionsFrame_CheckButton3" inherits="RangeColorCheckTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="RangeColorOptionsFrame_GeneralFrame">
<Offset>
<AbsDimension x="200" y="-60" />
</Offset>
</Anchor>
</Anchors>
</CheckButton>

</Frames>
</Frame>
Expand Down
3 changes: 3 additions & 0 deletions RangeColor/localization.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down