cdmichaelb / Outfitter

Outfitter - Classic
MIT License
10 stars 22 forks source link

GetSpecialization is nil on WOTLK-Classic #110

Closed KevinTyrrell closed 1 year ago

KevinTyrrell commented 1 year ago

The API function GetSpecialization is nil on WOTLK-Classic, causing Outfitter:TalentsChanged() to encounter an exception.

function Outfitter:TalentsChanged()
    self.CanDualWield2H = self.PlayerClass == "WARRIOR" and GetSpecialization() == 2
end

This then seizes the entire addon, causing little to no features to remain working.

Stack Trace

13x Outfitter\Outfitter-3.0.0.lua:1897: attempt to call global 'GetSpecialization' (a nil value)
[string "@Outfitter\Outfitter-3.0.0.lua"]:1897: in function `TalentsChanged'
[string "@Outfitter\Outfitter-3.0.0.lua"]:4924: in function `Function'
[string "@Outfitter\Libraries/MC2SchedulerLib/MC2SchedulerLib.lua"]:242: in function `OnUpdate2'
[string "@Outfitter\Libraries/MC2SchedulerLib/MC2SchedulerLib.lua"]:178: in function `OnUpdate'
[string "@Outfitter\Libraries/MC2SchedulerLib/MC2SchedulerLib.lua"]:20: in function <...fitter\Libraries/MC2SchedulerLib/MC2SchedulerLib.lua:20>

Locals:
self = <table> {
 cRidingOutfitDescription = "Equips the outfit when you're mounted"
 cFishingOutfit = "Fishing"
 cFishingOutfitDescription = "Unequips the outfit if you enter combat, then requips it afterwards."
 cCategoryOrder = <table> {
 }
 cFrenchLocalization = "French Localization"
 AskSetCurrent = <function> defined @Outfitter\Outfitter.lua:1806
 UpdateShapeshiftInfo = <function> defined @Outfitter\Outfitter.lua:4382
 cBattlegroundOutfit = "Battleground"
 InheritOver = <function> defined @Outfitter\Libraries/MC2AddonLib/MC2AddonLib.lua:128
 _SidebarWindowFrame = <table> {
 }
 GetBagSlotItemName = <function> defined @Outfitter\OutfitterInventory.lua:210
 cNewOutfit = "New Outfit"
 OutfitStack = <table> {
 }
 cHerbalismOutfit = "Herbalism"
 cFrostResistOutfit = "Resist: Frost"
 cArenaOutfit = "Battleground: Arena"
 cMissingItemReportIntro = "Missing items (note that a missing item will be listed multiple times if it was used by multiple outfits):"
 GetBagItemInvType = <function> defined @Outfitter\OutfitterInventory.lua:97
 cHunterWildDescription = "Equips the outfit when you are in Wild aspect"
 cHasDebuffOutfit = "Has Debuff"
 VoidStorageFrameClosed = <function> defined @Outfitter\Outfitter.lua:1406
 SuspendSecureActions = <function> defined @Outfitter\Outfitter.lua:1436
 cUnequipOthers = "On equip, unequip other Accessory outfits"
 cContributingDeveloper = "Contributing Developer"
 FormatItemList = <function> defined @Outfitter\Outfitter.lua:338
 cHalfAlternateStatSlot = <table> {
 }
 inheritOver = <function> defined @Outfitter\Libraries/MC2AddonLib/MC2AddonLib.lua:128
 ErrorMessage = <function> defined @Outfitter\Libraries/MC2DebugLib/MC2DebugLib.lua:137
 cFallingOutfit = "Falling"
 cWSGOutfit = "Battleground: Warsong Gulch"
 cBoEsOutfits = "Unopened"
 cUseEmptyOutfit = "Create Empty Outfit"
 ShowCommandHelp = <function> defined @Outfitter\Outfitter.lua:1743
 cDontChange = "Don't change"
 cAccessoryCategoryDescription = "Accessory outfits have some, but not all, slots specified.  You can equip as many accessory outfits at a time as you like."
 GetPlayerStat = <function> defined @Outfitter\Outfitter.lua:6397
 cQuestTurninOutfitDescription = "Use this to automatically equip your bonus XP gear before you turn in quests"
 cBoEsCategoryDescription = "Unopened is a list of items which are still in their original 'Binds on Equip' state."
 GetSummonedCompanionID = <function> defined @Outfitter\Outfitter.lua:7761
 cOutfitBarLargeSizeLabel = "Large"
 cIoCOutfit = "Battleground: Isle of Conquest"
 cWithdrawOthersFromBank = "Withdraw other outfits from bank"
 GenerateSmartUnequipScript = <function> defined @Outfitter\OutfitterScripting.lua:252
 cItemComparisonsOffDescription = "Turn this on to include items from your outfits in tooltip item comparisons"
 cLockpickingDescription = "Equips the outfit when your cursor is over a lock that is orange or red to you"
 cBankedItemsLabel = "Banked items: "
 cInZonesOutfit = "In Zones"
 Initialized = true
 cNatureResistOutfit = "Resist: Nature"
 _InventoryCache = <table> {
 }
 DeactivateScript = <function> defined @Outfitter\OutfitterScripting.lua:1760
 TankPoints_New = <function> defined @Outfitter\OutfitterItemStats.lua:612
 _ExtendedCompareTooltip = <table> {
 }
 CursorInFrame = <function> defined @Outfitter\OutfitterUITools.lua:461
 cRebuildFor = "Rebuild for..."
 cFuHideMissingDesc = "Hide outfits with missing items."
 cFinger0SlotName = "First Finger"
 cHunterMonkeyDescription = "Equips the outfit when you are in Monkey aspect"
 cEotSOutfit = "Battleground: Eye of the Storm"
 cAccessoryOutfits = "Accessories"
 LibDropdown = <table> {
 }
 FindOutfit = <function> defined @Outfitter\Outfitter.lua:3357
 ScriptContexts = <table> {
 }
 cOddsNEndsCategoryDescription = "Odds 'n ends is
KevinTyrrell commented 1 year ago

Solution:

Current function

function Outfitter:TalentsChanged()
    self.CanDualWield2H = self.PlayerClass == "WARRIOR" and GetSpecialization() == 2
end

Modified function

function Outfitter:TalentsChanged()
    self.CanDualWield2H = self.PlayerClass == "WARRIOR" and select(5, GetTalentInfo(2, 24)) > 0
end

GetSpecialization appears to be retail function where you obtain Titans Grip simply from specializing yourself as 'Fury'. Instead in WOTLK Classic it appears you will just need to check the talent. TalentsChanged by the way is a very poor name for this function, but I understand much of this codebase is legacy.

Gogo1951 commented 1 year ago

Fixed in latest release!