New char, no talents GetSpecializationInfo #69


  • New
  • Defect
Open
Assigned to torhal
  • Sygon_Paul created this issue Oct 27, 2013

    What steps will reproduce the problem?

    1. Create a brand new character at level 1
    2. Log into the game
    3. Since no Talents or Specializations are available, error occurs

    What is the expected output? What do you see instead?

    • No errors?

    What version of the product are you using?

    • 2.22.3-release

    Do you have an error log of what happened?

    5x Broker_HitCrit\Broker_HitCrit-2.22.3-release.lua:2349: Usage: GetSpecializationInfo(specIndex[, isInspect[, isPet]])
    <in C code>
    Broker_HitCrit\Broker_HitCrit-2.22.3-release.lua:2349: in function <Broker_HitCrit\Broker_HitCrit.lua:2343>
    (tail call): ?
    <in C code>
    <string>:"safecall Dispatcher[1]":9: in function <string>:"safecall Dispatcher[1]":5
    (tail call): ?
    AdiBags-v1.6.12-beta-1\libs\AceAddon-3.0\AceAddon-3.0-12.lua:558: in function "EnableAddon"
    AdiBags-v1.6.12-beta-1\libs\AceAddon-3.0\AceAddon-3.0-12.lua:651: in function <AdiBags\libs\AceAddon-3.0\AceAddon-3.0.lua:636>
    <in C code>
    <in C code>
    AddonLoader\AddonLoader-r126.lua:125: in function "LoadAddOn"
    AddonLoader-r126\Conditions.lua:142: in function <AddonLoader\Conditions.lua:130>
    AddonLoader-r126\Conditions.lua:162: in function <AddonLoader\Conditions.lua:149>
    
    Locals:
    nil
    

    Please provide any additional information below.

    • All my characters are Alliance, but I do not think it matters.
  • Sygon_Paul added the tags New Defect Oct 27, 2013
  • _ForgeUser827935 posted a comment Oct 14, 2014

    This patch might help to resolve this. I opted to file the untalented results under the Inactive Spec, it will be overwritten from level 10 onwards anyway, so little need to create a new data section solely for level 1-9.

    I reasoned that the drawing of the tooltip happens infrequently enough that putting the call in that function would not be an issue for slow downs or the likes.

    diff --git a/Broker_HitCrit.lua b/Broker_HitCrit.lua
    index 4b5fbc4..517e5a3 100644
    --- a/Broker_HitCrit.lua
    +++ b/Broker_HitCrit.lua
    @@ -785,7 +785,8 @@ function addon:drawTooltip( talent )
     	tooltip:Clear()
     	tooltip:SetColumnLayout(num_columns, unpack(t))
     
    -	if  talent == HitCrit.activeTalents then
    +	self:getSpecializationName()
    +	if talent == HitCrit.activeTalents and HitCrit.specName ~= "" then
     		headerTitle = HitCrit_White( L["Broker_HitCrit"] .. " - " .. HitCrit.specName )
     	else
     		headerTitle = HitCrit_White( L["Broker_HitCrit"] .. " - " .. L["Inactive Spec"] )
    @@ -2304,6 +2305,13 @@ function addon:checkSuperBuffs()
     	end
     end
     
    +function addon:getSpecializationName()
    +	local specialization = GetSpecialization()
    +	if (specialization) then
    +		HitCrit.specName = select(2, GetSpecializationInfo(specialization))
    +	end
    +end
    +
     function HitCrit:UNIT_AURA( ... )
     	HitCrit_Debug( "Player unit aura event fired" )
     	HitCrit:checkSuperBuffs()
    @@ -2322,7 +2330,7 @@ end
     function HitCrit:ACTIVE_TALENT_GROUP_CHANGED( ... )
     	HitCrit_Debug( "Player talents switched" )
     	HitCrit.activeTalents = GetActiveSpecGroup()
    -	HitCrit.specName = select(2, GetSpecializationInfo(GetSpecialization()))
    +	self:getSpecializationName()
     	HitCrit.currTT = HitCrit.activeTalents
     end
     
    @@ -2346,7 +2354,7 @@ function HitCrit:OnEnable()
     	HitCrit.GUID = UnitGUID( "player" )
     	HitCrit.level = UnitLevel( "player" )
     	HitCrit.activeTalents = GetActiveSpecGroup()
    -	HitCrit.specName = select(2, GetSpecializationInfo(GetSpecialization()))
    +	self:getSpecializationName()
     	HitCrit.currTT = HitCrit.activeTalents
     
     	self.db = LibStub( "AceDB-3.0" ):New( "HitCrit_DB", nil, "Default" )
    

To post a comment, please login or register a new account.