-
Notifications
You must be signed in to change notification settings - Fork 8
/
MasterMerchant_UI.lua
4026 lines (3563 loc) · 189 KB
/
MasterMerchant_UI.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
-- MasterMerchant UI Functions File
-- Last Updated September 15, 2014
-- Written August 2014 by Dan Stone (@khaibit) - [email protected]
-- Extended February 2015 by Chris Lasswell (@Philgo68) - [email protected]
-- Released under terms in license accompanying this file.
-- Distribution without license is prohibited!
-- Sort scrollList by price in 'ordering' order (asc = true as per ZOS)
-- Rather than using the built-in Lua quicksort, we use my own
-- implementation of Shellsort to save on memory.
local LMP = LibMediaProvider
local internal = _G["LibGuildStore_Internal"]
local sales_data = _G["LibGuildStore_SalesData"]
local sr_index = _G["LibGuildStore_SalesIndex"]
local listings_data = _G["LibGuildStore_ListingsData"]
local lr_index = _G["LibGuildStore_ListingsIndex"]
local purchases_data = _G["LibGuildStore_PurchaseData"]
local pr_index = _G["LibGuildStore_PurchaseIndex"]
local posted_items_data = _G["LibGuildStore_PostedItemsData"]
local pir_index = _G["LibGuildStore_PostedItemsIndex"]
local cancelled_items_data = _G["LibGuildStore_CancelledItemsData"]
local cr_index = _G["LibGuildStore_CancelledItemsIndex"]
--[[ TODO Verify this
when viewSize is 'full': then you are viewing the seller information
when viewSize if 'half': you are viewing the item information
]]--
--[[ can not use MasterMerchant.itemsViewSize for example
because that will not be available this early.
]]--
local ITEMS = 'items_vs'
local GUILDS = 'guild_vs'
local LISTINGS = 'listings_vs'
local PURCHASES = 'purchases_vs'
local REPORTS = 'reports_vs'
local SALES_WINDOW_DATAROW = "MasterMerchantDataRow"
local GUILD_WINDOW_DATAROW = "MasterMerchantGuildDataRow"
local LISTING_WINDOW_DATAROW = "MasterMerchantListingDataRow"
local PURCHASE_WINDOW_DATAROW = "MasterMerchantPurchaseDataRow"
local REPORTS_WINDOW_DATAROW = "MasterMerchantReportsDataRow"
local SALES_WINDOW_CONTROL_NAME = "MasterMerchantWindow"
local GUILD_WINDOW_CONTROL_NAME = "MasterMerchantGuildWindow"
local LISTING_WINDOW_CONTROL_NAME = "MasterMerchantListingWindow"
local PURCHASE_WINDOW_CONTROL_NAME = "MasterMerchantPurchaseWindow"
local REPORTS_WINDOW_CONTROL_NAME = "MasterMerchantReportsWindow"
local SALES_WINDOW_CONTROL_NAME_REGEX = "^MasterMerchantWindow"
local GUILD_WINDOW_CONTROL_NAME_REGEX = "^MasterMerchantGuildWindow"
local LISTING_WINDOW_CONTROL_NAME_REGEX = "^MasterMerchantListingWindow"
local PURCHASE_WINDOW_CONTROL_NAME_REGEX = "^MasterMerchantPurchaseWindow"
local REPORTS_WINDOW_CONTROL_NAME_REGEX = "^MasterMerchantReportsWindow"
function MasterMerchant:ActiveWindow()
return ((MasterMerchant.systemSavedVariables.viewSize == ITEMS and MasterMerchantWindow) or
(MasterMerchant.systemSavedVariables.viewSize == GUILDS and MasterMerchantGuildWindow) or
(MasterMerchant.systemSavedVariables.viewSize == LISTINGS and MasterMerchantListingWindow) or
(MasterMerchant.systemSavedVariables.viewSize == PURCHASES and MasterMerchantPurchaseWindow) or
(MasterMerchant.systemSavedVariables.viewSize == REPORTS and MasterMerchantReportsWindow))
end
function MasterMerchant:ActiveFragment()
return ((MasterMerchant.systemSavedVariables.viewSize == ITEMS and self.salesUiFragment) or
(MasterMerchant.systemSavedVariables.viewSize == GUILDS and self.guildUiFragment) or
(MasterMerchant.systemSavedVariables.viewSize == LISTINGS and self.listingUiFragment) or
(MasterMerchant.systemSavedVariables.viewSize == PURCHASES and self.purchaseUiFragment) or
(MasterMerchant.systemSavedVariables.viewSize == REPORTS and self.reportsUiFragment))
end
function MasterMerchant:GetLockButtonTooltipText()
if MasterMerchant.systemSavedVariables.isWindowMovable then
return GetString(MM_LOCK_TOOLTIP)
else
return GetString(MM_UNLOCK_TOOLTIP)
end
end
function MasterMerchant:SetWindowLockIcon()
local unlocked_up = "/esoui/art/miscellaneous/unlocked_up.dds"
local unlocked_over = "/esoui/art/miscellaneous/unlocked_over.dds"
local locked_up = "/esoui/art/miscellaneous/locked_up.dds"
local locked_over = "/esoui/art/miscellaneous/locked_over.dds"
if MasterMerchant.systemSavedVariables.isWindowMovable then
MasterMerchantWindowMenuHeaderLockButton:SetNormalTexture(unlocked_up)
MasterMerchantGuildWindowMenuHeaderLockButton:SetNormalTexture(unlocked_up)
MasterMerchantListingWindowMenuHeaderLockButton:SetNormalTexture(unlocked_up)
MasterMerchantPurchaseWindowMenuHeaderLockButton:SetNormalTexture(unlocked_up)
MasterMerchantReportsWindowMenuHeaderLockButton:SetNormalTexture(unlocked_up)
MasterMerchantWindowMenuHeaderLockButton:SetMouseOverTexture(unlocked_over)
MasterMerchantGuildWindowMenuHeaderLockButton:SetMouseOverTexture(unlocked_over)
MasterMerchantListingWindowMenuHeaderLockButton:SetMouseOverTexture(unlocked_over)
MasterMerchantPurchaseWindowMenuHeaderLockButton:SetMouseOverTexture(unlocked_over)
MasterMerchantReportsWindowMenuHeaderLockButton:SetMouseOverTexture(unlocked_over)
else
MasterMerchantWindowMenuHeaderLockButton:SetNormalTexture(locked_up)
MasterMerchantGuildWindowMenuHeaderLockButton:SetNormalTexture(locked_up)
MasterMerchantListingWindowMenuHeaderLockButton:SetNormalTexture(locked_up)
MasterMerchantPurchaseWindowMenuHeaderLockButton:SetNormalTexture(locked_up)
MasterMerchantReportsWindowMenuHeaderLockButton:SetNormalTexture(locked_up)
MasterMerchantWindowMenuHeaderLockButton:SetMouseOverTexture(locked_over)
MasterMerchantGuildWindowMenuHeaderLockButton:SetMouseOverTexture(locked_over)
MasterMerchantListingWindowMenuHeaderLockButton:SetMouseOverTexture(locked_over)
MasterMerchantPurchaseWindowMenuHeaderLockButton:SetMouseOverTexture(locked_over)
MasterMerchantReportsWindowMenuHeaderLockButton:SetMouseOverTexture(locked_over)
end
end
function MasterMerchant:SetWindowLock()
MasterMerchantWindow:SetMovable(MasterMerchant.systemSavedVariables.isWindowMovable)
MasterMerchantGuildWindow:SetMovable(MasterMerchant.systemSavedVariables.isWindowMovable)
MasterMerchantListingWindow:SetMovable(MasterMerchant.systemSavedVariables.isWindowMovable)
MasterMerchantPurchaseWindow:SetMovable(MasterMerchant.systemSavedVariables.isWindowMovable)
MasterMerchantReportsWindow:SetMovable(MasterMerchant.systemSavedVariables.isWindowMovable)
end
function MasterMerchant:ToggleWindowLock()
MasterMerchant.systemSavedVariables.isWindowMovable = not MasterMerchant.systemSavedVariables.isWindowMovable
MasterMerchant:SetWindowLock()
MasterMerchant:SetWindowLockIcon()
end
function MasterMerchant:SortByPrice(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
-- If they're viewing prices per-unit, then we need to sort on price / quantity.
if MasterMerchant.systemSavedVariables.showUnitPrice then
MasterMerchant.shellSort(listData, function(sortA, sortB)
-- In case quantity ends up 0 or nil somehow, let's not divide by it
if sortA.data[6] and sortA.data[6] > 0 and sortB.data[6] and sortB.data[6] > 0 then
return ((sortA.data[5] or 0) / sortA.data[6]) > ((sortB.data[5] or 0) / sortB.data[6])
else return (sortA.data[5] or 0) > (sortB.data[5] or 0) end
end)
-- Otherwise just sort on pure price.
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[5] or 0) > (sortB.data[5] or 0)
end)
end
else
-- And the same thing with descending sort
if MasterMerchant.systemSavedVariables.showUnitPrice then
MasterMerchant.shellSort(listData, function(sortA, sortB)
-- In case quantity ends up 0 or nil somehow, let's not divide by it
if sortA.data[6] and sortA.data[6] > 0 and sortB.data[6] and sortB.data[6] > 0 then
return ((sortA.data[5] or 0) / sortA.data[6]) < ((sortB.data[5] or 0) / sortB.data[6])
else return (sortA.data[5] or 0) < (sortB.data[5] or 0) end
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[5] or 0) < (sortB.data[5] or 0)
end)
end
end
end
-- Sort the scrollList by time in 'ordering' order (asc = true as per ZOS).
function MasterMerchant:SortByTime(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[4] or 0) < (sortB.data[4] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[4] or 0) > (sortB.data[4] or 0)
end)
end
end
function MasterMerchant:SortBySales(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[3] or 0) > (sortB.data[3] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[3] or 0) < (sortB.data[3] or 0)
end)
end
end
function MasterMerchant:SortByRank(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[4] or 9999) > (sortB.data[4] or 9999)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[4] or 9999) < (sortB.data[4] or 9999)
end)
end
end
function MasterMerchant:SortByCount(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[5] or 0) > (sortB.data[5] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[5] or 0) < (sortB.data[5] or 0)
end)
end
end
function MasterMerchant:SortByTax(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[8] or 0) > (sortB.data[8] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[8] or 0) < (sortB.data[8] or 0)
end)
end
end
--[[ TODO this is for ordering the buyer, seller name for the ranks
view. Which doesn't really work. When it is the buyer or seller name
then it's @Something. When it's the item view then it's by item link
which doesn't really sort.
zo_strformat(SI_TOOLTIP_ITEM_NAME, GetItemLinkName(itemLink))
If I use zo_strformat with the Item Link name it pretty much freezes the
game
]]--
function MasterMerchant:SortByName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[2] or 0) > (sortB.data[2] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[2] or 0) < (sortB.data[2] or 0)
end)
end
end
function MasterMerchant:SortByListingsAccountName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
local actualItemA = listings_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]
local actualItemB = listings_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]
local nameA = internal:GetAccountNameByIndex(actualItemA['seller'])
local nameB = internal:GetAccountNameByIndex(actualItemB['seller'])
return (nameA or 0) > (nameB or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
local actualItemA = listings_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]
local actualItemB = listings_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]
local nameA = internal:GetAccountNameByIndex(actualItemA['seller'])
local nameB = internal:GetAccountNameByIndex(actualItemB['seller'])
return (nameA or 0) < (nameB or 0)
end)
end
end
function MasterMerchant:SortByPurchaseAccountName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
local actualItemA = purchases_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]
local actualItemB = purchases_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]
local nameA = internal:GetAccountNameByIndex(actualItemA['seller'])
local nameB = internal:GetAccountNameByIndex(actualItemB['seller'])
return (nameA or 0) > (nameB or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
local actualItemA = purchases_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]
local actualItemB = purchases_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]
local nameA = internal:GetAccountNameByIndex(actualItemA['seller'])
local nameB = internal:GetAccountNameByIndex(actualItemB['seller'])
return (nameA or 0) < (nameB or 0)
end)
end
end
function MasterMerchant:SortByGuildName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[1] or 0) > (sortB.data[1] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sortA.data[1] or 0) < (sortB.data[1] or 0)
end)
end
end
function MasterMerchant:SortBySalesItemGuildName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sales_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild'] or 0) > (sales_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild'] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (sales_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild'] or 0) < (sales_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild'] or 0)
end)
end
end
function MasterMerchant:SortByListingItemGuildName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (listings_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild'] or 0) > (listings_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild'] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (listings_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild'] or 0) < (listings_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild'] or 0)
end)
end
end
function MasterMerchant:SortByPurchaseItemGuildName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (purchases_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild'] or 0) > (purchases_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild'] or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
return (purchases_data[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild'] or 0) < (purchases_data[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild'] or 0)
end)
end
end
function MasterMerchant:SortByReportItemGuildName(ordering, scrollList)
local listData = ZO_ScrollList_GetDataList(scrollList.list)
local dataTable
if MasterMerchant.reportsViewMode == MasterMerchant.reportsPostedViewMode then
dataTable = posted_items_data
elseif MasterMerchant.reportsViewMode == MasterMerchant.reportsCanceledViewMode then
dataTable = cancelled_items_data
end
if not ordering then
MasterMerchant.shellSort(listData, function(sortA, sortB)
local guildNameA = dataTable[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild']
local guildNameB = dataTable[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild']
local nameA = internal:GetGuildNameByIndex(guildNameA)
local nameB = internal:GetGuildNameByIndex(guildNameB)
return (nameA or 0) > (nameB or 0)
end)
else
MasterMerchant.shellSort(listData, function(sortA, sortB)
local guildNameA = dataTable[sortA.data[1]][sortA.data[2]]['sales'][sortA.data[3]]['guild']
local guildNameB = dataTable[sortB.data[1]][sortB.data[2]]['sales'][sortB.data[3]]['guild']
local nameA = internal:GetGuildNameByIndex(guildNameA)
local nameB = internal:GetGuildNameByIndex(guildNameB)
return (nameA or 0) < (nameB or 0)
end)
end
end
local function GetColorForGuild(currentGuild)
if not MasterMerchant.systemSavedVariables.addColorToGuildNames then
return MM_TEXT_COLOR_WHITE
end
if currentGuild ~= nil and currentGuild ~= "" and type(currentGuild) == 'string' then
if MasterMerchant.guildColorDefs[currentGuild] ~= nil then
return MasterMerchant.guildColorDefs[currentGuild]
end
end
return MM_TEXT_COLOR_WHITE
end
function MMScrollList:SetupSalesRow(control, data)
control.rowId = GetControl(control, 'RowId')
control.buyer = GetControl(control, 'Buyer')
control.guild = GetControl(control, 'Guild')
control.icon = GetControl(control, 'ItemIcon')
control.quant = GetControl(control, 'Quantity')
control.itemName = GetControl(control, 'ItemName')
control.sellTime = GetControl(control, 'SellTime')
control.price = GetControl(control, 'Price')
if not MasterMerchant:IsSalesDataValid(sales_data, data[1], data[2], data[3]) then return end
local actualItem = MasterMerchant:GetIndexedData(sales_data, data[1], data[2], data[3])
local currentItemLink = internal:GetItemLinkByIndex(actualItem['itemLink'])
local currentGuild = internal:GetGuildNameByIndex(actualItem['guild'])
local currentBuyer = internal:GetAccountNameByIndex(actualItem['buyer'])
local currentSeller = internal:GetAccountNameByIndex(actualItem['seller'])
local actualItemIcon = sales_data[data[1]][data[2]]['itemIcon']
local isFullSize = zo_strfind(control:GetName(), SALES_WINDOW_CONTROL_NAME_REGEX)
local fontString = LMP:Fetch('font', MasterMerchant.systemSavedVariables.windowFont) .. '|%d'
control.rowId:SetFont(string.format(fontString, 12))
control.buyer:SetFont(string.format(fontString, 15))
control.guild:SetFont(string.format(fontString, ((isFullSize and 15) or 11)))
control.itemName:SetFont(string.format(fontString, ((isFullSize and 15) or 11)))
control.quant:SetFont(string.format(fontString, ((isFullSize and 15) or 10)) .. '|soft-shadow-thin')
control.sellTime:SetFont(string.format(fontString, ((isFullSize and 15) or 11)))
control.price:SetFont(string.format(fontString, ((isFullSize and 15) or 11)))
control.rowId:SetText(data.sortIndex)
-- Some extra stuff for the Buyer cell to handle double-click and color changes
-- Plus add a marker if buyer is not in-guild (kiosk sale)
local buyerString
if MasterMerchant.systemSavedVariables.viewBuyerSeller == 'buyer' then
buyerString = currentBuyer
else
buyerString = currentSeller
end
control.buyer:GetLabelControl():SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.buyer:SetText(buyerString)
-- If the seller is the player, color the buyer green. Otherwise, blue.
local acctName = GetDisplayName()
if zo_strlower(currentSeller) == zo_strlower(acctName) then
control.buyer:SetNormalFontColor(0.18, 0.77, 0.05, 1)
control.buyer:SetPressedFontColor(0.18, 0.77, 0.05, 1)
control.buyer:SetMouseOverFontColor(0.32, 0.90, 0.18, 1)
else
control.buyer:SetNormalFontColor(0.21, 0.54, 0.94, 1)
control.buyer:SetPressedFontColor(0.21, 0.54, 0.94, 1)
control.buyer:SetMouseOverFontColor(0.34, 0.67, 1, 1)
end
control.buyer:SetHandler('OnMouseUp', function(self, upInside)
MasterMerchant:my_NameHandler_OnLinkMouseUp(buyerString, upInside, self)
end)
-- Guild cell
local guildString
if actualItem.wasKiosk then guildString = '|t16:16:/EsoUI/Art/icons/item_generic_coinbag.dds|t ' .. currentGuild else guildString = ' ' .. currentGuild end
control.guild:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.guild:SetText(guildString)
local color = GetColorForGuild(currentGuild)
if color then
control.guild:SetColor(color:UnpackRGBA())
end
-- Item Icon
control.icon:SetHidden(false)
control.icon:SetTexture(actualItemIcon)
-- Item name cell
control.itemName:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.itemName:SetText(zo_strformat('<<t:1>>', currentItemLink))
-- Insert the item link into the chat box, with a quick substitution so brackets show up
--control.itemName:SetHandler('OnMouseDoubleClick', function()
-- ZO_ChatWindowTextEntryEditBox:SetText(ZO_ChatWindowTextEntryEditBox:GetText() .. zo_strgsub(currentItemLink, '|H0', '|H1'))
--end)
control.itemName:SetHandler('OnMouseEnter', function() MasterMerchant.ShowToolTip(currentItemLink, control.itemName) end)
control.itemName:SetHandler('OnMouseExit', function() ClearTooltip(ItemTooltip) end)
-- Quantity cell
if actualItem.quant == 1 then control.quant:SetHidden(true)
else
control.quant:SetHidden(false)
control.quant:SetText(actualItem.quant)
end
-- Sale time cell
control.sellTime:SetText(MasterMerchant.TextTimeSince(actualItem.timestamp))
-- Handle the setting of whether or not to show pre-cut sale prices
-- Insert thousands separators for the price
local dispPrice = MasterMerchant:GetFullPriceOrProfit(actualItem.price, actualItem.quant)
local stringPrice = MasterMerchant.LocalizedNumber(dispPrice)
-- Finally, set the price
control.price:SetText(stringPrice .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
ZO_SortFilterList.SetupRow(self, control, data)
end
function MMScrollList:SetupGuildSalesRow(control, data)
if MasterMerchant.systemSavedVariables.viewSize ~= GUILDS then return end
control.rowId = GetControl(control, 'RowId')
control.seller = GetControl(control, 'Seller')
control.itemName = GetControl(control, 'ItemName')
control.guild = GetControl(control, 'Guild')
control.rank = GetControl(control, 'Rank')
control.sales = GetControl(control, 'Sales')
control.tax = GetControl(control, 'Tax')
control.count = GetControl(control, 'Count')
control.percent = GetControl(control, 'Percent')
if (data[1] == nil) then
-- just starting up so just bail out
return
end
local currentGuild = data[1]
local sellerString = data[2]
local salesValue = data[3] or 0
local rankValue = data[4]
local countValue = data[5]
local stackValue = data[6]
local salesAmount = data[7] -- entire guild
local taxAmount = data[8]
local wasKiosk = data[9]
local entireGuild = sellerString == GetString(MM_ENTIRE_GUILD)
local accountName = string.sub(sellerString, 1, 1) == '@'
--[[
local controlName = control:GetName()
if not zo_strfind(controlName, GUILD_WINDOW_CONTROL_NAME_REGEX) then
MasterMerchant:dm("Warn", controlName)
return
else
MasterMerchant:dm("Debug", controlName)
end
]]--
local fontString = LMP:Fetch('font', MasterMerchant.systemSavedVariables.windowFont) .. '|%d'
control.rowId:SetFont(string.format(fontString, 12))
control.seller:SetFont(string.format(fontString, 15))
control.itemName:SetFont(string.format(fontString, 15))
control.guild:SetFont(string.format(fontString, 15))
control.rank:SetFont(string.format(fontString, 15))
control.sales:SetFont(string.format(fontString, 15))
control.tax:SetFont(string.format(fontString, 15))
control.count:SetFont(string.format(fontString, 15))
control.percent:SetFont(string.format(fontString, 15))
control.rowId:SetText(data.sortIndex)
-- Some extra stuff for the Seller cell to handle double-click and color changes
if (accountName or entireGuild) then
control.itemName:SetHidden(true)
control.seller:SetHidden(false)
control.seller:GetLabelControl():SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.seller:SetText(sellerString)
-- If the seller is the player, color the buyer green. Otherwise, blue.
local acctName = GetDisplayName()
if zo_strlower(sellerString) == zo_strlower(acctName) then
control.seller:SetNormalFontColor(0.18, 0.77, 0.05, 1)
control.seller:SetPressedFontColor(0.18, 0.77, 0.05, 1)
control.seller:SetMouseOverFontColor(0.32, 0.90, 0.18, 1)
else
control.seller:SetNormalFontColor(0.21, 0.54, 0.94, 1)
control.seller:SetPressedFontColor(0.21, 0.54, 0.94, 1)
control.seller:SetMouseOverFontColor(0.34, 0.67, 1, 1)
end
control.seller:SetHandler('OnMouseUp', function(self, upInside)
MasterMerchant:my_NameHandler_OnLinkMouseUp(sellerString, upInside, self)
end)
else
-- Item name cell
control.seller:SetHidden(true)
control.itemName:SetHidden(false)
control.itemName:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.itemName:SetText(zo_strformat('<<t:1>>', sellerString))
control.itemName:SetHandler('OnMouseEnter', function() MasterMerchant.ShowToolTip(sellerString, control.itemName) end)
control.itemName:SetHandler('OnMouseExit', function() ClearTooltip(ItemTooltip) end)
end
-- Guild cell
local guildString
if wasKiosk then guildString = '|t16:16:/EsoUI/Art/icons/item_generic_coinbag.dds|t ' .. currentGuild else guildString = ' ' .. currentGuild end
control.guild:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.guild:SetText(guildString)
local color = GetColorForGuild(currentGuild)
if color then
control.guild:SetColor(color:UnpackRGBA())
end
-- Rank Cell
control.rank:SetText(rankValue)
-- Sales Cell
local stringSales = MasterMerchant.LocalizedNumber(salesValue)
control.sales:SetText(stringSales .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
-- Tax Cell
local stringTax = MasterMerchant.LocalizedNumber(taxAmount)
control.tax:SetText(stringTax .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
-- Count Cell
control.count:SetText((countValue or '-') .. '/' .. (stackValue or '-'))
-- Percent Cell
if salesAmount and salesAmount ~= 0 then
local percent = zo_floor((((salesValue / salesAmount) * 100) * 10) + 0.5) / 10
control.percent:SetText(percent .. GetString(MM_PERCENT_CHAR))
else
control.percent:SetText('--' .. GetString(MM_PERCENT_CHAR))
end
ZO_SortFilterList.SetupRow(self, control, data)
end
function MMScrollList:SetupListingsRow(control, data)
control.rowId = GetControl(control, 'RowId')
control.seller = GetControl(control, 'Seller')
control.location = GetControl(control, 'Location')
control.guild = GetControl(control, 'Guild')
control.icon = GetControl(control, 'ItemIcon')
control.quant = GetControl(control, 'Quantity')
control.itemName = GetControl(control, 'ItemName')
control.listTime = GetControl(control, 'ListingTime')
control.price = GetControl(control, 'Price')
if not MasterMerchant:IsSalesDataValid(listings_data, data[1], data[2], data[3]) then return end
local actualItem = MasterMerchant:GetIndexedData(listings_data, data[1], data[2], data[3])
if not actualItem.timestamp then
MasterMerchant:dm("Warn", actualItem)
end
local currentItemLink = internal:GetItemLinkByIndex(actualItem['itemLink'])
local currentGuild = internal:GetGuildNameByIndex(actualItem['guild'])
local currentSeller = internal:GetAccountNameByIndex(actualItem['seller'])
local actualItemIcon = listings_data[data[1]][data[2]]['itemIcon']
local guildZone = nil
local guildSubZone = nil
local guildZoneId = nil
local guildLocationInfo = {}
local guildLocationKey = nil
if internal.traderIdByNameLookup[currentGuild] then
guildLocationKey = internal.traderIdByNameLookup[currentGuild]
guildLocationInfo = GS17DataSavedVariables[internal.visitedNamespace][guildLocationKey]
guildZone = guildLocationInfo.zoneName
guildSubZone = guildLocationInfo.subzoneName
guildZoneId = guildLocationInfo.zoneId
end
local fontString = LMP:Fetch('font', MasterMerchant.systemSavedVariables.windowFont) .. '|%d'
control.rowId:SetFont(string.format(fontString, 12))
control.seller:SetFont(string.format(fontString, 15))
control.guild:SetFont(string.format(fontString, 15))
control.location:SetFont(string.format(fontString, 15))
control.quant:SetFont(string.format(fontString, 15) .. '|soft-shadow-thin')
control.itemName:SetFont(string.format(fontString, 15))
control.listTime:SetFont(string.format(fontString, 15))
control.price:SetFont(string.format(fontString, 15))
control.rowId:SetText(data.sortIndex)
control.seller:SetText(currentSeller)
control.seller:SetHandler('OnMouseUp', function(self, upInside) MasterMerchant:my_SellerColumn_OnLinkMouseUp(currentSeller, currentItemLink, upInside, self) end)
-- Guild cell
control.guild:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.guild:SetText(currentGuild)
-- Location cell
local locationText = guildZone or ""
local subZoneText = guildSubZone or ""
local assignedZoneId = guildZoneId or 0
control.location:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.location:SetText(locationText)
control.location:SetHandler('OnMouseEnter', function() ZO_Tooltips_ShowTextTooltip(control.location, TOP, subZoneText) end)
control.location:SetHandler('OnMouseExit', function() ClearTooltip(InformationTooltip) end)
control.location:SetHandler('OnMouseUp', function(self, upInside) MasterMerchant:my_GuildColumn_OnLinkMouseUp(assignedZoneId, upInside, self) end)
-- Item Icon
control.icon:SetHidden(false)
control.icon:SetTexture(actualItemIcon)
-- Item name cell
control.itemName:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.itemName:SetText(zo_strformat('<<t:1>>', currentItemLink))
-- Insert the item link into the chat box, with a quick substitution so brackets show up
--control.itemName:SetHandler('OnMouseDoubleClick', function()
-- ZO_ChatWindowTextEntryEditBox:SetText(ZO_ChatWindowTextEntryEditBox:GetText() .. zo_strgsub(currentItemLink, '|H0', '|H1'))
--end)
control.itemName:SetHandler('OnMouseEnter', function() MasterMerchant.ShowToolTip(currentItemLink, control.itemName) end)
control.itemName:SetHandler('OnMouseExit', function() ClearTooltip(ItemTooltip) end)
control.itemName:SetHandler('OnMouseUp', function(self, upInside) MasterMerchant:my_AddFilterHandler_OnLinkMouseUp(currentItemLink, upInside, self) end)
-- Quantity cell
if actualItem.quant == 1 then control.quant:SetHidden(true)
else
control.quant:SetHidden(false)
control.quant:SetText(actualItem.quant)
end
-- Sale time cell
local dispTime = MasterMerchant.TextTimeSince(actualItem.timestamp)
control.listTime:SetText(dispTime)
-- Handle the setting of whether or not to show pre-cut sale prices
-- zo_floor(number + 0.5) is a quick shorthand way to round for
-- positive values.
local dispPrice = actualItem.price
local quantity = actualItem.quant
if MasterMerchant.systemSavedVariables.showUnitPrice and quantity > 0 then
dispPrice = zo_floor((dispPrice / quantity) + 0.5)
end
-- Insert thousands separators for the price
local stringPrice = MasterMerchant.LocalizedNumber(dispPrice)
-- Finally, set the price
control.price:SetText(stringPrice .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
ZO_SortFilterList.SetupRow(self, control, data)
end
function MMScrollList:SetupPurchasesRow(control, data)
control.rowId = GetControl(control, 'RowId')
control.seller = GetControl(control, 'Seller')
control.guild = GetControl(control, 'Guild')
control.icon = GetControl(control, 'ItemIcon')
control.quant = GetControl(control, 'Quantity')
control.itemName = GetControl(control, 'ItemName')
control.purchaseTime = GetControl(control, 'PurchaseTime')
control.price = GetControl(control, 'Price')
if not MasterMerchant:IsSalesDataValid(purchases_data, data[1], data[2], data[3]) then return end
local actualItem = MasterMerchant:GetIndexedData(purchases_data, data[1], data[2], data[3])
if not actualItem.timestamp then
MasterMerchant:dm("Warn", actualItem)
end
local currentItemLink = internal:GetItemLinkByIndex(actualItem['itemLink'])
local currentGuild = internal:GetGuildNameByIndex(actualItem['guild'])
local currentBuyer = internal:GetAccountNameByIndex(actualItem['buyer'])
local currentSeller = internal:GetAccountNameByIndex(actualItem['seller'])
local actualItemIcon = purchases_data[data[1]][data[2]]['itemIcon']
local fontString = LMP:Fetch('font', MasterMerchant.systemSavedVariables.windowFont) .. '|%d'
control.rowId:SetFont(string.format(fontString, 12))
control.seller:SetFont(string.format(fontString, 15))
control.guild:SetFont(string.format(fontString, 15))
control.quant:SetFont(string.format(fontString, 15) .. '|soft-shadow-thin')
control.itemName:SetFont(string.format(fontString, 15))
control.purchaseTime:SetFont(string.format(fontString, 15))
control.price:SetFont(string.format(fontString, 15))
control.rowId:SetText(data.sortIndex)
-- Some extra stuff for the Buyer cell to handle double-click and color changes
-- Plus add a marker if buyer is not in-guild (kiosk sale)
local buyerString
--[[TODO determine whether or not to allow both
if MasterMerchant.systemSavedVariables.viewBuyerSeller == 'buyer' then
buyerString = currentBuyer
else
buyerString = currentSeller
end
]]--
buyerString = currentSeller
control.seller:GetLabelControl():SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.seller:SetText(buyerString)
--[[TODO determine whether or not to allow both
If the seller is the player, color the seller green. Otherwise, blue.
local acctName = GetDisplayName()
if zo_strlower(buyerString) == zo_strlower(acctName) then
124D05
control.seller:SetNormalFontColor(0.18, 0.77, 0.05, 1)
control.seller:SetPressedFontColor(0.18, 0.77, 0.05, 1)
control.seller:SetMouseOverFontColor(0.32, 0.90, 0.18, 1)
else
15365E
control.seller:SetNormalFontColor(0.21, 0.54, 0.94, 1)
control.seller:SetPressedFontColor(0.21, 0.54, 0.94, 1)
control.seller:SetMouseOverFontColor(0.34, 0.67, 1, 1)
end
]]--
control.seller:SetNormalFontColor(0.21, 0.54, 0.94, 1)
control.seller:SetPressedFontColor(0.21, 0.54, 0.94, 1)
control.seller:SetMouseOverFontColor(0.34, 0.67, 1, 1)
control.seller:SetHandler('OnMouseUp', function(self, upInside)
MasterMerchant:my_NameHandler_OnLinkMouseUp(buyerString, upInside, self)
end)
-- Guild cell
control.guild:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.guild:SetText(currentGuild)
-- Item Icon
control.icon:SetHidden(false)
control.icon:SetTexture(actualItemIcon)
-- Item name cell
control.itemName:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.itemName:SetText(zo_strformat('<<t:1>>', currentItemLink))
-- Insert the item link into the chat box, with a quick substitution so brackets show up
--control.itemName:SetHandler('OnMouseDoubleClick', function()
-- ZO_ChatWindowTextEntryEditBox:SetText(ZO_ChatWindowTextEntryEditBox:GetText() .. zo_strgsub(currentItemLink, '|H0', '|H1'))
--end)
control.itemName:SetHandler('OnMouseEnter',
function() MasterMerchant.ShowToolTip(currentItemLink, control.itemName) end)
control.itemName:SetHandler('OnMouseExit', function() ClearTooltip(ItemTooltip) end)
-- Quantity cell
if actualItem.quant == 1 then control.quant:SetHidden(true)
else
control.quant:SetHidden(false)
control.quant:SetText(actualItem.quant)
end
-- Sale time cell
local dispTime = MasterMerchant.TextTimeSince(actualItem.timestamp)
control.purchaseTime:SetText(dispTime)
-- Handle the setting of whether or not to show pre-cut sale prices
-- zo_floor(number + 0.5) is a quick shorthand way to round for
-- positive values.
local dispPrice = actualItem.price
local quantity = actualItem.quant
if MasterMerchant.systemSavedVariables.showUnitPrice and quantity > 0 then
dispPrice = zo_floor((dispPrice / quantity) + 0.5)
end
-- Insert thousands separators for the price
local stringPrice = MasterMerchant.LocalizedNumber(dispPrice)
-- Finally, set the price
control.price:SetText(stringPrice .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
ZO_SortFilterList.SetupRow(self, control, data)
end
function MMScrollList:SetupReportsRow(control, data)
control.rowId = GetControl(control, 'RowId')
control.seller = GetControl(control, 'Seller')
control.guild = GetControl(control, 'Guild')
control.icon = GetControl(control, 'ItemIcon')
control.quant = GetControl(control, 'Quantity')
control.itemName = GetControl(control, 'ItemName')
control.sellTime = GetControl(control, 'SellTime')
control.price = GetControl(control, 'Price')
control.listingfee = GetControl(control, 'ListingFee')
local dataTable
if MasterMerchant.reportsViewMode == MasterMerchant.reportsPostedViewMode then
dataTable = posted_items_data
elseif MasterMerchant.reportsViewMode == MasterMerchant.reportsCanceledViewMode then
dataTable = cancelled_items_data
end
if not MasterMerchant:IsSalesDataValid(dataTable, data[1], data[2], data[3]) then return end
local actualItem = MasterMerchant:GetIndexedData(dataTable, data[1], data[2], data[3])
local currentItemLink = internal:GetItemLinkByIndex(actualItem['itemLink'])
local currentGuild = internal:GetGuildNameByIndex(actualItem['guild'])
local currentBuyer = internal:GetAccountNameByIndex(actualItem['buyer'])
local currentSeller = internal:GetAccountNameByIndex(actualItem['seller'])
local actualItemIcon = dataTable[data[1]][data[2]]['itemIcon']
local fontString = LMP:Fetch('font', MasterMerchant.systemSavedVariables.windowFont) .. '|%d'
control.rowId:SetFont(string.format(fontString, 12))
control.seller:SetFont(string.format(fontString, 15))
control.guild:SetFont(string.format(fontString, 15))
control.itemName:SetFont(string.format(fontString, 15))
control.quant:SetFont(string.format(fontString, 15) .. '|soft-shadow-thin')
control.sellTime:SetFont(string.format(fontString, 15))
control.price:SetFont(string.format(fontString, 15))
control.listingfee:SetFont(string.format(fontString, 15))
control.rowId:SetText(data.sortIndex)
control.seller:GetLabelControl():SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.seller:SetText(currentSeller)
control.seller:SetHandler('OnMouseUp', function(self, upInside)
MasterMerchant:my_NameHandler_OnLinkMouseUp(currentSeller, upInside, self)
end)
-- Guild cell
control.guild:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.guild:SetText(currentGuild)
local color = GetColorForGuild(currentGuild)
if color then
control.guild:SetColor(color:UnpackRGBA())
end
-- Item Icon
control.icon:SetHidden(false)
control.icon:SetTexture(actualItemIcon)
-- Item name cell
control.itemName:SetWrapMode(TEXT_WRAP_MODE_ELLIPSIS)
control.itemName:SetText(zo_strformat('<<t:1>>', currentItemLink))
-- Insert the item link into the chat box, with a quick substitution so brackets show up
--control.itemName:SetHandler('OnMouseDoubleClick', function()
-- ZO_ChatWindowTextEntryEditBox:SetText(ZO_ChatWindowTextEntryEditBox:GetText() .. zo_strgsub(currentItemLink, '|H0', '|H1'))
--end)
control.itemName:SetHandler('OnMouseEnter',
function() MasterMerchant.ShowToolTip(currentItemLink, control.itemName) end)
control.itemName:SetHandler('OnMouseExit', function() ClearTooltip(ItemTooltip) end)
-- Quantity cell
if actualItem.quant == 1 then control.quant:SetHidden(true)
else
control.quant:SetHidden(false)
control.quant:SetText(actualItem.quant)
end
-- Sale time cell
control.sellTime:SetText(MasterMerchant.TextTimeSince(actualItem.timestamp))
-- Handle the setting of whether or not to show pre-cut sale prices
-- zo_floor(number + 0.5) is a quick shorthand way to round for
-- positive values.
local dispPrice = actualItem.price
local quantity = actualItem.quant
if MasterMerchant.systemSavedVariables.showUnitPrice and quantity > 0 then
dispPrice = zo_floor((dispPrice / quantity) + 0.5)
end
-- Insert thousands separators for the price
local stringPrice = MasterMerchant.LocalizedNumber(dispPrice)
-- set the price
control.price:SetText(stringPrice .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
-- set listing fee
local listingFee = GetTradingHousePostPriceInfo(actualItem.price)
control.listingfee:SetText(listingFee .. ' |t16:16:EsoUI/Art/currency/currency_gold.dds|t')
ZO_SortFilterList.SetupRow(self, control, data)
end
function MMScrollList:ColorRow(control, data, mouseIsOver)
for i = 1, control:GetNumChildren() do
local child = control:GetChild(i)
if not child.nonRecolorable then
if child:GetType() == CT_LABEL then
if string.find(child:GetName(), 'Price$') then
child:SetColor(MM_COLOR_YELLOW_NORMAL:UnpackRGBA())
elseif not string.find(child:GetName(), 'Guild') then
child:SetColor(1, 1, 1, 1) -- Default color
end
end
end
end
end
function MMScrollList:InitializeDataType(controlName)
self.masterList = {}
if controlName == 'MasterMerchantWindow' then
ZO_ScrollList_AddDataType(self.list, 1, 'MasterMerchantDataRow', 36,
function(control, data) self:SetupSalesRow(control, data) end)
elseif controlName == 'MasterMerchantGuildWindow' then
ZO_ScrollList_AddDataType(self.list, 1, 'MasterMerchantGuildDataRow', 36,
function(control, data) self:SetupGuildSalesRow(control, data) end)
elseif controlName == 'MasterMerchantListingWindow' then
ZO_ScrollList_AddDataType(self.list, 1, 'MasterMerchantListingDataRow', 36,
function(control, data) self:SetupListingsRow(control, data) end)
elseif controlName == 'MasterMerchantPurchaseWindow' then
ZO_ScrollList_AddDataType(self.list, 1, 'MasterMerchantPurchaseDataRow', 36,
function(control, data) self:SetupPurchasesRow(control, data) end)
elseif controlName == 'MasterMerchantReportsWindow' then
ZO_ScrollList_AddDataType(self.list, 1, 'MasterMerchantReportsDataRow', 36,
function(control, data) self:SetupReportsRow(control, data) end)
else
MasterMerchant:dm("Warn", "Shit Hit the fan MMScrollList:InitializeDataType")
MasterMerchant:dm("Warn", controlName)
end
self:RefreshData()
end
function MMScrollList:New(control)
local skList = ZO_SortFilterList.New(self, control)
skList:InitializeDataType(control:GetName())
if control:GetName() == 'MasterMerchantWindow' then
skList.sortHeaderGroup:SelectHeaderByKey('time')
ZO_SortHeader_OnMouseExit(MasterMerchantWindowHeadersSellTime)
elseif control:GetName() == 'MasterMerchantGuildWindow' then
skList.sortHeaderGroup:SelectHeaderByKey('sales')
ZO_SortHeader_OnMouseExit(MasterMerchantGuildWindowHeadersSales)
elseif control:GetName() == 'MasterMerchantListingWindow' then
skList.sortHeaderGroup:SelectHeaderByKey('time')
ZO_SortHeader_OnMouseExit(MasterMerchantListingWindowHeadersListingTime)
elseif control:GetName() == 'MasterMerchantPurchaseWindow' then