@@ -32,9 +32,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232--]]
3333
3434-- just bail out on classic, there is no DualSpec there
35- if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC then return end
35+ if WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE then return end
3636
37- local MAJOR , MINOR = " LibDualSpec-1.0" , 19
37+ local MAJOR , MINOR = " LibDualSpec-1.0" , 20
3838assert (LibStub , MAJOR .. " requires LibStub" )
3939local lib , minor = LibStub :NewLibrary (MAJOR , MINOR )
4040if not lib then return end
@@ -72,7 +72,7 @@ local AceDB3 = LibStub('AceDB-3.0', true)
7272local AceDBOptions3 = LibStub (' AceDBOptions-3.0' , true )
7373local AceConfigRegistry3 = LibStub (' AceConfigRegistry-3.0' , true )
7474
75- -- classId specialization functions don't require player data to be loaded
75+ -- class id specialization functions don't require player data to be loaded
7676local _ , _ , classId = UnitClass (" player" )
7777local numSpecs = GetNumSpecializationsForClassID (classId )
7878
@@ -82,22 +82,38 @@ local numSpecs = GetNumSpecializationsForClassID(classId)
8282
8383local L_ENABLED = " Enable spec profiles"
8484local L_ENABLED_DESC = " When enabled, your profile will be set to the specified profile when you change specialization."
85- local L_CURRENT = " %s (Current)" -- maybe something like >> %s << and/or coloring to avoid localization?
85+ local L_CURRENT = " %s (Current)"
8686
8787do
8888 local locale = GetLocale ()
89- if locale == " frFR" then
90- -- L_ENABLED = "Enable spec profiles"
91- -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
92- -- L_CURRENT = "%s (Current)"
93- elseif locale == " deDE" then
89+ if locale == " deDE" then
9490 L_ENABLED = " Spezialisierungsprofile aktivieren"
9591 L_ENABLED_DESC = " Falls diese Option aktiviert ist, wird dein Profil auf das angegebene Profil gesetzt, wenn du die Spezialisierung wechselst."
9692 L_CURRENT = " %s (Momentan)"
93+ elseif locale == " esES" then
94+ -- L_ENABLED = "Enable spec profiles"
95+ -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
96+ -- L_CURRENT = "%s (Current)"
97+ elseif locale == " esMX" then
98+ -- L_ENABLED = "Enable spec profiles"
99+ -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
100+ -- L_CURRENT = "%s (Current)"
101+ elseif locale == " frFR" then
102+ -- L_ENABLED = "Enable spec profiles"
103+ -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
104+ -- L_CURRENT = "%s (Current)"
105+ elseif locale == " itIT" then
106+ L_ENABLED = " Abilita i profili per la specializzazione"
107+ L_ENABLED_DESC = " Quando abilitato, il tuo profilo verrà impostato in base alla specializzazione usata."
108+ L_CURRENT = " %s (Attuale)"
97109 elseif locale == " koKR" then
98110 -- L_ENABLED = "Enable spec profiles"
99111 -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
100112 -- L_CURRENT = "%s (Current)"
113+ elseif locale == " ptBR" then
114+ -- L_ENABLED = "Enable spec profiles"
115+ -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
116+ -- L_CURRENT = "%s (Current)"
101117 elseif locale == " ruRU" then
102118 L_ENABLED = " Включить профили специализации"
103119 L_ENABLED_DESC = " Если включено, ваш профиль будет зависеть от выбранной специализации."
110126 L_ENABLED = " 啟用專精設定檔"
111127 L_ENABLED_DESC = " 當啟用後,當你切換專精時設定檔會設定為專精設定檔。"
112128 L_CURRENT = " %s (目前) "
113- elseif locale == " esES" or locale == " esMX" then
114- -- L_ENABLED = "Enable spec profiles"
115- -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
116- -- L_CURRENT = "%s (Current)"
117- elseif locale == " ptBR" then
118- -- L_ENABLED = "Enable spec profiles"
119- -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
120- -- L_CURRENT = "%s (Current)"
121- elseif locale == " itIT" then
122- -- L_ENABLED = "Enable spec profiles"
123- -- L_ENABLED_DESC = "When enabled, your profile will be set to the specified profile when you change specialization."
124- -- L_CURRENT = "%s (Current)"
125129 end
126130end
127131
@@ -406,18 +410,20 @@ end
406410-- ----------------------------------------------------------------------------
407411
408412local function eventHandler (self , event )
409- lib . currentSpec = GetSpecialization () or 0
413+ local spec = GetSpecialization () or 0
410414 -- Newly created characters start at 5 instead of 1 in 9.0.1.
411- if lib . currentSpec == 5 or not C_SpecializationInfo .CanPlayerUseTalentSpecUI () then
412- lib . currentSpec = 0
415+ if spec == 5 or not C_SpecializationInfo .CanPlayerUseTalentSpecUI () then
416+ spec = 0
413417 end
418+ lib .currentSpec = spec
414419
415420 if event == " PLAYER_LOGIN" then
416421 self :UnregisterEvent (event )
417422 self :RegisterUnitEvent (" PLAYER_SPECIALIZATION_CHANGED" , " player" )
423+ self :RegisterEvent (" PLAYER_LEVEL_CHANGED" )
418424 end
419425
420- if lib . currentSpec > 0 and next (upgrades ) then
426+ if spec > 0 and next (upgrades ) then
421427 for target in next , upgrades do
422428 UpgradeDatabase (target )
423429 end
@@ -446,3 +452,29 @@ else
446452 lib .eventFrame :RegisterEvent (" PLAYER_LOGIN" )
447453end
448454
455+ -- @do-not-package@
456+ if not lib .testdb then
457+ local AC = LibStub (" AceConfig-3.0" , true )
458+ local ACD = LibStub (" AceConfigDialog-3.0" , true )
459+ local ADO = LibStub (" AceDBOptions-3.0" , true )
460+ if AC and ACD and ADO then
461+ local key = format (" %s-%d test" , MAJOR , MINOR )
462+ local testdb = LibStub (' AceDB-3.0' ):New (key )
463+ lib .testdb = testdb
464+ testdb :RegisterCallback (" OnNewProfile" , print )
465+ testdb :RegisterCallback (" OnProfileChanged" , print )
466+ testdb :RegisterCallback (" OnProfileShutdown" , print )
467+ testdb :RegisterCallback (" OnProfileCopied" , print )
468+ testdb :RegisterCallback (" OnProfileDeleted" , print )
469+ testdb :RegisterCallback (" OnProfileReset" , print )
470+ testdb :RegisterCallback (" OnDatabaseReset" , print )
471+ testdb :RegisterCallback (" OnDatabaseShutdown" , print )
472+ lib :EnhanceDatabase (testdb , key )
473+ local options = ADO :GetOptionsTable (testdb )
474+ lib :EnhanceOptions (options , testdb )
475+ AC :RegisterOptionsTable (key , options )
476+ SlashCmdList [" SPECPROFILES" ] = function () ACD :Open (key ) end
477+ SLASH_SPECPROFILES1 = " /testdb"
478+ end
479+ end
480+ -- @end-do-not-package@
0 commit comments