80
80
81
81
function Bag :OnClick (button )
82
82
if button == ' RightButton' and ContainerFrame1FilterDropDown then
83
- if not self :IsReagents () and self : GetInfo () .owned then
83
+ if not self :IsReagents () and self . info .owned then
84
84
ContainerFrame1FilterDropDown :SetParent (self )
85
85
PlaySound (SOUNDKIT .IG_MAINMENU_OPTION_CHECKBOX_ON )
86
86
ToggleDropDownMenu (1 , nil , ContainerFrame1FilterDropDown , self , 0 , 0 )
87
87
end
88
88
elseif self :IsPurchasable () then
89
89
self :Purchase ()
90
- elseif CursorHasItem () and not self : GetInfo () .cached then
90
+ elseif CursorHasItem () and not self . info .cached then
91
91
if self :IsBackpack () then
92
92
PutItemInBackpack ()
93
93
else
94
- PutItemInBag (self : GetInfo () .slot )
94
+ PutItemInBag (self . info .slot )
95
95
end
96
96
elseif self :CanToggle () then
97
97
self :Toggle ()
@@ -101,9 +101,9 @@ function Bag:OnClick(button)
101
101
end
102
102
103
103
function Bag :OnDrag ()
104
- if self :IsCustomSlot () and not self : GetInfo () .cached then
104
+ if self :IsCustomSlot () and not self . info .cached then
105
105
PlaySound (SOUNDKIT .IG_BACKPACK_OPEN )
106
- PickupBagFromSlot (self : GetInfo () .slot )
106
+ PickupBagFromSlot (self . info .slot )
107
107
end
108
108
end
109
109
@@ -134,7 +134,7 @@ function Bag:RegisterEvents()
134
134
self :RegisterMessage (' CACHE_BANK_CLOSED' , ' RegisterEvents' )
135
135
end
136
136
137
- if not self : GetInfo () .cached then
137
+ if not self . info .cached then
138
138
if self :IsReagents () then
139
139
self :RegisterEvent (' REAGENTBANK_PURCHASED' , ' Update' )
140
140
elseif self :IsCustomSlot () then
@@ -162,21 +162,22 @@ end
162
162
function Bag :Update ()
163
163
local info = self :GetInfo ()
164
164
165
+ self .info = info
165
166
self .FilterIcon :SetShown (not info .cached )
166
167
self .Count :SetText (info .free and info .free > 0 and info .free or ' ' )
167
168
self :UpdateCursor ()
168
169
self :UpdateToggle ()
169
170
self :UpdateLock ()
170
171
171
- if self :IsBackpack () or self :IsBank () then
172
+ if self :IsBackpack () or self :IsBank () then
172
173
self :SetIcon (' Interface/Buttons/Button-Backpack-Up' )
173
174
elseif self :IsReagents () then
174
175
self :SetIcon (' Interface/Icons/Achievement_GuildPerk_BountifulBags' )
175
176
elseif self :IsKeyring () then
176
177
self :SetIcon (' Interface/ContainerFrame/KeyRing-Bag-Icon' )
177
178
else
178
179
self :SetIcon (info .icon or ' Interface/PaperDoll/UI-PaperDoll-Slot-Bag' )
179
- self .link = info .link
180
+ self .link = info .link
180
181
181
182
if not info .icon then
182
183
self .Count :SetText (' ' )
@@ -187,7 +188,7 @@ function Bag:Update()
187
188
local id = self :GetID ()
188
189
for i , atlas in ipairs (self .FILTER_ICONS ) do
189
190
local active = C_Container and (id > 0 and C_Container .GetBagSlotFlag (id , 2 ^ i )) or
190
- GetBagSlotFlag and (self :IsBankBag () and GetBankBagSlotFlag (id - NUM_BAG_SLOTS , i ) or GetBagSlotFlag (id , i ))
191
+ GetBagSlotFlag and (self :IsBankBag () and GetBankBagSlotFlag (id - NUM_BAG_SLOTS , i ) or GetBagSlotFlag (id , i ))
191
192
if active then
192
193
return self .FilterIcon .Icon :SetAtlas (atlas )
193
194
end
@@ -196,13 +197,13 @@ function Bag:Update()
196
197
end
197
198
198
199
function Bag :UpdateCursor ()
199
- if not self :IsCustomSlot () then
200
- if CursorCanGoInSlot (self : GetInfo () .slot ) then
200
+ --[[ if not self:IsCustomSlot() then
201
+ if CursorCanGoInSlot(self.info .slot) then
201
202
self:LockHighlight()
202
203
else
203
204
self:UnlockHighlight()
204
205
end
205
- end
206
+ end--]]
206
207
end
207
208
208
209
function Bag :UpdateToggle ()
@@ -223,7 +224,7 @@ function Bag:UpdateTooltip()
223
224
GameTooltip :SetText (self :IsReagents () and REAGENT_BANK or BANK_BAG_PURCHASE , 1 , 1 , 1 )
224
225
GameTooltip :AddLine (L .TipPurchaseBag :format (L .Click ))
225
226
226
- SetTooltipMoney (GameTooltip , self : GetInfo () .cost )
227
+ SetTooltipMoney (GameTooltip , self . info .cost )
227
228
elseif self :IsBackpack () then
228
229
GameTooltip :SetText (BACKPACK_TOOLTIP , 1 ,1 ,1 )
229
230
elseif self :IsBank () then
@@ -232,10 +233,10 @@ function Bag:UpdateTooltip()
232
233
GameTooltip :SetText (REAGENT_BANK , 1 ,1 ,1 )
233
234
elseif self :IsKeyring () then
234
235
GameTooltip :SetText (KEYRING , 1 ,1 ,1 )
235
- elseif self .link and self : GetInfo () .cached then
236
+ elseif self .link and self . info .cached then
236
237
GameTooltip :SetHyperlink (self .link )
237
238
elseif self .link then
238
- GameTooltip :SetInventoryItem (' player' , ContainerIDToInventoryID ( self : GetID ()) )
239
+ GameTooltip :SetInventoryItem (' player' , self . info . slot )
239
240
elseif self :IsBankBag () then
240
241
GameTooltip :SetText (BANK_BAG , 1 , 1 , 1 )
241
242
else
@@ -287,7 +288,7 @@ function Bag:SetFocus(focus)
287
288
end
288
289
289
290
function Bag :SetIcon (icon )
290
- local color = self : GetInfo () .owned and 1 or .1
291
+ local color = self . info .owned and 1 or .1
291
292
SetItemButtonTexture (self , icon )
292
293
SetItemButtonTextureVertexColor (self , 1 , color , color )
293
294
end
@@ -324,19 +325,18 @@ function Bag:IsCustomSlot()
324
325
end
325
326
326
327
function Bag :CanToggle ()
327
- return self :IsBackpack () or self :IsBank () or self : GetInfo () .owned
328
+ return self :IsBackpack () or self :IsBank () or self . info .owned
328
329
end
329
330
330
331
331
332
--[[ Info ]] --
332
333
333
334
function Bag :IsPurchasable ()
334
- local info = self :GetInfo ()
335
- return not info .cached and not info .owned
335
+ return not self .info .cached and not self .info .owned
336
336
end
337
337
338
338
function Bag :IsToggled ()
339
- return self :GetFrame ():IsShowingBag (self :GetID ()) and self : GetInfo () .owned
339
+ return self :GetFrame ():IsShowingBag (self :GetID ()) and self . info .owned
340
340
end
341
341
342
342
function Bag :GetInfo ()
0 commit comments