@@ -376,11 +376,21 @@ local function updateButtons()
376
376
local frameCounter = 1
377
377
local currentLevel = currentMinLevel
378
378
for row = 1 , NBR_OF_SPELL_ROWS do
379
+ if currentLevel >= 62 then
380
+ -- Hide all hidden rows.
381
+ for i = NBR_OF_SPELL_COLUMNS * row - NBR_OF_SPELL_COLUMNS + 1 , # spellButtons do
382
+ spellButtons [i ]:Hide ()
383
+ end
384
+ for i = row , NBR_OF_SPELL_ROWS do
385
+ levelStrings [i ]:SetText (" " )
386
+ end
387
+ break
388
+ end
379
389
local hiddenCounter = 0
380
390
local shownCounter = 0
381
- while emptyLevels [currentLevel ] do
382
- currentLevel = currentLevel + 2
383
- end
391
+ while currentLevel < 60 and emptyLevels [currentLevel ] do
392
+ currentLevel = currentLevel + 2
393
+ end
384
394
levelStrings [row ]:SetText (currentLevel ~= 2 and " Level " .. currentLevel or " Level 1" )
385
395
for spellIndex , spellInfo in ipairs (FieldGuide [selectedClass ][currentLevel ]) do
386
396
if not spellInfo .hidden then
@@ -408,7 +418,7 @@ local function hideUnwantedSpells()
408
418
for level = 60 , 2 , - 2 do
409
419
local hiddenCounter = 0
410
420
for spellIndex , spellInfo in ipairs (FieldGuide [selectedClass ][level ]) do
411
- if IsSpellKnown (spellInfo .id ) then
421
+ if selectedClass ~= " HUNTER_PETS " and selectedClass ~= " WARLOCK_PETS " and IsSpellKnown (spellInfo .id ) then
412
422
knownSpells [spellInfo .name ] = true
413
423
end
414
424
if spellInfo .empty then
@@ -442,7 +452,13 @@ local function hideUnwantedSpells()
442
452
end
443
453
end
444
454
setHorizontalSliderMaxValue (maxSpellIndex )
445
- FieldGuideFrameVerticalSlider :SetMinMaxValues (0 , 30 - NBR_OF_SPELL_ROWS - nbrOfHiddenRows )
455
+ if 30 - NBR_OF_SPELL_ROWS - nbrOfHiddenRows <= 0 then
456
+ FieldGuideFrameVerticalSlider :SetMinMaxValues (0 , 0 )
457
+ FieldGuideFrameVerticalSliderScrollDownButton :Disable ()
458
+ else
459
+ FieldGuideFrameVerticalSlider :SetMinMaxValues (0 , 30 - NBR_OF_SPELL_ROWS - nbrOfHiddenRows )
460
+ FieldGuideFrameVerticalSliderScrollDownButton :Enable ()
461
+ end
446
462
end
447
463
448
464
-- Sets the background to the given class. Class must be a capitalized string.
@@ -465,14 +481,14 @@ end
465
481
local function setClass (_ , class )
466
482
if class == " HUNTER_PETS" then
467
483
setBackground (" HUNTER" )
468
- ToggleDropDownMenu (nil , nil , FieldGuideDropdownFrame )
469
- UIDropDownMenu_SetText (FieldGuideDropdownFrame , CLASS_COLORS .HUNTER .. " Pet skills" )
484
+ L_ToggleDropDownMenu (nil , nil , FieldGuideDropdownFrame )
485
+ L_UIDropDownMenu_SetText (FieldGuideDropdownFrame , CLASS_COLORS .HUNTER .. " Pet skills" )
470
486
elseif class == " WARLOCK_PETS" then
471
487
setBackground (" WARLOCK" )
472
- ToggleDropDownMenu (nil , nil , FieldGuideDropdownFrame )
473
- UIDropDownMenu_SetText (FieldGuideDropdownFrame , CLASS_COLORS .WARLOCK .. " Demon spells" )
488
+ L_ToggleDropDownMenu (nil , nil , FieldGuideDropdownFrame )
489
+ L_UIDropDownMenu_SetText (FieldGuideDropdownFrame , CLASS_COLORS .WARLOCK .. " Demon spells" )
474
490
else
475
- UIDropDownMenu_SetText (FieldGuideDropdownFrame , CLASS_COLORS [class ] .. class :sub (1 , 1 ) .. class :sub (2 ):lower ())
491
+ L_UIDropDownMenu_SetText (FieldGuideDropdownFrame , CLASS_COLORS [class ] .. class :sub (1 , 1 ) .. class :sub (2 ):lower ())
476
492
end
477
493
selectedClass = class
478
494
if class ~= " WEAPONS" and class ~= " HUNTER_PETS" and class ~= " WARLOCK_PETS" then
521
537
522
538
-- Initializes the dropdown menu.
523
539
local function initDropdown ()
524
- local dropdown = FieldGuideDropdownFrame
525
- UIDropDownMenu_Initialize (dropdown , function (self , level , menuList )
526
- local info = UIDropDownMenu_CreateInfo ()
540
+ L_UIDropDownMenu_Initialize (FieldGuideDropdownFrame , function (self , level , menuList )
541
+ local info = L_UIDropDownMenu_CreateInfo ()
527
542
info .isNotRadio = true
528
543
info .func = setClass
529
544
if level == 1 then
@@ -532,89 +547,89 @@ local function initDropdown()
532
547
info .colorCode = CLASS_COLORS .WARRIOR
533
548
info .arg1 = " WARRIOR"
534
549
info .checked = isSelected (" WARRIOR" )
535
- UIDropDownMenu_AddButton (info , level )
550
+ L_UIDropDownMenu_AddButton (info , level )
536
551
-- Paladin.
537
552
info .text = " Paladin"
538
553
info .colorCode = CLASS_COLORS .PALADIN
539
554
info .arg1 = " PALADIN"
540
555
info .checked = isSelected (" PALADIN" )
541
- UIDropDownMenu_AddButton (info , level )
556
+ L_UIDropDownMenu_AddButton (info , level )
542
557
-- Hunter.
543
558
info .text = " Hunter"
544
559
info .colorCode = CLASS_COLORS .HUNTER
545
560
info .arg1 = " HUNTER"
546
561
info .checked = isSelected (" HUNTER" )
547
562
info .hasArrow = true
548
563
info .menuList = " HUNTER_PETS"
549
- UIDropDownMenu_AddButton (info , level )
564
+ L_UIDropDownMenu_AddButton (info , level )
550
565
-- Rogue.
551
566
info .text = " Rogue"
552
567
info .colorCode = CLASS_COLORS .ROGUE
553
568
info .arg1 = " ROGUE"
554
569
info .checked = isSelected (" ROGUE" )
555
570
info .hasArrow = false
556
571
info .menuList = nil
557
- UIDropDownMenu_AddButton (info , level )
572
+ L_UIDropDownMenu_AddButton (info , level )
558
573
-- Priest.
559
574
info .text = " Priest"
560
575
info .colorCode = CLASS_COLORS .PRIEST
561
576
info .arg1 = " PRIEST"
562
577
info .checked = isSelected (" PRIEST" )
563
- UIDropDownMenu_AddButton (info , level )
578
+ L_UIDropDownMenu_AddButton (info , level )
564
579
-- Shaman.
565
580
info .text = " Shaman"
566
581
info .colorCode = CLASS_COLORS .SHAMAN
567
582
info .arg1 = " SHAMAN"
568
583
info .checked = isSelected (" SHAMAN" )
569
- UIDropDownMenu_AddButton (info , level )
584
+ L_UIDropDownMenu_AddButton (info , level )
570
585
-- Mage.
571
586
info .text = " Mage"
572
587
info .colorCode = CLASS_COLORS .MAGE
573
588
info .checked = isSelected (" MAGE" )
574
589
info .arg1 = " MAGE"
575
- UIDropDownMenu_AddButton (info , level )
590
+ L_UIDropDownMenu_AddButton (info , level )
576
591
-- Warlock.
577
592
info .text = " Warlock"
578
593
info .colorCode = CLASS_COLORS .WARLOCK
579
594
info .arg1 = " WARLOCK"
580
595
info .checked = isSelected (" WARLOCK" )
581
596
info .hasArrow = true
582
597
info .menuList = " WARLOCK_PETS"
583
- UIDropDownMenu_AddButton (info , level )
598
+ L_UIDropDownMenu_AddButton (info , level )
584
599
-- Druid.
585
600
info .text = " Druid"
586
601
info .colorCode = CLASS_COLORS .DRUID
587
602
info .arg1 = " DRUID"
588
603
info .checked = isSelected (" DRUID" )
589
604
info .hasArrow = false
590
605
info .menuList = nil
591
- UIDropDownMenu_AddButton (info , level )
606
+ L_UIDropDownMenu_AddButton (info , level )
592
607
-- Weapon skills.
593
608
info .text = " Weapons"
594
609
info .colorCode = " |cFFDFDFDF"
595
610
info .arg1 = " WEAPONS"
596
611
info .checked = isSelected (" WEAPONS" )
597
- UIDropDownMenu_AddButton (info , level )
612
+ L_UIDropDownMenu_AddButton (info , level )
598
613
elseif menuList == " WARLOCK_PETS" then
599
614
info .text = " Demon spells"
600
615
info .colorCode = CLASS_COLORS .WARLOCK
601
616
info .arg1 = " WARLOCK_PETS"
602
617
info .checked = isSelected (" WARLOCK_PETS" )
603
618
info .func = setClass
604
- UIDropDownMenu_AddButton (info , level )
619
+ L_UIDropDownMenu_AddButton (info , level )
605
620
elseif menuList == " HUNTER_PETS" then
606
621
info .text = " Pet skills"
607
622
info .colorCode = CLASS_COLORS .HUNTER
608
623
info .arg1 = " HUNTER_PETS"
609
624
info .checked = isSelected (" HUNTER_PETS" )
610
625
info .func = setClass
611
- UIDropDownMenu_AddButton (info , level )
626
+ L_UIDropDownMenu_AddButton (info , level )
612
627
end
613
628
end )
614
- UIDropDownMenu_SetWidth ( dropdown , 100 );
615
- UIDropDownMenu_SetButtonWidth ( dropdown , 124 )
616
- UIDropDownMenu_JustifyText ( dropdown , " RIGHT" )
617
- UIDropDownMenu_SetText ( dropdown , CLASS_COLORS [actualClass ].. actualClass :sub (1 , 1 ) .. actualClass :sub (2 ):lower ())
629
+ L_UIDropDownMenu_SetWidth ( FieldGuideDropdownFrame , 100 );
630
+ L_UIDropDownMenu_SetButtonWidth ( FieldGuideDropdownFrame , 124 )
631
+ L_UIDropDownMenu_JustifyText ( FieldGuideDropdownFrame , " RIGHT" )
632
+ L_UIDropDownMenu_SetText ( FieldGuideDropdownFrame , CLASS_COLORS [actualClass ].. actualClass :sub (1 , 1 ) .. actualClass :sub (2 ):lower ())
618
633
end
619
634
620
635
-- Initializes all frames, level strings, and textures for reuse.
@@ -637,6 +652,9 @@ local function initFrames()
637
652
levelStrings [stringIndex ] = FieldGuideFrame :CreateFontString (nil , " ARTWORK" , " FieldGuideLevelStringTemplate" )
638
653
levelStrings [stringIndex ]:SetPoint (" TOPLEFT" , LEVEL_STRING_X_START , - LEVEL_STRING_Y_START - Y_SPACING * stringIndex )
639
654
end
655
+ -- The fact that this is even needed...
656
+ L_Create_UIDropDownMenu (" FieldGuideDropdownFrame" , FieldGuideFrame )
657
+ FieldGuideDropdownFrame :SetPoint (" TOPRIGHT" , - 36 , - 28 )
640
658
end
641
659
642
660
-- Initializes everything.
@@ -850,6 +868,8 @@ function FieldGuide_OnLoad(self)
850
868
self :RegisterEvent (" ADDON_LOADED" )
851
869
self :RegisterEvent (" LEARNED_SPELL_IN_TAB" )
852
870
self :RegisterEvent (" PLAYER_ENTERING_WORLD" )
871
+ self :RegisterEvent (" SKILL_LINES_CHANGED" )
872
+ self :RegisterEvent (" UNIT_PET" )
853
873
end
854
874
855
875
-- Called on each event the frame receives.
@@ -875,9 +895,18 @@ function FieldGuide_OnEvent(self, event, ...)
875
895
if selectedClass ~= " WEAPONS" then
876
896
hideUnwantedSpells ()
877
897
updateButtons ()
878
- else
898
+ resetScroll ()
899
+ end
900
+ elseif event == " SKILL_LINES_CHANGED" then
901
+ if selectedClass == " WEAPONS" then
879
902
hideUnwantedWeapons ()
880
- updateWeapons ()
903
+ updateButtons ()
904
+ end
905
+ elseif event == " UNIT_PET" then
906
+ if selectedClass == " HUNTER_PETS" or selectedClass == " WARLOCK_PETS" then
907
+ hideUnwantedSpells ()
908
+ updateButtons ()
909
+ resetScroll ()
881
910
end
882
911
elseif event == " PLAYER_ENTERING_WORLD" then
883
912
init ()
0 commit comments