-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.lua
1804 lines (1605 loc) · 69 KB
/
Config.lua
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 PileSeller = _G.PileSeller
local checkIcon = "|TInterface\\RAIDFRAME\\ReadyCheck-Ready:15:15|t"
local lastClicked
function GetStaticPopup(name)
for i = 1, #StaticPopup_DisplayedFrames do
if StaticPopup_DisplayedFrames[i]:GetName() == name then return i end
end
return nil
end
function PileSeller:CreateCunstomStaticPopup(text)
if not _G["PS_TOGGLE_TRACKING"] then
local popup = CreateFrame("Frame", "PS_TOGGLE_TRACKING", UIParent)
popup:SetFrameStrata("DIALOG")
popup:SetSize(320, 72)
popup.text = popup:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
popup.text:SetText(text)
popup.text:SetPoint("TOP", popup, "TOP", 0, -15)
local displayedFrames = StaticPopup_DisplayedFrames
if not StaticPopup_DisplayedFrames[1] then
popup:SetPoint("TOP", UIParent, "TOP", 0, -135)
else
popup:SetPoint("TOP", StaticPopup_DisplayedFrames[1], "BOTTOM")
end
tinsert(StaticPopup_DisplayedFrames, popup)
popup:Show()
local backdrop = {
bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]],
edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]],
tile = true,
tileSize = 32,
edgeSize = 32,
insets = {
left = 11,
right = 12,
top = 12,
bottom = 11
}
}
popup:SetBackdrop(backdrop)
local Y, X = 45, 25
local lines = 1
for i = 1, PileSeller:tablelength(PileSeller.itemsToKeep) do
PileSeller:CreateCheckIcon(PileSeller.itemsToKeep[i], popup, -Y, X, 35)
X = X + 40
if X >= 305 then
Y = Y + 40
X = 25 + ( 40 * 2)
lines = lines + 1
end
end
local height = 50 * lines + 80
popup:SetHeight(height)
popup.button1 = CreateFrame("Button", nil, popup, "StaticPopupButtonTemplate")
popup.button1:SetPoint("BOTTOM", popup, "BOTTOM", -70, 15)
popup.button2 = CreateFrame("Button", nil, popup, "StaticPopupButtonTemplate")
popup.button2:SetPoint("BOTTOM", popup, "BOTTOM", 70, 15)
popup.button1:SetText("Yes")
popup.button2:SetText("No")
popup.button1:SetScript("OnClick", function()
PileSeller:ToggleTracking(true, popup)
popup:Hide()
end)
popup.button2:SetScript("OnClick", function() popup:Hide() end)
popup:SetScript("OnHide", function()
local index = GetStaticPopup("PS_TOGGLE_TRACKING")
if index then
tremove(StaticPopup_DisplayedFrames, index)
end
end)
else _G["PS_TOGGLE_TRACKING"]:Show() end
end
--PileSeller:CreateCunstomStaticPopup(PileSeller.wishToTrack)
--- Function to write all the contents of a scroll frame
--- inputs:
--- list = scrollframe to fill
--- items = list of the items (eg. psItems)
--- literal = wether it's something to get id from or not (eg. ignored zone list)
--- outbut: none
function PileSeller:PopulateList(list, items, width, literal, drops)
if not width then width = 258 end
PileSeller:ClearAllButtons(list)
PileSeller:debugprint(list:GetName() .. " populating")
local item = 1
if not literal then
for i = 1, #items do
local shouldHide = select(3, GetItemInfo(items[i])) == 0 and psSettings["hideJunkSetting"]
if not shouldHide then
PileSeller:CreateScrollButton(list, items[i], item, width, 21, drops)
item = item + 1
end
end
else
for i = 1, #items do
PileSeller:CreateScrollButton(list, -1, i, width, 21, items[i], drops)
end
end
item = 1
end
--- Function to "delete" all the contents of a scroll frame
--- input:
--- parent = scrollframe to treat
--- outbut: none
function PileSeller:ClearAllButtons(parent)
local name = parent:GetName() .. "Button"
local i = 1
local b = parent[name .. i]
while b do
parent[name .. i].t:SetText("")
parent[name .. i]:SetBackdropColor(.27, .27, .27, 1)
parent[name .. i]:SetSize(parent[name .. i]:GetWidth(),0)
parent[name .. i]:SetHighlightTexture(nil)
parent[name .. i]:SetScript("OnClick", nil)
parent[name .. i]:SetScript("OnEnter", nil)
parent[name .. i]:SetScript("OnLeave", nil)
i = i + 1
b = parent[name .. i]
end
end
--- Function to create a button while filling a list
--- input:
--- parent = scrollframe to fill
--- id = item id (-1 = nil)
--- progress = normally the method it's run in a for loop, used to create space from one button and another
--- height = height of a button
--- [zoneName] = used for creating the ignored zones
--- outbut: none
function PileSeller:CreateScrollButton(parent, id, progress, width, height, zoneName, sources)
local name = parent:GetName() .. "Button" .. progress
local text = ""
local found = ""
if not parent[name] then
parent[name] = CreateFrame("Button", parent:GetName() .. "Button" .. progress, parent)
parent[name].t = parent[name]:CreateFontString(nil, "OVERLAY", "GameFontNormal")
else parent[name]:Show() end
if id ~= -1 then
if parent:GetName() == "PileSeller_ConfigFrame_SavedScrollContent" then
if psItemsSavedFound[id] then found = " " .. checkIcon end
end
local n, l, q, _t, _t, _t, _t, _t, _t, _t, _t = GetItemInfo(id)
text = n
-- select text color
qualities = {}
qualities[0] = { r = 0.615, g = 0.615, b = 0.615}
qualities[1] = { r = 1, g = 1, b = 1}
qualities[2] = { r = .118, g = 1, b = 0}
qualities[3] = { r = 0, g = .439, b = 1}
qualities[4] = { r = .639, g = .207, b = .933}
qualities[5] = { r = 1, g = .501, b = 0}
qualities[6] = { r = .901, g = .800, b = .501}
if q >= 6 then q = qualities[6]
else q = qualities[q] end
parent[name].t:SetTextColor(q.r, q.g, q.b)
parent[name]:SetScript("OnEnter", function()
GameTooltip:SetOwner(parent[name], "ANCHOR_BOTTOMRIGHT", 0, parent[name]:GetHeight())
GameTooltip:SetHyperlink(l)
GameTooltip:Show()
end)
parent[name]:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
PileSeller:debugprint(parent:GetName())
if parent:GetName() ~= "PileSeller_SellingBoxFrame_ScrollContent" then
parent[name]:SetScript("OnClick", function()
lastClicked = parent
PileSeller:SetItemInfo(PileSeller.UIConfig.itemInfos.item, id)
if IsShiftKeyDown() then
ChatEdit_InsertLink(l)
elseif IsControlKeyDown() then
DressUpItemLink(l)
end
end)
else
parent[name]:RegisterForClicks("AnyDown")
parent[name]:SetScript("OnClick", function(self, button)
if IsShiftKeyDown() then
ChatEdit_InsertLink(l)
elseif IsControlKeyDown() then
DressUpItemLink(l)
end
if button == "RightButton" then
PileSeller:debugprint("banana")
PileSeller:removeItem(l, psItems, parent)
_G["PileSeller_SellingBoxFrame"]:Hide()
_G["PileSeller_SellingBoxFrame"]:Show()
end
end)
end
elseif id == -1 then
text = zoneName
if parent:GetName() ~= "PileSeller_ConfigFrame_ItemInfos_MiniDialog_ScrollFrameContent" then
parent[name]:SetScript("OnClick", function()
PileSeller.UIConfig.txtAddIgnoreZone:SetText(text)
end)
else
if text == TRANSMOG_SOURCE_1 then
parent[name]:SetScript("OnEnter", function()
PileSeller:CreateTooltipInfo(parent[name], sources)
end)
parent[name]:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
end
end
parent[name].t:SetText(text .. found)
parent[name].t:SetPoint("LEFT", parent[name])
parent[name].t:SetSize(width, height)
parent[name]:SetSize(width, height)
parent[name]:SetHighlightTexture("Interface\\AddOns\\PileSeller\\media\\highlight", "ADD")
parent[name]:SetBackdrop({
bgFile = [[Interface\Buttons\WHITE8X8]],
})
if progress % 2 == 0 or progress == 0 then parent[name]:SetBackdropColor(.15, .15, .15,1)
else parent[name]:SetBackdropColor(.27, .27, .27,1) end
if progress == 1 then parent[name]:SetPoint("TOPLEFT", parent, 1, -1)
else parent[name]:SetPoint("TOPLEFT", parent, 1, -height * (progress - 1) - 1) end
end
--- Function to get the profit estimated from the items
--- input: none
--- output:
---formatted string (0g 0s 0c)
function GetSell()
local rtn = 0
local item = ""
for i = 0, NUM_BAG_SLOTS do
for j = 1, GetContainerNumSlots(i) do
item = select(7, GetContainerItemInfo(i, j))
--print(item)
if item then
local count = select(2, GetContainerItemInfo(i, j))
if PileSeller:getID(item) then
if PileSeller:IsToSell(item) then
local cost = select(11, GetItemInfo(id))
rtn = rtn + (cost * count)
end
end
end
end
end
return PileSeller:getProfitPerCoin(rtn)
end
--- Function to create the window of the addon
--- input: none
--- output: none
function PileSeller:ShowConfig(args)
PileSeller:debugprint("entered showconfig")
local switchTo = ""
if args == "config" then switchTo = "Items"
elseif args == "items" then switchTo = "Config" end
if not PileSeller.UIConfig then
PileSeller.UIConfig = CreateFrame("Frame", "PileSeller_ConfigFrame", UIParent, "ThinBorderTemplate")
PileSeller.UIConfig:SetFrameStrata("MEDIUM")
PileSeller.UIConfig:SetSize(500, 400)
PileSeller.UIConfig:SetPoint("RIGHT", UIParent, -100, 0)
PlaySound("igCharacterInfoOpen")
PileSeller:MakeMovable(PileSeller.UIConfig)
PileSeller.UIConfig:SetScript("OnShow", function()
PileSeller:UpdateUIInfo()
end)
-- Texture
PileSeller.UIConfig.bg = PileSeller.UIConfig:CreateTexture()
PileSeller.UIConfig.bg:SetAllPoints(PileSeller.UIConfig)
PileSeller.UIConfig.bg:SetTexture([[Interface\Buttons\WHITE8X8]])
PileSeller.UIConfig.bg:SetVertexColor(.1,.1,.1,.8)
-- Title
PileSeller.UIConfig.title = PileSeller.UIConfig:CreateFontString("PileSeller_ConfigFrame_Title", "OVERLAY", "GameFontHighlight")
PileSeller.UIConfig.title:SetPoint("TOPLEFT", PileSeller.UIConfig, "TOPLEFT", 10, -10)
PileSeller.UIConfig.title:SetText("|cFF" .. PileSeller.color .. "Pile|rSeller")
-- Switch Mode
PileSeller.UIConfig.switch = CreateFrame("Button", "PileSeller_ConfigFrame_SwitchButton", PileSeller.UIConfig, "GameMenuButtonTemplate")
PileSeller.UIConfig.switch:SetPoint("TOPRIGHT", PileSeller.UIConfig, "TOPRIGHT", -30, -4)
PileSeller.UIConfig.switch:SetSize(75, 26)
PileSeller.UIConfig.switch:SetText(switchTo)
PileSeller.UIConfig.switch:SetScript("OnClick", function()
local t = PileSeller.UIConfig.switch:GetText()
if t == "Items" then
t = "Config"
PileSeller:CreateItemsSection(PileSeller.UIConfig)
PileSeller.UIConfig.tutorial:Show()
elseif t == "Config" then
t = "Items"
CreateConfigSection(PileSeller.UIConfig)
PileSeller.UIConfig.tutorial:Hide()
end
PileSeller.UIConfig.switch:SetText(t)
end
)
-- Tutorial Button
PileSeller.UIConfig.tutorial = CreateFrame("Button", "PileSeller_ConfigFrame_TutorialButton", PileSeller.UIConfig)
PileSeller.UIConfig.tutorial:SetSize(75, 75)
PileSeller.UIConfig.tutorial:SetPoint("BOTTOMRIGHT", PileSeller.UIConfig, "BOTTOMRIGHT", 15, -15)
PileSeller.UIConfig.tutorial:SetNormalTexture("Interface\\COMMON\\help-i")
PileSeller.UIConfig.tutorial:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight", "ADD")
if not psTutorialDone then
PileSeller:CreateRing(PileSeller.UIConfig.tutorial)
end
PileSeller.UIConfig.tutorial:SetScript("OnClick", function()
PileSeller:ToggleTutorial(PileSeller.UIConfig)
psTutorialDone = true
if PileSeller.UIConfig.tutorial.glow then
PileSeller.UIConfig.tutorial.glow:Hide()
end
end
)
-- Toggle Tracking Button
PileSeller.UIConfig.toggleTracking = CreateFrame("Button", "PileSeller_ConfigFrame_ToggleTracking", PileSeller.UIConfig, "GameMenuButtonTemplate")
PileSeller.UIConfig.toggleTracking:SetPoint("TOP", PileSeller.UIConfig, "TOP", 0, 0)
PileSeller.UIConfig.toggleTracking:SetSize(125, 26)
PileSeller.UIConfig.toggleTracking:SetText(psSettings["trackSetting"] and "Stop tracking" or "Start tracking")
PileSeller.UIConfig.toggleTracking:SetScript("OnClick", function()
local b = PileSeller.UIConfig.toggleTracking:GetText() == "Start tracking"
PileSeller:ToggleTracking(b)
PileSeller.UIConfig.toggleTracking:SetText(psSettings["trackSetting"] and "Stop tracking" or "Start tracking")
end
)
PileSeller.UIConfig.toggleTracking:SetBackdrop({
edgeFile = [[Interface\Buttons\WHITE8X8]],
edgeSize = 3,
insets = {
left = 1,
right = 1,
top = 1,
bottom = 1
}
})
PileSeller.UIConfig.toggleTracking:SetBackdropBorderColor(1, 1, 1, psSettings["trackSetting"] and 1 or 0)
PileSeller.UIConfig.close = CreateFrame("Button", "PileSeller_ConfigFrame_CloseButton", PileSeller.UIConfig, "UIPanelCloseButton")
PileSeller.UIConfig.close:SetPoint("TOPRIGHT", PileSeller.UIConfig)
PileSeller.UIConfig.close:SetSize(34, 34)
PileSeller.UIConfig.close:SetScript("OnClick", HideConfig)
else
PileSeller.UIConfig:Show()
PlaySound("igCharacterInfoOpen");
PileSeller.UIConfig.switch:SetText(switchTo)
end
if args == "items" then
PileSeller:debugprint("entered showconfig items")
PileSeller:CreateItemsSection(PileSeller.UIConfig)
PileSeller.UIConfig.tutorial:Show()
elseif args == "config" then
PileSeller:debugprint("entered showconfig config")
CreateConfigSection(PileSeller.UIConfig)
end
end
--- Function to hide the config
--- input: none
--- output: sound
function HideConfig()
PileSeller.UIConfig:Hide()
--for i = 0, #UISpecialFrames do if UISpecialFrames[i] == "PileSeller_ConfigFrame" then print("kek"); tremove(UISpecialFrames, i) end end
--tremove(UISpecialFrames, "PileSeller_ConfigFrame")
PlaySound("igCharacterInfoClose")
end
--- Function to hide all the elements of the ui (used when switching from a mode to another)
--- input:
--- ui = UIConfig
--- output: none
function HideAllFromConfig(ui)
-- By doing this I can find any other item in the frame
-- Now I just hide all the things that I don't need
if ui:GetName():find("StaticPopup") then
local children = { ui:GetChildren() }
for i = 1, #children do
local name = children[i]:GetName()
if name:find("popupCheckbox") then
children[i]:Hide()
end
end
else
local children = { ui:GetChildren() }
for i=1, #children do
local name = children[i]:GetName()
PileSeller:debugprint(name)
local kid =
name == "PileSeller_ConfigFrame_CloseButton" or
name == "PileSeller_ConfigFrame_SwitchButton" or
name == "PileSeller_ConfigFrame_ToggleTracking" or
name == "PileSeller_ConfigFrame_TutorialButton" or
(children[i]:GetName() == "PileSeller_ConfigFrame_ItemInfos" and not children[i]:IsVisible())
if not kid and not children[i].donthide then
children[i]:Hide()
end
end
end
end
--- Function to create the item info window
function CreateItemInfos(UIConfig)
HideAllFromConfig(UIConfig)
UIConfig.itemInfos = CreateFrame("Frame", "PileSeller_ConfigFrame_ItemInfos", UIConfig, "ThinBorderTemplate")
UIConfig.itemInfos:SetSize(225, 300)
UIConfig.itemInfos:SetPoint("LEFT", UIConfig, -UIConfig.itemInfos:GetWidth() + 10, 0)
UIConfig.itemInfos.bg = UIConfig.itemInfos:CreateTexture()
UIConfig.itemInfos.bg:SetAllPoints(UIConfig.itemInfos)
UIConfig.itemInfos.bg:SetTexture([[Interface\Buttons\WHITE8X8]])
UIConfig.itemInfos.bg:SetVertexColor(.27,.27,.27,1)
UIConfig.itemInfos.item = CreateFrame("Frame", nil, UIConfig.itemInfos)
UIConfig.itemInfos.item:SetSize(50, 50)
UIConfig.itemInfos.item:SetPoint("TOP", UIConfig.itemInfos, 0, -10)
UIConfig.itemInfos.item.tx = UIConfig.itemInfos.item:CreateTexture(nil, "BACKGROUND")
UIConfig.itemInfos.item.tx:SetTexture("Interface\\Buttons\\UI-CheckBox-Up")
UIConfig.itemInfos.item.tx:SetVertexColor(1,1,1,1)
UIConfig.itemInfos.item.tx:SetAllPoints()
local infos = {
[1] = {obj = "FontString", name = "itemName", inherits = "GameFontNormal" },
[2] = {obj = "FontString", name = "itemClass", inherits = "GameFontHighlight" },
[3] = {obj = "FontString", name = "itemValue", inherits = "GameFontHighlight" },
[4] = {obj = "Button", name = "itemSource" },
[5] = {obj = "FontString", name = "itemID", inherits = "GameFontHighlight" },
}
for i = 1, #infos do
if infos[i].obj == "FontString" then
UIConfig.itemInfos.item[infos[i].name] = UIConfig.itemInfos.item:CreateFontString(nil, "OVERLAY", infos[i].inherits)
UIConfig.itemInfos.item[infos[i].name]:SetPoint("BOTTOM", UIConfig.itemInfos.item, 0, -20 - (i*20))
UIConfig.itemInfos.item[infos[i].name]:SetText("iteminfo." .. i)
UIConfig.itemInfos.item[infos[i].name]:SetSize(200, 40)
else
UIConfig.itemInfos.item[infos[i].name] = CreateFrame("Button", nil, UIConfig.itemInfos.item, "GameMenuButtonTemplate")
UIConfig.itemInfos.item[infos[i].name]:SetPoint("BOTTOM", UIConfig.itemInfos.item, 0, -20 - (i*18))
UIConfig.itemInfos.item[infos[i].name]:SetText("iteminfo." .. i)
UIConfig.itemInfos.item[infos[i].name]:SetSize(125, 21)
end
end
UIConfig.itemInfos.item.removeFromList = CreateFrame("Button", nil, UIConfig.itemInfos.item, "GameMenuButtonTemplate")
UIConfig.itemInfos.item.removeFromList:SetText("Remove from list")
UIConfig.itemInfos.item.removeFromList:SetSize(125, 21)
UIConfig.itemInfos.item.removeFromList:SetPoint("BOTTOM", UIConfig.itemInfos.item[infos[#infos].name], "BOTTOM", 0, -80)
UIConfig.itemInfos.item.tryIt = CreateFrame("Button", nil, UIConfig.itemInfos.item, "GameMenuButtonTemplate")
UIConfig.itemInfos.item.tryIt:SetText("Preview item")
UIConfig.itemInfos.item.tryIt:SetSize(125, 21)
UIConfig.itemInfos.item.tryIt:SetPoint("TOP", UIConfig.itemInfos.item.removeFromList, "TOP", 0, 20)
UIConfig.itemInfos.item.toggleAlert = CreateFrame("Button", nil, UIConfig.itemInfos.item, "GameMenuButtonTemplate")
UIConfig.itemInfos.item.toggleAlert:SetText("Set alert")
UIConfig.itemInfos.item.toggleAlert:SetSize(125, 21)
UIConfig.itemInfos.item.toggleAlert:SetPoint("TOP", UIConfig.itemInfos.item.tryIt, "TOP", 0, 20)
UIConfig.itemInfos.btnClose = CreateFrame("Button", nil, UIConfig.itemInfos, "UIPanelCloseButton")
UIConfig.itemInfos.btnClose:SetSize(26, 26)
UIConfig.itemInfos.btnClose:SetPoint("TOPRIGHT")
UIConfig.itemInfos:Hide()
--SetItemInfo(PileSeller.UIConfig.itemInfos.item, "60844")
end
function CreateMiniDialog(parent)
parent.miniDialog = CreateFrame("Frame", "PileSeller_ConfigFrame_ItemInfos_MiniDialog", parent, "ThinBorderTemplate")
parent.miniDialog:SetSize(200, 125)
parent.miniDialog:SetPoint("BOTTOM", parent, "BOTTOM")
parent.miniDialog.bg = parent.miniDialog:CreateTexture()
parent.miniDialog.bg:SetAllPoints(parent.miniDialog)
parent.miniDialog.bg:SetTexture([[Interface\Buttons\WHITE8X8]])
parent.miniDialog.bg:SetVertexColor(.27,.27,.27,1)
parent.miniDialog:SetFrameStrata("HIGH")
parent.miniDialog.closeButton = CreateFrame("Button", "PileSeller_ConfigFrame_ItemInfos_MiniDialog_CloseButton", parent.miniDialog, "UIPanelCloseButton")
parent.miniDialog.closeButton:SetPoint("TOPRIGHT", parent.miniDialog)
parent.miniDialog.closeButton:SetSize(26, 26)
parent.miniDialog.title = parent.miniDialog:CreateFontString(nil, "OVERLAY", "GameFontNormal")
parent.miniDialog.title:SetText("|cFF".. PileSeller.color .. "Item Source(s)|r")
parent.miniDialog.title:SetSize(100, 21)
parent.miniDialog.title:SetPoint("TOPLEFT", parent.miniDialog)
--parent.miniDialog.scroller = CreateFrame("ScrollFrame", nil, parent.miniDialog, "UIPanelScrollFrameTemplate")
--parent.miniDialog.scroller:SetSize(175, 100)
--parent.miniDialog.scroller:SetPoint("LEFT", parent.miniDialog, "LEFT", 0, -10)
--parent.miniDialog.scroller:SetBackdropColor(0,0,0)
parent.miniDialog.scroller = PileSeller:CreateScroll(parent.miniDialog, "PileSeller_ConfigFrame_ItemInfos_MiniDialog_ScrollFrame", 175, 100, true)
parent.miniDialog.scroller:SetPoint("LEFT", parent.miniDialog, "LEFT", 0, -10)
parent.miniDialog.scroller:SetParent(parent.miniDialog)
parent.miniDialog.scroller.text = parent.miniDialog.scroller:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
parent.miniDialog.scroller.text:SetJustifyH("LEFT")
parent.miniDialog.scroller.text:SetJustifyV("TOP")
parent.miniDialog.scroller.text:SetText("I have to test\nA very long string\n\nThat can be\nThis long")
parent.miniDialog.scroller.text:SetPoint("TOPLEFT", parent.miniDialog, "TOPLEFT", 10, -20)
parent.miniDialog.scroller.text:SetSize(170, 75)
parent.miniDialog.scroller.text:Hide()
-- REMOVED BECAUSE C_TransmogCollection.GetAppearanceSourceDrops RETURNS WRONG INFO
--parent.miniDialog.showBossSource = CreateFrame("Button", nil, parent.miniDialog, "GameMenuButtonTemplate")
--parent.miniDialog.showBossSource:SetText("Show instance sources")
--parent.miniDialog.showBossSource:SetSize(200, 21)
--parent.miniDialog.showBossSource:SetPoint("BOTTOMRIGHT", parent.miniDialog, nil, 0, -5)
parent.miniDialog:Hide()
end
function SetMiniDialogInfo(parent, itemLink, thereAreBosses)
PileSeller:ClearAllButtons(parent.miniDialog.scroller.content)
local sources = PileSeller:GetItemSources(itemLink)
if parent.miniDialog:IsShown() then return end
parent.miniDialog:Show()
if not sources or not sources[1] then parent.miniDialog.scroller.text:SetText("This item is not trasmogrificable, hence I don't know the source (sorry)."); parent.miniDialog.scroller.text:Show();
else
parent.miniDialog.scroller.text:Hide()
local text = {}
local writtenText = {}
if #sources[1] >= 1 then
for i = 1, #sources[1] do
--local name, nameColor, sourceText, sourceColor = WardrobeCollectionFrameModel_GetSourceTooltipInfo(sources[i])
if not writtenText[sources[1][i].text] then
tinsert(text, sources[1][i].text)
end
writtenText[sources[1][i].text] = true
end
end
--if sources[2] then
-- parent.miniDialog.showBossSource:Show()
-- parent.miniDialog.showBossSource:SetScript("OnClick", function()
-- PileSeller:PrintTable(C_TransmogCollection.GetAppearanceSourceDrops(sources[3]))
-- end)
--else parent.miniDialog.showBossSource:Hide() end
PileSeller:PopulateList(parent.miniDialog.scroller.content, text, 172, true, sources)
end
end
function PileSeller:SetItemInfo(parent, item)
parent:GetParent():Show()
if parent:GetParent().miniDialog then
parent:GetParent().miniDialog:Hide()
end
local n, l, q, _, _, _, c, _, _, i, v = GetItemInfo(item)
qualities = {}
qualities[0] = "9d9d9d"
qualities[1] = "FFFFFF"
qualities[2] = "1eff00"
qualities[3] = "0070ff"
qualities[4] = "a335ee"
qualities[5] = "ff8000"
qualities[6] = "e6cc80"
if q >= 6 then q = qualities[6]
else q = qualities[q] end
local tx = parent.tx
tx:SetTexture(i)
tx:SetVertexColor(1,1,1,1)
tx:SetAllPoints()
local id = PileSeller:getID(l)
parent.itemName:SetText(n)
parent.itemClass:SetText("|cFF".. PileSeller.color .. "Item type:|r |cFF" .. q .. c .. "|r")
parent.itemID:SetText("|cFF".. PileSeller.color .. "Item ID:|r " .. id)
parent.tryIt:SetScript("OnClick", function()
DressUpItemLink(l)
end
)
parent.removeFromList:SetScript("OnClick", function()
local tableToGet = {}
if lastClicked:GetName() == "PileSeller_ConfigFrame_SavedScrollContent" then tableToGet = psItemsSaved
else tableToGet = psItems end
PileSeller:removeItem(l, tableToGet, lastClicked)
PileSeller:UpdateUIInfo()
end
)
if lastClicked then
if lastClicked:GetName() then
if lastClicked:GetName() == "PileSeller_ConfigFrame_ToSellScrollContent" then parent.toggleAlert:Hide()
elseif lastClicked:GetName() == "PileSeller_ConfigFrame_SavedScrollContent" then
parent.toggleAlert:Show()
if psItemsAlert[id] then parent.toggleAlert:SetText("Remove Alert")
else parent.toggleAlert:SetText("Set alert") end
parent.toggleAlert:SetScript("OnClick", function()
if parent.toggleAlert:GetText() == "Set alert" then
psItemsAlert[id] = true
parent.toggleAlert:SetText("Remove alert")
else psItemsAlert[id] = false end
end
)
end
end
end
local t = "|cFF".. PileSeller.color .. "Item value: |r"
if v > 0 then
local gold = math.floor(v / 100 / 100)
local silver = math.floor((v / 100) % 100)
local copper = math.floor(v % 100)
if gold > 1 then t = t .. gold .. "|cFFFFD700g|r " end
if silver > 1 then t = t .. silver .. "|cFFC0C0C0s|r " end
if copper > 1 then t = t .. copper .. "|cFFCD7E32c|r" end
else t = t .. "No value" end
parent.itemValue:SetText(t)
if not WardrobeCollectionFrameModel_GetSourceTooltipInfo then
parent.itemSource:SetText("Load Sources")
parent.itemSource:SetScript("OnClick", function()
CollectionsJournal_LoadUI()
parent.itemSource:SetText("Show Sources")
parent.itemSource:SetScript("OnClick", function()
if not parent:GetParent().miniDialog then CreateMiniDialog(parent:GetParent()) end
SetMiniDialogInfo(parent:GetParent(), select(2, GetItemInfo(item)))
end)
--buttonToClick = CreateFrame("Button", nil, parent, "UIDropDownMenuTemplate")
end)
else
parent.itemSource:SetText("Show Sources")
parent.itemSource:SetScript("OnClick", function()
if not parent:GetParent().miniDialog then CreateMiniDialog(parent:GetParent()) end
SetMiniDialogInfo(parent:GetParent(), select(2, GetItemInfo(item)))
end)
end
end
function PileSeller:CreateItemsSection(UIConfig)
PileSeller:debugprint("entered createitemssection")
CreateItemInfos(UIConfig)
CreateSavedSection(UIConfig)
CreateToSellSection(UIConfig)
CreateIgnoreZone(UIConfig)
end
function PileSeller:CreateScroll(parent, name, width, height, noBorder, noBackground)
local f = CreateFrame("ScrollFrame", name, parent, "UIPanelScrollFrameTemplate")
f:SetSize(width, height)
f:SetClampedToScreen(true)
f:EnableMouseWheel(true)
_G[name .. "ScrollBar"]:SetParent(parent)
_G[name .. "ScrollBar"]:Show()
_G[name .. "ScrollBar"]:SetScript("OnValueChanged",
function(self, value)
f:SetVerticalScroll(value)
end
)
f:SetClipsChildren(true) -- 7.1 thingie
if not noBackground then
local tex = f:CreateTexture(nil, "BACKGROUND")
tex:SetTexture([[Interface\Buttons\WHITE8X8]])
tex:SetVertexColor(.27,.27,.27,1)
tex:SetAllPoints()
end
if not noBorder then
f:SetBackdrop({
edgeFile = [[Interface\Buttons\WHITE8X8]],
edgeSize = 1,
insets = {
left = 1,
right = 1,
top = 1,
bottom = 1
}
})
f:SetBackdropBorderColor(0, 0, 0)
end
f.content = CreateFrame("Frame", name .. "Content")
f.content:SetSize(width, height)
f:SetScrollChild(f.content)
f:SetScript("OnMouseWheel", function(self, delta)
local vertical = f:GetVerticalScroll()
local max = f:GetVerticalScrollRange()
--local step = ((max / 21) * 5) -- how much i should move. 21 = height of the button. 5 = speed
_G[name .. "ScrollBar"]:SetMinMaxValues(0, max)
local move = 13 * -delta
if vertical + move > 0 and vertical + move < max then
f:SetVerticalScroll(vertical + move)
elseif vertical + move > max then
f:SetVerticalScroll(max)
elseif vertical + move < 0 then
f:SetVerticalScroll(0)
end
_G[name .. "ScrollBar"]:SetValue(f:GetVerticalScroll()) -- feelsbadman
end)
return f
end
function CreateSavedSection(UIConfig)
PileSeller:debugprint("entered createitemssection saved")
--[[SAVED SECTION]]--
if not UIConfig.savedScroll then
UIConfig.savedScroll = PileSeller:CreateScroll(UIConfig, "PileSeller_ConfigFrame_SavedScroll", 260, 120)
UIConfig.savedScroll:SetPoint("TOPLEFT", UIConfig, 20, -35)
UIConfig.savedScroll:SetParent(UIConfig)
else
PileSeller:debugprint("entered createitemssection saved else")
UIConfig.savedScroll:Show()
UIConfig.savedScroll:SetScrollChild(UIConfig.savedScroll.content)
UIConfig.savedScroll:EnableMouseWheel(true)
UIConfig.savedScroll.ScrollBar:Show();
end
PileSeller:PopulateList(UIConfig.savedScroll.content, psItemsSaved, 258)
if not UIConfig.savedScroll.lblTitle then
UIConfig.savedScroll.lblTitle = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontNormal")
UIConfig.savedScroll.lblTitle:SetText("Saved items list")
UIConfig.savedScroll.lblTitle:SetPoint("TOPRIGHT", UIConfig.savedScroll, UIConfig.savedScroll.lblTitle:GetWidth() + 30, 0)
UIConfig.savedScroll.lblTitle:SetParent(UIConfig)
else UIConfig.savedScroll.lblTitle:Show() end
if not UIConfig.savedScroll.lblTitle.lblDesc then
UIConfig.savedScroll.lblTitle.lblDesc = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
UIConfig.savedScroll.lblTitle.lblDesc:SetText("Items saved: " .. #psItemsSaved .. "|nItems found: " .. PileSeller:tablelength(psItemsSavedFound))
UIConfig.savedScroll.lblTitle.lblDesc:SetPoint("LEFT", UIConfig.savedScroll.lblTitle, 0, -UIConfig.savedScroll.lblTitle:GetHeight() - 10)
UIConfig.savedScroll.lblTitle.lblDesc:SetJustifyH("LEFT")
UIConfig.savedScroll.lblTitle.lblDesc:SetParent(UIConfig)
else UIConfig.savedScroll.lblTitle.lblDesc:Show() end
-- Creating the add item bar
if not UIConfig.txtAddSavedItem then
UIConfig.txtAddSavedItem = CreateFrame("EditBox", nil, UIConfig)
UIConfig.txtAddSavedItem:SetSize(260, 21)
UIConfig.txtAddSavedItem:SetPoint("LEFT", UIConfig.savedScroll, "LEFT", 0, -70)
UIConfig.txtAddSavedItem:SetAutoFocus(false)
UIConfig.txtAddSavedItem:SetScript("OnEscapePressed", function()
UIConfig.txtAddSavedItem:ClearFocus()
end
)
-- Setting the EditBox properties
UIConfig.txtAddSavedItem:SetFontObject("GameFontHighlight") -- Its font
UIConfig.txtAddSavedItem:SetTextInsets(5, 0, 0, 0) -- Some insets for the text
UIConfig.txtAddSavedItem:SetBackdrop({ -- The border and backdrop
bgFile = [[Interface\Buttons\WHITE8X8]],
tile = false,
edgeFile = [[Interface\Buttons\WHITE8X8]],
edgeSize = 1,
insets = {
left = 1,
right = 1,
top = 1,
bottom = 1
}
})
UIConfig.txtAddSavedItem:SetBackdropColor(.27,.27,.27, 1)
UIConfig.txtAddSavedItem:SetBackdropBorderColor(0, 0, 0)
UIConfig.txtAddSavedItem:SetScript("OnEnterPressed", function()
local t = UIConfig.txtAddSavedItem:GetText()
if t then
if string.match(t, "item[%-?%d:]+") then
PileSeller:addItem(t, psItemsSaved, UIConfig.savedScroll.content)
else
local l = string.len(t)
for i=1, l do
s = t:sub(i,i)
if s < '0' or s > '9' then
UIConfig.txtAddSavedItem:SetText("-- ERROR --")
return
end
end
PileSeller:addItem(t, psItemsSaved, UIConfig.savedScroll.content)
UIConfig.txtAddSavedItem:SetText("")
PileSeller:UpdateUIInfo()
end
end
end
)
else UIConfig.txtAddSavedItem:Show() end
-- Creating the add item button
if not UIConfig.btnAddSavedItem then
UIConfig.btnAddSavedItem = CreateFrame("Button", nil, UIConfig.txtAddSavedItem, "GameMenuButtonTemplate")
UIConfig.btnAddSavedItem:SetSize(26, 26)
UIConfig.btnAddSavedItem:SetPoint("RIGHT", UIConfig.txtAddSavedItem, "RIGHT", 26, -1)
UIConfig.btnAddSavedItem:SetText("+")
UIConfig.btnAddSavedItem:SetScript("OnClick", function()
local t = UIConfig.txtAddSavedItem:GetText()
if t and #t > 0 then
if string.match(t, "item[%-?%d:]+") then
PileSeller:addItem(t, psItemsSaved, UIConfig.savedScroll.content)
else
local l = string.len(t)
for i=1, l do
s = t:sub(i,i)
if s < '0' or s > '9' then
UIConfig.txtAddSavedItem:SetText("-- ERROR --")
return
end
end
PileSeller:addItem(t, psItemsSaved, UIConfig.savedScroll.content)
UIConfig.txtAddSavedItem:SetText("")
PileSellser:UpdateUIInfo()
end
else if t and #t == 0 then
UIConfig.txtAddSavedItem:SetText("You have to input an ID or a link")
end
end
end
)
else UIConfig.btnAddSavedItem:Show() end
if not UIConfig.savedScroll:GetScrollChild() then
UIConfig.savedScroll:SetScrollChild(UIConfig.savedScroll.content)
end
end
function CreateToSellSection(UIConfig)
if not UIConfig.toSellScroll then
UIConfig.toSellScroll = PileSeller:CreateScroll(UIConfig, "PileSeller_ConfigFrame_ToSellScroll", 260, 100)
UIConfig.toSellScroll:SetPoint("BOTTOM", UIConfig.savedScroll, 0, -UIConfig.savedScroll:GetHeight() - 10)
UIConfig.toSellScroll:SetParent(UIConfig)
else UIConfig.toSellScroll:Show(); UIConfig.toSellScroll:EnableMouseWheel(true); UIConfig.toSellScroll.ScrollBar:Show(); end
PileSeller:PopulateList(UIConfig.toSellScroll.content, psItems, 258)
if not UIConfig.toSellScroll.lblTitle then
UIConfig.toSellScroll.lblTitle = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontNormal")
UIConfig.toSellScroll.lblTitle:SetText("To sell items list")
UIConfig.toSellScroll.lblTitle:SetPoint("TOPRIGHT", UIConfig.toSellScroll, UIConfig.toSellScroll.lblTitle:GetWidth() + 30, 0)
UIConfig.toSellScroll.lblTitle:SetParent(UIConfig)
else UIConfig.toSellScroll.lblTitle:Show() end
if not UIConfig.toSellScroll.lblTitle.lblDesc then
UIConfig.toSellScroll.lblTitle.lblDesc = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
local p = GetSell()
UIConfig.toSellScroll.lblTitle.lblDesc:SetText("Items to sell: " .. #psItems .. "|nProfit: " .. p)
UIConfig.toSellScroll.lblTitle.lblDesc:SetPoint("LEFT", UIConfig.toSellScroll.lblTitle, 0, -UIConfig.toSellScroll.lblTitle:GetHeight() - 10)
UIConfig.toSellScroll.lblTitle.lblDesc:SetJustifyH("LEFT")
UIConfig.toSellScroll.lblTitle.lblDesc:SetParent(UIConfig)
else UIConfig.toSellScroll.lblTitle.lblDesc:Show() end
end
function CreateIgnoreZone(UIConfig)
if not UIConfig.ignoredScroll then
UIConfig.ignoredScroll = PileSeller:CreateScroll(UIConfig, "PileSeller_ConfigFrame_IgnoredScroll", 260, 55)
UIConfig.ignoredScroll:SetPoint("BOTTOM", UIConfig.toSellScroll, 0, -65)
UIConfig.ignoredScroll:SetParent(UIConfig)
else UIConfig.ignoredScroll:Show(); UIConfig.ignoredScroll:EnableMouseWheel(true); UIConfig.ignoredScroll.ScrollBar:Show(); end
PileSeller:PopulateList(UIConfig.ignoredScroll.content, psIgnoredZones, 258, true)
-- Creating the add item bar
if not UIConfig.txtAddIgnoreZone then
UIConfig.txtAddIgnoreZone = CreateFrame("EditBox", nil, UIConfig)
UIConfig.txtAddIgnoreZone:SetSize(260, 21)
UIConfig.txtAddIgnoreZone:SetPoint("BOTTOM", UIConfig.ignoredScroll, 0, -20)
UIConfig.txtAddIgnoreZone:SetAutoFocus(false)
UIConfig.txtAddIgnoreZone:SetScript("OnEscapePressed", function()
UIConfig.txtAddIgnoreZone:ClearFocus()
end
)
-- Setting the EditBox properties
UIConfig.txtAddIgnoreZone:SetFontObject("GameFontHighlight") -- Its font
UIConfig.txtAddIgnoreZone:SetTextInsets(5, 0, 0, 0) -- Some insets for the text
UIConfig.txtAddIgnoreZone:SetBackdrop({ -- The border and backdrop
bgFile = [[Interface\Buttons\WHITE8X8]],
tile = false,
edgeFile = [[Interface\Buttons\WHITE8X8]],
edgeSize = 1,
insets = {
left = 1,
right = 1,
top = 1,
bottom = 1
}
})
UIConfig.txtAddIgnoreZone:SetBackdropColor(.27,.27,.27, 1)
UIConfig.txtAddIgnoreZone:SetBackdropBorderColor(0, 0, 0)
UIConfig.txtAddIgnoreZone:SetScript("OnTextChanged", function()
if PileSeller:IsIgnored(UIConfig.txtAddIgnoreZone:GetText()) then
UIConfig.btnAddIgnoreZone:SetText("-")
else UIConfig.btnAddIgnoreZone:SetText("+") end
end
)
UIConfig.txtAddIgnoreZone:SetScript("OnEnterPressed", function()
local s = UIConfig.btnAddIgnoreZone:GetText() == "+"
local t = UIConfig.txtAddIgnoreZone:GetText()
if s then
tinsert(psIgnoredZones, t)
PileSeller:PopulateList(UIConfig.ignoredScroll.content, psIgnoredZones, 258, true)
else
local index = PileSeller:IsIgnored(t)
tremove(psIgnoredZones, index)
PileSeller:PopulateList(UIConfig.ignoredScroll.content, psIgnoredZones, 258, true)
end
UIConfig.txtAddIgnoreZone:SetText("")
end
)
else UIConfig.txtAddIgnoreZone:Show() end
if not UIConfig.ignoredScroll.lblHelp then
UIConfig.ignoredScroll.lblHelp = UIConfig.ignoredScroll:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
UIConfig.ignoredScroll.lblHelp:SetText("use the above box to add and remove zones")
UIConfig.ignoredScroll.lblHelp:SetPoint("BOTTOM", UIConfig.txtAddIgnoreZone, 0, -UIConfig.txtAddIgnoreZone:GetHeight() + 2)
else UIConfig.ignoredScroll.lblHelp:Show() end
if not UIConfig.ignoredScroll.lblTitle then
UIConfig.ignoredScroll.lblTitle = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontNormal")
UIConfig.ignoredScroll.lblTitle:SetText("Ignored zone list")
UIConfig.ignoredScroll.lblTitle:SetPoint("TOPRIGHT", UIConfig.ignoredScroll, UIConfig.ignoredScroll.lblTitle:GetWidth() + 30, 0)
UIConfig.ignoredScroll.lblTitle:SetParent(UIConfig)
else UIConfig.ignoredScroll.lblTitle:Show() end
if not UIConfig.ignoredScroll.lblTitle.lblDesc then
UIConfig.ignoredScroll.lblTitle.lblDesc = UIConfig:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
UIConfig.ignoredScroll.lblTitle.lblDesc:SetText("You are currently in:|n|cFF" .. PileSeller.color .. GetZoneText() .. "|r")
UIConfig.ignoredScroll.lblTitle.lblDesc:SetWidth(125)
UIConfig.ignoredScroll.lblTitle.lblDesc:SetJustifyH("LEFT")
UIConfig.ignoredScroll.lblTitle.lblDesc:SetPoint("LEFT", UIConfig.ignoredScroll.lblTitle, 0, -UIConfig.ignoredScroll.lblTitle:GetHeight() - 10)
UIConfig.ignoredScroll.lblTitle.lblDesc:SetParent(UIConfig)
else UIConfig.ignoredScroll.lblTitle.lblDesc:Show() end
-- Creating the add item button
if not UIConfig.btnAddIgnoreZone then
UIConfig.btnAddIgnoreZone = CreateFrame("Button", nil, UIConfig.txtAddIgnoreZone, "GameMenuButtonTemplate")
UIConfig.btnAddIgnoreZone:SetSize(26, 26)
UIConfig.btnAddIgnoreZone:SetPoint("RIGHT", UIConfig.txtAddIgnoreZone, "RIGHT", 26, -1)
UIConfig.btnAddIgnoreZone:SetText("+")
UIConfig.btnAddIgnoreZone:SetScript("OnClick", function()
local s = UIConfig.btnAddIgnoreZone:GetText() == "+"
local t = UIConfig.txtAddIgnoreZone:GetText()
if s then
tinsert(psIgnoredZones, t)
PileSeller:PopulateList(UIConfig.ignoredScroll.content, psIgnoredZones, 258, true)
else
local index = PileSeller:IsIgnored(t)
tremove(psIgnoredZones, index)
PileSeller:PopulateList(UIConfig.ignoredScroll.content, psIgnoredZones, 258, true)
end
UIConfig.txtAddIgnoreZone:SetText("")
end
)
else UIConfig.btnAddIgnoreZone:Show() end
if not UIConfig.ignoredScroll:GetScrollChild() then
UIConfig.ignoredScroll:SetScrollChild(UIConfig.ignoredScroll.content)
end
end
function CreateConfigSection(UIConfig)
HideAllFromConfig(UIConfig)
if UIConfig.savedScroll and UIConfig.ignoredScroll then
UIConfig.savedScroll.lblTitle:Hide()
UIConfig.savedScroll.lblTitle.lblDesc:Hide()
UIConfig.toSellScroll.lblTitle:Hide()
UIConfig.toSellScroll.lblTitle.lblDesc:Hide()
UIConfig.ignoredScroll.lblTitle:Hide()
UIConfig.ignoredScroll.lblTitle.lblDesc:Hide()
end
----------- Creating the buttons
UIConfig.tab1Button = CreateFrame("Button", "PileSeller_ConfigFrame_Tab1Button", UIConfig, "GameMenuButtonTemplate")
UIConfig.tab1Button:SetText("General Options")
UIConfig.tab1Button:SetSize(120, 25)
UIConfig.tab1Button:SetPoint("TOPLEFT", UIConfig, "TOPLEFT", 30, -40)