From bf7db207d398ea5417e79bba544fd106be14f5b7 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 24 May 2013 15:50:18 +0200 Subject: [PATCH] Proper handling of GetLootSpecialization --- HabeebIt.lua | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/HabeebIt.lua b/HabeebIt.lua index 8fba4b7..3553734 100644 --- a/HabeebIt.lua +++ b/HabeebIt.lua @@ -1,7 +1,5 @@ local _, ns = ... -local patch50300 = select(4, GetBuildInfo()) == 50300 - local items = {} local specializations = {} local collapsed = true @@ -204,6 +202,19 @@ local function SpecializationEnter(self) GameTooltip:Show() end +local function GetSpec() + local loot = GetLootSpecialization() + if(loot and loot > 0) then + for index = 1, GetNumSpecializations() do + if(GetSpecializationInfo(index) == loot) then + return index + end + end + else + return GetSpecialization() + end +end + local function CreateSpecializationTabs(self) for index = 1, GetNumSpecializations() do local SpecButton = CreateFrame('Button', nil, self) @@ -245,12 +256,7 @@ local function CreateSpecializationTabs(self) specializations[index] = SpecButton end - if(patch50300) then - local loot = GetLootSpecialization() - UpdateSpecializations((loot and loot ~= 0 and loot) or GetSpecialization()) - else - UpdateSpecializations(GetSpecialization()) - end + UpdateSpecializations(GetSpec()) end Frame:RegisterEvent('PLAYER_LOGIN') @@ -264,12 +270,7 @@ Frame:SetScript('OnEvent', function(self, event, ...) CreateSpecializationTabs(self) end - if(patch50300) then - local loot = GetLootSpecialization() - InitializeList((loot and loot ~= 0 and loot) or GetSpecialization()) - else - InitializeList(GetSpecialization()) - end + InitializeList(GetSpec()) else print('|cffff8080HabeebIt:|r Found an unknown spell [' .. spellID .. ']. Please report this!') end -- 1.7.9.5