-
Notifications
You must be signed in to change notification settings - Fork 0
/
BankItems.lua
3338 lines (3036 loc) · 127 KB
/
BankItems.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
--[[ *****************************************************************
BankItems v3.4.1.0
January 28, 2023
Author: Xinhuan @ US Blackrock Alliance
Author: Thranduel @ US - Mankirk
*****************************************************************
Description:
Type /bi or /bankitems to see what is currently in your
bank. You must visit your bank once to initialize.
An addon that remembers the contents of your bank, bags,
mail and equipped and display them anywhere in the world.
Also able to remember/display the banks of any character
on the same account on any server, as well as searching
and exporting lists of bag/bank items out.
Download:
BankItems - http://ui.worldofwar.net/ui.php?id=1699
Plugins:
These plugins allow clicking on the panel/plugin icon to
open BankItems, giving a summarised view of inventory
slots and money of each character on the same realm, and
deleting data with the menu quickly.
Titan Panel - http://ui.worldofwar.net/ui.php?id=3848
FuBar - http://ui.worldofwar.net/ui.php?id=3849
Commands:
/bi : open BankItems
/bi all : open BankItems and all bags
/bi allbank: open BankItems and all bank bags only
/bi clear : clear currently selected player's info
/bi clearall : clear all players' info
/bi showbuttun : show the minimap button
/bi hidebutton : hide the minimap button
/bi search itemname : search for items
/bis itemname : search for items
Most options are found in the GUI options panel.
Credits:
Original concept from Merphle
Last maintained by JASlaughter, then Galmok@Stormrage-EU.
Additional modifications for Classic by Hawksy on Elune
*****************************************************************
Xinhuan's Note:
This addon replaces the Blizzard function updateContainerFrameAnchors() in ContainerFrame.lua
if the option is set to open the BankItems bags along with the Blizzard default bags. This may
break any addon(s) that hook this function, but see no real reason why anyone would ever hook
that function in the first place.
]]
--------------------
-- Patch Notes:
-- Updated to handle larger than 16 slot bags by Galmok@Stormrage-EU: Version 11000
-- Removed double variable definitions (first defined in ContainerFrame.lua): Version 11001
-- Updated to be patch 1.11 compatible (bag texture fix) by Galmok@Stormrage-EU: Version 11100
-- 2 December 2006, by Xinhuan @ Blackrock US Alliance: Version 20000
-- Updated to be TBC v2.0.2 compliant.
-- BankItems expanded to include the 4 extra bank slots and 1 bank bag slot in the expansion.
-- BankItems bags will now use the right side of the screen like normal bags and stack with them.
-- Removed the "resetpos" option since all frames are now not movable.
-- Updated link parsing format to TBC itemlinks.
-- Fixed the dropdown menu bug.
-- 6 December 2006, by Xinhuan @ Blackrock US Alliance: Version 20001
-- Updated to be Live Servers v2.0.1.6180 compliant.
-- Added function to upgrade saved data to TBC itemlink format.
-- 10 January 2007, by Xinhuan @ Blackrock US Alliance: Version 20300
-- For use with Live Servers v2.0.3.6299. TOC update to 20003.
-- NEW: BankItems will now also remember the contents of your 5 inventory bags.
-- NEW: BankItems Will now remember purchased and unused bank bag slots (grey/red background).
-- NEW: Added optional draggable minimap button.
-- NEW: Added "/bi showbutton" and "/bi hidebutton" to show and hide the minimap button.
-- NEW: The BankItems main window is now movable (and cannot be dragged offscreen).
-- NEW: You can now set the scale and transparency of BankItems. The default scale is now 80%.
-- NEW: Added GUI options panel which contain most of the available options.
-- UPDATED: When hovering over the bag portrait of an open BankItems bagframe, the tooltip will now show the bag link.
-- CHANGED/FIXED: Changed the way BankItems bags show. They will no longer open up together with the normal bags because doing so taints the default UI and causes the petbar not to show/hide in combat. They will now open next to the BankItems main bank frame instead.
-- FIXED: Fixed extra spaces that can appear on "/bi list".
-- FIXED: Removed invisible "unclickable" space below the BankItems main bank frame.
-- FIXED: Fixed error due to ContainerIDToInventoryID(bagID) API change. Inputs outside the range of 1-11 (4 bag and 7 bank) are no longer valid input.
-- NEW: FuBar and Titan Panel plugins for BankItems are now available.
--
-- Because up to 12 possible bags can be displayed, users are adviced to change the scale in the GUI options.
-- 17 January 2007, by Xinhuan @ Blackrock US Alliance: Version 20500
-- For use with Live Servers v2.0.5.6320. TOC remains at 20003 (don't ask me why).
-- FIXED: Fixed a rare possible error with item link parsing.
-- CHANGED: BankItems normal inventory bags will now have normal bag textures to match the default UI. This makes it easier to tell which ones are bank bags and which aren't.
-- 26 January 2007, by Xinhuan @ Blackrock US Alliance: Version 20600
-- For use with Live Servers v2.0.6.6337. TOC remains at 20003.
-- NEW: Added an extra keybind and slash command option (/bi allbank) to only open bank bags as opposed to all bags.
-- NEW: Added in Auctioneer tooltip support for BankItems (thanks Knaledge).
-- NEW: Readded in the option to open the BankItem bags along with the default bags in the bottom right corner as per in v20300, because tainting issues are fixed.
-- 5 February 2007, by Xinhuan @ Blackrock US Alliance: Version 20601
-- For use with Live Servers v2.0.6.6337. TOC remains at 20003.
-- NEW: Added an option to make the BankItems main frame behave like Blizzard frames (will push frames to the right). However, this only works at 100% frame scaling.
-- NEW: Added a little hook to support Saeris Lootlink tooltips.
-- NEW: Added an option to change the default behavior of "/bi" without having to add the "all" or "allbank" options.
-- NEW: You can now export a list of items in your bags/bank by copying text from an export window.
-- FIXED: BankItems will now work with OneBank, Bagnon and other bag/bank type addons.
-- 5 February 2007, by Xinhuan @ Blackrock US Alliance: Version 20602
-- FIXED: Fixed the errors that occur on hitting the Options Button due to a mistake.
-- 17 April 2007, by Xinhuan @ Blackrock US Alliance: Version 20603
-- For use with Live Servers v2.0.12.6546. TOC remains at 20003.
-- NEW: BankItems will now remember the 20 items that are equipped on each character.
-- NEW: Added HealPoints tooltip support.
-- CHANGED: The user dropdown list is now sorted alphabetically by name then by realm (for characters of the same name on multiple realms).
-- FIXED: Saeris LootLink, Auctioneer and other Auctioneer related addons will now show information with the correct stack sizes instead of 1 item.
-- 31 May 2007, by Xinhuan @ Blackrock US Alliance: Version 21000
-- For use with Live Servers v2.1.0.6729. TOC update to 20100.
-- NEW: Added some extra options for item groupings and no-preformatting for exporting bank content.
-- 21 June 2007, by Xinhuan @ Blackrock US Alliance: Version 21001
-- For use with Live Servers v2.1.2.6803.
-- UPDATED: BankItems will now generate minimal garbage to be collected (memory efficiency). It used to generate as much as 50kb of garbage on _every_ inventory change.
-- NEW: BankItems will now remember where your character last logged out and display it in the BankItems frame title.
-- 17 August 2007, by Xinhuan @ Blackrock US Alliance: Version 21002
-- For use with Live Servers v2.1.3.6898.
-- FIXED: Opening and closing BankItems with keybindings will no longer cause Blizzard frames to behave oddly.
-- NEW: BankItems will now remember your items and cumulative gold in the mailbox when you visit it.
-- NEW: You may now search for items by name using "/bi search itemname".
-- 24 August 2007, by Xinhuan @ Blackrock US Alliance: Version 22000
-- For use with Live Servers v2.1.3.6898 and PTR Servers v0.2.0.7125.
-- UPDATED: Rewrote BankItems fully using the latest available APIs and layout functions. The original addon was written 2 years ago.
-- UPDATED: Improved load time, speed, efficiency, garbage generation, event handling. Lowered memory usage, removed redundant code.
-- UPDATED: Rewrote event handling code so that BankItems will no longer record your whole inventory multiple times on bag/equipped changes. This means when you change equipment sets using closetgnome/itemrack/etc, it will only record changes once and not as much as 38 times.
-- UPDATED: When something in your bags change, BankItems will now only record the affected bag(s) once instead of your whole inventory.
-- UPDATED: BankItems no longer uses XML files. BankItems.xml is still included as a zero-byte file to overwrite the old 49KB file and can be deleted.
-- REMOVED: Removed '/bi list' because it is useless and text exporting is already available.
-- FIXED: Occasional inverted toggle for 'Show Bag Prefix' option.
-- FIXED: Clicking on bags/items in BankItems no longer inserts a link when typing a message if the Shift key isn't held down.
-- FIXED: BankItems will no longer stop recording bags at the first empty bag slot it found (if for some reason you skipped bag slots).
-- FIXED: Bankitems will now store items when you leave/close the mailbox instead of opening to avoid a possible WoW client hang.
-- FIXED: Hopefully fixed the Auctioneer/EnhTooltip tooltip display bugs.
-- CHANGED: Mailbag display has been changed to a single bag with next/prev buttons to allow unlimited mail to be shown.
-- NEW: Added a number in brackets indicating the total number of each item found when using 'Group similar items' mode while using /bi search itemname.
-- NEW: Items and money that are sent to known alts on your account are saved in the BankItems recipient's mailbag directly.
-- 1st October 2007, by Xinhuan @ Blackrock US Alliance: Version 22001
-- For use with Live Servers v2.2.0.7272. TOC update to 20200.
-- CHANGED: Pressing Esc will now close the export/search results window.
-- CHANGED: Made the search results more readable and more detailed.
-- CHANGED: Changed options so that you can now choose which bags (bank, inventory, equipped, mail) to open on /bi.
-- NEW: Added /bis as a shortcut for /bi search.
-- NEW: Added button to bring up the search results window.
-- NEW: Added checkbox to only search the current realm instead of all realms.
-- REMOVED: Removed EnhTooltip and Stubby from OptionalDeps. They are no longer required to load before BankItems.
-- FIXED: Attempted to fix line 1555 concatenate local 'recipient' nil error.
-- FIXED: Fixed Export and Search only counting the first 18 slots of the mail bag.
-- 16th November 2007, by Xinhuan @ Blackrock US Alliance: Version 23000
-- For use with Live Servers v2.3.0.7561. TOC update to 20300.
-- FIXED: Removed the "Behavior" character from appearing on the dropdown list when "Show All Realms" is selected.
-- UPDATED: Updated BankItems to work with multiple attachments mail in 2.3.
-- UPDATED: Split off localization into its own file. Removed the empty XML file.
-- 2019-October-11 Hawksy @ Elune: BankItems Classic Version 2.5
-- Many modifications to get BankItems working in Classic, the most significant being not showing mail items in a bag
-- Mail items are still findable via Search and Export (and now in tooltips)
-- An alternative might have been to show mail in a bag, but not show equipped items in a bag
-- Added tooltip display code from Retail version, modified to work in Classic
-- Known anomalies:
-- No auction support, no expired mail support, no returned or deleted mail support, no money support
-- Player A can see something they mailed to player B, but player B can't see that it is incoming -- even though players A and B can see each other's non-mail amounts
-- 2019-December-29 Version 2.55 fixed an issue where moving something to or from the bank gave double-counting.
-- 2021-Jan-10 Version 2.56 updated for 1.13.6
-- January 29, 2023 Thranduel @ Mankirk: BankItems WotLK Classic Version 3.0
-- Fixed mod to work with 10.0 API added in WotLK 3.4.1
--]]
BankItems_Save = {} -- table, SavedVariable, can't be local
local bankPlayer = nil -- table reference
local bankPlayerName = nil -- string
local selfPlayer = nil -- table reference
local selfPlayerName = nil -- string
local selfPlayerRealm = nil -- string
local isBankOpen = false -- boolean, whether the real bank is open
local BankItems_Quantity = 1 -- integer, used for hooking EnhTooltip data
local bagsToUpdate = {} -- table, stores data about bags to update on next OnUpdate
local mailItem = {} -- table, stores data about the item to be mailed
local sortedKeys = {} -- table, for sorted player dropdown menu
local info = {} -- table, for dropdown menu generation
local BankItemsCFrames = {} -- table, own bag position tracking
BankItemsCFrames.bags = {}
BankItemsCFrames.bagsShown = 0
BankItems_Cache = {} -- table, contains a cache of items of every character on the same realm except the player
BankItems_SelfCache = {} -- table, contains a cache of only the player's items
BankItems_TooltipCache = {} -- table, contains a cache of tooltip lines that have been added
-- Some constants
local BANKITEMS_BOTTOM_SCREEN_LIMIT = 80 -- Pixels from bottom not to overlap BankItem bags
local BANKITEMS_UCFA = updateContainerFrameAnchors -- Remember Blizzard's UCFA for NON-SAFE replacement
local BAGNUMBERS = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 100} -- List of bag numbers used internally by BankItems (11 and 101 removed for Classic)
local BAGNUMBERSPLUSMAIL = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 100, 101} -- List of bag numbers used internally by BankItems (11 removed for Classic)
-- 0 through 4 are the player's bags, to be shown in reverse order, preceded by 100, the player's equipment
-- 5 through 10 are the bank bags, left to right
-- 101 is never visible, contains the mail information
local BANKITEMS_UIPANELWINDOWS_TABLE = {area = "left", pushable = 11, whileDead = 1} -- UI Panel layout to be used
local BANKITEMS_INVSLOT = {
"HeadSlot",
"NeckSlot",
"ShoulderSlot",
"ShirtSlot",
"ChestSlot",
"WaistSlot",
"LegsSlot",
"FeetSlot",
"WristSlot",
"HandsSlot",
"Finger0Slot",
"Finger1Slot",
"Trinket0Slot",
"Trinket1Slot",
"BackSlot",
"MainHandSlot",
"SecondaryHandSlot",
"RangedSlot",
"TabardSlot",
"AmmoSlot",
[0] = "AmmoSlot"
}
-- Localize some globals
local pairs, ipairs = pairs, ipairs
local gsub, strfind, strlower, strmatch, strsplit = gsub, strfind, strlower, strmatch, strsplit
local GetInboxHeaderInfo, GetInboxItem, GetInboxItemLink = GetInboxHeaderInfo, GetInboxItem, GetInboxItemLink
-- Localize some frame references
local BankItems_Frame
local BankItems_OptionsFrame
local BankItems_ExportFrame
local BankItems_UpdateFrame
local ItemButtonAr = {}
local BagButtonAr = {}
local BagContainerAr = {}
-- For hooking tooltip support
-- LinkWrangler is supported by LinkWrangler callback methods
local TooltipList = {
"GameTooltip",
"ItemRefTooltip",
"ShoppingTooltip",
"ComparisonTooltip", -- EquipCompare support
"EQCompareTooltip", -- EQCompare support
"tekKompareTooltip", -- tekKompare support
"IRR_",
"LinksTooltip", -- Links support
"AtlasLootTooltip", -- AtlasLoot support
"ItemMagicTooltip", -- ItemMagic support
"SniffTooltip", -- Sniff support
"LH_", -- LinkHeaven support
"MirrorTooltip", -- Mirror support
"LootLink_ResultsTooltip", -- Saeris' LootLink support
"TooltipExchange_TooltipShow", -- TooltipExchange support
}
-------------------------------------------------
-- OnFoo scripts of the various widgets
function BankItems_Button_OnEnter(self)
if (bankPlayer[self:GetID()]) then
BankItems_Quantity = bankPlayer[self:GetID()].count or 1
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetHyperlink(bankPlayer[self:GetID()].link)
BankItems_AddEnhTooltip(bankPlayer[self:GetID()].link, BankItems_Quantity)
if ( IsControlKeyDown() ) then
ShowInspectCursor()
end
end
end
function BankItems_Button_OnClick(self, button)
if (bankPlayer[self:GetID()]) then
if ( IsControlKeyDown() ) then
DressUpItemLink(bankPlayer[self:GetID()].link)
elseif ( button and button == "LeftButton" and IsShiftKeyDown() and ChatEdit_GetActiveWindow():IsVisible() ) then
ChatEdit_GetActiveWindow():Insert(bankPlayer[self:GetID()].link)
end
end
end
function BankItems_Bag_OnEnter(self)
local id = self:GetID()
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if (id == 0) then
GameTooltip:SetText(BACKPACK_TOOLTIP)
elseif (id == 100) then
GameTooltip:SetText(BANKITEMS_EQUIPPED_ITEMS_TEXT)
-- elseif (id == 101) then
-- GameTooltip:SetText(BANKITEMS_MAILBOX_ITEMS_TEXT)
elseif (bankPlayer["Bag"..id]) then
GameTooltip:SetHyperlink(bankPlayer["Bag"..id].link)
BankItems_AddEnhTooltip(bankPlayer["Bag"..id].link, 1)
end
end
function BankItems_Bag_OnClick(self, button)
local bagID = self:GetID()
local theBag = bankPlayer["Bag"..bagID]
if (not theBag) then
if (bagID == 100) then
BankItems_Chat(BANKITEMS_DATA_NOT_FOUND_TEXT)
-- elseif (bagID == 101) then
-- BankItems_Chat(BANKITEMS_MAILDATA_NOT_FOUND_TEXT)
end
return
end
if (button and button == "LeftButton" and IsShiftKeyDown() and ChatEdit_GetActiveWindow():IsVisible() and bagID and bagID > 0 and bagID <= 10) then
ChatEdit_GetActiveWindow():Insert(theBag.link)
return
end
if (theBag.size == 0) then
-- It should never be 0, so this code should never occur
BankItems_Chat(BANKITEMS_BAG_NOT_INIT_TEXT)
return
end
-- Rest of this code is copied from ContainerFrame.lua, modified slightly for size/links
local bagFrame = BagContainerAr[bagID]
if ( bagFrame:IsVisible() ) then
bagFrame:Hide()
return
end
-- Generate the frame
local bagName = bagFrame:GetName()
local bgTextureTop = getglobal(bagName.."BackgroundTop")
local bgTextureMiddle = getglobal(bagName.."BackgroundMiddle1")
local bgTextureBottom = getglobal(bagName.."BackgroundBottom")
local columns = NUM_CONTAINER_COLUMNS
local size = theBag.size
local rows = ceil(size / columns)
-- Set whether or not its a bank bag
local bagTextureSuffix = ""
if ( bagID > NUM_BAG_FRAMES ) then
bagTextureSuffix = "-Bank"
elseif ( bagID == KEYRING_CONTAINER ) then
bagTextureSuffix = "-Keyring"
end
-- Set textures
bgTextureTop:SetTexture("Interface\\ContainerFrame\\UI-Bag-Components"..bagTextureSuffix)
for i=1, MAX_BG_TEXTURES do
getglobal(bagName.."BackgroundMiddle"..i):SetTexture("Interface\\ContainerFrame\\UI-Bag-Components"..bagTextureSuffix)
getglobal(bagName.."BackgroundMiddle"..i):Hide()
end
bgTextureBottom:SetTexture("Interface\\ContainerFrame\\UI-Bag-Components"..bagTextureSuffix)
local bgTextureCount, height
local rowHeight = 41
-- Subtract one, since the top texture contains one row already
local remainingRows = rows-1
-- See if the bag needs the texture with two slots at the top
local isPlusTwoBag
if ( mod(size,columns) == 2 ) then
isPlusTwoBag = 1
end
-- Bag background display stuff
if ( isPlusTwoBag ) then
bgTextureTop:SetTexCoord(0, 1, 0.189453125, 0.330078125)
bgTextureTop:SetHeight(72)
else
if ( rows == 1 ) then
-- If only one row chop off the bottom of the texture
bgTextureTop:SetTexCoord(0, 1, 0.00390625, 0.16796875)
bgTextureTop:SetHeight(86)
else
bgTextureTop:SetTexCoord(0, 1, 0.00390625, 0.18359375)
bgTextureTop:SetHeight(94)
end
end
-- Calculate the number of background textures we're going to need
bgTextureCount = ceil(remainingRows/ROWS_IN_BG_TEXTURE)
local middleBgHeight = 0
-- If one row only special case
if ( rows == 1 ) then
bgTextureBottom:SetPoint("TOP", bgTextureMiddle:GetName(), "TOP", 0, 0)
bgTextureBottom:Show()
-- Hide middle bg textures
for i=1, MAX_BG_TEXTURES do
getglobal(bagName.."BackgroundMiddle"..i):Hide()
end
else
-- Try to cycle all the middle bg textures
local firstRowPixelOffset = 9
local firstRowTexCoordOffset = 0.353515625
for i=1, bgTextureCount do
bgTextureMiddle = getglobal(bagName.."BackgroundMiddle"..i)
if ( remainingRows > ROWS_IN_BG_TEXTURE ) then
-- If more rows left to draw than can fit in a texture then draw the max possible
height = ( ROWS_IN_BG_TEXTURE*rowHeight ) + firstRowTexCoordOffset
bgTextureMiddle:SetHeight(height)
bgTextureMiddle:SetTexCoord(0, 1, firstRowTexCoordOffset, ( height/BG_TEXTURE_HEIGHT + firstRowTexCoordOffset) )
bgTextureMiddle:Show()
remainingRows = remainingRows - ROWS_IN_BG_TEXTURE
middleBgHeight = middleBgHeight + height
else
-- If not its a huge bag
bgTextureMiddle:Show()
height = remainingRows*rowHeight-firstRowPixelOffset
bgTextureMiddle:SetHeight(height)
bgTextureMiddle:SetTexCoord(0, 1, firstRowTexCoordOffset, ( height/BG_TEXTURE_HEIGHT + firstRowTexCoordOffset) )
middleBgHeight = middleBgHeight + height
end
end
-- Position bottom texture
bgTextureBottom:SetPoint("TOP", bgTextureMiddle:GetName(), "BOTTOM", 0, 0)
bgTextureBottom:Show()
end
-- Set the frame height
bagFrame:SetHeight(bgTextureTop:GetHeight()+bgTextureBottom:GetHeight()+middleBgHeight)
if (bagID == 0) then
getglobal(bagName.."Name"):SetText(BACKPACK_TOOLTIP)
elseif (bagID == 100) then
getglobal(bagName.."Name"):SetText(BANKITEMS_EQUIPPED_ITEMS_TEXT)
-- elseif (bagID == 101) then
-- getglobal(bagName.."Name"):SetText(BANKITEMS_MAILBOX_ITEMS_TEXT)
else
getglobal(bagName.."Name"):SetText(BankItems_ParseLink(theBag.link))
end
getglobal(bagName.."Portrait"):SetTexture(theBag.icon)
bagFrame:SetWidth(CONTAINER_WIDTH)
for bagItem = 1, size do
local idx = size - (bagItem - 1)
local button = getglobal(bagName.."Item"..bagItem)
if ( bagItem == 1 ) then
button:SetPoint("BOTTOMRIGHT", bagName, "BOTTOMRIGHT", -12, 9)
else
if ( mod((bagItem-1), columns) == 0 ) then
button:SetPoint("BOTTOMRIGHT", bagName.."Item"..(bagItem - columns), "TOPRIGHT", 0, 4)
else
button:SetPoint("BOTTOMRIGHT", bagName.."Item"..(bagItem - 1), "BOTTOMLEFT", -5, 0)
end
end
button:Show()
end
for bagItem = size + 1, 36 do
getglobal(bagName.."Item"..bagItem):Hide()
end
BankItems_PopulateBag(bagID)
bagFrame:ClearAllPoints()
if (BankItems_Save.BagParent == 1) then
BankItemsCFrames.bags[BankItemsCFrames.bagsShown + 1] = bagFrame:GetName()
BankItemsUpdateCFrameAnchors()
elseif (BankItems_Save.BagParent == 2) then
ContainerFrame1.bags[ContainerFrame1.bagsShown + 1] = bagFrame:GetName()
updateContainerFrameAnchors()
end
bagFrame:Show()
PlaySound(SOUNDKIT.IG_BACKPACK_CLOSE)
end
function BankItems_Bag_OnShow(self)
BagButtonAr[self:GetID()].HighlightTexture:Show()
if (BankItems_Save.BagParent == 1) then
BankItemsCFrames.bagsShown = BankItemsCFrames.bagsShown + 1
elseif (BankItems_Save.BagParent == 2) then
ContainerFrame1.bagsShown = ContainerFrame1.bagsShown + 1
end
end
function BankItems_Bag_OnHide(self)
BagButtonAr[self:GetID()].HighlightTexture:Hide()
if (BankItems_Save.BagParent == 1) then
BankItemsCFrames.bagsShown = BankItemsCFrames.bagsShown - 1
tDeleteItem(BankItemsCFrames.bags, self:GetName()) -- defined in UIParent.lua
BankItemsUpdateCFrameAnchors()
elseif (BankItems_Save.BagParent == 2) then
ContainerFrame1.bagsShown = ContainerFrame1.bagsShown - 1
tDeleteItem(ContainerFrame1.bags, self:GetName()) -- defined in UIParent.lua
updateContainerFrameAnchors()
end
PlaySound(SOUNDKIT.IG_BACKPACK_CLOSE)
end
function BankItems_BagItem_OnEnter(self)
local bagID = self:GetParent():GetID()
local itemID = bankPlayer["Bag"..bagID].size - ( self:GetID() - 1 )
if (bagID == 100 and itemID == 20) then -- Treat slot 20 as slot 0 (ammo slot)
itemID = 0
-- elseif (bagID == 101) then
-- itemID = itemID + (mailPage - 1) * 18
end
local item = bankPlayer["Bag"..bagID][itemID]
if (item) then
BankItems_Quantity = item.count or 1
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if (type(item.link) == "number") then
GameTooltip:SetText(BANKITEMS_MAILBOX_MONEY_TEXT)
SetTooltipMoney(GameTooltip, item.link)
SetMoneyFrameColor("GameTooltipMoneyFrame", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
elseif (type(item.link) == "nil" and bagID == 100) then
GameTooltip:SetText((gsub(BANKITEMS_INVSLOT[itemID], "Slot", " Slot")))
else
GameTooltip:SetHyperlink(item.link)
BankItems_AddEnhTooltip(item.link, BankItems_Quantity)
end
if (IsControlKeyDown()) then
ShowInspectCursor()
end
GameTooltip:Show()
end
end
function BankItems_BagItem_OnClick(self, button)
local bagID = self:GetParent():GetID()
local itemID = bankPlayer["Bag"..bagID].size - ( self:GetID() - 1 )
if (bagID == 100 and itemID == 20) then -- Treat slot 20 as slot 0 (ammo slot)
itemID = 0
-- elseif (bagID == 101) then
-- itemID = itemID + (mailPage - 1) * 18
end
local item = bankPlayer["Bag"..bagID][itemID]
if (item) then
if ( IsControlKeyDown() ) then
if (type(item.link) ~= "number") then
DressUpItemLink(item.link)
end
elseif ( button and button == "LeftButton" and IsShiftKeyDown() and ChatEdit_GetActiveWindow():IsVisible() ) then
if (type(item.link) == "number") then
ChatEdit_GetActiveWindow():Insert(BankItem_ParseMoney(item.link))
else
ChatEdit_GetActiveWindow():Insert(item.link)
end
end
end
end
function BankItems_BagPortrait_OnEnter(self)
GameTooltip:SetOwner(self, "ANCHOR_LEFT")
local bagNum = self:GetParent():GetID()
if ( bagNum == 0 ) then
GameTooltip:SetText(BACKPACK_TOOLTIP)
elseif ( bagNum == 100 ) then
GameTooltip:SetText(BANKITEMS_EQUIPPED_ITEMS_TEXT)
-- elseif ( bagNum == 101 ) then
-- GameTooltip:SetText(BANKITEMS_MAILBOX_ITEMS_TEXT)
elseif ( bagNum == KEYRING_CONTAINER ) then
GameTooltip:SetText(KEYRING)
elseif ( bankPlayer["Bag"..bagNum].link ) then
GameTooltip:SetHyperlink(bankPlayer["Bag"..bagNum].link)
BankItems_AddEnhTooltip(bankPlayer["Bag"..bagNum].link, 1)
end
end
function BankItems_AddEnhTooltip(link, quantity)
if (IsAddOnLoaded("EnhTooltip") and EnhTooltip) then
local name = strmatch(link, "|h%[(.-)%]|h|r")
EnhTooltip.TooltipCall(GameTooltip, name, link, nil, quantity, nil, false, link)
end
end
function BankItems_Button_OnLeave(self)
ResetCursor()
GameTooltip:Hide()
end
function BankItems_Frame_OnShow(self)
PlaySound(SOUNDKIT.IG_MAINMENU_OPEN)
BankItems_PopulateFrame()
end
function BankItems_Frame_OnHide(self)
PlaySound(SOUNDKIT.IG_MAINMENU_OPEN)
for _, i in ipairs(BAGNUMBERS) do
BagContainerAr[i]:Hide()
end
end
function BankItems_Frame_OnDragStart(self)
self:StartMoving()
if (BankItems_Save.BagParent == 1) then
self:SetScript("OnUpdate", BankItemsUpdateCFrameAnchors)
elseif (BankItems_Save.BagParent == 2) then
self:SetScript("OnUpdate", updateContainerFrameAnchors)
end
end
function BankItems_Frame_OnDragStop(self)
self:StopMovingOrSizing()
self:SetScript("OnUpdate", nil)
BankItems_Save.pospoint, _, BankItems_Save.posrelpoint, BankItems_Save.posoffsetx, BankItems_Save.posoffsety = BankItems_Frame:GetPoint()
end
function BankItems_Frame_OnEvent(self, event, ...)
local arg1 = ...
if event == "UNIT_INVENTORY_CHANGED" and arg1 == "player" then
-- Delay updating to the next frame as multiple UNIT_INVENTORY_CHANGED events can occur in 1 frame
-- This is the reason why BankItemsFu delays updates by 2 frames.
bagsToUpdate.inv = true
BankItems_UpdateFrame:SetScript("OnUpdate", BankItems_UpdateFrame_OnUpdate)
elseif event == "BAG_UPDATE" then
-- Delay updating to the next frame as multiple BAG_UPDATE events can occur in 1 frame
-- This is the reason why BankItemsFu delays updates by 2 frames.
bagsToUpdate[tonumber(arg1)] = true
BankItems_UpdateFrame:SetScript("OnUpdate", BankItems_UpdateFrame_OnUpdate)
elseif event == "PLAYER_MONEY" then
BankItems_SaveMoney()
elseif strfind(event, "ZONE_CHANGED") then
BankItems_SaveZone()
elseif event == "PLAYER_ENTERING_WORLD" then
BankItems_SaveInvItems()
BankItems_SaveMoney()
BankItems_SaveZone()
BankItems_Generate_SelfItemCache()
elseif event == "PLAYERBANKSLOTS_CHANGED" or event == "PLAYERBANKBAGSLOTS_CHANGED" then --fires even when bank is closed
--"PLAYERBANKSLOTS_CHANGED" will fire when one of the main bank slots changes, an equipped bank bag is changed, or the combination of items in an equipped bank bag changes (permutation doesn't matter)
if not isBankOpen then
--[[If multiple items are removed at once (e.g. crafting) the first frame should
have an event for each item removed. The first event for each item will give the
first bank slot the item was removed from and the total count will already be fully
updated for the item when the event fires even if events for additional bank slots
for that item haven't fired yet. The additional bank slot events for each item
could be delayed a few seconds from the first event set.--]]
if arg1 and bankSlotsToUpdate then
bankSlotsToUpdate[#bankSlotsToUpdate + 1] = tonumber(arg1)
BankItems_UpdateFrame:SetScript("OnUpdate", BankItems_UpdateFrame_OnUpdate)
end
elseif arg1 and arg1 <= NUM_BANKGENERIC_SLOTS then
bagsToUpdate.bank = true
BankItems_UpdateFrame:SetScript("OnUpdate", BankItems_UpdateFrame_OnUpdate)
end
elseif event == "BANKFRAME_OPENED" then
isBankOpen = true
BankItems_SaveItems()
BankItems_Generate_SelfItemCache()
elseif event == "BANKFRAME_CLOSED" then
-- Hawksy: trying the following two lines (didn't seem to help)
BankItems_SaveItems()
BankItems_Generate_SelfItemCache()
isBankOpen = false
elseif event == "MAIL_SHOW" then
BankItems_Frame:RegisterEvent("MAIL_CLOSED")
self:RegisterEvent("MAIL_INBOX_UPDATE")
elseif event == "MAIL_INBOX_UPDATE" then
BankItems_SaveMailbox()
BankItems_Generate_SelfItemCache()
elseif event == "MAIL_CLOSED" then
BankItems_SaveMailbox()
BankItems_Generate_SelfItemCache()
self:UnregisterEvent(event) -- Because it can fire more than once if you walk away from mailbox
self:UnregisterEvent("MAIL_INBOX_UPDATE")
elseif event == "MAIL_SEND_SUCCESS" then
BankItems_Frame_MailSendSuccess()
BankItems_Generate_ItemCache()
self:UnregisterEvent(event)
elseif event == "ADDON_LOADED" and arg1 == "BankItems" then
BankItems_Initialize()
BankItems_Generate_ItemCache()
self:UnregisterEvent(event)
elseif event == "VARIABLES_LOADED" then
-- This overrides layout-cache.txt and also ensures all non-LoD addons have already loaded
BankItems_Initialize()
end
end
function BankItems_UpdateFrame_OnUpdate(self, elapsed)
if bagsToUpdate.elap then
bagsToUpdate.elap = bagsToUpdate.elap - elapsed
end
for i = 0, 10 do
if (bagsToUpdate[i]) then
BankItems_SaveInvItems(i)
bagsToUpdate[i] = nil
end
end
if bagsToUpdate.bank then
-- Hawksy: adding this bit (from retail) seems to fix the bank contents bug -- monitor it
BankItems_SaveItems(true)
bagsToUpdate.bank = nil
end
if (bagsToUpdate.inv) then
BankItems_SaveInvItems("inv")
bagsToUpdate.inv = nil
end
BankItems_Generate_SelfItemCache()
self:SetScript("OnUpdate", nil)
end
----------------------------------
-- Create frames
do
local temp
-- Create the main BankItems frame
BankItems_Frame = CreateFrame("Frame", "BankItems_Frame", UIParent)
BankItems_Frame:Hide()
BankItems_Frame:SetWidth(453)
BankItems_Frame:SetHeight(430)
BankItems_Frame:SetPoint("TOPLEFT", 50, -104)
BankItems_Frame:EnableMouse(true)
BankItems_Frame:SetToplevel(true)
BankItems_Frame:SetMovable(true)
BankItems_Frame:SetClampedToScreen(true)
-- Portrait
temp = BankItems_Frame:CreateTexture("BankItems_Portrait", "BACKGROUND")
temp:SetWidth(60)
temp:SetHeight(60)
temp:SetPoint("TOPLEFT", 7, -6)
-- Frame texture
temp = BankItems_Frame:CreateTexture(nil, "ARTWORK")
temp:SetWidth(512)
temp:SetHeight(512)
temp:SetPoint("TOPLEFT")
temp:SetTexture("Interface\\BankFrame\\UI-BankFrame")
-- Overlay frame texture for inventory/equipped/mail bags
temp = BankItems_Frame:CreateTexture(nil, "OVERLAY")
temp:SetTexture("Interface\\BankFrame\\UI-BankFrame")
do
local left, right, top, bottom
left = 37
right = 374
top = 197
bottom = 248
temp:SetWidth(right - left)
temp:SetHeight(bottom - top)
temp:SetPoint("TOPLEFT", left, -310)
temp:SetTexCoord(left/512, right/512, top/512, bottom/512)
end
-- Title text
temp = BankItems_Frame:CreateFontString("BankItems_TitleText", "ARTWORK", "GameFontHighlight")
temp:SetPoint("CENTER", 0, 192)
temp:SetJustifyH("CENTER")
-- Version text
temp = BankItems_Frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
temp:SetWidth(280)
temp:SetPoint("TOPLEFT", 80, -38)
temp:SetJustifyH("LEFT")
temp:SetText(BANKITEMS_VERSIONTEXT)
-- Item slots text
temp = BankItems_Frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
temp:SetPoint("CENTER", -18, 155)
temp:SetText(ITEMSLOTTEXT)
-- Bag slots text
temp = BankItems_Frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
temp:SetPoint("CENTER", -18, -43)
temp:SetText(BAGSLOTTEXT)
-- Close Button (inherits OnClick script to HideUIPanel(this:GetParent()))
temp = CreateFrame("Button", "BankItems_CloseButton", BankItems_Frame, "UIPanelCloseButton")
temp:SetPoint("TOPRIGHT", -50, -8)
-- Options Button
temp = CreateFrame("Button", "BankItems_OptionsButton", BankItems_Frame, "GameMenuButtonTemplate")
temp:SetWidth(85)
temp:SetHeight(25)
temp:SetPoint("TOPRIGHT", -70, -40)
temp:SetText(BANKITEMS_OPTION_TEXT)
temp:SetScript("OnClick", function()
if (BankItems_OptionsFrame:IsVisible()) then
BankItems_OptionsFrame:Hide()
else
BankItems_OptionsFrame:Show()
end
end)
-- had problems with ItemButtonTemplate, ItemButton isn't in classic, now seems to work anyway
-- Create the 28 (classic 24) main bank buttons
for i = 1, 28 do
ItemButtonAr[i] = CreateFrame("Button", "BankItems_Item"..i, BankItems_Frame, "ItemButtonTemplate")
ItemButtonAr[i]:SetID(i)
if (i == 1) then
ItemButtonAr[i]:SetPoint("TOPLEFT", 40, -73)
elseif (mod(i, 7) == 1) then
ItemButtonAr[i]:SetPoint("TOPLEFT", ItemButtonAr[i-7], "BOTTOMLEFT", 0, -7)
else
ItemButtonAr[i]:SetPoint("TOPLEFT", ItemButtonAr[i-1], "TOPRIGHT", 12, 0)
end
ItemButtonAr[i].count = _G["BankItems_Item"..i.."Count"]
ItemButtonAr[i].texture = _G["BankItems_Item"..i.."IconTexture"]
end
-- Create the 14 (classic 12) bag buttons
for _, i in ipairs(BAGNUMBERS) do
BagButtonAr[i] = CreateFrame("Button", "BankItems_Bag"..i, BankItems_Frame, "ItemButtonTemplate")
BagButtonAr[i]:SetID(i)
BagButtonAr[i].isBag = 1
BagButtonAr[i].HighlightTexture = BagButtonAr[i]:CreateTexture(nil, "OVERLAY")
BagButtonAr[i].HighlightTexture:Hide()
BagButtonAr[i].HighlightTexture:SetAllPoints(BagButtonAr[i])
BagButtonAr[i].HighlightTexture:SetTexture("Interface\\Buttons\\CheckButtonHilight")
BagButtonAr[i].HighlightTexture:SetBlendMode("ADD")
BagButtonAr[i].count = _G["BankItems_Bag"..i.."Count"]
BagButtonAr[i].texture = _G["BankItems_Bag"..i.."IconTexture"]
end
BagButtonAr[5]:SetPoint("TOPLEFT", ItemButtonAr[22], "BOTTOMLEFT", 0, -33) -- top row, bank bags
BagButtonAr[6]:SetPoint("TOPLEFT", BagButtonAr[5], "TOPRIGHT", 12, 0)
BagButtonAr[7]:SetPoint("TOPLEFT", BagButtonAr[6], "TOPRIGHT", 12, 0)
BagButtonAr[8]:SetPoint("TOPLEFT", BagButtonAr[7], "TOPRIGHT", 12, 0)
BagButtonAr[9]:SetPoint("TOPLEFT", BagButtonAr[8], "TOPRIGHT", 12, 0)
BagButtonAr[10]:SetPoint("TOPLEFT", BagButtonAr[9], "TOPRIGHT", 12, 0)
BagButtonAr[11]:SetPoint("TOPLEFT", BagButtonAr[10], "TOPRIGHT", 12, 0)
BagButtonAr[100]:SetPoint("TOPLEFT", BagButtonAr[6], "BOTTOMLEFT", 0, -6) -- bottom row, player bags
BagButtonAr[4]:SetPoint("TOPLEFT", BagButtonAr[100], "TOPRIGHT", 12, 0)
BagButtonAr[3]:SetPoint("TOPLEFT", BagButtonAr[4], "TOPRIGHT", 12, 0)
BagButtonAr[2]:SetPoint("TOPLEFT", BagButtonAr[3], "TOPRIGHT", 12, 0)
BagButtonAr[1]:SetPoint("TOPLEFT", BagButtonAr[2], "TOPRIGHT", 12, 0)
BagButtonAr[0]:SetPoint("TOPLEFT", BagButtonAr[1], "TOPRIGHT", 12, 0)
-- Create the Money frame
CreateFrame("Frame", "BankItems_MoneyFrame", BankItems_Frame, "SmallMoneyFrameTemplate")
BankItems_MoneyFrame:SetPoint("BOTTOMRIGHT", -60, 20)
BankItems_MoneyFrame:UnregisterAllEvents()
BankItems_MoneyFrame:SetScript("OnEvent", nil)
BankItems_MoneyFrame:SetScript("OnShow", nil)
BankItems_MoneyFrame.small = 1
BankItems_MoneyFrame.moneyType = "PLAYER"
BankItems_MoneyFrame.info = {
collapse = 1,
canPickup = 1,
showSmallerCoins = "Backpack"
}
-- Create the Money Total frame
CreateFrame("Frame", "BankItems_MoneyFrameTotal", BankItems_Frame, "SmallMoneyFrameTemplate")
BankItems_MoneyFrameTotal:SetPoint("BOTTOMLEFT", 38, 20)
BankItems_MoneyFrameTotal:UnregisterAllEvents()
BankItems_MoneyFrameTotal:SetScript("OnEvent", nil)
BankItems_MoneyFrameTotal:SetScript("OnShow", nil)
BankItems_MoneyFrameTotal.small = 1
BankItems_MoneyFrameTotal.moneyType = "PLAYER"
BankItems_MoneyFrameTotal.info = {
collapse = 1,
showSmallerCoins = "Backpack"
}
BankItems_MoneyFrameTotal:CreateFontString("BankItems_TotalMoneyText", "BACKGROUND", "GameFontHighlightSmall")
BankItems_TotalMoneyText:SetText("(total)")
BankItems_TotalMoneyText:SetJustifyH("LEFT")
BankItems_TotalMoneyText:SetPoint("LEFT", "BankItems_MoneyFrameTotalCopperButton", "RIGHT")
-- Create the 14 (classic 12) bags
for _, i in ipairs(BAGNUMBERS) do
local name = "BankItems_ContainerFrame"..i
BagContainerAr[i] = CreateFrame("Frame", name, UIParent)
BagContainerAr[i]:SetID(i)
BagContainerAr[i]:Hide()
BagContainerAr[i]:EnableMouse(true)
BagContainerAr[i]:SetToplevel(true)
BagContainerAr[i]:SetMovable(true)
BagContainerAr[i]:SetFrameStrata("MEDIUM")
BagContainerAr[i].portrait = BagContainerAr[i]:CreateTexture(name.."Portrait", "BACKGROUND")
BagContainerAr[i].portrait:SetWidth(40)
BagContainerAr[i].portrait:SetHeight(40)
BagContainerAr[i].portrait:SetPoint("TOPLEFT", 7, -5)
BagContainerAr[i].backgroundtop = BagContainerAr[i]:CreateTexture(name.."BackgroundTop", "ARTWORK")
BagContainerAr[i].backgroundtop:SetWidth(256)
BagContainerAr[i].backgroundtop:SetPoint("TOPRIGHT")
BagContainerAr[i].backgroundmiddle1 = BagContainerAr[i]:CreateTexture(name.."BackgroundMiddle1", "ARTWORK")
BagContainerAr[i].backgroundmiddle1:SetWidth(256)
BagContainerAr[i].backgroundmiddle1:SetPoint("TOP", BagContainerAr[i].backgroundtop, "BOTTOM")
BagContainerAr[i].backgroundmiddle2 = BagContainerAr[i]:CreateTexture(name.."BackgroundMiddle2", "ARTWORK")
BagContainerAr[i].backgroundmiddle2:SetWidth(256)
BagContainerAr[i].backgroundmiddle2:SetPoint("TOP", BagContainerAr[i].backgroundmiddle1, "BOTTOM")
BagContainerAr[i].backgroundbottom = BagContainerAr[i]:CreateTexture(name.."BackgroundBottom", "ARTWORK")
BagContainerAr[i].backgroundbottom:SetWidth(256)
BagContainerAr[i].backgroundbottom:SetHeight(10)
BagContainerAr[i].backgroundbottom:SetTexCoord(0, 1, 0.330078125, 0.349609375)
BagContainerAr[i].backgroundbottom:SetPoint("TOP", BagContainerAr[i].backgroundmiddle2, "BOTTOM")
BagContainerAr[i].name = BagContainerAr[i]:CreateFontString(name.."Name", "ARTWORK", "GameFontHighlight")
BagContainerAr[i].name:SetWidth(112)
BagContainerAr[i].name:SetHeight(12)
BagContainerAr[i].name:SetPoint("TOPLEFT", 47, -10)
for j = 1, 40 do
BagContainerAr[i][j] = CreateFrame("Button", name.."Item"..j, BagContainerAr[i], "ItemButtonTemplate")
BagContainerAr[i][j]:SetID(j)
BagContainerAr[i][j].count = _G[name.."Item"..j.."Count"]
BagContainerAr[i][j].texture = _G[name.."Item"..j.."IconTexture"]
end
BagContainerAr[i].PortraitButton = CreateFrame("Button", name.."PortraitButton", BagContainerAr[i])
BagContainerAr[i].PortraitButton:SetWidth(40)
BagContainerAr[i].PortraitButton:SetHeight(40)
BagContainerAr[i].PortraitButton:SetPoint("TOPLEFT", 7, -5)
BagContainerAr[i].CloseButton = CreateFrame("Button", name.."CloseButton", BagContainerAr[i], "UIPanelCloseButton")
BagContainerAr[i].CloseButton:SetPoint("TOPRIGHT", 0, -2)
end
-- Create the Show All Realms checkbox
CreateFrame("CheckButton", "BankItems_ShowAllRealms_Check", BankItems_Frame, "UICheckButtonTemplate")
BankItems_ShowAllRealms_Check:SetPoint("BOTTOMLEFT", 30, 40)
BankItems_ShowAllRealms_Check:SetHitRectInsets(0, -100, 0, 0)
BankItems_ShowAllRealms_Check:SetChecked(allRealms == true)
BankItems_ShowAllRealms_CheckText:SetText(BANKITEMS_ALLREALMS_TEXT)
BankItems_ShowAllRealms_Check:SetScript("OnClick", function(self)
allRealms = self:GetChecked()
if (allRealms) then
PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF)
else
PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON)
end
BankItems_UserDropdownGenerateKeys()
BankItems_UpdateMoney()
CloseDropDownMenus()
end)
-- Create the User Dropdown
CreateFrame("Frame", "BankItems_UserDropdown", BankItems_Frame, "UIDropDownMenuTemplate")
BankItems_UserDropdown:SetPoint("TOPRIGHT", BankItems_Frame, "BOTTOMRIGHT", -110, 69)
BankItems_UserDropdown:SetHitRectInsets(16, 16, 0, 0)
UIDropDownMenu_SetWidth(BankItems_UserDropdown, 140)
UIDropDownMenu_EnableDropDown(BankItems_UserDropdown)
-- Create the Export Button
CreateFrame("Button", "BankItems_ExportButton", BankItems_Frame)
BankItems_ExportButton:SetWidth(32)
BankItems_ExportButton:SetHeight(32)
BankItems_ExportButton:SetPoint("TOPRIGHT", BankItems_Frame, "BOTTOMRIGHT", -93, 71)
BankItems_ExportButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
BankItems_ExportButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
BankItems_ExportButton:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled")
BankItems_ExportButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
-- Create the Search Button
CreateFrame("Button", "BankItems_SearchButton", BankItems_Frame)
BankItems_SearchButton:SetWidth(32)
BankItems_SearchButton:SetHeight(32)
BankItems_SearchButton:SetPoint("TOPRIGHT", BankItems_Frame, "BOTTOMRIGHT", -65, 71)
BankItems_SearchButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
BankItems_SearchButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
BankItems_SearchButton:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled")
BankItems_SearchButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
-- Create the Next Mail page button in bag 101
-- CreateFrame("Button", "BankItems_NextMailButton", BagContainerAr[101])
-- BankItems_NextMailButton:SetWidth(32)
-- BankItems_NextMailButton:SetHeight(32)
-- BankItems_NextMailButton:SetPoint("TOPLEFT", 70, -22)
-- BankItems_NextMailButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
-- BankItems_NextMailButton:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down")
-- BankItems_NextMailButton:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled")
-- BankItems_NextMailButton:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
-- Create the Prev Mail page button in bag 101