From 56b231d83375b0d792b20f4cc7d845f0b4b25b98 Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Mon, 30 Sep 2019 22:13:10 -0700 Subject: [PATCH 1/2] Prevent addon loading if player isn't a druid --- DruidBar.lua | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/DruidBar.lua b/DruidBar.lua index c2f148e..705bbc5 100644 --- a/DruidBar.lua +++ b/DruidBar.lua @@ -17,17 +17,22 @@ local minimapIconLDB = LibStub("LibDataBroker-1.1"):NewDataObject("DruidBarMinim local DruidBar_MinimapButton = LibStub("LibDBIcon-1.0"); function DruidBar_OnLoad() - DruidBarUpdateFrame:RegisterEvent("ADDON_LOADED"); - DruidBarUpdateFrame:RegisterEvent("PLAYER_LEAVING_WORLD"); - DruidBarUpdateFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); + -- Get players className + _, className = UnitClass("player"); - SlashCmdList["DRUIDBARSLASH"] = DruidBar_Enable_ChatCommandHandler; - SLASH_DRUIDBARSLASH1 = "/dbar"; - SLASH_DRUIDBARSLASH2 = "/druidbar"; - DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE"); + if className and className == "DRUID" then + DruidBarUpdateFrame:RegisterEvent("ADDON_LOADED"); + DruidBarUpdateFrame:RegisterEvent("PLAYER_LEAVING_WORLD"); + DruidBarUpdateFrame:RegisterEvent("PLAYER_ENTERING_WORLD"); - -- Creating the minimap config icon - DruidBar_MinimapButton:Register("DruidBarMinimapIcon", minimapIconLDB, DruidBarKey); + SlashCmdList["DRUIDBARSLASH"] = DruidBar_Enable_ChatCommandHandler; + SLASH_DRUIDBARSLASH1 = "/dbar"; + SLASH_DRUIDBARSLASH2 = "/druidbar"; + DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE"); + + -- Creating the minimap config icon + DruidBar_MinimapButton:Register("DruidBarMinimapIcon", minimapIconLDB, DruidBarKey); + end end function EventRegistration(event) if event == "PLAYER_ENTERING_WORLD" then @@ -139,10 +144,6 @@ function Load_Variables(className) DruidBarKey.color = {0,0,1,1}; DruidBarKey.bordercolor = {1,1,1,1}; DruidBarKey.bgcolor = {0,0,0,0.5}; - DruidBarKey.barstrata = 2; - -- Below aren't currently used - DruidBarKey.borderstrata = "BACKGROUND"; - DruidBarKey.bgstrata = "BORDER"; end if not DruidBarKey.color then DruidBarKey.color = {0,0,1,1}; end @@ -151,11 +152,7 @@ function Load_Variables(className) if(not DruidBarKey.tempW or DruidBarKey.tempW == 0) then DruidBarKey.tempW = DruidBarKey.xvar; end if(not DruidBarKey.tempH or DruidBarKey.tempH == 0) then DruidBarKey.tempH = DruidBarKey.yvar; end if(not DruidBarKey.DontShiftBack) then DruidBarKey.DontShiftBack = false; end - if not DruidBarKey.barstrata then DruidBarKey.barstrata = 2; end - -- Below aren't currently used - if not DruidBarKey.borderstrata then DruidBarKey.borderstrata = "BACKGROUND" end if not DruidBarKey.bgstrata then DruidBarKey.bgstrata = "BORDER" end - if not DruidBarKey.manatexture then DruidBarKey.manatexture = "Interface\\TargetingFrame\\UI-StatusBar"; end if not DruidBarKey.bordertexture then DruidBarKey.bordertexture = "Interface\\Tooltips\\UI-StatusBar-Border"; end @@ -764,9 +761,7 @@ function DruidBar_ColorAndStrataAndTexture() DruidBarMana:SetStatusBarTexture(DruidBarKey.manatexture); DruidBarManaBackground:SetTexture(DruidBarKey.manatexture); DruidBarBorder:SetTexture(DruidBarKey.bordertexture); - -- DruidBarMana:SetFrameLevel(DruidBarKey.barstrata); DruidBarManaBackground:SetDrawLayer(DruidBarKey.bgstrata); - -- DruidBarBorder:SetDrawLayer(DruidBarKey.borderstrata); end function UIErrorsFrame:realEcho() -- 1.7.9.5 From f9f9e4bc9f23f3bef236d29158f82ec8cbac440e Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Mon, 30 Sep 2019 22:14:46 -0700 Subject: [PATCH 2/2] Update version info --- CHANGELOG.md | 3 +++ DruidBarClassic.toc | 2 +- README.md | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 052232a..cd2169c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Version History +#### 0.7.2 +Prevent addon load when player unit is not a druid. + #### 0.7.1 Update width when attached to player frame. Add Bliz-like option to text to match blizzard layout. diff --git a/DruidBarClassic.toc b/DruidBarClassic.toc index 960850b..f8c48f1 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.1 +## Version: 0.7.2 ## X-Curse-Project-ID: 334762 ## X-WoWI-ID: 25036 diff --git a/README.md b/README.md index 48e2e44..3f7b1a6 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,6 @@ There are 2 available /druidbar or /dbar and either may recieve a number of para * or all three at once (like /dbar color 1 0 0) ## Contact info: -In-game: COMING SOON! +In-game: Tek on Pagle Discord: https://discord.gg/b5sPQnu -- 1.7.9.5