Repository navigation
Expand file tree
/
Copy pathAutoLockUI.lua
More file actions
2321 lines (2104 loc) · 86.9 KB
/
Copy pathAutoLockUI.lua
File metadata and controls
2321 lines (2104 loc) · 86.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- AutoLock: Ace2 Mini UI (Vanilla 1.12)
local Dewdrop = AceLibrary and AceLibrary("Dewdrop-2.0")
-- =========================
-- SavedVariables
-- =========================
AutoLockUI_ShowDisabled = true
AutoLockSearchText = ""
AutoLockTypeFilter = "all"
-- AutoLockDB is a SavedVariable: WoW restores it after VARIABLES_LOADED.
-- Ace2 may fire OnEnable() before that (via DEFAULT_CHAT_FRAME hack), so
-- we hook VARIABLES_LOADED directly and re-run InitConfigs with real data.
local autoLockVarFrame = CreateFrame("Frame")
autoLockVarFrame:RegisterEvent("VARIABLES_LOADED")
autoLockVarFrame:SetScript("OnEvent", function()
if AutoLock and AutoLock.InitConfigs then
AutoLock:InitConfigs()
if AutoLock.CreateMinimapButton then
AutoLock:CreateMinimapButton()
end
if frame and frame:IsShown() then
AutoLockRefreshConfigList()
AutoLock:PrioScrollUpdate()
end
end
end)
-- =========================
-- Helpers: Sortieren/Verschieben
-- =========================
local function SanitizeNumberText(s)
s = tostring(s or "")
-- Dezimalkomma -> Punkt (falls jemand , tippt)
s = string.gsub(s, ",", ".")
-- alles außer Ziffern und Punkt raus
s = string.gsub(s, "[^0-9%.]", "")
-- ab dem zweiten Punkt alle weiteren Punkte entfernen
local firstDot = string.find(s, "%.")
if firstDot then
local head = string.sub(s, 1, firstDot) -- inkl. erstem Punkt
local tail = string.gsub(string.sub(s, firstDot + 1), "%.", "")
s = head .. tail
end
return s
end
local function AutoLockUI_GetFiltered()
local filtered = {}
local search = strlower(AutoLockSearchText or "")
local typeFilter = AutoLockTypeFilter or "all"
for _, e in ipairs(SPELL_PRIORITY) do
if e._deleted then
-- skip
elseif not AutoLockUI_ShowDisabled and e.enabled == false then
-- skip
else
local passType = (typeFilter == "all") or (e.type == typeFilter)
local passSearch = (search == "") or strfind(strlower(e.uitext or e.name or ""), search, 1)
local passKnown = true
if AutoLockDB and AutoLockDB.settings and AutoLockDB.settings.hideUnknownSpells then
local ks = AutoLock.KnownSpells
-- only filter if KnownSpells is actually populated; an empty table means
-- BuildKnownSpellSet ran before the spellbook was ready – don't hide everything
if ks and next(ks) ~= nil and not ks[e.name] then
passKnown = false
end
end
if passType and passSearch and passKnown then
table.insert(filtered, e)
end
end
end
return filtered
end
local function SortByPriorityNumbers()
table.sort(SPELL_PRIORITY, function(a, b)
local pa = a.priority or 99
local pb = b.priority or 99
if pa == pb then return (a.name or "") < (b.name or "") end
return pa < pb
end)
end
local function RenumberPriorities()
local n = table.getn(SPELL_PRIORITY)
for i = 1, n do
local e = SPELL_PRIORITY[i]
e.priority = i
if e.enabled == nil then e.enabled = true end
end
end
local function MoveEntry(fromIdx, toIdx)
local n = table.getn(SPELL_PRIORITY)
if not fromIdx or not toIdx then return end
if fromIdx < 1 or fromIdx > n or toIdx < 1 or toIdx > n then return end
if fromIdx == toIdx then return end
local e = table.remove(SPELL_PRIORITY, fromIdx)
table.insert(SPELL_PRIORITY, toIdx, e)
RenumberPriorities()
end
-- =========================
-- Frames/State
-- =========================
local frame, scroll
local rows = {}
local header = {}
local ROW_HEIGHT, ROW_SPACING, VISIBLE_ROWS = 20, 4, 15
local miniBtn
local configStrip
local configBtns = {}
local settingsPanel
-- kleines Bedingungen-Fenster (einmalig wiederverwendet)
local condFrame
-- ESC schließt das oberste sichtbare AutoLock-Fenster
local _origCloseWindows = CloseWindows
CloseWindows = function()
local picker = getglobal("AutoLockSpellPicker")
if picker and picker:IsVisible() then
picker:Hide()
return true
end
local cond = getglobal("AutoLockConditionFrame")
if cond and cond:IsVisible() then
cond:Hide()
return true
end
local settings = getglobal("AutoLockSettingsPanel")
if settings and settings:IsVisible() then
settings:Hide()
return true
end
if frame and frame:IsVisible() then
frame:Hide()
return true
end
return _origCloseWindows()
end
-- Spaltenbreiten
local GRIP_W = 22 -- Drag-Handle
local NAME_W = 340 -- Spell-Name
local REF_W = 40 -- Refresh-EditBox
local COND_W = 56 -- Cond-Button
local DEL_W = 22 -- Delete-Button
local CFG_W = 36 -- Spell-Config-Button (z.B. Dark Harvest DoTs)
local GAP = 8
-- =========================
-- Config helpers
-- =========================
-- Use uitext when available so Shadow Trance (Shadow Bolt) and
-- the filler Shadow Bolt don't share the same key.
local function GetSpellKey(e)
return (e.uitext or e.name or "?").."|"..(e.type or "?")
end
-- Own tooltip frame so we don't share state/backdrop with GameTooltip
local AL_TT = CreateFrame("Frame", "AutoLockTooltip", UIParent)
AL_TT:SetFrameStrata("TOOLTIP")
AL_TT:SetFrameLevel(200)
AL_TT:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left=4, right=4, top=4, bottom=4 },
})
AL_TT:SetBackdropColor(0.05, 0.05, 0.05, 0.95)
AL_TT:SetBackdropBorderColor(0.6, 0.6, 0.6, 1)
AL_TT:Hide()
local AL_TT_title = AL_TT:CreateFontString(nil, "OVERLAY", "GameFontNormal")
AL_TT_title:SetPoint("TOPLEFT", AL_TT, "TOPLEFT", 8, -8)
AL_TT_title:SetJustifyH("LEFT")
local AL_TT_body = AL_TT:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
AL_TT_body:SetPoint("TOPLEFT", AL_TT_title, "BOTTOMLEFT", 0, -4)
AL_TT_body:SetJustifyH("LEFT")
local _AL_TT_NativeShow = AL_TT.Show
function AL_TT:SetOwner(owner, anchor)
self:ClearAllPoints()
if anchor == "ANCHOR_LEFT" then
self:SetPoint("RIGHT", owner, "LEFT", -4, 0)
elseif anchor == "ANCHOR_BOTTOM" then
self:SetPoint("TOP", owner, "BOTTOM", 0, -4)
elseif anchor == "ANCHOR_TOP" then
self:SetPoint("BOTTOM", owner, "TOP", 0, 4)
else
self:SetPoint("LEFT", owner, "RIGHT", 4, 0)
end
self._ttLines = {}
end
function AL_TT:ClearLines()
self._ttLines = {}
end
function AL_TT:AddLine(text, r, g, b)
if not self._ttLines then self._ttLines = {} end
self._ttLines[table.getn(self._ttLines) + 1] = { text=text, r=r or 1, g=g or 1, b=b or 1 }
end
function AL_TT:Show()
local lines = self._ttLines or {}
local n = table.getn(lines)
-- Title
AL_TT_title:SetWidth(0)
AL_TT_title:SetText(n >= 1 and lines[1].text or "")
if n >= 1 then AL_TT_title:SetTextColor(lines[1].r, lines[1].g, lines[1].b) end
-- Body (remaining lines joined)
AL_TT_body:SetWidth(0)
if n >= 2 then
local parts = {}
for i = 2, n do parts[i-1] = lines[i].text end
AL_TT_body:SetText(table.concat(parts, "\n"))
AL_TT_body:SetTextColor(0.9, 0.9, 0.9)
else
AL_TT_body:SetText("")
end
-- Measure using GetWidth/GetHeight (vanilla 1.12 – SetWidth(0) lets string expand freely)
local titleW = AL_TT_title:GetWidth()
local bodyW = AL_TT_body:GetWidth()
local titleH = AL_TT_title:GetHeight()
local bodyH = (n >= 2) and AL_TT_body:GetHeight() or 0
local gap = (bodyH > 0) and 4 or 0
self:SetWidth(math.max(titleW, bodyW) + 16)
self:SetHeight(titleH + bodyH + gap + 16)
_AL_TT_NativeShow(self)
end
local function ShowTooltip(owner, title, body)
AL_TT:SetOwner(owner, "ANCHOR_RIGHT")
AL_TT:ClearLines()
AL_TT:AddLine(title, 1, 0.82, 0)
AL_TT:AddLine(body, 0.9, 0.9, 0.9)
AL_TT:Show()
end
local function GetActiveConfig()
-- Gibt den gerade im UI geladenen Config zurück (Vorschau oder Combat-Config)
local name = AutoLock._loadedConfigName or (AutoLockDB and AutoLockDB.activeConfig)
for _, c in ipairs(AutoLockDB.configs) do
if c.name == name then return c end
end
end
local function SnapshotSpells()
local t = {}
for _, e in ipairs(SPELL_PRIORITY) do
if not e._deleted then
t[GetSpellKey(e)] = { enabled=e.enabled, priority=e.priority, refreshtime=e.refreshtime }
end
end
return t
end
local function SaveCurrentConfigSpells()
local cfg = GetActiveConfig()
if not cfg then return end
cfg.spells = {}
for _, e in ipairs(SPELL_PRIORITY) do
if not e._deleted then
cfg.spells[GetSpellKey(e)] = {
enabled=e.enabled, priority=e.priority, refreshtime=e.refreshtime,
TH_player_hp=e.TH_player_hp, TH_player_hp_cmp=e.TH_player_hp_cmp,
TH_player_mana=e.TH_player_mana, TH_player_mana_cmp=e.TH_player_mana_cmp,
TH_target_hp=e.TH_target_hp, TH_target_hp_cmp=e.TH_target_hp_cmp,
TH_mode=e.TH_mode,
}
end
end
-- If the just-saved config is the one bound to the action bar, refresh its snapshot.
if AutoLock._combatConfigName == cfg.name then
AutoLock:_loadCombatSnapshot(cfg.name)
end
end
local function ApplyConfigToSpells(cfg)
AutoLock._loadedConfigName = cfg.name
for _, e in ipairs(SPELL_PRIORITY) do
e._deleted = nil -- reset deletion flag from previous config
local s = cfg.spells and cfg.spells[GetSpellKey(e)]
if s then
e.enabled = s.enabled
if s.priority ~= nil then e.priority = s.priority end
if s.refreshtime ~= nil then e.refreshtime = s.refreshtime end
e.TH_player_hp=s.TH_player_hp; e.TH_player_hp_cmp=s.TH_player_hp_cmp
e.TH_player_mana=s.TH_player_mana; e.TH_player_mana_cmp=s.TH_player_mana_cmp
e.TH_target_hp=s.TH_target_hp; e.TH_target_hp_cmp=s.TH_target_hp_cmp
e.TH_mode=s.TH_mode
end
end
if cfg.deletedSpells then
for _, e in ipairs(SPELL_PRIORITY) do
if cfg.deletedSpells[GetSpellKey(e)] then
e._deleted = true
end
end
end
SortByPriorityNumbers()
RenumberPriorities()
end
-- Lädt Config für Anzeige im UI, ändert NICHT AutoLockDB.activeConfig
local function PreviewConfig(cfg)
if not cfg then return end
ApplyConfigToSpells(cfg)
if scroll then AutoLock:PrioScrollUpdate() end
AutoLockRefreshConfigList()
end
local function LoadConfig(cfg)
if not cfg then return end
AutoLockDB.activeConfig = cfg.name
ApplyConfigToSpells(cfg)
if scroll then AutoLock:PrioScrollUpdate() end
AutoLockRefreshConfigList() -- forward ref to global defined below
end
-- Stellt den aktiven Combat-Config wieder her (z.B. nach UI-Vorschau)
function AutoLock:_reloadActiveCombatConfig()
local name = AutoLockDB and AutoLockDB.activeConfig
if not name then return end
for _, cfg in ipairs(AutoLockDB.configs) do
if cfg.name == name then
local savedName = AutoLock._loadedConfigName
ApplyConfigToSpells(cfg)
AutoLock._loadedConfigName = savedName -- goldener Rahmen bleibt auf zuletzt gewähltem Config
return
end
end
end
function AutoLock:LoadConfigByName(name)
for _, cfg in ipairs(AutoLockDB.configs) do
if cfg.name == name then LoadConfig(cfg); return true end
end
return false
end
-- =========================
-- UI: Condition Box
-- =========================
local function CreateSmallEditBox(parent, w)
local eb = CreateFrame("EditBox", nil, parent)
eb:SetAutoFocus(false)
eb:SetWidth(w or 40)
eb:SetHeight(18)
eb:SetFontObject(GameFontHighlightSmall)
eb:SetJustifyH("LEFT")
eb:SetTextInsets(4, 0, 0, 0)
eb:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 12,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
})
eb:SetBackdropColor(0,0,0,0.6)
eb:SetScript("OnTextChanged", function()
local txt = this:GetText() or ""
local clean = SanitizeNumberText(txt)
if clean ~= txt then this:SetText(clean) end
end)
eb:SetScript("OnEnterPressed", function() this:ClearFocus() end)
eb:SetScript("OnEscapePressed", function() this:ClearFocus() end)
return eb
end
-- kleine Helper für Vanilla-Dropdowns
local function CreateSimpleDropdown(parent, width)
local dd = CreateFrame("Frame", nil, parent, "UIDropDownMenuTemplate")
dd:SetWidth(width or 100)
dd:SetHeight(24)
return dd
end
local function SetDropDownSelectedByValue(drop, val, textMap)
UIDropDownMenu_SetSelectedValue(drop, val)
local label = textMap and textMap[val] or tostring(val)
UIDropDownMenu_SetText(drop, label)
end
local function ShowCondFrameForEntry(entry, anchor)
if not entry then return end
if not Dewdrop then
AutoLockLog.Warning("Dewdrop-2.0 not found – Conditions menu disabled.")
return
end
local function cmpLabel(v) return (v == ">=") and "≥" or "≤" end
local function logicLabel(v) return (v == "OR") and "ANY (OR)" or "ALL (AND)" end
-- Fenster bauen (einmalig)
if not condFrame then
condFrame = CreateFrame("Frame", "AutoLockConditionFrame", UIParent)
condFrame:SetWidth(280)
condFrame:SetHeight(190)
condFrame:SetFrameStrata("DIALOG")
condFrame:SetFrameLevel(20)
condFrame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
condFrame:SetBackdropColor(0,0,0,1)
condFrame:EnableMouse(true)
condFrame:SetMovable(true)
condFrame:RegisterForDrag("LeftButton")
condFrame:SetScript("OnDragStart", function() this:StartMoving() end)
condFrame:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
local title = condFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
title:SetPoint("TOP", condFrame, "TOP", 0, -8)
title:SetText("Conditions")
local close = CreateFrame("Button", nil, condFrame, "UIPanelCloseButton")
close:SetPoint("TOPRIGHT", condFrame, "TOPRIGHT", -4, -4)
-- Labels
condFrame.l_ph = condFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
condFrame.l_ph:SetPoint("TOPLEFT", condFrame, "TOPLEFT", 12, -36)
condFrame.l_ph:SetText("Player HP")
condFrame.l_pm = condFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
condFrame.l_pm:SetPoint("TOPLEFT", condFrame.l_ph, "BOTTOMLEFT", 0, -14)
condFrame.l_pm:SetText("Player Mana")
condFrame.l_th = condFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
condFrame.l_th:SetPoint("TOPLEFT", condFrame.l_pm, "BOTTOMLEFT", 0, -14)
condFrame.l_th:SetText("Target HP")
-- kleine Button-Factory
local function MakeBtn(parent, w, h)
local b = CreateFrame("Button", nil, parent, "UIPanelButtonTemplate")
b:SetWidth(w or 60); b:SetHeight(h or 18)
return b
end
-- Comparator-Buttons (Dewdrop-Menüs mit ≤ / ≥)
condFrame.phCmpBtn = MakeBtn(condFrame, 50, 18)
condFrame.phCmpBtn:SetPoint("LEFT", condFrame.l_ph, "RIGHT", 6, 0)
condFrame.pmCmpBtn = MakeBtn(condFrame, 50, 18)
condFrame.pmCmpBtn:SetPoint("LEFT", condFrame.l_pm, "RIGHT", 6, 0)
condFrame.thCmpBtn = MakeBtn(condFrame, 50, 18)
condFrame.thCmpBtn:SetPoint("LEFT", condFrame.l_th, "RIGHT", 6, 0)
-- Prozent-Editboxen daneben (nutzt deine vorhandene Helper-Funktion)
condFrame.e_ph = CreateSmallEditBox(condFrame, 50)
condFrame.e_ph:SetPoint("LEFT", condFrame.phCmpBtn, "RIGHT", 6, 0)
condFrame.e_pm = CreateSmallEditBox(condFrame, 50)
condFrame.e_pm:SetPoint("LEFT", condFrame.pmCmpBtn, "RIGHT", 6, 0)
condFrame.e_th = CreateSmallEditBox(condFrame, 50)
condFrame.e_th:SetPoint("LEFT", condFrame.thCmpBtn, "RIGHT", 6, 0)
-- Logik (AND/OR) Button
condFrame.l_logic = condFrame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
condFrame.l_logic:SetPoint("TOPLEFT", condFrame.l_th, "BOTTOMLEFT", 0, -18)
condFrame.l_logic:SetText("Combine:")
condFrame.logicBtn = MakeBtn(condFrame, 100, 18)
condFrame.logicBtn:SetPoint("LEFT", condFrame.l_logic, "RIGHT", 6, 0)
-- Speichern der Zahlen beim Fokusverlust
local function bindSaver(box, key)
box:SetScript("OnEditFocusLost", function()
local v = tonumber(this:GetText())
entry[key] = v
end)
end
bindSaver(condFrame.e_ph, "TH_player_hp")
bindSaver(condFrame.e_pm, "TH_player_mana")
bindSaver(condFrame.e_th, "TH_target_hp")
-- OnClick Menüs (Dewdrop)
local function OpenCmpMenu(btn, key)
local b = btn
Dewdrop:Open(b, 'children', function(level, value)
Dewdrop:AddLine('text', "≤", 'func', function()
entry[key] = "<="; b:SetText("≤"); Dewdrop:Close()
end)
Dewdrop:AddLine('text', "≥", 'func', function()
entry[key] = ">="; b:SetText("≥"); Dewdrop:Close()
end)
end)
end
condFrame.phCmpBtn:SetScript("OnClick", function() OpenCmpMenu(this, "TH_player_hp_cmp") end)
condFrame.pmCmpBtn:SetScript("OnClick", function() OpenCmpMenu(this, "TH_player_mana_cmp") end)
condFrame.thCmpBtn:SetScript("OnClick", function() OpenCmpMenu(this, "TH_target_hp_cmp") end)
condFrame.logicBtn:SetScript("OnClick", function()
local b = this
Dewdrop:Open(b, 'children', function(level, value)
Dewdrop:AddLine('text', "ALL (AND)", 'func', function()
entry.TH_mode = "AND"; b:SetText("ALL (AND)"); Dewdrop:Close()
end)
Dewdrop:AddLine('text', "ANY (OR)", 'func', function()
entry.TH_mode = "OR"; b:SetText("ANY (OR)"); Dewdrop:Close()
end)
end)
end)
end
-- Werte in die UI laden
condFrame.phCmpBtn:SetText(cmpLabel(entry.TH_player_hp_cmp or "<="))
condFrame.pmCmpBtn:SetText(cmpLabel(entry.TH_player_mana_cmp or "<="))
condFrame.thCmpBtn:SetText(cmpLabel(entry.TH_target_hp_cmp or "<="))
condFrame.logicBtn:SetText(logicLabel(entry.TH_mode or "AND"))
condFrame.e_ph:SetText(entry.TH_player_hp and tostring(entry.TH_player_hp) or "")
condFrame.e_pm:SetText(entry.TH_player_mana and tostring(entry.TH_player_mana) or "")
condFrame.e_th:SetText(entry.TH_target_hp and tostring(entry.TH_target_hp) or "")
-- andocken + anzeigen
condFrame:ClearAllPoints()
if anchor then
condFrame:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -4)
else
condFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
end
condFrame:Show()
end
-- =========================
-- UI: Prio-List
-- =========================
function AutoLock:PrioScrollUpdate()
if not frame or not scroll then
AutoLockLog.Warning("PrioScrollUpdate skipped: frame=" .. tostring(frame ~= nil) .. " scroll=" .. tostring(scroll ~= nil))
return
end
local filtered = AutoLockUI_GetFiltered()
local total = table.getn(filtered)
if total == 0 then
AutoLockLog.Warning("PrioScrollUpdate: 0 entries visible! SPELL_PRIORITY=" .. table.getn(SPELL_PRIORITY) .. " ShowDisabled=" .. tostring(AutoLockUI_ShowDisabled) .. " TypeFilter=" .. tostring(AutoLockTypeFilter))
end
local offset = FauxScrollFrame_GetOffset(scroll)
local maxOff = math.max(total - VISIBLE_ROWS, 0)
if offset > maxOff then
offset = maxOff
FauxScrollFrame_SetOffset(scroll, offset)
end
FauxScrollFrame_Update(scroll, total, VISIBLE_ROWS, ROW_HEIGHT + ROW_SPACING)
for i = 1, VISIBLE_ROWS do
local row = rows[i]
if not row then
AutoLockLog.Warning("PrioScrollUpdate: rows[" .. i .. "] is nil – UI not fully initialized")
break
end
local idx = offset + i
row.index = idx
if idx >= 1 and idx <= total then
local e = filtered[idx]
row.entry = e
row:Show()
row.check:SetChecked(e.enabled ~= false and 1 or nil)
row.nameText:SetText((e.uitext or e.name or "?") .. " (" .. (e.type or "?") .. ")")
if e.enabled == false then
row.nameText:SetTextColor(0.5, 0.5, 0.5)
else
row.nameText:SetTextColor(1, 0.82, 0)
end
if e.name == "Dark Harvest" or e.name == "Drain Soul" then
row.cfgBtn:Show()
else
row.cfgBtn:Hide()
end
if e.type == "curse" then
row.refreshBox:Show()
row.refreshBox.settingEntry = e
row.refreshBox:SetText(e.refreshtime and tostring(e.refreshtime) or "")
row.refreshBox:SetScript("OnEditFocusLost", function()
local v = tonumber(this:GetText())
local tgt = this.settingEntry
if tgt then
tgt.refreshtime = v
SaveCurrentConfigSpells()
end
end)
else
row.refreshBox:Hide()
row.refreshBox.settingEntry = nil
end
row.check:SetScript("OnClick", function()
-- Toggle stored value; do NOT use GetChecked() which returns the pre-click
-- state in vanilla 1.12 and would invert the intended change.
e.enabled = not (e.enabled == true)
AutoLock:PrioScrollUpdate()
end)
else
row:Hide()
end
end
SaveCurrentConfigSpells()
end
-- =========================
-- Dark Harvest DoTs Popup
-- =========================
local dhDotsPopup = nil
local function ShowDHDotsPopup(anchor)
if not dhDotsPopup then
dhDotsPopup = CreateFrame("Frame", "AutoLockDHDotsPopup", UIParent)
dhDotsPopup:SetWidth(220); dhDotsPopup:SetHeight(255)
dhDotsPopup:SetFrameStrata("TOOLTIP")
dhDotsPopup:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
dhDotsPopup:SetBackdropColor(0.1, 0.1, 0.15, 1)
dhDotsPopup:EnableMouse(true)
dhDotsPopup:SetMovable(true)
dhDotsPopup:RegisterForDrag("LeftButton")
dhDotsPopup:SetScript("OnDragStart", function() this:StartMoving() end)
dhDotsPopup:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
local title = dhDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
title:SetPoint("TOP", dhDotsPopup, "TOP", 0, -10)
title:SetText("Dark Harvest Cfg")
local closeBtn = CreateFrame("Button", nil, dhDotsPopup, "UIPanelCloseButton")
closeBtn:SetWidth(18); closeBtn:SetHeight(18)
closeBtn:SetPoint("TOPRIGHT", dhDotsPopup, "TOPRIGHT", -2, -2)
closeBtn:SetScript("OnClick", function() dhDotsPopup:Hide() end)
local function makeDotCheck(key, label, prevAnchor, yOffset, tooltip)
local cb = CreateFrame("CheckButton", nil, dhDotsPopup, "UICheckButtonTemplate")
cb:SetWidth(18); cb:SetHeight(18)
if prevAnchor then
cb:SetPoint("TOPLEFT", prevAnchor, "BOTTOMLEFT", 0, yOffset or -6)
else
cb:SetPoint("TOPLEFT", dhDotsPopup, "TOPLEFT", 10, -30)
end
cb:SetScript("OnClick", function()
local cfg = GetActiveConfig()
if not cfg then return end
if not cfg.darkHarvestDots then cfg.darkHarvestDots = {} end
local newVal = not (cfg.darkHarvestDots[key] == true)
cfg.darkHarvestDots[key] = newVal
cb:SetChecked(newVal and 1 or nil)
end)
if tooltip then
cb:SetScript("OnEnter", function() ShowTooltip(this, label, tooltip) end)
cb:SetScript("OnLeave", function() AL_TT:Hide() end)
end
local lbl = dhDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
lbl:SetPoint("LEFT", cb, "RIGHT", 4, 0)
lbl:SetText(label)
cb._key = key
return cb
end
dhDotsPopup.shadowVulnCheck = makeDotCheck("shadowVuln", "Shadow Vulnerability",
nil, nil, "Shadow Vulnerability must be active on the\ntarget before Dark Harvest can be cast.")
-- Divider
local divider = dhDotsPopup:CreateTexture(nil, "ARTWORK")
divider:SetHeight(1)
divider:SetWidth(190)
divider:SetPoint("TOPLEFT", dhDotsPopup.shadowVulnCheck, "BOTTOMLEFT", 0, -10)
divider:SetTexture(0.4, 0.4, 0.4, 0.8)
-- Require full dot time checkbox
local fullDotTimeCb = CreateFrame("CheckButton", nil, dhDotsPopup, "UICheckButtonTemplate")
fullDotTimeCb:SetWidth(18); fullDotTimeCb:SetHeight(18)
fullDotTimeCb:SetPoint("TOPLEFT", divider, "BOTTOMLEFT", 0, -6)
fullDotTimeCb:SetScript("OnClick", function()
local cfg = GetActiveConfig()
if not cfg then return end
local newVal = not (cfg.darkHarvestRequireFullDotTime == true)
cfg.darkHarvestRequireFullDotTime = newVal
fullDotTimeCb:SetChecked(newVal and 1 or nil)
end)
fullDotTimeCb:SetScript("OnEnter", function()
ShowTooltip(this, "Require full dot time",
"Only cast Dark Harvest if CoA/CoS,\nCorruption and Siphon Life all have\nenough remaining time for full damage.\n(Minimum: DH duration x 1.3)")
end)
fullDotTimeCb:SetScript("OnLeave", function() AL_TT:Hide() end)
local fullDotTimeLbl = dhDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
fullDotTimeLbl:SetPoint("LEFT", fullDotTimeCb, "RIGHT", 4, 0)
fullDotTimeLbl:SetText("Require full dot time")
dhDotsPopup.fullDotTimeCheck = fullDotTimeCb
-- Sub-checkboxes for which dots must have enough time (indented under fullDotTimeCb)
local function makeSubDotCheck(key, label, prevAnchor, xOffset)
local cb = CreateFrame("CheckButton", nil, dhDotsPopup, "UICheckButtonTemplate")
cb:SetWidth(16); cb:SetHeight(16)
cb:SetPoint("TOPLEFT", prevAnchor, "BOTTOMLEFT", xOffset or 0, -4)
cb:SetScript("OnClick", function()
local cfg = GetActiveConfig()
if not cfg then return end
if not cfg.darkHarvestFullDotTimeDots then
cfg.darkHarvestFullDotTimeDots = {}
end
-- nil = default true; toggle: nil/true → false, false → true
local newVal = not (cfg.darkHarvestFullDotTimeDots[key] ~= false)
cfg.darkHarvestFullDotTimeDots[key] = newVal
cb:SetChecked(newVal and 1 or nil)
end)
local lbl = dhDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
lbl:SetPoint("LEFT", cb, "RIGHT", 2, 0)
lbl:SetText(label)
return cb
end
dhDotsPopup.agonySubCheck = makeSubDotCheck("agony", "Curse of Agony", fullDotTimeCb, 20)
dhDotsPopup.corruptionSubCheck = makeSubDotCheck("corruption", "Corruption", dhDotsPopup.agonySubCheck, 0)
dhDotsPopup.siphonLifeSubCheck = makeSubDotCheck("siphonLife", "Siphon Life", dhDotsPopup.corruptionSubCheck, 0)
-- Nightfall checkbox (separate config key, not darkHarvestDots)
local nightfallCb = CreateFrame("CheckButton", nil, dhDotsPopup, "UICheckButtonTemplate")
nightfallCb:SetWidth(18); nightfallCb:SetHeight(18)
nightfallCb:SetPoint("TOPLEFT", dhDotsPopup.siphonLifeSubCheck, "BOTTOMLEFT", -20, -8)
nightfallCb:SetScript("OnClick", function()
local cfg = GetActiveConfig()
if not cfg then return end
local newVal = not (cfg.darkHarvestAllowNightfall == true)
cfg.darkHarvestAllowNightfall = newVal
nightfallCb:SetChecked(newVal and 1 or nil)
end)
local nightfallLbl = dhDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
nightfallLbl:SetPoint("LEFT", nightfallCb, "RIGHT", 4, 0)
nightfallLbl:SetText("Allow Nightfall interrupt")
nightfallCb:SetScript("OnEnter", function()
ShowTooltip(this, "Allow Nightfall interrupt",
"When checked, a Nightfall proc\n(Shadow Trance) interrupts the Dark\nHarvest channel and casts Shadow Bolt.")
end)
nightfallCb:SetScript("OnLeave", function() AL_TT:Hide() end)
dhDotsPopup.nightfallCheck = nightfallCb
-- DH interrupts DS checkbox
local dhInterruptsCb = CreateFrame("CheckButton", nil, dhDotsPopup, "UICheckButtonTemplate")
dhInterruptsCb:SetWidth(18); dhInterruptsCb:SetHeight(18)
dhInterruptsCb:SetPoint("TOPLEFT", nightfallCb, "BOTTOMLEFT", 0, -6)
dhInterruptsCb:SetScript("OnClick", function()
local cfg = GetActiveConfig()
if not cfg then return end
local newVal = not (cfg.darkHarvestInterruptsDS == true)
cfg.darkHarvestInterruptsDS = newVal
dhInterruptsCb:SetChecked(newVal and 1 or nil)
end)
local dhInterruptsLbl = dhDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
dhInterruptsLbl:SetPoint("LEFT", dhInterruptsCb, "RIGHT", 4, 0)
dhInterruptsLbl:SetText("DH interrupts Drain Soul")
dhInterruptsCb:SetScript("OnEnter", function()
ShowTooltip(this, "DH interrupts Drain Soul",
"When checked, Dark Harvest can\ninterrupt an active Drain Soul channel.\nUncheck to protect Drain Soul from\nbeing cut short by Dark Harvest.")
end)
dhInterruptsCb:SetScript("OnLeave", function() AL_TT:Hide() end)
dhDotsPopup.dhInterruptsCheck = dhInterruptsCb
end
if dhDotsPopup:IsShown() and dhDotsPopup.anchor == anchor then
dhDotsPopup:Hide()
return
end
dhDotsPopup.anchor = anchor
dhDotsPopup:ClearAllPoints()
dhDotsPopup:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, 4)
-- Checkboxen vor Show() setzen damit der Zustand beim Öffnen korrekt ist
local cfg = GetActiveConfig()
local dh = (cfg and cfg.darkHarvestDots) or {}
dhDotsPopup.shadowVulnCheck:SetChecked(dh.shadowVuln and 1 or nil)
dhDotsPopup.fullDotTimeCheck:SetChecked(cfg and cfg.darkHarvestRequireFullDotTime and 1 or nil)
local fdtd = (cfg and cfg.darkHarvestFullDotTimeDots) or {}
dhDotsPopup.agonySubCheck:SetChecked( fdtd.agony ~= false and 1 or nil)
dhDotsPopup.corruptionSubCheck:SetChecked(fdtd.corruption ~= false and 1 or nil)
dhDotsPopup.siphonLifeSubCheck:SetChecked(fdtd.siphonLife ~= false and 1 or nil)
dhDotsPopup.nightfallCheck:SetChecked(cfg and cfg.darkHarvestAllowNightfall and 1 or nil)
dhDotsPopup.dhInterruptsCheck:SetChecked(
(cfg == nil or cfg.darkHarvestInterruptsDS ~= false) and 1 or nil)
dhDotsPopup:Show()
end
-- =========================
-- Drain Soul DoTs Popup
-- =========================
local dsDotsPopup = nil
local function ShowDSDotsPopup(anchor)
if not dsDotsPopup then
dsDotsPopup = CreateFrame("Frame", "AutoLockDSDotsPopup", UIParent)
dsDotsPopup:SetWidth(220); dsDotsPopup:SetHeight(148)
dsDotsPopup:SetFrameStrata("TOOLTIP")
dsDotsPopup:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 }
})
dsDotsPopup:SetBackdropColor(0.1, 0.1, 0.15, 1)
dsDotsPopup:EnableMouse(true)
dsDotsPopup:SetMovable(true)
dsDotsPopup:RegisterForDrag("LeftButton")
dsDotsPopup:SetScript("OnDragStart", function() this:StartMoving() end)
dsDotsPopup:SetScript("OnDragStop", function() this:StopMovingOrSizing() end)
local title = dsDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
title:SetPoint("TOP", dsDotsPopup, "TOP", 0, -10)
title:SetText("Allow renewal during DS channel:")
local closeBtn = CreateFrame("Button", nil, dsDotsPopup, "UIPanelCloseButton")
closeBtn:SetWidth(18); closeBtn:SetHeight(18)
closeBtn:SetPoint("TOPRIGHT", dsDotsPopup, "TOPRIGHT", -2, -2)
closeBtn:SetScript("OnClick", function() dsDotsPopup:Hide() end)
local function makeDSCheck(key, label, prevAnchor, tooltip)
local cb = CreateFrame("CheckButton", nil, dsDotsPopup, "UICheckButtonTemplate")
cb:SetWidth(18); cb:SetHeight(18)
if prevAnchor then
cb:SetPoint("TOPLEFT", prevAnchor, "BOTTOMLEFT", 0, -6)
else
cb:SetPoint("TOPLEFT", dsDotsPopup, "TOPLEFT", 10, -30)
end
cb:SetScript("OnClick", function()
local cfg = GetActiveConfig()
if not cfg then return end
if not cfg.drainSoulDots then cfg.drainSoulDots = {} end
local newVal = not (cfg.drainSoulDots[key] == true)
cfg.drainSoulDots[key] = newVal
cb:SetChecked(newVal and 1 or nil)
end)
if tooltip then
cb:SetScript("OnEnter", function() ShowTooltip(this, label, tooltip) end)
cb:SetScript("OnLeave", function() AL_TT:Hide() end)
end
local lbl = dsDotsPopup:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
lbl:SetPoint("LEFT", cb, "RIGHT", 4, 0)
lbl:SetText(label)
cb._key = key
return cb
end
dsDotsPopup.agonyCheck = makeDSCheck("agony", "Curse of Agony",
nil, "Checked: Curse of Agony and Curse of Shadow\ncan be renewed during Drain Soul.\nUnchecked: both are blocked to avoid\ninterrupting the channel.")
dsDotsPopup.corruptionCheck = makeDSCheck("corruption", "Corruption",
dsDotsPopup.agonyCheck, "Checked: Corruption can be renewed\nduring Drain Soul.\nUnchecked: blocked to avoid interrupting\nthe channel.")
dsDotsPopup.siphonCheck = makeDSCheck("siphonLife", "Siphon Life",
dsDotsPopup.corruptionCheck, "Checked: Siphon Life can be renewed\nduring Drain Soul.\nUnchecked: blocked to avoid interrupting\nthe channel.")
end
if dsDotsPopup:IsShown() and dsDotsPopup.anchor == anchor then
dsDotsPopup:Hide()
return
end
dsDotsPopup.anchor = anchor
dsDotsPopup:ClearAllPoints()
dsDotsPopup:SetPoint("BOTTOMLEFT", anchor, "TOPLEFT", 0, 4)
local cfg = GetActiveConfig()
local ds = (cfg and cfg.drainSoulDots) or {}
dsDotsPopup.agonyCheck:SetChecked(ds.agony and 1 or nil)
dsDotsPopup.corruptionCheck:SetChecked(ds.corruption and 1 or nil)
dsDotsPopup.siphonCheck:SetChecked(ds.siphonLife and 1 or nil)
dsDotsPopup:Show()
end
local function CreatePrioUIOnce(parent)
if scroll then return end
SortByPriorityNumbers()
RenumberPriorities()
-- ==== Drag-State ====
local dragEntry = nil
local dropTargetRow = nil
-- Ghost-Frame (folgt Cursor während Drag)
local dragGhost = CreateFrame("Frame", "AutoLockDragGhost", UIParent)
dragGhost:SetWidth(300); dragGhost:SetHeight(20)
dragGhost:SetFrameStrata("TOOLTIP")
dragGhost:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true, tileSize = 16, edgeSize = 8,
insets = { left = 3, right = 3, top = 3, bottom = 3 }
})
dragGhost:SetBackdropColor(0.1, 0.3, 0.8, 0.85)
local ghostText = dragGhost:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
ghostText:SetPoint("LEFT", dragGhost, "LEFT", 6, 0)
ghostText:SetPoint("RIGHT", dragGhost, "RIGHT", 0, 0)
ghostText:SetJustifyH("LEFT")
ghostText:SetTextColor(1, 1, 1)
dragGhost:Hide()
-- Full-Screen Mouse-Catcher (empfängt OnMouseUp egal wo losgelassen)
local mouseCatcher = CreateFrame("Frame", "AutoLockMouseCatcher", UIParent)
mouseCatcher:SetAllPoints(UIParent)
mouseCatcher:SetFrameStrata("FULLSCREEN_DIALOG")
mouseCatcher:EnableMouse(true)
mouseCatcher:Hide()
mouseCatcher:SetScript("OnUpdate", function()
if not dragEntry then return end
local cx, cy = GetCursorPosition()
local s = UIParent:GetScale()
dragGhost:ClearAllPoints()
dragGhost:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", cx/s + 14, cy/s - 12)
-- Ziel-Zeile unter Cursor bestimmen
dropTargetRow = nil
for _, r in ipairs(rows) do
if r:IsShown() and r.entry and r.entry ~= dragEntry then
local rb = r:GetBottom()
local rt = r:GetTop()
local rl = r:GetLeft()
local rr = r:GetRight()
if rb and rt and rl and rr then
local ux, uy = cx/s, cy/s
if ux >= rl and ux <= rr and uy >= rb and uy <= rt then
dropTargetRow = r
end
end
end
end
-- Drop-Indikatoren aktualisieren
for _, r in ipairs(rows) do
if r.dropIndicator then
if r == dropTargetRow then r.dropIndicator:Show()
else r.dropIndicator:Hide() end
end
end
end)
mouseCatcher:SetScript("OnMouseUp", function()
mouseCatcher:Hide()
dragGhost:Hide()
for _, r in ipairs(rows) do
if r.dropIndicator then r.dropIndicator:Hide() end
end
if dragEntry and dropTargetRow and dropTargetRow.entry and dragEntry ~= dropTargetRow.entry then
local fromIdx, toIdx
for k, v in ipairs(SPELL_PRIORITY) do
if v == dragEntry then fromIdx = k end
if v == dropTargetRow.entry then toIdx = k end
end
if fromIdx and toIdx then
MoveEntry(fromIdx, toIdx)
AutoLock:PrioScrollUpdate()
end
end
dragEntry = nil
dropTargetRow = nil
end)
-- ==== Kopfzeile: Name | Refresh | Cond ====
header.name = parent:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
header.name:SetPoint("TOPLEFT", parent, "TOPLEFT", 60, -109)
header.name:SetText("Name")
header.refresh = parent:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
header.refresh:SetPoint("TOPLEFT", parent, "TOPLEFT", 408, -109)
header.refresh:SetText("Refresh (s)")
header.cond = parent:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
header.cond:SetPoint("TOPLEFT", parent, "TOPLEFT", 456, -109)
header.cond:SetText("Cond")
-- ==== ScrollFrame ====
scroll = CreateFrame("ScrollFrame", "AutoLockPrioScroll", parent, "FauxScrollFrameTemplate")
scroll:SetPoint("TOPLEFT", parent, "TOPLEFT", 8, -107)
scroll:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", -8, 34)
scroll:EnableMouse(false)
scroll:EnableMouseWheel(true)
scroll:SetScript("OnVerticalScroll", function()
FauxScrollFrame_OnVerticalScroll(arg1, ROW_HEIGHT + ROW_SPACING, function()
AutoLock:PrioScrollUpdate()