Skip to content

Commit

Permalink
Fixed feral identification bug
Browse files Browse the repository at this point in the history
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".
  • Loading branch information
SecretX33 committed Dec 7, 2020
1 parent dc2eecd commit bb8bb61
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
11 changes: 10 additions & 1 deletion AutomaticWeaponRemoval.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions AutomaticWeaponRemoval.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion localization.lua
Original file line number Diff line number Diff line change
@@ -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."
Expand Down

0 comments on commit bb8bb61

Please sign in to comment.