From d170e3e73ff13de6d388ce139552cafcd4d70aa9 Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Fri, 10 Jan 2020 17:30:26 -0800 Subject: [PATCH 1/4] Fix mouse over issue --- DruidBar.lua | 70 ++++++++++++++++++++++++++++++++-------------------------- Options.lua | 4 ++-- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/DruidBar.lua b/DruidBar.lua index 637a67c..517b4ca 100644 --- a/DruidBar.lua +++ b/DruidBar.lua @@ -338,44 +338,52 @@ function DruidBar_MainGraphics() end end -function DruidBar_TextRenderer() - dbarHide(DruidBarTextLeft); - dbarHide(DruidBarTextCenter); - dbarHide(DruidBarTextRight); - - -- Text options -- - if DruidBarKey.Text or (not DruidBarKey.Text) then - if DruidBarKey.Percent then - if DruidBarKey.Percent == 0 then -- Numbers - dbarShow(DruidBarTextCenter); - DruidBarTextCenter:SetText(ManaValues()); - DruidBarTextCenter:SetTextColor(1,1,1,1); - elseif DruidBarKey.Percent == 1 then -- Percent - dbarShow(DruidBarTextCenter); - DruidBarTextCenter:SetText(ManaPercentage()); - DruidBarTextCenter:SetTextColor(1,1,1,1); - elseif DruidBarKey.Percent == 2 then -- Bliz-Like +function DruidBar_TextStyle() + if DruidBarKey.Percent then + if DruidBarKey.Percent == 0 then -- Numbers + dbarShow(DruidBarTextCenter); + DruidBarTextCenter:SetText(ManaValues()); + DruidBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 1 then -- Percent + dbarShow(DruidBarTextCenter); + DruidBarTextCenter:SetText(ManaPercentage()); + DruidBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 2 then -- Bliz-Like dbarShow(DruidBarTextLeft); dbarShow(DruidBarTextRight); DruidBarTextLeft:SetText(ManaPercentage()); DruidBarTextRight:SetText(CurrentMana()); DruidBarTextLeft:SetTextColor(1,1,1,1); DruidBarTextRight:SetTextColor(1,1,1,1); - end - else -- Both - dbarShow(DruidBarTextCenter); - DruidBarTextCenter:SetText(ManaValuesAndPercentage()); - DruidBarTextCenter:SetTextColor(1,1,1,1); end + else -- Both + dbarShow(DruidBarTextCenter); + DruidBarTextCenter:SetText(ManaValuesAndPercentage()); + DruidBarTextCenter:SetTextColor(1,1,1,1); + end + + if DruidBarKey.Text == 0 then + DruidBarTextLeft:SetFontObject("GameTooltipTextSmall"); + DruidBarTextCenter:SetFontObject("GameTooltipTextSmall"); + DruidBarTextRight:SetFontObject("GameTooltipTextSmall"); + elseif DruidBarKey.Text == 1 then + DruidBarTextLeft:SetFontObject("TextStatusBarText"); + DruidBarTextCenter:SetFontObject("TextStatusBarText"); + DruidBarTextRight:SetFontObject("TextStatusBarText"); + end +end - if DruidBarKey.Text == 0 then - DruidBarTextLeft:SetFontObject("GameTooltipTextSmall"); - DruidBarTextCenter:SetFontObject("GameTooltipTextSmall"); - DruidBarTextRight:SetFontObject("GameTooltipTextSmall"); - elseif DruidBarKey.Text == 1 then - DruidBarTextLeft:SetFontObject("TextStatusBarText"); - DruidBarTextCenter:SetFontObject("TextStatusBarText"); - DruidBarTextRight:SetFontObject("TextStatusBarText"); +function DruidBar_TextRenderer() + dbarHide(DruidBarTextLeft); + dbarHide(DruidBarTextCenter); + dbarHide(DruidBarTextRight); + + -- Text options -- + if DruidBarKey.Text then + if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 then + DruidBar_TextStyle() + elseif DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)) then + DruidBar_TextStyle() end end end @@ -422,7 +430,7 @@ function DruidBar_ReplaceGraphics() str1 = "|CFFFFFFFF"..(floor(DruidBarKey.currentmana / 100)/10).."k,"..floor(DruidBarKey.currentmana / DruidBarKey.maxmana * 100).."%|r"; end -- DruidBarReplaceText:SetFrameLevel("2"); - if (DruidBarKey.Text and DruidBarKey.Text == 1) or (not DruidBarKey.Text and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)))then + if (DruidBarKey.Text and DruidBarKey.Text == 1) or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then dbarShow(DEnergyText1); dbarShow(DManaText1); dbarHide(DManaText); diff --git a/Options.lua b/Options.lua index 466c427..123b1e0 100644 --- a/Options.lua +++ b/Options.lua @@ -158,7 +158,7 @@ function DRUIDBAROptions_Text_OnShow() UIDropDownMenu_SetSelectedID(DRUIDBAROptionsTextDropDown, 1); elseif( DruidBarKey.Text == 1 ) then -- NEW UIDropDownMenu_SetSelectedID(DRUIDBAROptionsTextDropDown, 2); - elseif( DruidBarKey.Text == nil ) then -- NO TEXT + elseif( DruidBarKey.Text == 2 ) then -- MOUSEOVER UIDropDownMenu_SetSelectedID(DRUIDBAROptionsTextDropDown, 3); end UIDropDownMenu_SetWidth(DRUIDBAROptionsTextDropDown, 100); @@ -173,7 +173,7 @@ function DRUIDBAROptions_Text_OnClick(self) elseif(i == 2) then DruidBarKey.Text = 1; elseif(i == 3) then - DruidBarKey.Text = nil; + DruidBarKey.Text = 2; end end -- 1.7.9.5 From 077254f5b1efb94ba634026201eab6f854ea7203 Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Fri, 10 Jan 2020 18:21:38 -0800 Subject: [PATCH 2/4] Fix replace text garbage, stage 1 --- DruidBar.lua | 89 ++++++++++++++++++++++++++++++++-------------------------- DruidBar.xml | 34 +++++++++++----------- 2 files changed, 67 insertions(+), 56 deletions(-) diff --git a/DruidBar.lua b/DruidBar.lua index 517b4ca..5dcba58 100644 --- a/DruidBar.lua +++ b/DruidBar.lua @@ -113,6 +113,7 @@ function DruidBar_OnUpdate(self, elapsed) if DruidBarKey.Graphics then if DruidBarKey.Replace then DruidBar_ReplaceGraphics(); + DruidBar_ColorAndStrataAndTexture(); else DruidBarMana:SetMinMaxValues(0, DruidBarKey.maxmana); DruidBarMana:SetValue(DruidBarKey.currentmana); @@ -338,7 +339,7 @@ function DruidBar_MainGraphics() end end -function DruidBar_TextStyle() +function DruidBar_TextStyle if DruidBarKey.Percent then if DruidBarKey.Percent == 0 then -- Numbers dbarShow(DruidBarTextCenter); @@ -380,9 +381,7 @@ function DruidBar_TextRenderer() -- Text options -- if DruidBarKey.Text then - if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 then - DruidBar_TextStyle() - elseif DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)) then + if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then DruidBar_TextStyle() end end @@ -406,57 +405,67 @@ end function DruidBar_ReplaceGraphics() if UnitPowerType("player") ~= 0 then - dbarShow(DruidBarFrame); dbarHide(DruidBarManaBackground); dbarHide(DruidBarBorder); dbarHide(DruidBarTextLeft); dbarHide(DruidBarTextCenter); dbarHide(DruidBarTextRight); dbarHide(PlayerFrameManaBarText); + + dbarShow(DruidBarFrame); dbarShow(DruidBarReplaceText); PlayerFrameManaBar:SetWidth(60); DruidBarFrame:ClearAllPoints(); - DruidBarFrame:SetPoint("TOPLEFT","PlayerFrame","TOPLEFT", 116, -50); + DruidBarFrame:SetPoint("CENTER","PlayerFrameManaBar","CENTER", 60, 0); DruidBarMana:SetWidth(60); DruidBarMana:SetHeight(10); - -- DruidBarMana:SetFrameLevel("1"); - local str, str1; - str = "|CFFFFFFFF"..UnitPower("player").."|r"; - if DruidBarKey.Percent and DruidBarKey.Percent == 1 then - str1 = "|CFFFFFFFF"..floor(DruidBarKey.currentmana / DruidBarKey.maxmana * 100).."%|r"; - elseif DruidBarKey.Percent then - str1 = "|CFFFFFFFF"..floor(DruidBarKey.currentmana).."|r"; - else - str1 = "|CFFFFFFFF"..(floor(DruidBarKey.currentmana / 100)/10).."k,"..floor(DruidBarKey.currentmana / DruidBarKey.maxmana * 100).."%|r"; - end - -- DruidBarReplaceText:SetFrameLevel("2"); - if (DruidBarKey.Text and DruidBarKey.Text == 1) or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then - dbarShow(DEnergyText1); - dbarShow(DManaText1); - dbarHide(DManaText); - dbarHide(DEnergyText); - DEnergyText1:SetText(str); - DManaText1:SetText(str1); - elseif DruidBarKey.Text then - dbarShow(DEnergyText); - dbarHide(DEnergyText1); - dbarShow(DManaText); - dbarHide(DManaText1); - DEnergyText:SetText(str); - DManaText:SetText(str1); - else - dbarHide(DEnergyText); - dbarHide(DEnergyText1); - dbarHide(DManaText); - dbarHide(DManaText1); + + dbarHide(DBarTextLeft); + dbarHide(DBarTextCenter); + dbarHide(DBarTextRight); + if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then + if DruidBarKey.Percent then + if DruidBarKey.Percent == 0 then -- Numbers + dbarShow(DBarTextCenter); + DBarTextCenter:SetText(ManaValues()); + DBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 1 then -- Percent + dbarShow(DBarTextCenter); + DBarTextCenter:SetText(ManaPercentage()); + DBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 2 then -- Bliz-Like + dbarShow(DBarTextLeft); + dbarShow(DBarTextRight); + DBarTextLeft:SetText(ManaPercentage()); + DBarTextRight:SetText(CurrentMana()); + DBarTextLeft:SetTextColor(1,1,1,1); + DBarTextRight:SetTextColor(1,1,1,1); + end + else -- Both + dbarShow(DBarTextLeft); + dbarShow(DBarTextRight); + DBarTextLeft:SetText(CurrentMana()); + DBarTextRight:SetText(ManaPercentage()); + DBarTextLeft:SetTextColor(1,1,1,1); + DBarTextRight:SetTextColor(1,1,1,1); + end + + if DruidBarKey.Text == 0 then + DBarTextLeft:SetFontObject("GameTooltipTextSmall"); + DBarTextCenter:SetFontObject("GameTooltipTextSmall"); + DBarTextRight:SetFontObject("GameTooltipTextSmall"); + elseif DruidBarKey.Text == 1 then + DBarTextLeft:SetFontObject("TextStatusBarText"); + DBarTextCenter:SetFontObject("TextStatusBarText"); + DBarTextRight:SetFontObject("TextStatusBarText"); + end end else dbarHide(DruidBarFrame); - dbarHide(DEnergyText); - dbarHide(DEnergyText1); - dbarHide(DManaText); - dbarHide(DManaText1); dbarHide(DruidBarReplaceText); + dbarHide(DBarTextLeft); + dbarHide(DBarTextCenter); + dbarHide(DBarTextRight); PlayerFrameManaBar:SetWidth(120); end end diff --git a/DruidBar.xml b/DruidBar.xml index 514828a..96aa209 100644 --- a/DruidBar.xml +++ b/DruidBar.xml @@ -130,43 +130,45 @@ - + - - - - - - - - - - - + + + + + - + - + + + + + - + - + + + + + -- 1.7.9.5 From 834f7ea9889d7147e82946f086c4b6f96c87dc88 Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Sat, 11 Jan 2020 16:43:47 -0800 Subject: [PATCH 3/4] Add missing parens --- DruidBar.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DruidBar.lua b/DruidBar.lua index 5dcba58..151ef5a 100644 --- a/DruidBar.lua +++ b/DruidBar.lua @@ -339,7 +339,7 @@ function DruidBar_MainGraphics() end end -function DruidBar_TextStyle +function DruidBar_TextStyle() if DruidBarKey.Percent then if DruidBarKey.Percent == 0 then -- Numbers dbarShow(DruidBarTextCenter); -- 1.7.9.5 From a3550d46fea7a19fde64e77be0156c12467af60e Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Sat, 11 Jan 2020 16:50:13 -0800 Subject: [PATCH 4/4] update version --- CHANGELOG.md | 4 ++++ DruidBarClassic.toc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98d6eb2..77637fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Version History +#### 0.7.7 +Fix text on mouseover. +Change text when setting `replace` is selected. + #### 0.7.6 Finaly resolve `bar reset on lock` issue :D diff --git a/DruidBarClassic.toc b/DruidBarClassic.toc index 34ad5aa..ca5da2b 100644 --- a/DruidBarClassic.toc +++ b/DruidBarClassic.toc @@ -4,7 +4,7 @@ ## Current Author: Tek (port to WoW Classic Beta) ## Original Authors: SkaDemon (GUI: DiabloHu) ## SavedVariables: DruidBarKey -## Version: 0.7.6 +## Version: 0.7.7 ## X-Curse-Project-ID: 334762 ## X-WoWI-ID: 25036 -- 1.7.9.5