Repository navigation
Expand file tree
/
Copy pathUI.lua
More file actions
1690 lines (1656 loc) · 96.4 KB
/
Copy pathUI.lua
File metadata and controls
1690 lines (1656 loc) · 96.4 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
local _, F = ...
F.UI = {page='home', rows={}, filter='', entries={}, recipeChoices={}}
local U, C = F.UI, F.Catalog
local function skin(frame, dark)
F.Theme.Skin(frame,dark)
end
local function label(parent,font,x,y,width,text)
local l=parent:CreateFontString(nil,'OVERLAY',font)
l:SetPoint('TOPLEFT',x,y); l:SetWidth(width); l:SetJustifyH('LEFT'); l:SetText(C.Safe(text))
F.Theme.Text(l,font:find('Normal',1,true),font:find('Small',1,true) and 12 or 14); return l
end
local function tooltip(widget,text)
widget:SetScript('OnEnter',function(self)
F.Theme.ShowTooltip(self,F.L(text))
end)
widget:SetScript('OnLeave',F.Theme.HideTooltip)
end
local function button(parent,text,x,y,width,action)
local b=CreateFrame('Button',nil,parent,'UIPanelButtonTemplate')
b:SetSize(width,24); b:SetPoint('TOPLEFT',x,y); b:SetText(text); F.Theme.Button(b); b:SetScript('OnClick',action); return b
end
local function who(owner) return owner == F.me and F.L('YOU') or owner end
local function profileAge(profile)
if not F.Integer(profile.seen,0,2147483647) then return F.L('FINDER_AGE_UNKNOWN') end
return string.format(F.L(F.ProfileStale(profile) and 'PROFILE_CACHED_AGE' or 'DATA_AGE'),math.max(0,math.floor((F.Now()-profile.seen)/60)))
end
local function amount(qty) return tostring(qty or 0) end
function U.Quantity() return tonumber(U.qty and U.qty:GetText()) end
function U.Ensure()
if U.frame then return end
local frame=CreateFrame('Frame','ForeverNetWindow',UIParent,'PortraitFrameTemplate')
frame:SetSize(780,570); frame:SetPoint('CENTER'); frame:SetFrameStrata('DIALOG'); frame:SetClampedToScreen(true)
frame:SetTitle('ForeverNet'); frame:SetPortraitToAsset(F.icon)
F.Theme.Title(frame)
U.paper,U.paperBase=F.Theme.Background(frame)
frame:SetMovable(true); frame:EnableMouse(true); frame:RegisterForDrag('LeftButton')
frame:SetScript('OnDragStart',frame.StartMoving); frame:SetScript('OnDragStop',frame.StopMovingOrSizing)
U.heading=label(frame,'GameFontNormal',24,-48,360,'')
U.sharing=label(frame,'GameFontHighlightSmall',24,-73,730,'')
U.scan=button(frame,'',405,-48,108,function() F.Command('scan') end)
U.share=button(frame,'',519,-48,108,function() F.Command('share '..(F.db.settings.sharing and 'off' or 'on')) end)
U.sync=button(frame,'',633,-48,122,function() F.Command('sync') end)
tooltip(U.scan,'SCAN_HINT'); tooltip(U.share,'SHARE_HINT'); tooltip(U.sync,'SYNC_HINT')
local left=CreateFrame('Frame',nil,frame,'BackdropTemplate')
U.left=left
left:SetPoint('TOPLEFT',14,-93); left:SetSize(248,357); skin(left,true)
U.searchLabel=label(left,'GameFontNormalSmall',14,-10,222,'')
U.search=CreateFrame('EditBox',nil,left,'InputBoxTemplate')
local foSmall = _G['GameFontHighlightSmall'] or GameFontHighlightSmall
if foSmall and type(foSmall) ~= 'string' then pcall(U.search.SetFontObject, U.search, foSmall) end
if U.search.SetFont then pcall(U.search.SetFont, U.search, STANDARD_TEXT_FONT or "Fonts\\FRIZQT__.TTF", 12, "") end
F.Theme.Font(U.search,12)
U.search:SetSize(124,22); U.search:SetPoint('TOPLEFT',16,-29); U.search:SetAutoFocus(false)
U.filterButton=button(left,'',150,-29,82,function() if U.page=='queue' then U.QueueMenu() else U.OpenFilters() end end)
U.filterButton:SetHeight(22)
U.search:SetScript('OnTextChanged',function(self)
U.filter=self:GetText(); if not U.resettingSearch then U.Status() end
end)
U.search:SetScript('OnEscapePressed',function(self) self:ClearFocus() end)
U.listScroll=F.Theme.ScrollFrame(left)
U.listScroll:SetPoint('TOPLEFT',8,-65); U.listScroll:SetPoint('BOTTOMRIGHT',-28,12)
U.list=CreateFrame('Frame',nil,U.listScroll); U.list:SetSize(208,280); U.listScroll:SetScrollChild(U.list)
U.empty=label(U.list,'GameFontHighlightSmall',8,-14,188,'')
local right=CreateFrame('Frame',nil,frame,'BackdropTemplate'); U.right=right
right:SetPoint('TOPLEFT',270,-93); right:SetSize(496,357); skin(right)
U.hero=right:CreateTexture(nil,'ARTWORK'); U.hero:SetSize(40,40); U.hero:SetPoint('TOPLEFT',14,-12)
U.heroHover=CreateFrame('Frame',nil,right); U.heroHover:SetAllPoints(U.hero)
F.Theme.BindItemTooltip(U.heroHover,function() return U.detailItem end,function() return U.detailItem and C.ItemName(U.detailItem) or '' end)
U.detailTitle=label(right,'GameFontNormalLarge',66,-14,397,'')
U.detailTitle:SetHeight(22)
U.summary=label(right,'GameFontHighlightSmall',66,-39,397,'')
U.summary:SetHeight(20)
U.details=F.Theme.ScrollFrame(right)
U.details:SetPoint('TOPLEFT',16,-64); U.details:SetPoint('BOTTOMRIGHT',-28,46)
U.body=CreateFrame('Frame',nil,U.details); U.body:SetSize(440,240)
U.bodyText=U.body:CreateFontString(nil,'OVERLAY','GameFontHighlight')
U.bodyText:SetPoint('TOPLEFT'); U.bodyText:SetWidth(440)
U.bodyText:SetSpacing(2); U.bodyText:SetJustifyH('LEFT'); U.bodyText:SetJustifyV('TOP'); U.bodyText:SetWordWrap(true)
F.Theme.Text(U.bodyText,false,14)
U.details:SetScrollChild(U.body)
U.accept=button(right,'',12,-319,150,function() U.RequestAction('accept') end)
U.done=button(right,'',169,-319,150,function() U.RequestAction('done') end)
U.cancel=button(right,'',326,-319,150,function() U.RequestAction('cancel') end)
U.crafter=button(right,'',12,-319,220,function()
if U.page=='queue' then F.Tracker.Toggle()
elseif U.page=='crafters' then U.Navigate('network') else U.CycleCrafter() end
end)
U.enqueue=button(right,'',248,-319,220,function() if U.page=='network' then U.Navigate('requests') else U.Enqueue() end end)
U.itemLabel=label(frame,'GameFontNormalSmall',24,-461,235,'')
local chosen=CreateFrame('Frame',nil,frame,'BackdropTemplate')
U.chosen=chosen
chosen:SetPoint('TOPLEFT',14,-479); chosen:SetSize(248,48); skin(chosen,true)
U.itemIcon=chosen:CreateTexture(nil,'ARTWORK'); U.itemIcon:SetSize(28,28); U.itemIcon:SetPoint('LEFT',8,0)
F.Theme.BindItemTooltip(chosen,function() return U.target and U.target.item end,function() return U.target and C.ItemName(U.target.item) or '' end)
U.item=label(chosen,'GameFontHighlightSmall',43,-8,193,'')
U.item:SetHeight(36)
U.qtyLabel=label(frame,'GameFontNormalSmall',280,-461,68,'')
U.qty=CreateFrame('EditBox',nil,frame,'InputBoxTemplate')
local foSmall = _G['GameFontHighlightSmall'] or GameFontHighlightSmall
if foSmall and type(foSmall) ~= 'string' then pcall(U.qty.SetFontObject, U.qty, foSmall) end
if U.qty.SetFont then pcall(U.qty.SetFont, U.qty, STANDARD_TEXT_FONT or "Fonts\\FRIZQT__.TTF", 12, "") end
F.Theme.Font(U.qty,12)
U.qty:SetSize(55,24); U.qty:SetPoint('TOPLEFT',285,-487); U.qty:SetNumeric(true); U.qty:SetAutoFocus(false); U.qty:SetText('1')
U.qty:SetScript('OnTextChanged',function()
if U.frame and not U.settingTarget then
if U.page=='queue' and U.selectedEntry and U.selectedEntry.kind=='goal' and F.Integer(U.Quantity(),1,10000) then
local goal=F.Queue.data.goals[U.selectedEntry.index]
if goal and goal.quantity~=U.Quantity() then F.Queue.Quantity(U.selectedEntry.index,U.Quantity()) end
end
local position=U.details:GetVerticalScroll() or 0
if U.page=='chain' and U.planData and U.target and U.target.item==U.planData.target and F.Integer(U.Quantity(),1,10000) then
U.planData.quantity=U.Quantity(); F.Automation.RefreshPlan()
end
U.UpdateActions(); U.RenderSelection(); U.LayoutDetails()
U.details:SetVerticalScroll(math.min(position,U.details:GetVerticalScrollRange()))
end
end)
U.qty:SetScript('OnEscapePressed',function(self) self:ClearFocus() end)
U.plan=button(frame,'',355,-487,185,function() U.BuildSelected() end)
tooltip(U.plan,'RECIPE_NEXT')
U.request=button(frame,'',550,-487,200,function() U.RequestSelected() end)
U.footer=label(frame,'GameFontHighlightSmall',24,-535,450,'')
U.commands=button(frame,'',490,-535,112,function() U.Commands() end)
U.help=button(frame,'',614,-535,136,function() U.Help() end)
local icons={'INV_Misc_Head_Human_01','INV_Scroll_03','INV_Misc_Note_05','INV_Misc_Coin_01','INV_Misc_GroupLooking','INV_Misc_Note_01','INV_Misc_EngGizmos_01','Trade_Engineering'}
local pages={'home','recipes','queue','market','network','requests','chain','settings'}
U.navigation={}
local previousTab
for i,page in ipairs(pages) do
local nav=CreateFrame('Frame',nil,frame,'LargeSideTabButtonTemplate')
nav:EnableMouse(true)
if previousTab then nav:SetPoint('TOPLEFT',previousTab,'BOTTOMLEFT',0,-3)
else nav:SetPoint('TOPLEFT',frame,'TOPRIGHT',-3,-93) end
nav.iconPath='Interface\\Icons\\'..icons[i]; nav.Icon:SetTexture(nav.iconPath); nav:SetFillToInterior(true,40); nav:SetChecked(false)
F.Theme.SideTab(nav)
nav:SetCustomOnMouseUpHandler(function(_,mouse,inside)
if mouse=='LeftButton' and inside then
if page=='settings' then
if U.setDialog then U.setDialog:Hide() end
F.Settings.Open()
else U.Navigate(page) end
end
end)
U.navigation[page]=nav
nav:SetScript('OnEnter',function(self) F.Theme.ShowTooltip(self,self.tooltipText) end)
nav:SetScript('OnLeave',F.Theme.HideTooltip)
previousTab=nav
end
-- EllesmereUI / FojjiCore Left Navigation Sidebar
local sidebar = CreateFrame('Frame', nil, frame, 'BackdropTemplate')
sidebar:SetPoint('TOPLEFT', 0, 0); sidebar:SetPoint('BOTTOMLEFT', 0, 36)
sidebar:SetWidth(190)
sidebar:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8',
tile=false, edgeSize=1, insets={left=0, right=1, top=0, bottom=0}})
sidebar:SetBackdropColor(0.020, 0.030, 0.048, 1)
sidebar:SetBackdropBorderColor(0.075, 0.114, 0.165, 0.9)
U.neonSidebar = sidebar
local logo = sidebar:CreateTexture(nil, 'ARTWORK')
logo:SetSize(28, 28); logo:SetPoint('TOPLEFT', 14, -12)
logo:SetTexture(F.icon)
sidebar.logo = logo
local brandTitle = sidebar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlight')
brandTitle:SetPoint('TOPLEFT', 48, -12)
F.Theme.Text(brandTitle, true, 15)
brandTitle:SetText('ForeverNet')
sidebar.brandTitle = brandTitle
local brandSub = sidebar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
brandSub:SetPoint('TOPLEFT', 48, -28)
F.Theme.Text(brandSub, false, 11)
brandSub:SetText('|cff00e5ffv' .. F.version .. '|r |cff64748bP2P|r')
sidebar.brandSub = brandSub
local sideDiv = sidebar:CreateTexture(nil, 'ARTWORK')
sideDiv:SetPoint('TOPLEFT', 10, -48); sideDiv:SetPoint('TOPRIGHT', -10, -48); sideDiv:SetHeight(1)
sideDiv:SetColorTexture(0.075, 0.114, 0.165, 0.9)
sidebar.sideDiv = sideDiv
U.neonMenu = {}
local menuDefs = {
{header = 'РЕЖИМЫ КРАФТА'},
{page = 'home', icon = 'INV_Misc_Head_Human_01', title = 'Персонаж'},
{page = 'recipes', icon = 'INV_Scroll_03', title = 'Рецепты'},
{page = 'queue', icon = 'INV_Misc_Note_05', title = 'Очередь'},
{page = 'chain', icon = 'INV_Misc_EngGizmos_01', title = 'Цепочка'},
{header = 'СЕТЬ И РЫНОК'},
{page = 'market', icon = 'INV_Misc_Coin_01', title = 'Рынок'},
{page = 'network', icon = 'INV_Misc_GroupLooking', title = 'Сеть'},
{page = 'requests', icon = 'INV_Misc_Note_01', title = 'Запросы'},
{header = 'СИСТЕМА'},
{page = 'settings', icon = 'Trade_Engineering', title = 'Настройки'},
{page = 'loot', icon = 'INV_Misc_Bag_08', title = 'Сброс лута'},
{page = 'updates', icon = 'INV_Misc_Note_02', title = 'Обновления'},
}
local menuY = 56
for _, def in ipairs(menuDefs) do
if def.header then
local hdr = sidebar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
hdr:SetPoint('TOPLEFT', 14, -menuY)
F.Theme.Text(hdr, true, 10)
hdr:SetText('|cff64748b' .. def.header .. '|r')
menuY = menuY + 18
else
local btn = CreateFrame('Button', nil, sidebar, 'BackdropTemplate')
btn:SetSize(174, 26); btn:SetPoint('TOPLEFT', 8, -menuY)
btn:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8',
tile=false, edgeSize=1, insets={left=0, right=0, top=0, bottom=0}})
btn:SetBackdropColor(0, 0, 0, 0)
btn:SetBackdropBorderColor(0, 0, 0, 0)
local activeBar = btn:CreateTexture(nil, 'OVERLAY')
activeBar:SetPoint('TOPLEFT', 0, 1); activeBar:SetPoint('BOTTOMLEFT', 0, -1); activeBar:SetWidth(3)
activeBar:SetColorTexture(0.0, 0.85, 1.0, 1)
activeBar:Hide()
btn.activeBar = activeBar
local ic = btn:CreateTexture(nil, 'ARTWORK')
ic:SetSize(16, 16); ic:SetPoint('LEFT', 8, 0)
ic:SetTexture('Interface\\Icons\\' .. def.icon)
btn.icon = ic
local text = btn:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
text:SetPoint('LEFT', 30, 0); text:SetPoint('RIGHT', -6, 0)
text:SetJustifyH('LEFT')
F.Theme.Text(text, false, 12)
btn.text = text
btn.rawTitle = def.title
btn.page = def.page
btn:SetScript('OnEnter', function(self)
if U.page ~= self.page then
self:SetBackdropColor(1, 1, 1, 0.04)
end
end)
btn:SetScript('OnLeave', function(self)
if U.page ~= self.page then
self:SetBackdropColor(0, 0, 0, 0)
end
end)
btn:SetScript('OnClick', function(self)
if self.page == 'settings' then
if U.setDialog then U.setDialog:Hide() end
F.Settings.Open()
elseif self.page == 'loot' then
F.LootAdvisor.Show()
elseif self.page == 'updates' then
F.Updates.Open()
else
U.Navigate(self.page)
end
end)
U.neonMenu[def.page] = btn
menuY = menuY + 28
end
end
local statusDiv = sidebar:CreateTexture(nil, 'ARTWORK')
statusDiv:SetPoint('BOTTOMLEFT', 10, 52); statusDiv:SetPoint('BOTTOMRIGHT', -10, 52); statusDiv:SetHeight(1)
statusDiv:SetColorTexture(0.075, 0.114, 0.165, 0.9)
sidebar.statusDiv = statusDiv
local statNet = sidebar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
statNet:SetPoint('BOTTOMLEFT', 16, 30); statNet:SetJustifyH('LEFT')
F.Theme.Text(statNet, false, 11)
sidebar.statNet = statNet
local statDb = sidebar:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
statDb:SetPoint('BOTTOMLEFT', 16, 12); statDb:SetJustifyH('LEFT')
F.Theme.Text(statDb, false, 11)
sidebar.statDb = statDb
sidebar:Hide()
U.frame=frame; frame:Hide(); UISpecialFrames[#UISpecialFrames+1]='ForeverNetWindow'
frame:SetScript('OnHide',function()
F.Theme.HideTooltip()
if U.filterMenu then U.filterMenu:Hide() end
if U.setDialog then U.setDialog:Hide() end
if U.queueBoard then U.queueBoard.menu:Hide() end
end)
end
function U.Toggle()
if U.frame and U.frame:IsShown() then U.frame:Hide() else U.Status() end
end
function U.Navigate(page)
U.Ensure(); U.page,U.selectionKey,U.view=page,nil,nil
if U.setDialog then U.setDialog:Hide() end
U.resettingSearch=true; U.search:SetText(''); U.filter=''; U.resettingSearch=false
U.listScroll:SetVerticalScroll(0)
if page=='chain' and U.planData then U.SetTarget(U.planData.target,U.planData.quantity,U.planData.owner,U.planData.recipeID) end
U.Status()
end
function U.FindCrafters(item,quantity)
if not F.ID(item) or not F.Integer(quantity,1,10000) then return false,F.L('QUANTITY_ERROR') end
U.Ensure(); U.finder={item=item}
U.SetTarget(item,quantity); U.Navigate('crafters')
return true
end
function U.SetTarget(item,quantity,owner,recipeID)
U.Ensure(); U.target={item=item,owner=owner,recipeID=recipeID}
F.Theme.HideTooltipFor(U.chosen)
U.settingTarget=true; U.qty:SetText(amount(quantity or 1)); U.settingTarget=false
U.UpdateActions()
end
function U.UpdateActions()
if not U.frame then return end
local isNeon = F.Theme.IsNeon()
local prefix = isNeon and '|cff00e5ff▌|r ' or ''
local target,qty=U.target,U.Quantity()
local goal=U.page=='queue' and U.selectedEntry and U.selectedEntry.kind=='goal' and F.Queue.data.goals[U.selectedEntry.index]
U.qtyLabel:SetText(prefix..F.L(goal and goal.mode=='stock' and 'RESTOCK_TARGET' or 'QUANTITY_FIELD'))
local valid=target and F.ID(target.item) and F.Integer(qty,1,10000)
U.item:SetText(C.Safe(target and C.ItemName(target.item) or F.L('CHOOSE_RECIPE')))
U.itemIcon:SetTexture(target and C.Icon(target.item) or 'Interface\\Icons\\INV_Misc_QuestionMark')
U.MaterialBadge(U.itemIcon,target and target.item or nil)
U.plan:SetEnabled(not not valid and U.page~='crafters')
U.plan:SetText(F.L(U.page=='chain' and U.planData and 'CHAIN_REFRESH' or 'Собрать цепочку'))
local canRequest=valid and U.page~='requests' and U.page~='crafters' and F.db.settings.sharing and F.Net.available and F.Net.Channel()
U.request:SetEnabled(not not canRequest)
local hint
if not target then hint='CHOOSE_RECIPE'
elseif not F.Integer(qty,1,10000) then hint='QUANTITY_ERROR'
elseif not F.db.settings.sharing then hint='ENABLE_TO_REQUEST'
elseif not F.Net.Channel() then hint='JOIN_TO_REQUEST'
else hint='FOOTER_FLOW' end
local hintText = F.L(hint)
local browsing = U.page=='home' or U.page=='network' or U.page=='market' or U.page=='queue' or U.view=='help' or U.view=='commands'
if isNeon then
if browsing then
U.footer:SetText('|cff00e5ff●|r |cff38bdf8/fn|r |cff64748b— ForeverNet v' .. F.version .. '|r')
else
U.footer:SetText('|cff00e5ff●|r |cff38bdf8/fn|r |cff64748b— ForeverNet v' .. F.version .. '|r |cff94a3b8' .. hintText .. '|r')
end
else
U.footer:SetText(hintText)
end
end
function U.Show(text,title,subtitle,tone)
if U.HideGraphics then U.HideGraphics() end
if U.HideQueueBoard then U.HideQueueBoard() end
if U.crafter then U.crafter:SetScript('OnEnter',nil); U.crafter:SetScript('OnLeave',F.Theme.HideTooltip) end
if U.marketPlot then U.marketPlot:Hide() end
U.Ensure(); U.blockCount=0; for _,block in ipairs(U.blocks or {}) do block.title:Hide(); block.text:Hide() end
for _,header in ipairs(U.profileHeaders or {}) do header:Hide() end
for _,card in ipairs(U.profileCards or {}) do card:Hide() end
for _,row in ipairs(U.sourceRows or {}) do row:Hide() end
U.bodyText:Show(); for _,card in ipairs(U.cards or {}) do card:Hide() end
F.Theme.HideTooltipFor(U.heroHover)
local entry=U.view~='help' and U.view~='commands' and U.selectedEntry
U.detailItem=entry and entry.item
U.hero:SetTexture(U.detailItem and C.Icon(U.detailItem) or 'Interface\\Icons\\INV_Misc_EngGizmos_01')
U.MaterialBadge(U.hero,U.detailItem)
U.accept:Hide(); U.done:Hide(); U.cancel:Hide(); U.crafter:Hide(); U.enqueue:Hide()
local isNeon = F.Theme.IsNeon()
local prefix = isNeon and '|cff00e5ff▌|r ' or ''
U.detailTitle:SetText(prefix..C.Safe(title or F.L('PAGE_'..U.page)))
U.summary:SetText(C.Safe(subtitle or ''))
if tone=='good' or tone=='missing' then F.Theme.Color(U.summary,tone)
else F.Theme.Text(U.summary) end
U.bodyText:ClearAllPoints(); U.bodyText:SetPoint('TOPLEFT'); U.bodyText:SetHeight(0); U.bodyText:SetText(C.Safe(text))
U.body:SetHeight(math.max(240,U.bodyText:GetStringHeight()+24))
U.LayoutDetails(); U.details:SetVerticalScroll(0); U.frame:Show()
end
function U.LayoutMain(browsing)
local T=F.Theme
local isNeon = T.IsNeon()
if isNeon then
U.frame:SetSize(950, 580)
if U.neonSidebar then U.neonSidebar:Show() end
if U.frame.TitleText then U.frame.TitleText:Hide() end
if U.frame.portrait then U.frame.portrait:Hide() end
if U.frame.portraitFrame then U.frame.portraitFrame:Hide() end
-- Hide legacy right-hand side tabs in neon
for _, nav in pairs(U.navigation) do nav:Hide() end
-- Position Heading at top of content area
U.heading:SetHeight(0); U.heading:ClearAllPoints()
U.heading:SetPoint('TOPLEFT', 215, -14); U.heading:SetWidth(380)
-- Contextual Subtitle
if not U.neonSub then
local sub = U.frame:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
F.Theme.Text(sub, false, 11)
U.neonSub = sub
end
U.neonSub:ClearAllPoints()
U.neonSub:SetPoint('TOPLEFT', 215, -34); U.neonSub:SetWidth(380); U.neonSub:SetJustifyH('LEFT')
local descs = {
home = 'Профессии, навыки и изученные рецепты персонажа',
recipes = 'База изученных рецептов сети и материалы',
queue = 'Очередь создания предметов и расчет компонентов',
chain = 'Подетальное дерево крафта и цепочки переработки',
market = 'Анализ рыночных цен и история аукциона',
network = 'Участники P2P сети и ремесленники',
requests = 'Асинхронные запросы на изготовление между игроками',
}
U.neonSub:SetText('|cff64748b' .. (descs[U.page] or '') .. '|r')
U.neonSub:Show()
-- Action Buttons in Top Right (clean margins, no overlap with CloseButton at -12, -12)
U.sync:ClearAllPoints(); U.sync:SetPoint('TOPRIGHT', -44, -14); U.sync:SetSize(90, 24)
U.share:ClearAllPoints(); U.share:SetPoint('TOPRIGHT', U.sync, 'TOPLEFT', -6, 0); U.share:SetSize(96, 24)
U.scan:ClearAllPoints(); U.scan:SetPoint('TOPRIGHT', U.share, 'TOPLEFT', -6, 0); U.scan:SetSize(124, 24)
for _, b in ipairs({U.scan, U.share, U.sync}) do T.FitButton(b, b:GetWidth()) end
-- Content Bento Panes
local top = 56
local paneHeight = browsing and 470 or 402
U.left:ClearAllPoints(); U.left:SetPoint('TOPLEFT', 205, -top); U.left:SetSize(260, paneHeight)
U.right:ClearAllPoints(); U.right:SetPoint('TOPLEFT', U.left, 'TOPRIGHT', 12, 0); U.right:SetSize(460, paneHeight)
local listTop = math.max(65, 29 + (U.filterButton:IsShown() and U.filterButton:GetHeight() or U.search:GetHeight()) + 10)
U.listScroll:ClearAllPoints(); U.listScroll:SetPoint('TOPLEFT', 8, -listTop); U.listScroll:SetPoint('BOTTOMRIGHT', -28, 12)
-- Search input box skinning (hide brown Blizzard border)
if U.search then
if U.search.Left then U.search.Left:Hide() end
if U.search.Right then U.search.Right:Hide() end
if U.search.Middle then U.search.Middle:Hide() end
if not U.search.neonBg then
local bg = CreateFrame('Frame', nil, U.search, 'BackdropTemplate')
bg:SetAllPoints()
bg:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', tile=false, edgeSize=1, insets={left=1,right=1,top=1,bottom=1}})
bg:SetBackdropColor(0.024, 0.038, 0.060, 1)
bg:SetBackdropBorderColor(0.082, 0.125, 0.180, 0.85)
bg:SetFrameLevel(U.search:GetFrameLevel() - 1)
U.search.neonBg = bg
U.search:HookScript('OnEditFocusGained', function() bg:SetBackdropBorderColor(0.0, 0.80, 1.0, 0.95) end)
U.search:HookScript('OnEditFocusLost', function() bg:SetBackdropBorderColor(0.082, 0.125, 0.180, 0.85) end)
end
U.search.neonBg:Show()
U.search:SetTextColor(0.92, 0.96, 1.0, 1)
end
-- Crafting Controls below panes
for _, region in ipairs({U.itemLabel, U.chosen, U.qtyLabel, U.qty, U.plan, U.request}) do
if not (U.page == 'queue' and (region == U.qty or region == U.qtyLabel)) then
region:SetShown(not browsing)
end
end
if not browsing then
U.chosen:ClearAllPoints(); U.chosen:SetPoint('TOPLEFT', 205, -top - paneHeight - 8); U.chosen:SetSize(260, 48)
U.qtyLabel:ClearAllPoints(); U.qtyLabel:SetPoint('TOPLEFT', U.chosen, 'TOPRIGHT', 14, 10)
U.qty:ClearAllPoints(); U.qty:SetPoint('TOPLEFT', U.chosen, 'TOPRIGHT', 14, -10); U.qty:SetSize(55, 24)
U.plan:ClearAllPoints(); U.plan:SetPoint('TOPLEFT', U.qty, 'TOPRIGHT', 12, 0); U.plan:SetSize(180, 24)
U.request:ClearAllPoints(); U.request:SetPoint('TOPLEFT', U.plan, 'TOPRIGHT', 10, 0); U.request:SetSize(180, 24)
T.FitButton(U.plan, 180); T.FitButton(U.request, 180)
end
-- Bottom footer line and controls (anchored outside sidebar)
U.footer:ClearAllPoints()
U.footer:SetPoint('BOTTOMLEFT', 205, 12)
U.footer:SetWidth(450)
U.footer:SetJustifyH('LEFT')
U.help:ClearAllPoints(); U.help:SetPoint('BOTTOMRIGHT', -16, 8); U.help:SetSize(110, 24)
U.commands:ClearAllPoints(); U.commands:SetPoint('BOTTOMRIGHT', U.help, 'BOTTOMLEFT', -8, 0); U.commands:SetSize(110, 24)
T.FitButton(U.help, 110); T.FitButton(U.commands, 110)
return
end
U.frame:SetSize(780, 570)
if U.frame.TitleText then U.frame.TitleText:Show() end
if U.frame.portrait then U.frame.portrait:Show() end
if U.frame.portraitFrame then U.frame.portraitFrame:Show() end
U.footer:ClearAllPoints(); U.footer:SetPoint('TOPLEFT', 24, -535); U.footer:SetWidth(450)
if U.neonSidebar then U.neonSidebar:Hide() end
if U.neonSub then U.neonSub:Hide() end
if U.search and U.search.neonBg then
U.search.neonBg:Hide()
if U.search.Left then U.search.Left:Show() end
if U.search.Right then U.search.Right:Show() end
if U.search.Middle then U.search.Middle:Show() end
end
U.heading:SetHeight(0); U.heading:ClearAllPoints()
U.heading:SetPoint('TOPLEFT',T.IsClassic() and 78 or 24,-48); U.heading:SetWidth(T.IsClassic() and 310 or 360)
local headerHeight=U.heading:GetStringHeight()
for _,b in ipairs({U.scan,U.share,U.sync}) do headerHeight=math.max(headerHeight,T.FitButton(b,b:GetWidth())) end
local top=math.max(93,48+headerHeight+12)
U.paneTop=top
U.scan:ClearAllPoints(); U.scan:SetPoint('TOPLEFT', 405, -48)
U.share:ClearAllPoints(); U.share:SetPoint('TOPLEFT', 519, -48)
U.sync:ClearAllPoints(); U.sync:SetPoint('TOPLEFT', 633, -48)
local footerHeight=0
for _,b in ipairs({U.plan,U.request}) do
footerHeight=math.max(footerHeight,T.FitButton(b,b:GetWidth()))
b:ClearAllPoints(); b:SetPoint('BOTTOMLEFT',b==U.plan and 355 or 550,59)
end
for _,b in ipairs({U.commands,U.help}) do
T.FitButton(b,b:GetWidth()); b:ClearAllPoints(); b:SetPoint('BOTTOMLEFT',b==U.commands and 490 or 614,11)
end
local footerExtra=browsing and 0 or math.max(0,footerHeight-40)
U.left:ClearAllPoints(); U.left:SetPoint('TOPLEFT',14,-top)
U.right:ClearAllPoints(); U.right:SetPoint('TOPLEFT',270,-top)
local paneHeight=(browsing and 433 or 357)-(top-93)-footerExtra
U.left:SetSize(248, paneHeight); U.right:SetSize(496, paneHeight)
local listTop=math.max(65,29+(U.filterButton:IsShown() and U.filterButton:GetHeight() or U.search:GetHeight())+10)
U.listScroll:ClearAllPoints(); U.listScroll:SetPoint('TOPLEFT',8,-listTop); U.listScroll:SetPoint('BOTTOMRIGHT',-28,12)
end
function U.LayoutDetails()
if not U.frame then return end
local browsing=U.page=='home' or U.page=='network' or U.page=='market' or U.page=='queue' or U.view=='help' or U.view=='commands'
for _,region in ipairs({U.itemLabel,U.chosen,U.qtyLabel,U.qty,U.plan,U.request}) do
if not (U.page=='queue' and U.view~='help' and U.view~='commands' and (region==U.qty or region==U.qtyLabel)) then region:SetShown(not browsing) end
end
-- Overview/profile browsing does not need the crafting footer controls.
-- Reclaim that area for both content panes rather than leaving disabled buttons.
U.LayoutMain(browsing)
U.detailTitle:SetWordWrap(true); U.detailTitle:SetHeight(0)
U.summary:SetWordWrap(true); U.summary:SetHeight(0)
U.hero:SetSize(32,32)
U.detailTitle:ClearAllPoints(); U.detailTitle:SetPoint('TOPLEFT',54,-12); U.detailTitle:SetWidth(409)
U.summary:SetWidth(409)
local titleHeight=U.detailTitle:GetStringHeight()
local titleWidth=U.detailTitle:GetUnboundedStringWidth()
local inline=U.summary:GetText()~='' and titleWidth+16+U.summary:GetUnboundedStringWidth()<=409
U.summary:ClearAllPoints()
local top
if inline then
U.detailTitle:SetWidth(titleWidth+1); U.summary:SetWidth(409-titleWidth-16)
U.summary:SetPoint('TOPLEFT',54+titleWidth+16,-14)
top=math.max(52,20+math.max(titleHeight,U.summary:GetStringHeight()))
else
U.summary:SetPoint('TOPLEFT',54,-(16+titleHeight))
top=math.max(52,16+titleHeight+(U.summary:GetText()~='' and U.summary:GetStringHeight()+6 or 0))
end
local height=0
for _,control in ipairs({U.accept,U.done,U.cancel,U.crafter,U.enqueue}) do
if control:IsShown() then
height=math.max(height,F.Theme.FitButton(control,control:GetWidth()))
local x=(control==U.accept or control==U.crafter) and 12 or control==U.done and 169 or control==U.cancel and 326 or 248
-- All action rows follow the bottom edge, regardless of header wrapping.
control:ClearAllPoints(); control:SetPoint('BOTTOMLEFT',x,12)
end
end
U.details:ClearAllPoints(); U.details:SetPoint('TOPLEFT',16,-top)
U.details:SetPoint('BOTTOMRIGHT',-28,height>0 and height+20 or 12)
if U.LayoutQueueControls then U.LayoutQueueControls() end
end
function U.RefreshRows()
for _, row in ipairs(U.rows) do row:Hide() end
for _,header in ipairs(U.recipeHeaders or {}) do header:Hide() end
local profiles,entries=F.Profiles(),{}
local function add(entry)
local text=C.Fold(entry.title..' '..(entry.subtitle or ''))
if U.filter=='' or text:find(C.Fold(U.filter),1,true) then entries[#entries+1]=entry end
end
if U.page=='home' then
local scans=F.db.professionScans and F.db.professionScans[F.me] or {}
for _,group in ipairs(C.ProfileProfessions(F.localProfile)) do
local scan=scans[group.id]
local maximum=scan and F.Integer(scan.maximum,1,1000) and scan.maximum
local rank=tostring(group.rank or '?')..(maximum and '/'..maximum or '')
add({key=group.id,kind='profession',profession=group.id,title=group.title,icon=C.ProfessionIcon(group.id),
rank=group.rank,maximum=maximum,
subtitle=rank..' / '..#group.recipes..' '..F.L('RECIPES_COUNT')})
end
elseif U.page=='queue' then
for i,goal in ipairs(F.Queue.data.goals) do
add({key=tostring(i),kind='goal',index=i,item=goal.item,title=C.ItemName(goal.item)..' x'..goal.quantity,
subtitle=who(goal.owner or F.me)..(goal.mode=='stock' and ' / '..F.L('RESTOCK_MODE') or '')})
end
elseif U.page=='market' then
local items={}
for item in pairs(F.Market.data.snapshots) do items[item]=true end
for item in pairs(F.Queue.Build().missing) do items[item]=true end
for item in pairs(F.db.favorites.recipes) do items[item]=true end
for item in pairs(F.db.favorites.market) do items[item]=true end
for _,item in ipairs(F.Keys(items)) do add({key=item,kind='market',item=item,title=C.ItemName(item),subtitle=F.Market.data.snapshots[item] and F.L('MARKET_HISTORY') or F.L('MARKET_UNKNOWN')}) end
elseif U.page=='recipes' then entries=C.Recipes(profiles,U.filter,U.recipeChoices,U.recipeFilters)
elseif U.page=='crafters' then entries=C.Crafters(profiles,U.finder and U.finder.item,U.filter)
elseif U.page=='network' then
for _, owner in ipairs(F.Keys(profiles)) do
local p=profiles[owner]
if owner~=F.me then add({key=owner,kind='player',owner=owner,title=who(owner),
subtitle=string.format(F.L('RECIPE_COUNT'),#F.Keys(p.recipes))..(F.ProfileStale(p) and '\n'..F.L('PROFILE_CACHED') or '')}) end
end
elseif U.page=='requests' then
for _, id in ipairs(F.Keys(F.db.requests)) do
local r=F.db.requests[id]
add({key=id,kind='request',request=r,item=r.item,title=C.ItemName(r.item)..' x'..r.quantity,
subtitle=F.L('STATUS_'..r.status)..' / '..who(r.owner)})
end
elseif U.page=='chain' and U.planData then
for _, item in ipairs(F.Keys(U.planData.missing)) do
add({key='missing/'..item,kind='missing',item=item,quantity=U.planData.missing[item],title=C.ItemName(item),
subtitle=string.format(F.L('MISSING_QUANTITY'),U.planData.missing[item])})
end
for i,step in ipairs(U.planData.steps) do
add({key='step/'..i,kind='step',step=step,item=step.item,title=i..'. '..C.ItemName(step.item,step.name),subtitle=who(step.owner)})
end
end
U.entries=entries; U.selectedEntry=nil
if U.page=='network' then table.sort(entries,function(a,b)
local favoriteA,favoriteB=F.IsFavorite('profiles',a.owner),F.IsFavorite('profiles',b.owner)
if favoriteA~=favoriteB then return favoriteA end
return C.Fold(a.title)<C.Fold(b.title)
end) end
for i,entry in ipairs(entries) do
if U.selectionKey==entry.key then
U.selectedEntry=entry
if entry.kind=='recipe' then U.SetTarget(entry.item,U.Quantity() or 1,entry.owner,entry.recipeID) end
end
end
local rows,positions,heights,y={}, {},{},0
U.rowMeasure=U.rowMeasure or label(U.list,'GameFontHighlightSmall',0,0,158,'')
local starPage=U.page=='recipes' or U.page=='network' or U.page=='crafters' or U.page=='market'
U.rowMeasure:SetWidth(starPage and 136 or 158)
U.rowMeasure:SetWordWrap(true); U.rowMeasure:Hide()
local function append(entry)
U.rowMeasure:SetHeight(0); U.rowMeasure:SetText(C.Safe(entry.title..'\n'..(entry.subtitle or '')))
local height=math.max(entry.kind=='profession' and 66 or 50,U.rowMeasure:GetStringHeight()+(entry.kind=='profession' and 30 or 18))
rows[#rows+1]=entry; positions[#positions+1]=y; heights[#heights+1]=height; y=y+height+4
end
if U.page=='recipes' or U.page=='market' then
U.recipeHeaders,U.catalogCollapsed=U.recipeHeaders or {},U.catalogCollapsed or {}
local pinned,regular={},{}
for _,entry in ipairs(entries) do
local destination=F.IsFavorite(U.page=='market' and 'market' or 'recipes',entry.item) and pinned or regular
destination[#destination+1]=entry
end
U.recipeGroups=U.page=='market' and (#regular>0 and {{id='market-items',title=F.L('PAGE_market'),recipes=regular}} or {}) or C.GroupRecipes(regular)
if #pinned>0 then table.insert(U.recipeGroups,1,{id=U.page=='market' and 'favorite-market' or 'favorite-recipes',title=F.L('FAVORITES'),recipes=pinned}) end
for i,group in ipairs(U.recipeGroups) do
local header=U.recipeHeaders[i]
if not header then
header=CreateFrame('Button',nil,U.list,'BackdropTemplate'); header:SetWidth(208); F.Theme.Section(header)
header.label=label(header,'GameFontNormalSmall',8,-5,173,''); header.label:SetWordWrap(true)
F.Theme.Color(header.label,'heading')
header.toggle=label(header,'GameFontNormal',189,-5,15,''); header.toggle:SetTextColor(1,.82,.22)
U.recipeHeaders[i]=header
end
local professionID=group.id
local closed=U.catalogCollapsed[professionID] and U.filter==''
header:ClearAllPoints(); header:SetPoint('TOPLEFT',0,-y)
header.label:SetHeight(0)
header.label:SetText(C.Safe(group.title..' ('..#group.recipes..')'))
header.toggle:SetText(closed and '+' or '-')
local height=math.max(24,header.label:GetStringHeight()+10)
header:SetHeight(height); header:Show(); y=y+height+4
header:SetScript('OnClick',function()
U.catalogCollapsed[professionID]=not U.catalogCollapsed[professionID]
local position=U.listScroll:GetVerticalScroll() or 0
U.Status(); U.listScroll:SetVerticalScroll(math.min(position,math.max(0,U.list:GetHeight()-280)))
end)
if not closed then
for _,entry in ipairs(group.recipes) do
append(entry)
end
end
y=y+8
end
else
U.recipeGroups=nil
for _,entry in ipairs(entries) do append(entry) end
end
for i,entry in ipairs(rows) do
local b=U.rows[i]
if not b then
b=CreateFrame('Button',nil,U.list,'BackdropTemplate'); b:SetSize(208,46); skin(b,true)
b.icon=b:CreateTexture(nil,'ARTWORK'); b.icon:SetSize(26,26); b.icon:SetPoint('LEFT',7,0)
b.label=label(b,'GameFontHighlightSmall',40,-7,158,'')
b.label:SetWordWrap(true); b.label:SetHeight(0)
b.favorite=CreateFrame('Button',nil,b); b.favorite:SetSize(20,20); b.favorite:SetPoint('TOPRIGHT',-6,-6)
b.favorite.icon=b.favorite:CreateTexture(nil,'ARTWORK'); b.favorite.icon:SetSize(20,18); b.favorite.icon:SetPoint('CENTER')
b.favorite:SetScript('OnClick',function()
local kind=(b.entry.kind=='player' or b.entry.kind=='crafter') and 'profiles' or b.entry.kind=='market' and 'market' or 'recipes'
local ok,why=F.ToggleFavorite(kind,kind=='profiles' and b.entry.owner or b.entry.item)
if not ok then F.Print(why) end
U.Status()
end)
tooltip(b.favorite,'FAVORITE_HINT')
b.progress=b:CreateTexture(nil,'BACKGROUND')
b.progress:SetPoint('BOTTOMLEFT',40,8); b.progress:SetSize(158,3)
b.fill=b:CreateTexture(nil,'ARTWORK')
b.fill:SetPoint('BOTTOMLEFT',40,8); b.fill:SetHeight(3)
b:SetScript('OnEnter',function(self)
if F.Theme.IsNeon() then
self:SetBackdropBorderColor(0.20, 0.32, 0.48, 0.95)
else
self:SetBackdropBorderColor(.95,.75,.22,1)
end
if self.entry.item then F.Theme.ShowItemTooltip(self,self.entry.item,self.entry.title,self.entry.subtitle)
elseif self.entry.kind=='profession' then
local scans=F.db.professionScans and F.db.professionScans[F.me] or {}
local scan=scans[self.entry.profession]
F.Theme.ShowTooltip(self,self.entry.title,scan and F.Integer(scan.seen,0,2147483647) and string.format(F.L('SCAN_AGE'),math.max(0,math.floor((F.Now()-scan.seen)/60))) or F.L('SCAN_UNKNOWN'))
end
end)
b:SetScript('OnLeave',function(self)
F.Theme.HideTooltip()
if F.Theme.IsNeon() then
if self.selected then
self:SetBackdropBorderColor(0.0, 0.70, 0.95, 0.95)
self:SetBackdropColor(0.040, 0.075, 0.125, 0.98)
else
self:SetBackdropBorderColor(0.090, 0.137, 0.204, 0.85)
self:SetBackdropColor(0.035, 0.055, 0.090, 0.90)
end
else
self:SetBackdropBorderColor(self.selected and .95 or .52,self.selected and .75 or .38,.18,1)
end
end)
U.rows[i]=b
end
F.Theme.HideTooltipFor(b)
b.entry,b.selected=entry,U.selectionKey==entry.key
b.label:SetWidth(starPage and 136 or 158); b.favorite:SetShown(starPage)
if starPage then
local kind=(U.page=='network' or U.page=='crafters') and 'profiles' or U.page=='market' and 'market' or 'recipes'
b.favorite.icon:SetAtlas(F.IsFavorite(kind,kind=='profiles' and entry.owner or entry.item)
and 'auctionhouse-icon-favorite' or 'auctionhouse-icon-favorite-off')
end
b:ClearAllPoints(); b:SetPoint('TOPLEFT',0,-positions[i]); b:SetHeight(heights[i])
b.label:SetText(C.Safe(entry.title..'\n'..(entry.subtitle or '')))
local progress=entry.kind=='profession' and entry.maximum and entry.maximum>0 and type(entry.rank)=='number'
b.progress:SetShown(not not progress); b.fill:SetShown(not not progress)
if progress then b.fill:SetWidth(math.max(1,158*math.min(1,entry.rank/entry.maximum))) end
if F.Theme.IsNeon() then
b.progress:SetColorTexture(0.060, 0.095, 0.150, 1.0)
b.fill:SetColorTexture(0.0, 0.80, 1.0, 1.0)
if b.selected then
b:SetBackdropBorderColor(0.0, 0.70, 0.95, 0.95)
b:SetBackdropColor(0.040, 0.075, 0.125, 0.98)
else
b:SetBackdropBorderColor(0.090, 0.137, 0.204, 0.85)
b:SetBackdropColor(0.035, 0.055, 0.090, 0.90)
end
elseif U.page=='queue' then
b.progress:SetColorTexture(.22,.20,.16,1)
b.fill:SetColorTexture(.72,.55,.27,1)
b:SetBackdropBorderColor(.25,.225,.185,1)
b:SetBackdropColor(b.selected and .18 or .085,b.selected and .16 or .078,b.selected and .12 or .066,1)
else
b.progress:SetColorTexture(.22,.20,.16,1)
b.fill:SetColorTexture(.72,.55,.27,1)
b:SetBackdropBorderColor(b.selected and .95 or .52,b.selected and .75 or .38,.18,1)
end
b.icon:SetTexture(entry.icon or entry.item and C.Icon(entry.item) or 'Interface\\Icons\\INV_Misc_GroupLooking')
U.MaterialBadge(b.icon,entry.item)
b:SetScript('OnClick',function(self) U.Select(self.entry) end); b:Show()
end
U.list:SetHeight(math.max(280,y)); U.empty:SetShown(#entries==0)
U.empty:SetText(F.L(U.filter~='' and 'SEARCH_EMPTY' or 'EMPTY_'..U.page))
end
function U.Select(entry)
U.selectionKey,U.view=entry.key,nil
if entry.kind=='profession' then U.Navigate('recipes'); U.SetRecipeFilter('profession',entry.profession); return
elseif entry.kind=='goal' then
local goal=F.Queue.data.goals[entry.index]
U.SetTarget(goal.item,goal.quantity,goal.owner,goal.recipeID)
elseif entry.kind=='market' then U.SetTarget(entry.item,F.Queue.Build().missing[entry.item] or 1)
elseif entry.kind=='recipe' then U.SetTarget(entry.item,U.Quantity() or 1,entry.owner,entry.recipeID)
elseif entry.kind=='request' then U.SetTarget(entry.item,entry.request.quantity)
elseif entry.kind=='missing' then U.SetTarget(entry.item,entry.quantity,nil,nil)
elseif entry.kind=='step' then U.SetTarget(entry.item,entry.step.quantity,entry.step.owner,entry.step.recipeID) end
U.Status()
end
function U.CycleCrafter()
local e=U.selectedEntry
if not e or e.kind~='recipe' or #e.providers<2 then return end
local index=1
for i,p in ipairs(e.providers) do if p.owner==e.owner and p.recipeID==e.recipeID then index=i; break end end
local provider=e.providers[index%#e.providers+1]
U.recipeChoices[e.item]=provider.key
U.SetTarget(e.item,U.Quantity() or 1,provider.owner,provider.recipeID)
U.Status()
end
function U.RenderSelection()
local e=U.selectedEntry
if U.view=='commands' then U.Show(F.L('HELP'),F.L('COMMANDS_BUTTON')); return end
if U.view=='help' then U.RenderHelp(); return end
if U.page=='home' then U.RenderHome(); return end
if U.page=='queue' then U.RenderQueue(); return end
if U.page=='market' then U.RenderMarket(); return end
if U.page=='crafters' then U.RenderFinder(); return end
if U.page=='chain' and U.planData and e and (e.kind=='missing' or e.kind=='step') then
U.RenderPlan(); return
end
if not e then
if U.page=='chain' and U.planData then U.RenderPlan(); return end
if U.page=='network' then
local text=F.L(#U.entries>0 and 'NETWORK_PICK' or 'EMPTY_network')
local channel=F.Net.Channel()
text=text..'\n\n'..F.L('NETWORK_CHANNEL')..(channel and F.L('CHANNEL_'..channel) or F.L('NETWORK_NO_CHANNEL'))
if F.Net.lastError then text=text..'\n\n'..F.Net.lastError end
U.Show(text,F.L('PAGE_network')); U.enqueue:SetText(F.L('PAGE_requests')); U.enqueue:Show(); return
end
if U.page~='recipes' then U.Show(F.L('EMPTY_'..U.page),F.L('PAGE_'..U.page)); return end
local hasRecipes=#C.Recipes(F.Profiles(),'')>0
U.Show(F.L(hasRecipes and 'CHOOSE_RECIPE' or 'START_SCAN'),F.L('PAGE_recipes'))
return
end
if e.kind=='recipe' then
U.RenderRecipe(e)
elseif e.kind=='player' then
local p=F.db.profiles[e.owner]; if not p then return end
U.RenderPlayer(e,p)
U.enqueue:SetText(F.L('PAGE_requests')); U.enqueue:Show()
elseif e.kind=='request' then
local r=e.request
U.requestID=r.id
U.Show(F.L('OWNER')..who(r.owner)..'\n'..F.L('CRAFTER')..(r.assignee~='' and who(r.assignee) or F.L('NOT_ASSIGNED'))..
'\n\n'..string.format(F.L('REQUEST_EXPIRES'),math.max(0,math.ceil((r.expires-F.Now())/60)))..'\n\n'..F.L('REQUEST_HELP'),e.title,F.L('STATUS_'..r.status))
local pending=F.Requests.IsOfferPending(r.id)
U.accept:SetText(F.L(pending and 'OFFER_PENDING' or 'ACCEPT'))
U.accept:SetShown(r.owner~=F.me and r.status=='open'); U.accept:SetEnabled(not pending and F.db.settings.sharing)
U.done:SetShown(r.owner==F.me and r.status=='accepted'); U.done:SetEnabled(F.db.settings.sharing)
U.cancel:SetShown(r.owner==F.me and (r.status=='open' or r.status=='accepted')); U.cancel:SetEnabled(F.db.settings.sharing)
end
end
function U.OpenProfileRecipe(owner,recipeID,item)
local p=F.Profiles()[owner]
if not p or not p.recipes[recipeID] or p.recipes[recipeID].output~=item then U.DataChanged(); return end
U.recipeChoices[item]=owner..'/'..recipeID
U.recipeFilters={}
U.Navigate('recipes'); U.selectionKey='item/'..item; U.Status()
end
function U.RenderPlayer(entry,profile)
local stale=F.ProfileStale(profile)
U.Show('',entry.title,profileAge(profile),stale and 'missing' or nil)
U.hero:SetTexture('Interface\\Icons\\INV_Misc_GroupLooking')
U.bodyText:Hide()
U.profileHeaders,U.profileCards=U.profileHeaders or {},U.profileCards or {}
U.profileCollapsed=U.profileCollapsed or {}
local collapsed=U.profileCollapsed[entry.owner] or {}
U.profileCollapsed[entry.owner]=collapsed
local groups=C.ProfileProfessions(profile)
local y,cardIndex=0,0
for i,g in ipairs(groups) do
local header=U.profileHeaders[i]
if not header then
header=CreateFrame('Button',nil,U.body,'BackdropTemplate'); header:SetWidth(434); F.Theme.Section(header)
header.icon=header:CreateTexture(nil,'ARTWORK'); header.icon:SetSize(22,22); header.icon:SetPoint('TOPLEFT',7,-6)
header.title=label(header,'GameFontNormal',36,-6,204,''); header.title:SetWordWrap(true); F.Theme.Color(header.title,'text')
header.detail=label(header,'GameFontHighlightSmall',247,-6,153,''); header.detail:SetWordWrap(true); F.Theme.Color(header.detail,'muted')
header.toggle=label(header,'GameFontNormalLarge',407,-7,20,''); header.toggle:SetTextColor(1,.82,.22)
U.profileHeaders[i]=header
end
header:ClearAllPoints(); header:SetPoint('TOPLEFT',0,-y)
header.icon:SetTexture(C.ProfessionIcon(g.id)); header.title:SetHeight(0); header.title:SetText(C.Safe(g.title))
local titleHeight=header.title:GetStringHeight()
header.detail:SetHeight(0)
local rank=g.rank and string.format(F.L('SKILL_RANK'),g.rank)..' / ' or ''
header.detail:SetText(C.Safe(rank..string.format(F.L('RECIPE_COUNT'),#g.recipes)))
header.toggle:SetText(collapsed[g.id] and '+' or '-')
local headerHeight=math.max(34,math.max(titleHeight,header.detail:GetStringHeight())+12)
header:SetHeight(headerHeight); header:Show()
local professionID=g.id
header:SetScript('OnClick',function()
collapsed[professionID]=not collapsed[professionID]
local position=U.details:GetVerticalScroll() or 0
U.RenderSelection()
U.details:SetVerticalScroll(math.min(position,U.details:GetVerticalScrollRange()))
end)
y=y+headerHeight+8
if not collapsed[g.id] then
for start=1,#g.recipes,2 do
local row,rowHeight={},0
for col=0,1 do
local r=g.recipes[start+col]
if r then
cardIndex=cardIndex+1
local card=U.profileCards[cardIndex]
if not card then
card=CreateFrame('Button',nil,U.body,'BackdropTemplate'); card:SetWidth(212); skin(card,true)
card.icon=card:CreateTexture(nil,'ARTWORK'); card.icon:SetSize(32,32); card.icon:SetPoint('TOPLEFT',8,-9)
card.title=label(card,'GameFontNormalSmall',48,-8,156,''); card.title:SetWordWrap(true)
card.detail=label(card,'GameFontHighlightSmall',48,0,156,''); card.detail:SetWordWrap(true)
card:SetScript('OnEnter',function(self)
self:SetBackdropBorderColor(.95,.75,.22,1)
F.Theme.ShowItemTooltip(self,self.entry.item,C.Safe(self.entry.title),F.L('PROFILE_RECIPE_HINT'))
end)
card:SetScript('OnLeave',function(self)
self:SetBackdropBorderColor(self.blueprint and .68 or .52,self.blueprint and .4 or .38,self.blueprint and .9 or .18,1)
F.Theme.HideTooltip()
end)
card:SetScript('OnClick',function(self)
F.Theme.HideTooltip()
U.OpenProfileRecipe(self.owner,self.entry.recipeID,self.entry.item)
end)
U.profileCards[cardIndex]=card
end
card.entry,card.owner,card.blueprint=r,entry.owner,r.recipe.blueprint
card:ClearAllPoints(); card:SetPoint('TOPLEFT',col*222,-y)
card.icon:SetTexture(C.Icon(r.item)); card.title:SetHeight(0); card.title:SetText(C.Safe(r.title))
U.MaterialBadge(card.icon,r.item)
local titleHeight=card.title:GetStringHeight()
card.detail:ClearAllPoints(); card.detail:SetPoint('TOPLEFT',48,-(titleHeight+12)); card.detail:SetHeight(0)
card.detail:SetText(C.Safe(r.recipe.blueprint and 'Blueprint / x'..r.recipe.quantity or F.L('RECIPE')..' / x'..r.recipe.quantity))
F.Theme.Color(card.detail,r.recipe.blueprint and 'blueprint' or 'muted')
card:SetBackdropBorderColor(card.blueprint and .68 or .52,card.blueprint and .4 or .38,card.blueprint and .9 or .18,1)
rowHeight=math.max(rowHeight,58,titleHeight+card.detail:GetStringHeight()+22)
row[#row+1]=card
end
end
for _,card in ipairs(row) do card:SetHeight(rowHeight); card:Show() end
y=y+rowHeight+8
end
end
y=y+10
end
local camps={}
for _,id in ipairs(F.Keys(profile.camps)) do
camps[#camps+1]=F.L('CAMP')..id..' ('..math.max(0,profile.camps[id]-F.Now())..F.L('SECONDS')..')'
end
if #camps>0 then U.ShowBlocks({{title=F.L('CAPABILITIES'),text=table.concat(camps,'\n')}},y)
elseif #groups==0 then U.ShowBlocks({{title=F.L('PROFESSIONS'),text=F.L('PROFILE_EMPTY')}},y)
else U.body:SetHeight(math.max(240,y+8)) end
end
local function ingredientList(reagents,multiplier)
local lines={}
for _,item in ipairs(F.Keys(reagents or {})) do
lines[#lines+1]=C.ItemName(item)..' x'..reagents[item]*(multiplier or 1)
end
return #lines>0 and table.concat(lines,'\n') or F.L('NO_REAGENTS')
end
local function finderProfession(profile,profession)
local rank=profile.professions[profession]
return C.ProfessionName(profession)..' / '..(rank and string.format(F.L('SKILL_RANK'),rank) or F.L('FINDER_SKILL_UNKNOWN'))
end
function U.PreviewCrafter(owner,recipeID,openRecipe)
if U.page~='crafters' or not U.finder then return false end
local profiles=F.Profiles()
local profile=profiles[owner]
local recipe=profile and profile.recipes[recipeID]
if F.IsSelf(owner) or not recipe or recipe.output~=U.finder.item then
F.Print(F.L('FINDER_CHANGED')); U.DataChanged(); return false
end
local quantity=U.Quantity()
if not F.Integer(quantity,1,10000) then F.Print(F.L('QUANTITY_ERROR')); return false end
if openRecipe then U.OpenProfileRecipe(owner,recipeID,recipe.output); return true end
local inventory=F.Adapter.Inventory(profiles)
inventory[recipe.output]=F.Adapter.StockCount(recipe.output)
local plan=F.Planner.Build(profiles,recipe.output,quantity,inventory,nil,{owner=owner,recipeID=recipeID,localOwner=F.me})
plan.owner,plan.recipeID=owner,recipeID
U.Plan(plan); return true
end
function U.OpenFinderProfile(owner)
if F.IsSelf(owner) or not F.Profiles()[owner] then F.Print(F.L('FINDER_CHANGED')); U.DataChanged(); return false end
U.Navigate('network'); U.selectionKey=owner; U.Status(); return true
end
function U.RenderFinder()
local context=U.finder
if not context then U.Show(F.L('EMPTY_crafters'),F.L('PAGE_crafters')); return end
U.Show('',C.ItemName(context.item),string.format(F.L('FINDER_COUNT'),#U.entries))
U.detailItem=context.item; U.hero:SetTexture(C.Icon(context.item)); U.MaterialBadge(U.hero,context.item); U.crafter:SetText(F.L('FINDER_NETWORK')); U.crafter:Show()
local channel=F.Net.Channel()
local rows={{section=true,title=F.L('PAGE_crafters'),hint=F.L('FINDER_HELP')..'\n'..F.L('NETWORK_CHANNEL')..
(channel and F.L('CHANNEL_'..channel) or F.L('NETWORK_NO_CHANNEL'))}}
local selected=U.selectedEntry
if selected and selected.kind=='crafter' then
local owner=selected.owner
rows[#rows+1]={section=true,title=owner,text=profileAge(selected.profile),tone=F.ProfileStale(selected.profile) and 'missing' or nil,
actions={{text=F.L('FINDER_PROFILE'),run=function() U.OpenFinderProfile(owner) end}}}
local filtered={professions=selected.profile.professions,recipes={}}
for i,match in ipairs(selected.recipes) do
if i>20 then break end
filtered.recipes[match.recipeID]=match.recipe
end
local valid=F.Integer(U.Quantity(),1,10000)
if not valid then rows[#rows+1]={title=F.L('QUANTITY_ERROR'),tone='missing'} end
for _,group in ipairs(C.ProfileProfessions(filtered)) do
if #group.recipes>0 then
rows[#rows+1]={section=true,title=finderProfession(selected.profile,group.id)}
for _,match in ipairs(group.recipes) do
local recipeID=match.recipeID
local recipe=match.recipe
rows[#rows+1]={item=context.item,title=recipe.name,text=string.format(F.L('PRO_OUTPUT'),recipe.quantity)..'\n'..
string.format(F.L('CHAIN_FROM'),ingredientList(recipe.reagents))..(recipe.blueprint and '\n'..F.L('FILTER_BLUEPRINT') or ''),
actions={{text=F.L('FINDER_PLAN'),enabled=valid,run=function() U.PreviewCrafter(owner,recipeID,false) end},
{text=F.L('FINDER_RECIPE'),enabled=valid,run=function() U.PreviewCrafter(owner,recipeID,true) end}}}
end
end
end
if #selected.recipes>20 then rows[#rows+1]={title=F.L('FINDER_PROFILE'),text=string.format(F.L('FINDER_VARIANT_LIMIT'),20)} end
else
rows[#rows+1]={title=F.L('FINDER_PICK'),text=#U.entries==0 and F.L(U.filter~='' and 'SEARCH_EMPTY' or 'EMPTY_crafters') or ''}
for i,entry in ipairs(U.entries) do
if i>20 then break end
local owner=entry.owner
local professions={}
for _,match in ipairs(entry.recipes) do professions[match.recipe.profession]=true end
local text={profileAge(entry.profile)}
for _,profession in ipairs(F.Keys(professions)) do text[#text+1]=finderProfession(entry.profile,profession) end
rows[#rows+1]={title=owner,text=table.concat(text,'\n'),tone=F.ProfileStale(entry.profile) and 'missing' or nil,
actions={{text=F.L('FINDER_RECIPES'),run=function() U.selectionKey=owner; U.Status() end},
{text=F.L('FINDER_PROFILE'),run=function() U.OpenFinderProfile(owner) end}}}
end
if #U.entries>20 then rows[#rows+1]={title=F.L('FINDER_PICK'),text=string.format(F.L('FINDER_PLAYER_LIMIT'),20)} end