From bb8bb61807bec47bbca3d727acd80c0558343cb9 Mon Sep 17 00:00:00 2001 From: SecretX33 <4389757+SecretX33@users.noreply.github.com> Date: Mon, 7 Dec 2020 17:01:55 -0300 Subject: [PATCH] Fixed feral identification bug Fixed bug with build being identified as "Feral Combat" but addon was expecting "Feral", so when the lib identify the player as "Feral Combat" the spec will be converted to just "Feral". --- AutomaticWeaponRemoval.lua | 11 ++++++++++- AutomaticWeaponRemoval.toc | 4 ++-- localization.lua | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/AutomaticWeaponRemoval.lua b/AutomaticWeaponRemoval.lua index 65ab9ef..4ddcaee 100644 --- a/AutomaticWeaponRemoval.lua +++ b/AutomaticWeaponRemoval.lua @@ -137,6 +137,7 @@ local function updatePlayerSpec() -- the function GetUnitTalentSpec from GroupTalentsLib can return a number if the player has not yet seen that class/build, so another "just in case" code, but I'm not sure what if this number means the talent tree number (like 1 for balance, 3 for restoration) or just the spec slot (player has just two slots), I guess I'll have to shoot in the dark here. ;) -- I just discovered that this function can also return nil if called when player is logging in (probably because the inspect function doesn't work while logging in) local spec = groupTalentsLib:GetUnitTalentSpec(UnitName("player")) + if spec=="Feral Combat" then spec = "Feral" end -- We will treat 'Feral Combat' as 'Feral' if spec~=nil then playerSpec = spec @@ -377,7 +378,15 @@ end local function slashCommandSpec() if(playerClass==nil) then send(AWR_ADDON_STILL_LOADING); return; end updatePlayerClassAndSpec() - send("Your class is " .. upperFirstOnly(playerClass) .. (playerSpec and (" and your build is " .. upperFirstOnly(playerSpec)) or "") .. ".") + local spec = getPlayerSpec() + local class = playerClass + + if class=="DEATHKNIGHT" then class = "Death Knight" + else class = upperFirstOnly(playerClass) end + if spec==nil then spec = "Unknown" + else spec = upperFirstOnly(spec) end + + send("Your class is " .. class .. " and your build is " .. spec .. ".") end -- debug diff --git a/AutomaticWeaponRemoval.toc b/AutomaticWeaponRemoval.toc index d0297b0..a45589e 100644 --- a/AutomaticWeaponRemoval.toc +++ b/AutomaticWeaponRemoval.toc @@ -4,11 +4,11 @@ ## Title: AutomaticWeaponRemoval ## Notes: Remove weapons automatically when Lady casts Mind Control on you. No in-game options, configuration via Lua. ## Author: SecretX (Freezingice) -## Version: 1.0.6 +## Version: 1.0.6.1 ## SavedVariables: AWRDB ## OptionalDeps: BugSack, !Swatter ## X-Category: Combat Assist -## X-Date: 12/03/2020 +## X-Date: 12/07/2020 embeds.xml localization.lua diff --git a/localization.lua b/localization.lua index 158eefe..73522f4 100644 --- a/localization.lua +++ b/localization.lua @@ -1,5 +1,5 @@ -- AutomaticWeaponRemoval Localization File --- Version 1.0.6 +-- Version 1.0.6.1 AWR_HELP1 = "This addon will automatically remove your weapons and bow when Lady Deathwhisper controls you." AWR_HELP2 = "Try typing |cffffaf24/awr toggle|r to toggle the addon state ON or OFF, you can also use |cff6fe014/awr on|r or |cffff3838/awr off|r."