-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkBags.lua
186 lines (170 loc) · 5.3 KB
/
kBags.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
local _, Internals = ...;
-- **** defines ****
local CATEGORIES = {
{
"Quest",
44987, -- Valiant's Seal
39878, -- Mysterious Egg
44717, -- Disgusting Jar
},
{ -- Heirloom items
42943, -- Bloodied Arcanite Reaper
42944, -- Balanced Heartseeker
42946, -- Charmed Ancient Bone Bow
42948, -- Devout Aurastone Hammer
44091, -- Sharpened Scarlet Kris
44092, -- Reforged Truesilver Champion
44093, -- Upgraded Dwarven Hand Cannon
44094, -- The Blessed Hammer of Grace
44095, -- Grand Staff of Jordan
44096, -- Battleworn Thrash Blade
48716, -- Venerable Mass of McGowan
48718, -- Repurposed Lava Dredger
42949, -- Polished Spaulders of Valor
42951, -- Mystical Pauldrons of Elements
42952, -- Stained Shadowcraft Spaulders
42984, -- Preened Ironfeather Shoulders
42985, -- Tattered Dreadmist Mantle
42991, -- Swift Hand of Justice
42992, -- Discerning Eye of the Beast
44097, -- Inherited Insignia of the Horde
44098, -- Inherited Insignia of the Alliance
44099, -- Strengthened Stockade Pauldrons
44100, -- Pristine Lightforge Spaulders
44102, -- Aged Pauldrons of The Five Thunders
44103, -- Exceptional Stormshroud Shoulders
44105, -- Lasting Feralheart Spaulders
44107, -- Exquisite Sunderseer Mantle
48683, -- Mystical Vest of Elements
48685, -- Polished Breastplate of Valor
48687, -- Preened Ironfeather Breastplate
48689, -- Stained Shadowcraft Tunic
48691, -- Tattered Dreadmist Robe
50255, -- Dread Pirate Ring
42945, -- Venerable Dal'Rend's Sacred Charge
},
{ "Miscellaneous->Reagent" },
{ "Consumable" },
{ "Trade Goods->Meat" },
{
"Weapon->Fishing Poles",
33820, -- Weather-Beaten Fishing Hat
46006, -- Glow Worm
34861, -- Sharpened Fish Hook
},
{ "Trade Goods->Other" },
{
"Trade Goods->Devices",
"Trade Goods->Explosives",
"Recipe->Engineering",
48933, -- Wormhole generator
},
{ "Trade Goods->Parts" },
{
"Trade Goods->Metal & Stone",
"empty->Mining Bag",
},
{ "Trade Goods->Cloth" },
{
"Trade Goods->Herb",
"empty->Herb Bag",
},
{
"Gem",
"empty->Gem Bag",
},
{ "Trade Goods->Elemental" },
{
"Trade Goods->Enchanting",
"Recipe->Enchanting",
"empty->Enchanting Bag",
34055, -- Greater Cosmic Essence
},
{
"empty->Ammo Pouch",
"empty->Quiver",
"Projectile",
},
{
"empty->Soul Bag",
6265, -- Soul Shard
},
};
-- **** imports ****
local kWidgets = kWidgets;
local BagFrame = Internals.BagFrame;
local Scale = kWidgets.Scale;
-- **** main ****
-- bag
local bagFrame = BagFrame( 0, NUM_BAG_SLOTS );
bagFrame:SetMaxHeight( 300 );
for _, category in ipairs( CATEGORIES ) do
bagFrame:AddCategory( category );
end
bagFrame:SetFrameStrata( "HIGH" );
bagFrame:Hide();
-- bank
local bankFrame = BagFrame( NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS, -1 );
bankFrame:SetPoint( "BOTTOMRIGHT", bagFrame, "BOTTOMLEFT", -19, 0 );
bankFrame:SetMaxHeight( 400 );
for _, category in ipairs( CATEGORIES ) do
bankFrame:AddCategory( category );
end
bankFrame:SetFrameStrata( "HIGH" );
bankFrame:Hide();
-- "hide" blizzard bags
BankFrame:ClearAllPoints();
BankFrame:SetPoint( "TOPRIGHT", UIParent, "BOTTOMLEFT", 0, 0 );
BankFrame.size = 0;
for index = 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do
container = _G[ "ContainerFrame" .. tostring( index ) ];
container:ClearAllPoints();
container:SetPoint( "TOPRIGHT", UIParent, "BOTTOMLEFT", 0, 0 );
container.size = 0;
end
UIPanelWindows[ "BankFrame" ] = nil;
-- create secure openers - this is just temporary workaround until I implement creating templated frames through kWidgets
bagToggleFrame = CreateFrame( "Frame", nil, UIParent, "SecureHandlerShowHideTemplate" );
bagToggleFrame:SetParent( ContainerFrame1 );
bagFrame:MakeRaw();
bankFrame:MakeRaw();
bagToggleFrame:SetFrameRef( "BankFrame", BankFrame );
bagToggleFrame:SetFrameRef( "kBag", bagFrame );
bagToggleFrame:SetFrameRef( "PetActionButton10", PetActionButton10 );
bagToggleFrame:SetFrameRef( "MultiBarLeftButton12", MultiBarLeftButton12 );
bagToggleFrame:Execute( [[
kBag = self:GetFrameRef( "kBag" );
BankFrame = self:GetFrameRef( "BankFrame" );
PetActionButton10 = self:GetFrameRef( "PetActionButton10" );
MultiBarLeftButton12 = self:GetFrameRef( "MultiBarLeftButton12" );
]] );
bagToggleFrame:SetAttribute( "_onshow", [[
if ( PetActionButton10:IsShown() ) then
kBag:SetPoint( "BOTTOMRIGHT", PetActionButton10, "BOTTOMLEFT", ]] .. Scale( -10 ) .. [[, ]] .. Scale( -5 ) .. [[ );
else
kBag:SetPoint( "BOTTOMRIGHT", MultiBarLeftButton12, "BOTTOMLEFT", ]] .. Scale( -10 ) .. [[, ]] .. Scale( -5 ) .. [[ );
end
kBag:Show();
]] );
bagToggleFrame:SetAttribute( "_onhide", [[
BankFrame:Hide();
kBag:Hide();
]] );
local bankToggleFrame = CreateFrame( "Frame", nil, UIParent, "SecureHandlerShowHideTemplate" );
bankToggleFrame:SetParent( BankFrame );
bankToggleFrame:SetFrameRef( "ContainerFrame1", ContainerFrame1 );
bankToggleFrame:SetFrameRef( "kBank", bankFrame );
bankToggleFrame:Execute( [[
ContainerFrame1 = self:GetFrameRef( "ContainerFrame1" );
kBank = self:GetFrameRef( "kBank" );
]] );
bankToggleFrame:SetAttribute( "_onshow", [[
ContainerFrame1:Show();
kBank:Show();
]] );
bankToggleFrame:SetAttribute( "_onhide", [[
ContainerFrame1:Hide();
kBank:Hide();
]] );
bagFrame:Restore();
bankFrame:Restore();