-
Notifications
You must be signed in to change notification settings - Fork 10
/
engbank.lua
3060 lines (2654 loc) · 119 KB
/
engbank.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
-- Constants
EngBank_DEBUGMESSAGES = 0; -- 0 = off, 1 = on
EngBank_SHOWITEMDEBUGINFO = 0;
EngBank_WIPECONFIGONLOAD = 0; -- for debugging, test it out on a new config every load
BINDING_HEADER_EngBank = "EngBank @ EngBags";
BINDING_NAME_EB_TOGGLE = "Toggle Bank Window";
EngBank_MAXBUTTONS = 144;
EngBank_TOP_PADWINDOW = 75;
EngBank_WINDOWBOTTOMPADDING_EDITMODE = 50;
EngBank_WINDOWBOTTOMPADDING_NORMALMODE = 25;
EngBank_WindowBottomPadding = EngBank_WINDOWBOTTOMPADDING_NORMALMODE;
EngBank_AtBank = 0;
EngReplaceBank = 1;
local BankFrame_Saved = nil;
EngBank_item_cache = { {}, {}, {}, {}, {}, {}, {} }; -- cache of all the items as they appear in bags
EngBank_bar_positions = {};
EngBank_buttons = {};
EngBank_hilight_new = 0;
EngBank_edit_mode = 0;
EngBank_edit_hilight = ""; -- when editmode is 1, which items do you want to hilight
EngBank_edit_selected = ""; -- when editmode is 1, this is the class of item you clicked on
EngBank_RightClickMenu_mode = "";
EngBank_RightClickMenu_opts = {};
EngBank_Bags = { -1, 5, 6, 7, 8, 9, 10}
EngBags_Bars = {"first", "second", "third"}
EngBank_NOTNEEDED = 0; -- when items haven't changed, or only item counts
EngBank_REQUIRED = 1; -- when items have changed location, but it's been sorted once and won't break if we don't sort again
EngBank_MANDATORY = 2; -- it's never been sorted, the window is in an unstable state, you MUST sort.
EngBank_resort_required = EngBank_MANDATORY;
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_BuildTradeList = {}; -- only build a full list of trade skill info once
EngBank_Catagories_Exclude_List = {};
EngBank_ConfigOptions_Default = {
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 1.0, ["color"] = { 1,0,0.25 }, ["align"] = "center",
["text"] = "Window Options" },
},
{}, ---------------------------------------------------------------------------------------
{ -- Window Columns
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Columns:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = EngBags_MAXCOLUMNS_MIN },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = EngBags_MAXCOLUMNS_MIN, ["maxValue"] = EngBags_MAXCOLUMNS_MAX, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["maxColumns"];
end,
["func"] = function(v)
EngBankConfig["maxColumns"] = tonumber(v);
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = EngBags_MAXCOLUMNS_MAX }
},
{ -- Button Size
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Button Size:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = EngBags_BUTTONSIZE_MIN },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = EngBags_BUTTONSIZE_MIN, ["maxValue"] = EngBags_BUTTONSIZE_MAX, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["frameButtonSize"];
end,
["func"] = function(v)
EngBankConfig["frameButtonSize"] = tonumber(v);
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = EngBags_BUTTONSIZE_MAX }
},
{ -- Font Size / item count
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Item count font size:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = EngBags_FONTSIZE_MIN },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = EngBags_FONTSIZE_MIN, ["maxValue"] = EngBags_FONTSIZE_MAX, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["button_size_opts"]["EngBags_BUTTONFONTHEIGHT"];
end,
["func"] = function(v)
EngBankConfig["button_size_opts"]["EngBags_BUTTONFONTHEIGHT"] = tonumber(v);
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = EngBags_FONTSIZE_MAX }
},
{ -- Font Size / New text
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "New tag font size:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = EngBags_FONTSIZE_MIN },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = EngBags_FONTSIZE_MIN, ["maxValue"] = EngBags_FONTSIZE_MAX, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["button_size_opts"]["EngBags_BUTTONFONTHEIGHT2"];
end,
["func"] = function(v)
EngBankConfig["button_size_opts"]["EngBags_BUTTONFONTHEIGHT2"] = tonumber(v);
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = EngBags_FONTSIZE_MAX }
},
{}, ---------------------------------------------------------------------------------------
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 1.0, ["color"] = { 1,0,0.25 }, ["align"] = "center",
["text"] = "Display Strings & New Item Settings" },
},
{}, ---------------------------------------------------------------------------------------
{ -- "New" Text
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.5, ["color"] = { 1,1,0.25 },
["text"] = "New item text:" },
{ ["type"] = "Edit", ["ID"] = 1, ["width"] = 0.2, ["letters"]=10,
["defaultValue"] = function()
return EngBankConfig["newItemText"];
end,
["func"] = function(v)
EngBankConfig["newItemText"] = v;
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
},
{ -- Item count increased text
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.5, ["color"] = { 1,1,0.25 },
["text"] = "Item count increased:" },
{ ["type"] = "Edit", ["ID"] = 1, ["width"] = 0.2, ["letters"]=10,
["defaultValue"] = function()
return EngBankConfig["newItemTextPlus"];
end,
["func"] = function(v)
EngBankConfig["newItemTextPlus"] = v;
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
},
{ -- Item count decreased text
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.5, ["color"] = { 1,1,0.25 },
["text"] = "Item count decreased:" },
{ ["type"] = "Edit", ["ID"] = 1, ["width"] = 0.2, ["letters"]=10,
["defaultValue"] = function()
return EngBankConfig["newItemTextMinus"];
end,
["func"] = function(v)
EngBankConfig["newItemTextMinus"] = v;
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
},
},
{ -- New Tag timing
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.5, ["color"] = { 1,1,0.25 }, ["text"] = "Timeout for new tag - older (Minutes):" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.5, ["minValue"] = 0, ["maxValue"] = 60*6, ["valueStep"] = 1,
["defaultValue"] = function()
return ceil(EngBankConfig["newItemTimeout"] / 60);
end,
["func"] = function(v)
EngBankConfig["newItemTimeout"] = tonumber(v) * 60;
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
}
},
{ -- New Tag timing
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.5, ["color"] = { 1,1,0.25 }, ["text"] = "Timeout for new tag - newer (Minutes):" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.5, ["minValue"] = 0, ["maxValue"] = 60*1, ["valueStep"] = 1,
["defaultValue"] = function()
return ceil(EngBankConfig["newItemTimeout2"] / 60);
end,
["func"] = function(v)
EngBankConfig["newItemTimeout2"] = tonumber(v) * 60;
EngBank_SetDefaultValues(0);
EngBank_window_update_required = EngBank_MANDATORY;
EngBank_UpdateWindow();
end
}
},
{}, ---------------------------------------------------------------------------------------
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 1.0, ["color"] = { 1,0,0.25 }, ["align"] = "center",
["text"] = "Bag Hooks" },
},
{}, ---------------------------------------------------------------------------------------
{ -- Hook "Bank"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Bank:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["hook_BANKFRAME_OPENED"];
end,
["func"] = function(v)
EngBankConfig["hook_BANKFRAME_OPENED"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bank"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bank:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag-1"];
end,
["func"] = function(v)
EngBankConfig["show_Bag-1"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bag 5"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bag 1 Contents:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag5"];
end,
["func"] = function(v)
EngBankConfig["show_Bag5"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bag 6"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bag 2 Contents:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag6"];
end,
["func"] = function(v)
EngBankConfig["show_Bag6"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bag 7"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bag 3 Contents:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag7"];
end,
["func"] = function(v)
EngBankConfig["show_Bag7"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bag 8"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bag 4 Contents:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag8"];
end,
["func"] = function(v)
EngBankConfig["show_Bag8"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bag 9"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bag 5 Contents:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag9"];
end,
["func"] = function(v)
EngBankConfig["show_Bag9"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Show "Bag 10"
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Include Bag 6 Contents:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["show_Bag10"];
end,
["func"] = function(v)
EngBankConfig["show_Bag10"] = tonumber(v);
EngBank_SetDefaultValues(0);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{}, ---------------------------------------------------------------------------------------
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 1.0, ["color"] = { 1,0,0.25 }, ["align"] = "center",
["text"] = "Misc Options" },
},
{}, ---------------------------------------------------------------------------------------
{ -- Build trade skill list for export
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Build trade skill list for export:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Off" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["build_trade_list"];
end,
["func"] = function(v)
EngBankConfig["build_trade_list"] = tonumber(v);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "On" }
},
{ -- Tooltip Mode Setting
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.4, ["color"] = { 1,1,0.25 }, ["text"] = "Tooltip Mode:" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "right", ["text"] = "Mode 1" },
{ ["type"] = "Slider", ["ID"] = 1, ["width"] = 0.4, ["minValue"] = 0, ["maxValue"] = 1, ["valueStep"] = 1,
["defaultValue"] = function()
return EngBankConfig["tooltip_mode"];
end,
["func"] = function(v)
EngBankConfig["tooltip_mode"] = tonumber(v);
end
},
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.1, ["color"] = { 0,1,0.5 }, ["align"] = "left", ["text"] = "Mode 2" }
},
{}, ---------------------------------------------------------------------------------------
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 1.0, ["color"] = { 1,0,0.25 }, ["align"] = "center",
["text"] = "Item Search and Assignment" },
},
{}, ---------------------------------------------------------------------------------------
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.025+0.025+0.025 + 0.005, ["color"] = { 1,0,0.25 }, ["text"] = "" },
{ ["type"] = "Text", ["ID"] = 2, ["width"] = 0.20, ["color"] = { 1,0,0.25 }, ["text"] = "Category" },
{ ["type"] = "Text", ["ID"] = 3, ["width"] = 0.20, ["color"] = { 1,0,0.25 }, ["text"] = "Keywords" },
{ ["type"] = "Text", ["ID"] = 4, ["width"] = 0.35, ["color"] = { 1,0,0.25 }, ["text"] = "Tooltip Search" },
{ ["type"] = "Text", ["ID"] = 5, ["width"] = 0.170, ["color"] = { 1,0,0.25 }, ["text"] = "ItemType" }
}
};
--EngBank_ConfigOptions = EngBank_ConfigOptions_Default;
function EngBank_Config_GetItemSearchList(key, idx)
return EngBankConfig["item_search_list"][key][idx]
end
function EngBank_Config_AssignItemSearchList(v, key, idx)
if (key ~= nil) then
EngBankConfig["item_search_list"][key][idx] = v;
end
end
function EngBank_Config_GetItemSearchListLower(key, idx)
return string.lower(EngBankConfig["item_search_list"][key][idx]);
end
function EngBank_Config_AssignItemSearchListUpper(v, key, idx)
if (key ~= nil) then
EngBankConfig["item_search_list"][key][idx] = string.upper(v);
end
end
function EngBank_Config_SwapSearchListItems(unused_value, key1, key2)
local tmp;
if ( (EngBankConfig["item_search_list"][key1] ~= nil) and (EngBankConfig["item_search_list"][key2] ~= nil) ) then
tmp = EngBankConfig["item_search_list"][key1];
EngBankConfig["item_search_list"][key1] = EngBankConfig["item_search_list"][key2];
EngBankConfig["item_search_list"][key2] = tmp;
if (key1 > key2) then
EngBank_Opts_CurrentPosition = EngBank_Opts_CurrentPosition - 1;
else
EngBank_Opts_CurrentPosition = EngBank_Opts_CurrentPosition + 1;
end
EngBank_Options_UpdateWindow();
end
end
function EngBank_CreateConfigOptions()
local key,value;
EngBank_ConfigOptions = EngBank_ConfigOptions_Default;
for key,value in EngBankConfig["item_search_list"] do
table.insert( EngBank_ConfigOptions,
{
{ ["type"] = "Text", ["ID"] = 1, ["width"] = 0.025, ["color"] = { 1,0,1 }, ["text"] = key.."." },
{ ["type"] = "UpButton", ["ID"] = 1, ["width"] = 0.025,
["param1"] = key, ["param2"] = key-1,
["func"] = EngBank_Config_SwapSearchListItems
},
{ ["type"] = "DownButton", ["ID"] = 1, ["width"] = 0.025,
["param1"] = key, ["param2"] = key+1,
["func"] = EngBank_Config_SwapSearchListItems
},
{ ["type"] = "Edit", ["ID"] = 1, ["width"] = 0.20, ["letters"]=50, ["param1"] = key, ["param2"] = 1,
["defaultValue"] = EngBank_Config_GetItemSearchListLower, ["func"] = EngBank_Config_AssignItemSearchListUpper
},
{ ["type"] = "Edit", ["ID"] = 2, ["width"] = 0.20, ["letters"]=50, ["param1"] = key, ["param2"] = 2,
["defaultValue"] = EngBank_Config_GetItemSearchListLower, ["func"] = EngBank_Config_AssignItemSearchListUpper
},
{ ["type"] = "Edit", ["ID"] = 3, ["width"] = 0.35, ["letters"]=50, ["param1"] = key, ["param2"] = 3,
["defaultValue"] = EngBank_Config_GetItemSearchList, ["func"] = EngBank_Config_AssignItemSearchList
},
{ ["type"] = "Edit", ["ID"] = 4, ["width"] = 0.175, ["letters"]=50, ["param1"] = key, ["param2"] = 4,
["defaultValue"] = EngBank_Config_GetItemSearchList, ["func"] = EngBank_Config_AssignItemSearchList
}
} );
end
end
------------------------
function EngBank_CalcButtonSize(newsize)
local k = "button_size_opts";
-- constants
EngBags_BUTTONFRAME_X_PADDING = 2;
EngBags_BUTTONFRAME_Y_PADDING = 1;
EngBags_BUTTONFRAME_BUTTONWIDTH = newsize;
EngBags_BUTTONFRAME_BUTTONHEIGHT = newsize;
EngBags_BUTTONFRAME_WIDTH = EngBags_BUTTONFRAME_BUTTONWIDTH + (EngBags_BUTTONFRAME_X_PADDING*2);
EngBags_BUTTONFRAME_HEIGHT = EngBags_BUTTONFRAME_BUTTONHEIGHT + (EngBags_BUTTONFRAME_Y_PADDING*2);
EngBags_BKGRFRAME_WIDTH = EngBags_BUTTONFRAME_BUTTONWIDTH * 1.6;
EngBags_BKGRFRAME_HEIGHT = EngBags_BUTTONFRAME_BUTTONHEIGHT * 1.6;
EngBags_COOLDOWN_SCALE = 0.02125 * EngBags_BUTTONFRAME_BUTTONWIDTH;
if (EngBankConfig[k] == nil) then
EngBankConfig[k] = {
["EngBags_BUTTONFONTHEIGHT"] = 0.35 * EngBags_BUTTONFRAME_BUTTONHEIGHT,
["EngBags_BUTTONFONTHEIGHT2"] = 0.30 * EngBags_BUTTONFRAME_BUTTONHEIGHT,
["EngBank_BUTTONFONTDISTANCE_Y"] = (0.08 * EngBags_BUTTONFRAME_WIDTH),
["EngBank_BUTTONFONTDISTANCE_X"] = (0.10 * EngBags_BUTTONFRAME_HEIGHT)
};
if (newsize == 40) then
EngBankConfig[k]["EngBags_BUTTONFONTHEIGHT"] = 14;
EngBankConfig[k]["EngBags_BUTTONFONTHEIGHT2"] = 12;
EngBankConfig[k]["EngBank_BUTTONFONTDISTANCE_Y"] = 2;
EngBankConfig[k]["EngBank_BUTTONFONTDISTANCE_X"] = 5;
end
end
EngBags_BUTTONFONTHEIGHT = math.ceil(EngBankConfig[k]["EngBags_BUTTONFONTHEIGHT"]);
EngBags_BUTTONFONTHEIGHT2 = math.ceil(EngBankConfig[k]["EngBags_BUTTONFONTHEIGHT2"]);
EngBank_BUTTONFONTDISTANCE_Y = EngBankConfig[k]["EngBank_BUTTONFONTDISTANCE_Y"];
EngBank_BUTTONFONTDISTANCE_X = EngBankConfig[k]["EngBank_BUTTONFONTDISTANCE_X"];
end
-- scan the config and build a list of catagories
function EngBank_Catagories(exclude_list, select_bar)
local clist, key, value;
clist = {};
for key,value in EngBankConfig do
if ( (string.find(key, "putinslot--")) and (not string.find(key, "__version")) ) then
barclass = string.sub(key, 12);
if ( (exclude_list ~= nil) and (not exclude_list[barclass]) ) then
if ( (select_bar == nil) or (value==select_bar) ) then
table.insert(clist, barclass);
end
end
end
end
table.sort(clist);
return(clist);
end
-- sets a default value in the config if the current value is nil. Increment "resetversion" to override saved values
-- and force a new setting.
function EBank_SetDefault(varname, defaultvalue, resetversion, cleanupfunction, cleanup_param1, cleanup_param2)
EngBankConfig = EngBagsConfig["Bank"][EngBank_PLAYERID];
local orig_value = EngBankConfig[varname];
if (orig_value == nil) then
orig_value = "";
end
if (resetversion == nil) then
-- more debugging
message("* Warning, EngBank EBank_SetDefault called with nil reset version: "..varname.." *");
resetversion = 0;
end
if (cleanupfunction ~= nil) then
EngBankConfig[varname] = cleanupfunction(EngBankConfig[varname], cleanup_param1, cleanup_param2);
end
if (EngBankConfig[varname] == nil) then
EngBankConfig[varname] = defaultvalue;
elseif (EngBankConfig[varname.."__version"] == nil) then
EngBankConfig[varname] = defaultvalue;
elseif (EngBankConfig[varname.."__version"] < resetversion) then
EngBags_PrintDEBUG("old version: "..EngBankConfig[varname.."__version"]..", resetversion: "..resetversion);
EngBags_Print( varname.." was reset to it's default value. Changed from '"..orig_value.."' to "..EngBankConfig[varname], 1,0,0 );
EngBankConfig[varname] = defaultvalue;
end
EngBankConfig[varname.."__version"] = resetversion;
end
function EBags_SetDefault(varname, defaultvalue, resetversion, cleanupfunction, cleanup_param1, cleanup_param2)
local orig_value = EngBagsConfig[varname];
if (orig_value == nil) then
orig_value = "";
end
if (resetversion == nil) then
-- more debugging
message("* Warning, EngBank EBags_SetDefault called with nil reset version: "..varname.." *");
resetversion = 0;
end
if (cleanupfunction ~= nil) then
EngBagsConfig[varname] = cleanupfunction(EngBagsConfig[varname], cleanup_param1, cleanup_param2);
end
if (EngBagsConfig[varname] == nil) then
EngBagsConfig[varname] = defaultvalue;
elseif (EngBankConfig[varname.."__version"] == nil) then
EngBagsConfig[varname] = defaultvalue;
elseif (EngBankConfig[varname.."__version"] < resetversion) then
EngBags_PrintDEBUG("old version: "..EngBankConfig[varname.."__version"]..", resetversion: "..resetversion);
EngBags_Print( varname.." was reset to it's default value. Changed from '"..orig_value.."' to "..EngBagsConfig[varname], 1,0,0 );
EngBagsConfig[varname] = defaultvalue;
end
EngBankConfig[varname.."__version"] = resetversion;
end
function EngBank_SetClassBars()
local c = {};
local localizedPlayerClass, englishClass = UnitClass("player");
c["WARLOCK"] = "";
c["MAGE"] = "";
c["PRIEST"] = "";
c["HUNTER"] = "";
c["ROGUE"] = "";
c["SHAMAN"] = "";
c["DRUID"] = "";
c["WARRIOR"] = "";
c["PALADIN"] = "";
c[englishClass] = "putinslot--CLASS_ITEMS";
EngBankConfig["putinslot--SOULSHARDS"] = c["WARLOCK"].."1";
EngBankConfig["putinslot--WARLOCK_REAGENTS"] = c["WARLOCK"].."2";
EngBankConfig["putinslot--ROGUE_POISON"] = c["ROGUE"].."1";
EngBankConfig["putinslot--ROGUE_POWDER"] = c["ROGUE"].."1";
EngBankConfig["putinslot--MAGE_REAGENT"] = c["MAGE"].."1";
EngBankConfig["putinslot--SHAMAN_REAGENTS"] = c["SHAMAN"].."1";
end
-- set "re" to 1 to restore all default values
function EngBank_SetDefaultValues(re)
local i, key, value, newEngBankConfig;
local current_config_version = 2; -- increase this number to wipe everyone's settings
if ( (EngBankConfig == nil) or (EngBankConfig["configVersion"] == nil) or (EngBankConfig["configVersion"] ~= current_config_version) ) then
EngBankConfig = { ["configVersion"] = current_config_version };
end
EBank_SetDefault("tooltip_mode", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("hide_bag_icons", 0, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("hide_purchase button", 0, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("maxColumns", 9, 1+re, EngBags_NumericRange, EngBags_MAXCOLUMNS_MIN,EngBags_MAXCOLUMNS_MAX);
EBank_SetDefault("moveLock", 1, 1+re, EngBags_NumericRange, 0,1);
EBank_SetDefault("hook_BANKFRAME_OPENED", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag-1", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag5", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag6", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag7", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag8", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag9", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("show_Bag10", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("frameButtonSize", 40, 1+re, EngBags_NumericRange, 15, 80);
EngBank_CalcButtonSize(EngBankConfig["frameButtonSize"]);
EBank_SetDefault("frameLEFT", UIParent:GetRight() * UIParent:GetScale() * 0.5, 2+re, EngBags_NumericRange);
EBank_SetDefault("frameRIGHT", UIParent:GetRight() * UIParent:GetScale() * 0.975, 2+re, EngBags_NumericRange);
EBank_SetDefault("frameTOP", UIParent:GetTop() * UIParent:GetScale() * 0.90, 2+re, EngBags_NumericRange);
EBank_SetDefault("frameBOTTOM", UIParent:GetTop() * UIParent:GetScale() * 0.19, 2+re, EngBags_NumericRange);
EBank_SetDefault("frameXRelativeTo", "RIGHT", 1+re, EngBags_StringChoices, {"RIGHT","LEFT"} );
EBank_SetDefault("frameYRelativeTo", "BOTTOM", 1+re, EngBags_StringChoices, {"TOP","BOTTOM"} );
EBank_SetDefault("frameXSpace", 5, 1+re, EngBags_NumericRange, 0, 20);
EBank_SetDefault("frameYSpace", 5, 1+re, EngBags_NumericRange, 0, 20);
EBank_SetDefault("show_top_graphics", 1, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("build_trade_list", 0, 1+re, EngBags_NumericRange, 0, 1);
EBank_SetDefault("newItemText", "!", 1+re);
EBank_SetDefault("newItemTextPlus", "++", 1+re);
EBank_SetDefault("newItemTextMinus", "--", 1+re);
EBank_SetDefault("newItemText_Off", "", 1+re);
EBank_SetDefault("newItemTimeout", 60*60*3 , 1+re, EngBags_NumericRange); -- 3 hours for an item to lose "new" status
EBank_SetDefault("newItemTimeout2", 60*10 , 1+re, EngBags_NumericRange); -- 10 minutes
EBank_SetDefault("newItemColor1_R", 0.9 , 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("newItemColor1_G", 0.9 , 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("newItemColor1_B", 0.2 , 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("newItemColor2_R", 0.0 , 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("newItemColor2_G", 1.0 , 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("newItemColor2_B", 0.4 , 1+re, EngBags_NumericRange, 0, 1.0);
for i = 1, EngBags_MAINWINDOWCOLORIDX do
EBank_SetDefault("bar_colors_"..i.."_background_r", 0.5, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_background_g", 0.0, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_background_b", 0.0, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_background_a", 0.5, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_border_r", 1.0, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_border_g", 0.0, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_border_b", 0.0, 1+re, EngBags_NumericRange, 0, 1.0);
EBank_SetDefault("bar_colors_"..i.."_border_a", 0.5, 1+re, EngBags_NumericRange, 0, 1.0);
end
EngBank_SetClassBars();
-- default slot locations for items
EBank_SetDefault("putinslot--CLASS_ITEMS1", 15, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EMPTY_PROJECTILE_SLOTS", 15, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--USED_PROJECTILE_SLOTS", 15, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--PROJECTILE", 14, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS); -- arrows and bullets that AREN'T in your shot bags
EBank_SetDefault("putinslot--EMPTY_SLOTS", 13, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS); -- Empty slots go in this bar
EBank_SetDefault("putinslot--GRAY_ITEMS", 13, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS); -- Gray items go in this bar
--
EBank_SetDefault("putinslot--OTHERORUNKNOWN", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS); -- if not soulbound, but doesn't match any other catagory, it goes here
EBank_SetDefault("putinslot--TRADEGOODS", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--RECIPE", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--PATTERN", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--SCHEMATIC", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--FORMULA", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADESKILL_COOKING", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADESKILL_FIRSTAID", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--OTHERSOULBOUND", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS); -- this will usually be soulbound equipment
EBank_SetDefault("putinslot--CUSTOM_01", 10, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--CUSTOM_02", 10, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--CUSTOM_03", 10, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--CUSTOM_04", 10, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--CUSTOM_05", 10, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--CUSTOM_06", 10, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
--
EBank_SetDefault("putinslot--CONSUMABLE", 9, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADESKILL_2", 8, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADESKILL_1", 8, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADESKILL_2_CREATED", 8, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADESKILL_1_CREATED", 8, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPPED", 7, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
--
EBank_SetDefault("putinslot--FOOD", 6, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--DRINK", 5, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--QUESTITEMS", 4, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
--
EBank_SetDefault("putinslot--HEALINGPOTION", 3, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--HEALTHSTONE", 3, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--MANAPOTION", 2, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--BANDAGE", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--REAGENT", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--JUJU", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--MISC", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--TRADETOOLS", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--MINIPET", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--HEARTH", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--KEYS", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--CLASS_ITEMS2", 1, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
-- NEW EQUIP SORTING
EBank_SetDefault("putinslot--BOP_BOE", 12, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPSHIRT", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPSHOULDER", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPLEGS", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPFEET", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPFINGER", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPWRIST", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPTABARD", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPBACK", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPCHEST", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPHEAD", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPNECK", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPHANDS", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPWAIST", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPTRINKET", 11, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPFIRERESIST", 7, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPFROSTRESIST", 7, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPSHADOWRESIST", 7, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPNATURERESIST", 7, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
EBank_SetDefault("putinslot--EQUIPARCANERESIST", 7, 1+re, EngBags_NumericRange, 1, EngBags_MAX_BARS);
-- default item overrides
EBank_SetDefault("itemoverride_loaddefaults", 1, 3+re, EngBags_NumericRange, 0, 1);
if (EngBankConfig["itemoverride_loaddefaults"] == 1) then
EngBankConfig["item_overrides"] = EngBags_DefaultItemOverrides;
EngBankConfig["item_search_list"] = EngBags_DefaultSearchList;
for key,value in EngBankConfig["item_search_list"] do
if (string.sub(value[4], 1, 5) == "loc::") then
EngBankConfig["item_search_list"][key][4] = EBLocal[ string.sub(value[4],6) ];
end
end
for key,value in EBLocal["string_searches"] do
table.insert(EngBankConfig["item_search_list"], EngBags_DefaultSearchItemsINSERTTO,
{ value[1], "", value[2], "" } );
end
EngBankConfig["itemoverride_loaddefaults"] = 0;
end
-- cleanup old overrides that shouldn't be in the config anymore
newEngBankConfig = EngBankConfig;
for key,value in EngBankConfig do
if (string.find(key, "itemoverride--")) then
newEngBankConfig = EngBags_Table_RemoveKey(newEngBankConfig, key);
end
end
EngBankConfig = newEngBankConfig;
-- default sort views / default "allow new items in bar" settings
EBank_SetDefault("bar_sort_"..EngBankConfig["putinslot--EMPTY_SLOTS"], EngBags_SORTBYNAMEREV, 2+re, EngBags_NumericRange, EngBags_SORTLOWESTVALUE, EngBags_SORTHIGHESTVALUE);
EBank_SetDefault("bar_sort_"..EngBankConfig["putinslot--HEALINGPOTION"], EngBags_SORTBYNAMEREV, 2+re, EngBags_NumericRange, EngBags_SORTLOWESTVALUE, EngBags_SORTHIGHESTVALUE);
EBank_SetDefault("bar_sort_"..EngBankConfig["putinslot--MANAPOTION"], EngBags_SORTBYNAMEREV, 2+re, EngBags_NumericRange, EngBags_SORTLOWESTVALUE, EngBags_SORTHIGHESTVALUE);
EBank_SetDefault("bar_sort_"..EngBankConfig["putinslot--TRADEGOODS"], EngBags_SORTBYNAMEREV, 2+re, EngBags_NumericRange, EngBags_SORTLOWESTVALUE, EngBags_SORTHIGHESTVALUE);
for i = 1, EngBags_MAX_BARS do
EBank_SetDefault("bar_sort_"..i, EngBags_SORTBYNAME, 2+re, EngBags_NumericRange, EngBags_SORTLOWESTVALUE, EngBags_SORTHIGHESTVALUE);
EBank_SetDefault("allow_new_in_bar_"..i, 1, 1+re, EngBags_NumericRange, 0, 1);
end
-- find matching catagories that are not assigned
for key,value in EngBankConfig["item_search_list"] do
if (EngBankConfig["putinslot--"..value[1]] == nil) then
message("EngBank: Unassigned catagory: "..value[1].." -- It has been assigned to slot 1");
EngBankConfig["putinslot--"..value[1]] = 1;
end
end
if (re>0) then
EngBank_SetDefaultValues(0);
end
end
function EngBank_SetTradeSkills()
local k,v;
EngBank_TRADE1 = "";
EngBank_TRADE2 = "";
for k,v in EngBagsConfig[EngBank_PLAYERID]["tradeskills"] do
if ((k ~= EBLocal["Cooking"]) and (k ~= EBLocal["First Aid"])) then
EngBank_TRADE1 = EngBank_TRADE2;
EngBank_TRADE2 = k;
end
end
end
function EngBank_init()
EngBags_SetDefaultValues();
EngBags_PLAYERID = UnitName("player").."|"..EngBags_Trim(GetCVar("realmName"));
EngBank_PLAYERID = EngBags_PLAYERID;
if ( EngBagsItems[EngBank_PLAYERID] == nil) then
EngBagsItems[EngBank_PLAYERID] = {};
end
-- change imported from auctioneer team.. what does it do?
UIPanelWindows["EngBank_frame"] = { area = "left", pushable = 6 };
if ( EngBank_WIPECONFIGONLOAD == 1 ) then
EngBankConfig = {};
end
-- Load localization -- ERR_BADATTACKPOS is a blizzard defined constant for displaying an error message.
-- it should be good enough to determine what language the game is running in.
if ( ERR_BADATTACKPOS == ERR_BADATTACKPOS_LOCAL_EN ) then
-- US/English
EngBank_load_Localization("EN");
elseif ( ERR_BADATTACKPOS == ERR_BADATTACKPOS_LOCAL_FR ) then
-- French
EngBank_load_Localization("FR");
elseif ( ERR_BADATTACKPOS == ERR_BADATTACKPOS_LOCAL_DE ) then
-- German
EngBank_load_Localization("DE");
else
-- have to load something... :(
--EngBags_Print("*** No localization found, stuff won't work properly ***", 1,0.25,0.25 );
message("EngBank: No localization found, stuff won't work properly");
EngBank_load_Localization("EN");
end
-- register slash command
SlashCmdList["EngBank"] = EngBank_cmd;
SLASH_EngBank1 = "/ebinv";
SLASH_EngBank2 = "/eb";
if ( EngBagsConfig["Bank"][EngBank_PLAYERID] == nil ) then
EngBagsConfig["Bank"][EngBank_PLAYERID] = {};
end
-- load default values
EngBank_SetDefaultValues(0);
EngBank_SetReplaceBank();
-- go through the tradeskill list, and remove what shouldn't be there
-- bah, do it in a lazy way, just wipe it
if (EngBagsConfig[EngBank_PLAYERID] == nil) then
EngBagsConfig[EngBank_PLAYERID] = {};
end
if (EngBagsConfig[EngBank_PLAYERID]["tradeskills"] == nil) then
EngBagsConfig[EngBank_PLAYERID]["tradeskills"] = {};
end
local max_skills = 2;
if (EngBagsConfig[EngBank_PLAYERID]["tradeskills"][EBLocal["Cooking"]] ~= nil) then
max_skills = max_skills + 1;
end
if (EngBagsConfig[EngBank_PLAYERID]["tradeskills"][EBLocal["First Aid"]] ~= nil) then
max_skills = max_skills + 1;
end
if (table.getn(EngBagsConfig[EngBank_PLAYERID]["tradeskills"]) > max_skills) then
EngBagsConfig[EngBank_PLAYERID]["tradeskills"] = {}; -- wipe it out
EngBagsConfig[EngBank_PLAYERID]["tradeskill_items"] = {};
end
-- detailed info about tradeskills
if (EngBagsConfig[EngBank_PLAYERID]["trades"] == nil) then
EngBagsConfig[EngBank_PLAYERID]["trades"] = {};
end
EngBank_SetTradeSkills();
-- setup hooks
EngBank_RegisterHooks(EngBank_HOOKS_REGISTER);
EngBank_Button_HighlightToggle:SetText(EBLocal["EngBank_Button_HighlightToggle_off"]);
EngBank_Button_ChangeEditMode:SetText(EBLocal["EngBank_Button_ChangeEditMode_off"]);
if (EngBankConfig["moveLock"] == 0) then
EngBank_Button_MoveLockToggle:SetText(EBLocal["EngBank_Button_MoveLock_locked"]);
else
EngBank_Button_MoveLockToggle:SetText(EBLocal["EngBank_Button_MoveLock_unlocked"]);
end
EngBank_OnEvent("UPDATE_INVENTORY_ALERTS"); -- reload the items currently equipped
end
function EngBank_Update_BagSlots()
local numSlots, full = GetNumBankSlots();
local cost = GetBankSlotCost(numSlots);
if ( (not full) and (EngBankConfig["hide_purchase button"]==0) ) then
MoneyFrame_Update("EngBank_SlotCostFrame", cost);
else
EngBank_SlotCostFrame:Hide();
EngBank_PurchaseButton:Hide();
end
B4nkFrameBag1:SetScale(0.7);
B4nkFrameBag2:SetScale(0.7);
B4nkFrameBag3:SetScale(0.7);
B4nkFrameBag4:SetScale(0.7);
B4nkFrameBag5:SetScale(0.7);
B4nkFrameBag6:SetScale(0.7);
if (numSlots < 1) then B4nkFrameBag1:Hide(); else B4nkFrameBag1:Show(); end
if (numSlots < 2) then B4nkFrameBag2:Hide(); else B4nkFrameBag2:Show(); end
if (numSlots < 3) then B4nkFrameBag3:Hide(); else B4nkFrameBag3:Show(); end
if (numSlots < 4) then B4nkFrameBag4:Hide(); else B4nkFrameBag4:Show(); end
if (numSlots < 5) then B4nkFrameBag5:Hide(); else B4nkFrameBag5:Show(); end
if (numSlots < 6) then B4nkFrameBag6:Hide(); else B4nkFrameBag6:Show(); end
for i=1, NUM_BANKBAGSLOTS, 1 do
local button = getglobal("B4nkFrameBag"..i);
local tooltipText;
if ( button ) then
if ( i <= numSlots ) then
SetItemButtonTextureVertexColor(button, 1.0,1.0,1.0);
button.tooltipText = BANK_BAG;
else
SetItemButtonTextureVertexColor(button, 1.0,0.1,0.1);
button.tooltipText = BANK_BAG_PURCHASE;
end
end
end
end
function EngBank_OnEvent(event)
if (event == "BANKFRAME_OPENED") then
if EngReplaceBank == 1 then
EngBank_AtBank = 1;
EngBank_resort_required = EngBank_MANDATORY;
EngBank_edit_mode = 0;
EngBankFrameTitleText:SetText(UnitName("npc"));
SetPortraitTexture(EngBank_framePortrait, "npc");
EngBank_PlayerName = UnitName("player").."|"..EngBags_Trim(GetCVar("realmName"));
EngBank_frame:Show();
EngBank_Update_BagSlots();
end
elseif (event == "BANKFRAME_CLOSED") then
EngBank_AtBank = 0;
CloseBackpack(); -- Close Backpack when leaving
if EngReplaceBank == 1 then
EngBank_frame:Hide();
end
end
if ( EngBank_frame:IsVisible() ) then
EngBags_PrintDEBUG("bank_event: '"..event.."'");
if ( event == "BAG_UPDATE" ) then
EngBank_UpdateWindow();
elseif ( event == "BAG_UPDATE_COOLDOWN" ) then
EngBank_UpdateWindow();
elseif ( event == "ITEM_LOCK_CHANGED" ) then
EngBank_UpdateWindow();
elseif ( event == "PLAYERBANKBAGSLOTS_CHANGED" or event == "PLAYERBANKSLOTS_CHANGED") then
EngBank_Update_BagSlots();
-- elseif ( event == "CRAFT_SHOW" ) then
-- EngBags_Craft();
-- elseif ( event == "TRADE_SKILL_SHOW" ) then
-- EngBags_Trade();
-- elseif ( event == "UPDATE_INVENTORY_ALERTS" ) then
-- local itemLink;
-- local a,b,c,d;
--
-- EngBags_PrintDEBUG("About to scan inventory");
--
-- if (EngBagsConfig[EngBank_PLAYERID]["equipped_items"] == nil) then
-- EngBagsConfig[EngBank_PLAYERID]["equipped_items"] = {};
-- end
--
-- for key,value in { "HeadSlot","NeckSlot","ShoulderSlot","BackSlot","ChestSlot",
-- "ShirtSlot","TabardSlot","WristSlot","HandsSlot","WaistSlot","LegsSlot",
-- "FeetSlot","Finger0Slot","Finger1Slot","Trinket0Slot","Trinket1Slot",
-- "MainHandSlot","SecondaryHandSlot","RangedSlot" } do
--
-- itemLink = GetInventoryItemLink("player", GetInventorySlotInfo(value) );
-- if ( (itemLink ~= nil) and (type(itemLink) == "string") ) then
-- for a,b,c,d in string.gfind(itemLink, "(%d+):(%d+):(%d+):(%d+)") do
-- itemLink = ""..a..":0:"..c..":0";
-- end
--
-- EngBagsConfig[EngBank_PLAYERID]["equipped_items"][itemLink] = 1;
-- end
-- end
--
-- EngBank_UpdateWindow();
else
EngBags_PrintDEBUG("OnEvent: No event handler found.");
end
EngBags_PrintDEBUG("OnEvent: Finished "..event);
end
end