Repository navigation
Expand file tree
/
Copy pathBankItems.lua
More file actions
10220 lines (9545 loc) · 429 KB
/
Copy pathBankItems.lua
File metadata and controls
10220 lines (9545 loc) · 429 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[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, equipped, currency, AH, void storage 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.
BankItems will also remember the contents of Guild Banks
if you are able to view them. Use /bigb to see them. Note
that Guild Banks are a shared repository and changes can
occur to it by other members of your guild.
- Curse: http://www.curse.com/addons/wow/bank-items
- Project site: https://www.wowace.com/projects/bank-items
Plugins:
These plugins allow clicking on the panel/plugin icon to
open BankItems, giving a summarised view money of each
character on the same realm.
LDB - Supplied by BankItems if LDB is detected
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
/bigb : open BankItems guild bank
/bigb clear : clear currently selected guild's info
/bimc : open Mail Call to see expiring mail
Most options are found in the GUI options panel.
Not a bug:
If you close your bank after retrieving/storing an item in it
too quickly and the server hasn't updated your inventory,
BankItems is unable to record the change to your bank when the
item actually moves later. The WoW API does not give you any
data about your bank once BANK_FRAME_CLOSED event has fired.
Credits:
Original concept from Merphle.
Maintained by JASlaughter, Galmok@Stormrage-EU, Xinhuan@Blackrock/Barthilas/Frostmourne-US, and Burstroc@Area 52-US.
*****************************************************************
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.
updateContainerFrameAnchors() is the very last function called by
UIParent_ManageFramePositions(), hence tainting it shouldn't be an issue for petbars or any
other frame. Also, note that UIParent_ManageFramePositions() is almost always securecalled
from other functions in Blizzard code.
]]
BankItems_Save = {} -- table, SavedVariable, can't be local
BankItems_SaveGuild = {} -- table, another SavedVariable
BankItems_SaveAccount = {} -- table, another SavedVariable
local bankPlayer = nil -- table reference
local bankPlayerName = nil -- string
local selfPlayer = nil -- table reference
local selfPlayerName = nil -- string
local selfPlayerRealmName = nil -- string, name of player's realm with all special characterrs (e.g. Thorium Brotherhood, Azjol-Nerub, etc.)
local selfPlayerRealmNormalized = nil -- string, name of player's realm with any spaces and hyphens removed (e.g. ThoriumBrotherhood, AzjolNerub, etc.)
local isBankOpen = false -- boolean, whether the real bank is open
local isVoidReadable = false -- boolean, whether the real void storage is open
local isGuildBankOpen = false -- boolean, whether the real guild bank is open
local dontUpdateClosedBank = false -- boolean, whether we should skip updating the closed bank's counts due to out-of-date data
local pages = {} -- table, reduce number of local variables in main function for bag pages
pages.Mail = 1 -- integer, current page of bag 101
pages.Currency = 1 -- integer, current page of bag 102
pages.AH = 1 -- integer, current page of bag 103
pages.Void = 1 -- integer, current page of bag 104
local voidPageSize = 18 -- integer, size of pages for bag 104
pages.ReagentBank = 1 -- integer, current page of bag 105 (Reagent Bank)
local reagentBankPageSize = 28 -- integer, size of pages for bag 105 (Reagent Bank)
pages.AccountBank = 1 -- integer, current page of bag 106 (Account Bank)
local accountBankPageSize = 28 -- integer, size of pages for bag 106 (Account Bank)
local BankItems_Quantity = 1 -- integer, used for hooking EnhTooltip data
local bagsToUpdate = {} -- table, stores data about bags to update on next OnUpdate
local bankSlotsToUpdate = {} -- table, stores data about bank slots to update on next OnUpdate
local mailItem = {} -- table, stores data about the item to be mailed
local sortedKeys = {} -- table, for sorted player drop-down menu
local sortedDelUserKeys = {} -- table, for sorted player deletion drop-down menu
local sortedDelGuildKeys = {} -- table, for sorted guild deletion drop-down menu
local sortedGuildKeys = {} -- table, for sorted guild drop-down menu
local selfPlayerConRealms = {} -- table, for list of realms connected to current character's realm
local realmNormalizer = {} -- table, key = realm name, value = normalized realm name
local info = {} -- table, for drop-down menu generation
local CurrencyStringCache = {} -- table, stores data of currency strings for currency names
local BankItemsMouseover = nil -- frame reference, current button with mouseover
local BankItemsCFrames = { -- table, own bag position tracking
bags = {},
bagsShown = 0,
}
local slotAdjust = { -- table, contains adjustments for finding non-nil values in updated reagent bank and void storage saved variables
[104] = {},
[105] = {},
[106] = {},
}
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_GuildCache = {} -- table, contains a cache of selected guild's items
BankItems_AccountCache = {} -- table, contains a cache of account items
BankItems_TooltipCache = {} -- table, contains a cache of tooltip lines that have been added
BankItems_FactionCache = {} -- table, contains a cache of player faction info
BankItems_GFactionCache = {} -- table, contains a cache of guild faction info
local filterSearchText = "" -- filter text
local function strVerToIntVer(stringVer) --convert version text to an integer for easier comparison
if not stringVer then return end
local a,b,c,d = strsplit(".", stringVer)
--6.2.0.1 = 6.02.00.01 = 6020001
return a*1000000+b*10000+c*100+d
end
-- Cataclysm and backwards compatibility
local TOC = select(4, GetBuildInfo())
local MAX_GUILDBANK_TABS = MAX_GUILDBANK_TABS or 8
-- Localization stuff, add a few more entries for convenience
local L = BANKITEMS_LOCALIZATION -- Localization table
L[" of "] = " "..L["of"].." "
-- Some constants
local BANKITEMS_VERSION = C_AddOns.GetAddOnMetadata("BankItems", "Version")
local BANKITEMS_VERSIONTEXT = "BankItems v"..BANKITEMS_VERSION
BANKITEMS_VERSION = strVerToIntVer(BANKITEMS_VERSION) --convert BANKITEMS_VERSION to an integer after saving BANKITEMS_VERSIONTEXT constant
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, 12, 100, 101, 102, 103, 104, 105, 106} -- List of bag numbers used internally by BankItems
local NUM_REAGENTBANKGENERIC_SLOTS = 98; --1..98 (14x7) Number of slots in the reagent bank. If Blizzard ever creates a constant, use it instead. They already have NUM_BANKGENERIC_SLOTS
local VOID_STORAGE_MAX = 80; --Total number of items allowed per Void Storage tab - Same name from Blizzard void storage code in case they make it a global/constant
local VOID_STORAGE_PAGES = 2; --Total number of Void Storage tabs - Same name from Blizzard void storage code in case they make it a global/constant
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",
"TABARDSLOT",
"PROF0TOOLSLOT",
"PROF0GEAR0SLOT",
"PROF0GEAR1SLOT",
"PROF1TOOLSLOT",
"PROF1GEAR0SLOT",
"PROF1GEAR1SLOT",
"COOKINGTOOLSLOT",
"COOKINGGEAR0SLOT",
"FISHINGTOOLSLOT",
"FISHINGGEAR0SLOT",
[30] = "FISHINGGEAR1SLOT",
}
local BANKITEMS_BEHAVIORLIST = {
L["Open bank bags"],
L["Open inventory bags"],
L["Open equipped items bag"],
L["Open mail bag"],
L["Open currencies bag"],
L["Open auction house bag"],
L["Open void storage bag"],
L["Open reagent bank"],
L["Open guild bank"],
}
local BANKITEMS_BEHAVIORLIST2 = {
L["Search bank and bank bags"],
L["Search inventory bags"],
L["Search equipped gear"],
L["Search mailbox"],
L["Search guild banks"],
L["Search account bank"]
}
local icons = {}
icons.ICON_AuctionHouse = "Interface\\Icons\\INV_Hammer_15"; --Wooden mace, supposed to look like an auctioneer gavel. The legacy BankItems AH icon. (what we call bag 103)
icons.ICON_VoidStorage = "Interface\\Icons\\INV_Enchant_EssenceCosmicGreater"; --The icon used by the second tab of Void Storage (what we call bag 104)
icons.ICON_ReagentBank = "Interface\\Icons\\INV_Enchant_ShardShadowfrostLarge" --old "Interface\\Icons\\INV_Misc_Bag_09_Green"; --Icon for the Reagent Pouch, and the icon we'll use for the reagent bank (what we call bag 105)
icons.ICON_AccountBank = "Interface\\Icons\\Garrison_building_barracks" --Icon for the Account/Warband bank (what we call bag 106)
icons.ICON_Mailbox = "Interface\\Icons\\INV_Letter_02.png" --old "Interface\\MailFrame\\Mail-Icon" --
icons.ICON_Currency = "Interface\\Icons\\INV_Misc_Coin_01" --old "Interface\\Icons\\Spell_Holy_ChampionsGrace"
icons.ICON_Equipped_Items = "Interface\\Icons\\INV_Shirt_White_01"
-- Localize some globals
local _G = getfenv(0)
local pairs, ipairs = pairs, ipairs
local tinsert, tremove, sort, wipe = tinsert, tremove, sort, wipe
local gsub, strfind, strlower, strmatch, strsplit, strtrim, tContains, time = gsub, strfind, strlower, strmatch, strsplit, strtrim, tContains, time
local format = format
local GetContainerItemInfo, GetContainerNumSlots = C_Container.GetContainerItemInfo, C_Container.GetContainerNumSlots
local GetInventoryItemLink, GetInventoryItemTexture, GetInventoryItemCount = GetInventoryItemLink, GetInventoryItemTexture, GetInventoryItemCount
local GetVoidItemInfo, GetVoidItemHyperlinkString = GetVoidItemInfo, GetVoidItemHyperlinkString
local GetMoney, IsReagentBankUnlocked = GetMoney, IsReagentBankUnlocked
local GetGuildBankTabInfo, GetGuildBankItemInfo, GetGuildBankItemLink = GetGuildBankTabInfo, GetGuildBankItemInfo, GetGuildBankItemLink
local GetInboxHeaderInfo, GetInboxItem, GetInboxItemLink = GetInboxHeaderInfo, GetInboxItem, GetInboxItemLink
local GetMerchantItemCostItem = GetMerchantItemCostItem
local GetItemReagentQualityByItemInfo, GetRecipeItemLink, GetRecipeFixedReagentItemLink, GetQuestLogItemLink, GetQuestItemLink = C_TradeSkillUI.GetItemReagentQualityByItemInfo, C_TradeSkillUI.GetRecipeItemLink, C_TradeSkillUI.GetRecipeFixedReagentItemLink, GetQuestLogItemLink, GetQuestItemLink
local GetItemIcon, GetItemIconByID, GetItemInfo, GetItemCount = C_Item.GetItemIcon, C_Item.GetItemIconByID, C_Item.GetItemInfo, C_Item.GetItemCount
local GetPetInfoBySpeciesID = C_PetJournal.GetPetInfoBySpeciesID
local ShowInspectCursor, ResetCursor, GetMouseFocus, IsControlKeyDown = ShowInspectCursor, ResetCursor, GetMouseFocus, IsControlKeyDown
-- Localize globals changing in Shadowlands
local GetCurrencyListInfo, GetCurrencyListLink, GetCurrencyListSize, GetBackpackCurrencyInfo = C_CurrencyInfo.GetCurrencyListInfo, C_CurrencyInfo.GetCurrencyListLink, C_CurrencyInfo.GetCurrencyListSize, C_CurrencyInfo.GetBackpackCurrencyInfo
local GetSelectedQuest, LE_ITEM_QUALITY_COMMON = C_QuestLog.GetSelectedQuest, Enum.ItemQuality.Common
-- Localize some frame references
local BankItems_Frame
local BankItems_GBFrame
local BankItems_OptionsFrame
local BankItems_ExportFrame
local BankItems_UpdateFrame
local ItemButtonAr = {}
local BagButtonAr = {}
local BagContainerAr = {}
local GBButtonAr = {}
local GBTabFrameAr = {}
local BankItems_RBFrame --Special Reagent Bank Frame
local RBButtonAr = {} --Reagent Bank Buttons
local BankItems_ABFrame --Special Account Bank Frame
local ABButtonAr = {} --Account Bank Buttons
local ABTabFrameAr = {} --Account Bank Tabs
local BankItems_VoidFrame --Special Void Storage Frame
local VoidButtonAr = {} --Void Storage Buttons
local VoidTabFrameAr = {} --Void Storage Tabs
-- 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
}
-- Some reagent IDs are out of order and are causing problems for tooltips
local ProblematicItemIDs = {
[189143] = 189143, [188658] = 188658, [190311] = 190311, --Draconium Ore
[190395] = 190395, [190396] = 190396, [190394] = 190394, --Serevite Ore
[192852] = 192852, [192853] = 192853, [192855] = 192855, --Alexstraszite
[192862] = 192862, [192863] = 192863, [192865] = 192865, --Neltharite
[193208] = 193208, [193210] = 193210, [193211] = 193211, --Resilient Leather
[194817] = 194817, [194819] = 194819, [194820] = 194820 --Howling Rune
}
-- Localize more frames to see if it fixes the Lua interpreter errors on macs
local BankItems_MoneyFrame
local BankItems_MoneyFrameTotal
local BankItems_ShowAllRealms_Check
local BankItems_ShowOppositeFaction_Check
local BankItems_UserDropdown
local BankItems_DelUserDropdown
local BankItems_DelGuildDropdown
local BankItems_ExportButton
local BankItems_SearchButton
local BankItems_SearchBox
local BankItems_NextMailButton
local BankItems_PrevMailButton
local BankItems_NextCurrencyButton
local BankItems_PrevCurrencyButton
local BankItems_NextAHButton
local BankItems_PrevAHButton
local BankItems_NextVoidButton
local BankItems_PrevVoidButton
local BankItems_NextReagentButton
local BankItems_PrevReagentButton
local BankItems_GBFrame_MoneyFrame
local BankItems_ABFrame_MoneyFrame
local BankItems_GuildDropdown
local BankItems_ShowAllRealms_GBCheck
local BankItems_ShowOppositeFaction_GBCheck
local BankItems_GBExportButton
local BankItems_GBEmblemFrame
local BankItems_MinimapButton
local BankItems_OptionsFrame_LockWindow
local BankItems_OptionsFrame_MinimapButton
local BankItems_OptionsFrame_WindowStyle
local BankItems_OptionsFrame_BagParent
local BankItems_OptionsFrame_VoidBag
local BankItems_OptionsFrame_ReagentBag
local BankItems_OptionsFrame_TooltipInfo
local BankItems_OptionsFrame_LoginMailCall
local BankItems_GTTDropDown
--local BankItems_OptionsFrame_TTSoulbound --option no longer used
local BankItems_OptionsFrame_TTUnique
local BankItems_BehaviorDropDown
local BankItems_ButtonRadiusSlider
local BankItems_ButtonPosSlider
local BankItems_TransparencySlider
local BankItems_ScaleSlider
local BankItems_ExportFrame_GroupData
local BankItems_ExportFrame_ShowBagPrefix
local BankItems_ExportFrame_SearchDropDown
local BankItems_ExportFrame_SearchTextbox
local BankItems_ExportFrame_SearchAllRealms
local BankItems_ExportFrame_ResetButton
local BankItems_ExportFrame_Scroll
local BankItems_ExportFrame_ScrollText
local GetCurrencyString, UpdateClosedBankCounts, bankStackReduction, BankItems_Frame_CursorUpdate
local voidVersionChecked, mailVersionChecked, AdjustExpiredMail
local ahFirstLoad = true
local lastErrorTime
local lastErrorItemID = 0
local lastErrorSearch = ""
ACCOUNT_BANK = L["Warband bank"] --needed until Blizz adds the variable in global strings
--8.3 switched these ContainerFrame variables to local so replicate them here for reference
--use a table to reduce number of local variables in main function
local CFrame = {}
CFrame.MAX_CONTAINER_ITEMS = 36;
CFrame.NUM_CONTAINER_COLUMNS = 4;
CFrame.ROWS_IN_BG_TEXTURE = 6;
CFrame.MAX_BG_TEXTURES = 2;
CFrame.CONTAINER_WIDTH = 192;
CFrame.CONTAINER_SPACING = 0;
CFrame.VISIBLE_CONTAINER_SPACING = 3;
CFrame.CONTAINER_SCALE = 0.75;
CFrame.BACKPACK_BASE_HEIGHT = 255;
CFrame.BACKPACK_DEFAULT_TOPHEIGHT = 255;
CFrame.BACKPACK_EXTENDED_TOPHEIGHT = 226;
CFrame.BACKPACK_BASE_SIZE = 16;
-------------------------------------------------
-- Constants for the keybindings menu
BINDING_HEADER_BANKITEMS = L["BankItems Bindings"]
BINDING_NAME_TOGGLEBANKITEMS = L["Toggle BankItems"]
BINDING_NAME_TOGGLEBANKITEMSALL = L["Toggle BankItems and all Bags"]
BINDING_NAME_TOGGLEBANKITEMSBANK = L["Toggle BankItems and all Bank Bags"]
BINDING_NAME_TOGGLEBANKITEMSGUILDBANK = L["Toggle BankItems Guild Bank"]
-------------------------------------------------
-------------------------------------------------
-- OnFoo scripts of the various widget
function BankItems_Generic_OnEnter(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if self.tooltiptext then
GameTooltip:SetText(self.tooltiptext, nil, nil, nil, nil, 1)
end
end
function BankItems_Frame_CursorUpdate(self, elapsed)
--run this from one of the main frames OnUpdate scripts instead of having it run on every visible button
--BankItemsMouseover contains the button that triggered the last OnEnter function or nil if not over a button
if BankItemsMouseover then
if IsControlKeyDown() and BankItemsMouseover.IconBorder and BankItemsMouseover.IconBorder:IsShown() then
ShowInspectCursor()
else
ResetCursor()
end
end
end
function BankItems_Button_OnEnter(self)
local t = bankPlayer[self:GetID()]
BankItemsMouseover = self
if t then
BankItems_Quantity = t.count or 1
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
local link = t.link
if link:find("battlepet:") then
local _, speciesID, level, breedQuality, maxHealth, power, speed = strsplit(":", link)
BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality), tonumber(maxHealth), tonumber(power), tonumber(speed)) --name only needs to be passed for custom names which don't exist for caged pets
GameTooltip:SetOwner(BattlePetTooltip, "ANCHOR_NONE")
GameTooltip:SetPoint("TOPLEFT", BattlePetTooltip, "BOTTOMLEFT")
else
GameTooltip:SetHyperlink(link)
end
BankItems_AddEnhTooltip(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 == "LeftButton" and IsShiftKeyDown() then
ChatEdit_InsertLink(bankPlayer[self:GetID()].link)
end
end
end
function BankItems_Bag_OnEnter(self)
local id = self:GetID()
BankItemsMouseover = self
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if id == 0 then
GameTooltip:SetText(BACKPACK_TOOLTIP)
elseif id == 100 then
GameTooltip:SetText(L["Equipped Items"])
elseif id == 101 then
GameTooltip:SetText(L["Items in Mailbox"])
elseif id == 102 then
GameTooltip:SetText(CURRENCY)
elseif id == 103 then
GameTooltip:SetText(AUCTIONS)
elseif id == 104 then
GameTooltip:SetText(VOID_STORAGE)
elseif id == 105 then
GameTooltip:SetText(REAGENT_BANK)
elseif id == 106 then
GameTooltip:SetText(ACCOUNT_BANK)
elseif bankPlayer[format("Bag%d", id)] then
GameTooltip:SetHyperlink(bankPlayer[format("Bag%d", id)].link)--bag item. not need to check battlepet link.
BankItems_AddEnhTooltip(bankPlayer[format("Bag%d", id)].link, 1)
end
end
function BankItems_Bag_OnClick(self, button)
local bagID = self:GetID()
local theBag = bankPlayer[format("Bag%d", bagID)]
if bagID == 106 and not BankItems_Save.accountBags then --use new Account Bank Frame
BankItems_DisplayAccountBank()
elseif bagID == 105 and not BankItems_Save.reagentBags then --use new Reagent Bank Frame
BankItems_DisplayReagentBank()
elseif bagID == 104 and not BankItems_Save.voidBags then --use new Void Storage Frame
BankItems_DisplayVoidStorage()
else
if button == "LeftButton" and IsShiftKeyDown() and bagID > 0 and bagID <= 12 then
ChatEdit_InsertLink(theBag.link)
return
end
if not theBag then
if bagID == 100 then
BankItems_Chat(L["%s data not found. Please log on this character."]:format(L["Equipped"]))
elseif bagID == 101 then
BankItems_Chat(L["Mailbox data not found. Please visit the mailbox on this character."])
elseif bagID == 102 then
BankItems_Chat(L["%s data not found. Please log on this character."]:format(CURRENCY))
elseif bagID == 103 then
BankItems_Chat(L["%s data not found. Please visit the Auction House on this character."]:format(AUCTIONS))
elseif bagID == 104 then
BankItems_Chat(L["%s data not found. Please visit the Void Storage on this character."]:format(VOID_STORAGE))
elseif bagID == 105 then
BankItems_Chat(L["%s data not found. Please visit the Bank on this character."]:format(REAGENT_BANK))
elseif bagID == 106 then
BankItems_Chat(L["%s data not found. Please visit the Bank on this character."]:format(ACCOUNT_BANK))
end
return
end
local bagFrame = BagContainerAr[bagID]
if ( bagFrame:IsVisible() ) then
bagFrame:Hide()
return
end
-- Generate the frame
local frame = bagFrame
local size = theBag.size
-- Rest of this code is copied from ContainerFrame.lua, modified slightly for size/links
local name = frame:GetName();
local bgTextureTop = _G[name.."BackgroundTop"];
local bgTextureMiddle = _G[name.."BackgroundMiddle1"];
local bgTextureMiddle2 = _G[name.."BackgroundMiddle2"];
local bgTextureBottom = _G[name.."BackgroundBottom"];
local bgTexture1Slot = _G[name.."Background1Slot"];
local columns = CFrame.NUM_CONTAINER_COLUMNS;
local rows = ceil(size / columns);
local extraRows = 0;
local BG_TEXTURE_HEIGHT = 512;
-- if id = 0 then its the backpack
if ( bagID == 0 ) then
bgTexture1Slot:Hide();
--_G[name.."MoneyFrame"]:Show();
--Check to see if backpack was extended by an authenticator
local extended = size > CFrame.BACKPACK_BASE_SIZE;
-- Set Backpack texture
bgTextureTop:SetTexture("Interface\\ContainerFrame\\UI-BackpackBackground");
if (extended) then
extraRows = math.ceil((size - CFrame.BACKPACK_BASE_SIZE) / columns);
bgTextureTop:SetHeight(CFrame.BACKPACK_EXTENDED_TOPHEIGHT);
bgTextureTop:SetTexCoord(0, 1, 0, CFrame.BACKPACK_EXTENDED_TOPHEIGHT / CFrame.BACKPACK_DEFAULT_TOPHEIGHT);
else
bgTextureTop:SetHeight(CFrame.BACKPACK_DEFAULT_TOPHEIGHT);
bgTextureTop:SetTexCoord(0, 1, 0, 1);
end
bgTextureTop:Show();
bgTextureBottom:Hide();
-- Hide unused textures
for i=1, CFrame.MAX_BG_TEXTURES do
_G[name.."BackgroundMiddle"..i]:SetTexture("Interface\\ContainerFrame\\UI-Bag-Components");
_G[name.."BackgroundMiddle"..i]:Hide();
end
local middleBgHeight = 0;
if (extended) then
local height
local rowHeight = 41;
-- Subtract four, since the top part of the backpack texture contains four rows already
local remainingRows = extraRows;
-- Calculate the number of background textures we're going to need
bgTextureCount = ceil(remainingRows/CFrame.ROWS_IN_BG_TEXTURE);
-- Try to cycle all the middle bg textures
local firstRowPixelOffset = 9;
local firstRowTexCoordOffset = 0.353515625;
for i=1, bgTextureCount do
bgTextureMiddle = _G[name.."BackgroundMiddle"..i];
if ( remainingRows > CFrame.ROWS_IN_BG_TEXTURE ) then
-- If more rows left to draw than can fit in a texture then draw the max possible
height = ( CFrame.ROWS_IN_BG_TEXTURE*rowHeight ) - firstRowPixelOffset
bgTextureMiddle:SetHeight(CFrame.ROWS_IN_BG_TEXTURE*rowHeight);
bgTextureMiddle:SetTexCoord(0, 1, firstRowTexCoordOffset, ( height/BG_TEXTURE_HEIGHT + firstRowTexCoordOffset) );
bgTextureMiddle:Show();
remainingRows = remainingRows - CFrame.ROWS_IN_BG_TEXTURE;
middleBgHeight = middleBgHeight + CFrame.ROWS_IN_BG_TEXTURE+rowHeight;
else
-- If not its a huge bag
bgTextureMiddle:Show();
height = remainingRows*rowHeight-firstRowPixelOffset;
bgTextureMiddle:SetHeight(remainingRows*rowHeight);
bgTextureMiddle:SetTexCoord(0, 1, firstRowTexCoordOffset, ( height/BG_TEXTURE_HEIGHT + firstRowTexCoordOffset) );
middleBgHeight = middleBgHeight + remainingRows*rowHeight;
end
end
-- Position and setup bottom texture
bgTextureBottom:SetPoint("TOP", bgTextureMiddle:GetName(), "BOTTOM", 0, 0);
bgTextureBottom:SetTexture("Interface\\ContainerFrame\\UI-BackpackBackground");
bgTextureBottom:SetHeight(CFrame.BACKPACK_DEFAULT_TOPHEIGHT - CFrame.BACKPACK_EXTENDED_TOPHEIGHT);
bgTextureBottom:SetTexCoord(0, 1, CFrame.BACKPACK_EXTENDED_TOPHEIGHT / CFrame.BACKPACK_DEFAULT_TOPHEIGHT, 1);
bgTextureBottom:Show();
end
frame:SetHeight(CFrame.BACKPACK_BASE_HEIGHT + middleBgHeight);
else
if (size == 1) then
-- Halloween gag gift
bgTexture1Slot:Show();
bgTextureTop:Hide();
bgTextureMiddle:Hide();
bgTextureMiddle2:Hide();
bgTextureBottom:Hide();
--_G[name.."MoneyFrame"]:Hide();
else
bgTexture1Slot:Hide();
bgTextureTop:Show();
-- Not the backpack
-- 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, CFrame.MAX_BG_TEXTURES do
_G[name.."BackgroundMiddle"..i]:SetTexture("Interface\\ContainerFrame\\UI-Bag-Components"..bagTextureSuffix);
_G[name.."BackgroundMiddle"..i]:Hide();
end
bgTextureBottom:SetTexture("Interface\\ContainerFrame\\UI-Bag-Components"..bagTextureSuffix);
-- Hide the moneyframe since its not the backpack
--_G[name.."MoneyFrame"]:Hide();
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/CFrame.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, CFrame.MAX_BG_TEXTURES do
_G[name.."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 = _G[name.."BackgroundMiddle"..i];
if ( remainingRows > CFrame.ROWS_IN_BG_TEXTURE ) then
-- If more rows left to draw than can fit in a texture then draw the max possible
height = ( CFrame.ROWS_IN_BG_TEXTURE*rowHeight ) + firstRowTexCoordOffset;
bgTextureMiddle:SetHeight(height);
bgTextureMiddle:SetTexCoord(0, 1, firstRowTexCoordOffset, ( height/BG_TEXTURE_HEIGHT + firstRowTexCoordOffset) );
bgTextureMiddle:Show();
remainingRows = remainingRows - CFrame.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
frame:SetHeight(bgTextureTop:GetHeight()+bgTextureBottom:GetHeight()+middleBgHeight);
end
end
if (size == 1) then
-- Halloween gag gift
frame:SetHeight(70);
frame:SetWidth(99);
_G[frame:GetName().."Name"]:SetText("");
local itemButton = _G[name.."Item1"];
itemButton:SetID(1);
itemButton:SetPoint("BOTTOMRIGHT", name, "BOTTOMRIGHT", -10, 5);
itemButton:Show();
else
frame:SetWidth(CFrame.CONTAINER_WIDTH);
local index, itemButton;
for i=1, size, 1 do
index = size - i + 1;
itemButton = _G[name.."Item"..i];
itemButton:SetID(index);
-- Set first button
if ( i == 1 ) then
local FIRST_BACKPACK_BUTTON_OFFSET_BASE = -225;
local FIRST_BACKPACK_BUTTON_OFFSET_PER_EXTRA_ROW = 41;
-- Anchor the first item differently if its the backpack frame
if ( bagID == 0 ) then
itemButton:SetPoint("BOTTOMRIGHT", name, "TOPRIGHT", -12, FIRST_BACKPACK_BUTTON_OFFSET_BASE - (FIRST_BACKPACK_BUTTON_OFFSET_PER_EXTRA_ROW*extraRows));
else
itemButton:SetPoint("BOTTOMRIGHT", name, "BOTTOMRIGHT", -12, 9);
end
else
if ( mod((i-1), columns) == 0 ) then
itemButton:SetPoint("BOTTOMRIGHT", name.."Item"..(i - columns), "TOPRIGHT", 0, 4);
else
itemButton:SetPoint("BOTTOMRIGHT", name.."Item"..(i - 1), "BOTTOMLEFT", -5, 0);
end
end
itemButton:Show();
end
end
for i=size + 1, CFrame.MAX_CONTAINER_ITEMS, 1 do
_G[name.."Item"..i]:Hide();
end
if (bagID == 0) then
_G[name.."Name"]:SetText(BACKPACK_TOOLTIP)
elseif (bagID == 100) then
_G[name.."Name"]:SetText(L["Equipped Items"])
elseif (bagID == 101) then
_G[name.."Name"]:SetText(L["Items in Mailbox"])
elseif (bagID == 102) then
_G[name.."Name"]:SetText(CURRENCY)
elseif (bagID == 103) then
_G[name.."Name"]:SetText(AUCTIONS)
elseif (bagID == 104) then
_G[name.."Name"]:SetText(VOID_STORAGE)
elseif (bagID == 105) then
_G[name.."Name"]:SetText(REAGENT_BANK)
elseif (bagID == 106) then
_G[name.."Name"]:SetText(ACCOUNT_BANK)
else
_G[name.."Name"]:SetText(BankItems_ParseLink(theBag.link))
end
_G[name.."Portrait"]:SetTexture(theBag.icon or GetItemIconByID(theBag.link))
BankItems_PopulateBag(bagID)
bagFrame:ClearAllPoints()
if BankItems_Save.BagParent == 1 then
BankItemsCFrames.bags[(BankItemsCFrames.bagsShown or 0) + 1] = bagFrame:GetName()
BankItemsUpdateCFrameAnchors()
elseif BankItems_Save.BagParent == 2 then
if ContainerFrame1.bags == nil then ContainerFrame1.bags = {} end
ContainerFrame1.bags[(ContainerFrame1.bagsShown or 0) + 1] = bagFrame:GetName()
updateContainerFrameAnchors()
end
bagFrame:Show()
PlaySound(862)
bagFrame:Raise();
end
end
function BankItems_Bag_OnShow(self)
BagButtonAr[self:GetID()].HighlightTexture:Show()
if BankItems_Save.BagParent == 1 then
BankItemsCFrames.bagsShown = (BankItemsCFrames.bagsShown or 0) + 1
elseif BankItems_Save.BagParent == 2 then
ContainerFrame1.bagsShown = (ContainerFrame1.bagsShown or 0) + 1
end
if self:GetID() == 104 then
if not voidVersionChecked then
if bankPlayer.Bag104 then
bankPlayer.Bag104.outOfDate = (bankPlayer.Bag104.VerNum or 0) < 6020001
end
voidVersionChecked = true
if bankPlayer.Bag104.outOfDate then
BankItems_Chat(L["%s data appears out-of-date. Please visit the %s on this character."]:format(VOID_STORAGE, VOID_STORAGE))
end
end
end
if self:GetID() == 101 then
if not mailVersionChecked then
if bankPlayer.Bag101 and bankPlayer.Bag101.TOC and bankPlayer.Bag101.VerNum then
bankPlayer.Bag101.outOfDate = bankPlayer.Bag101.outOfDate or bankPlayer.Bag101.TOC >= 70000 and bankPlayer.Bag101.VerNum < 7000301 or nil
end
mailVersionChecked = true
if bankPlayer.Bag101 and bankPlayer.Bag101.outOfDate then
BankItems_Chat(L["%s data appears out-of-date. Please visit the %s on this character."]:format(MINIMAP_TRACKING_MAILBOX, MINIMAP_TRACKING_MAILBOX))
end
end
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(863)
end
function BankItems_BagItem_OnEnter(self)
local bagID = self:GetParent():GetID()
BankItemsMouseover = self
local itemID = self:GetID()
if bagID == 101 then
itemID = itemID + (pages.Mail - 1) * 18
elseif bagID == 102 then
itemID = itemID + (pages.Currency - 1) * 32
elseif bagID == 103 then
itemID = itemID + (pages.AH - 1) * 18
elseif bagID == 104 then
itemID = itemID + (pages.Void - 1) * voidPageSize
itemID = slotAdjust[104][itemID] --table listing all non-empty slots
elseif bagID == 105 then
itemID = itemID + (pages.ReagentBank - 1) * reagentBankPageSize
itemID = slotAdjust[105][itemID] --table listing all non-empty slots
end
local item = bankPlayer[format("Bag%d", bagID)][itemID]
if item then
local link = item.link
BankItems_Quantity = item.count or 1
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
if type(link) == "number" then
GameTooltip:SetText(L["Money (cumulative)"])
SetTooltipMoney(GameTooltip, link)
SetMoneyFrameColor("GameTooltipMoneyFrame", HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b)
else
if link:find("battlepet:") then
local _, speciesID, level, breedQuality, maxHealth, power, speed = strsplit(":", link)
BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality), tonumber(maxHealth), tonumber(power), tonumber(speed)) --name only needs to be passed for custom names which don't exist for caged pets
GameTooltip:SetOwner(BattlePetTooltip, "ANCHOR_NONE")
GameTooltip:SetPoint("TOPLEFT", BattlePetTooltip, "BOTTOMLEFT")
else
GameTooltip:SetHyperlink(link)
end
--[[GameTooltip.BankItemsIsCurrency = strmatch(link, "(currency:%d+)")
if GameTooltip.BankItemsIsCurrency then
BankItems_AddTooltipData(GameTooltip)
GameTooltip.BankItemsIsCurrency = nil
end]]--deprecated
BankItems_AddEnhTooltip(link, BankItems_Quantity)
if item.expiry then
local t = SecondsToTime(item.expiry - time())
if t == "" then GameTooltip:AddLine(ERR_MAIL_ATTACHMENT_EXPIRED, 0.2890625, 0.6953125, 0.8359375)
elseif item.deleted then GameTooltip:AddLine(TIME_UNTIL_DELETED..": "..t, 0.2890625, 0.6953125, 0.8359375)
elseif item.returned then GameTooltip:AddLine(TIME_UNTIL_RETURNED..": "..t, 0.2890625, 0.6953125, 0.8359375)
end
end
if item.AHexpiry then
local e = item.AHexpiry
local snaptime = bankPlayer.Bag103.time
local elapsed = time() - snaptime
if elapsed >= e then
GameTooltip:AddLine(ERR_MAIL_ATTACHMENT_EXPIRED, 0.2890625, 0.6953125, 0.8359375)
else
GameTooltip:AddLine(CLOSES_IN..": "..SecondsToTime(e), 0.2890625, 0.6953125, 0.8359375)
end
end
end
if IsControlKeyDown() then ShowInspectCursor() end
GameTooltip:Show()
elseif bagID == 100 then
if itemID == 18 then
-- Tabard fix
itemID = 19
end
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(_G[ BANKITEMS_INVSLOT[itemID] ])
GameTooltip:Show()
end
end
function BankItems_BagItem_OnClick(self, button)
local bagID = self:GetParent():GetID()
local itemID = self:GetID()
if bagID == 101 then
itemID = itemID + (pages.Mail - 1) * 18
elseif bagID == 102 then
itemID = itemID + (pages.Currency - 1) * 32
elseif bagID == 103 then
itemID = itemID + (pages.AH - 1) * 18
elseif bagID == 104 then
itemID = itemID + (pages.Void - 1) * voidPageSize
itemID = slotAdjust[104][itemID] --table listing all non-empty slots
elseif bagID == 105 then
itemID = itemID + (pages.ReagentBank - 1) * reagentBankPageSize
itemID = slotAdjust[105][itemID] --table listing all non-empty slots
end
local item = bankPlayer[format("Bag%d", bagID)][itemID]
if item then
if IsControlKeyDown() then
if type(item.link) ~= "number" then
DressUpItemLink(item.link)
end
elseif button == "LeftButton" and IsShiftKeyDown() then
if type(item.link) == "number" then
ChatEdit_InsertLink(BankItem_ParseMoney(item.link))
else
ChatEdit_InsertLink(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(L["Equipped Items"])
elseif bagNum == 101 then
GameTooltip:SetText(L["Items in Mailbox"])
elseif bagNum == 102 then
GameTooltip:SetText(CURRENCY)
elseif bagNum == 103 then
GameTooltip:SetText(AUCTIONS)
elseif bagNum == 104 then
GameTooltip:SetText(VOID_STORAGE)
elseif bagNum == 105 then
GameTooltip:SetText(REAGENT_BANK)
elseif bagNum == 106 then
GameTooltip:SetText(ACCOUNT_BANK)
elseif bankPlayer[format("Bag%d", bagNum)].link then
GameTooltip:SetHyperlink(bankPlayer[format("Bag%d", bagNum)].link)
BankItems_AddEnhTooltip(bankPlayer[format("Bag%d", bagNum)].link, 1)
end
end
function BankItems_AddEnhTooltip(link, quantity)
if C_AddOns.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)
BankItemsMouseover = nil
ResetCursor()
GameTooltip:Hide()
BattlePetTooltip:Hide()
end
function BankItems_Frame_OnShow(self)
BankItems_Frame:SetScript("OnUpdate", BankItems_Frame_CursorUpdate)
BankItems_GBFrame:SetScript("OnUpdate", nil) --only want one of the BankItems_Frame_CursorUpdate firing at a time
BankItems_ABFrame:SetScript("OnUpdate", nil) --only want one of the BankItems_Frame_CursorUpdate firing at a time
BankItems_CreateFrames()
--BankItems_Frame:SetUserPlaced(nil) -- Temporary
PlaySound(850)
BankItems_PopulateFrame()
end
function BankItems_Frame_OnHide(self)
PlaySound(850)
for _, i in ipairs(BAGNUMBERS) do
if BagContainerAr[i] then
BagContainerAr[i]:Hide()
end
end
BankItems_GBFrame:SetScript("OnUpdate", BankItems_Frame_CursorUpdate)
BankItems_ABFrame:SetScript("OnUpdate", BankItems_Frame_CursorUpdate)
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)
local _
self:StopMovingOrSizing()
self:SetScript("OnUpdate", nil)
BankItems_Save.pospoint, _, BankItems_Save.posrelpoint, BankItems_Save.posoffsetx, BankItems_Save.posoffsety = BankItems_Frame:GetPoint()
--self:SetUserPlaced(nil)
end
local function NormalizeRealm(realm)
if not realm then return end
return gsub(realm, "[ -]", "")
end
function BankItems_Frame_OnEvent(self, event, ...)
local arg1, arg2 = ...
if event == "UNIT_INVENTORY_CHANGED" and arg1 == "player" then
-- Delay updating to the next frame as multiple UNIT_INVENTORY_CHANGED and PLAYER_EQUIPMENT_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 == "PLAYER_EQUIPMENT_CHANGED" then
--equipment types with multiple slots won't fire UNIT_INVENTORY_CHANGED
-- Delay updating to the next frame as multiple PLAYER_EQUIPMENT_CHANGED and 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)