vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -------------------------------------------------------------------------- |
2 | -- MyBagsCore |
||
3 | -- Author: Ramble |
||
4 | -- |
||
5 | -- Credits |
||
6 | -- Svarten for MyInventory |
||
7 | -- Turan for OneBag |
||
8 | -- Sarf for AIOI and initail concept |
||
9 | -------------------------------------------------------------------------- |
||
10 | |||
11 | local MYBAGS_BOTTOMOFFSET = 20 |
||
12 | local MYBAGS_COLWIDTH = 40 |
||
13 | local MYBAGS_ROWHEIGHT = 40 |
||
14 | |||
15 | local MYBAGS_MAXBAGSLOTS = 28 |
||
16 | |||
17 | local MIN_SCALE_VAL = "0.2" |
||
18 | local MAX_SCALE_VAL = "2.0" |
||
19 | |||
20 | local MYBAGS_SLOTCOLOR = { 0.5, 0.5, 0.5 } |
||
21 | local MYBAGS_AMMOCOLOR = { 0.6, 0.6, 0.1 } |
||
22 | local MYBAGS_SHARDCOLOR = { 0.6, 0.3, 0.6 } |
||
23 | local MYBAGS_ENCHANTCOLOR = { 0.2, 0.2, 1.0 } |
||
24 | local MYBAGS_ENGINEERCOLOR = { 0.6, 0.0, 0.0 } |
||
25 | local MYBAGS_HERBCOLOR = { 0.0, 0.6, 0.0 } |
||
26 | local MYBAGS_KEYRINGCOLOR = { 0.7, 0.4, 0.4 } |
||
27 | |||
28 | local CHARACTER_DELIMITOR = " " .. ACE_TEXT_OF .. " " -- surrounding spaces are needed |
||
29 | |||
30 | MYBAGS_KC_CHARS = nil |
||
31 | MYBAGS_CACHE_CHARS = nil |
||
32 | |||
33 | MyBagsCoreClass = AceAddonClass:new({ |
||
34 | version = "0.4.6 (11100)", |
||
35 | releaseDate = "07/19/06", |
||
36 | category = "inventory", |
||
37 | author = "Ramble (modified by Isharra)", |
||
38 | email = "isharra (at) gmail (dot) com", |
||
39 | website = "http://isharra.wowinterface.com", |
||
40 | aceCompatible = "103", |
||
41 | |||
42 | MAXBAGSLOTS = 36, |
||
43 | minColumns = 2, |
||
44 | maxColumns = 24, |
||
45 | |||
46 | _TOPOFFSET = 28, |
||
47 | _BOTTOMOFFSET = 20, |
||
48 | _LEFTOFFSET = 8, |
||
49 | _RIGHTOFFSET = 3, |
||
50 | |||
51 | }) |
||
52 | ace:RegisterFunctions(MyBagsCoreClass, { |
||
53 | ColorConvertHexToDigit = function(h) |
||
54 | if(strlen(h)~=6) then return 0,0,0 end |
||
55 | local r={a=10,b=11,c=12,d=13,e=14,f=15} |
||
56 | return ((tonumber(strsub(h,1,1)) or r[strsub(h,1,1)] or 0) * 16 + |
||
57 | (tonumber(strsub(h,2,2)) or r[strsub(h,2,2)] or 0))/255, |
||
58 | ((tonumber(strsub(h,3,3)) or r[strsub(h,3,3)] or 0) * 16 + |
||
59 | (tonumber(strsub(h,4,4)) or r[strsub(h,4,4)] or 0))/255, |
||
60 | ((tonumber(strsub(h,5,5)) or r[strsub(h,5,5)] or 0) * 16 + |
||
61 | (tonumber(strsub(h,6,6)) or r[strsub(h,6,6)] or 0))/255 |
||
62 | end, |
||
63 | |||
64 | GetItemInfoFromLink = function(l) |
||
65 | if(not l) then return end |
||
66 | local _,_,c,id,il,n=strfind(l,"|cff(%x+)|Hitem:(%d+)(:%d+:%d+:%d+)|h%[(.-)%]|h|r") |
||
67 | return n,c,id..il,id |
||
68 | end, |
||
69 | |||
70 | IsSpecialtyBagFromLink = function(b) |
||
71 | local _,_,_,i=ace.GetItemInfoFromLink(b) |
||
72 | if(not i) then return end |
||
73 | local _,_,_,_,c,d=GetItemInfo(i) |
||
74 | return ace.IsSpecialtyBag(c,d) |
||
75 | end, |
||
76 | |||
77 | IsSpecialtyBagFromID = function(i) |
||
78 | if(not i) then return end |
||
79 | local _,_,_,_,c,d=GetItemInfo(i) |
||
80 | return ace.IsSpecialtyBag(c,d) |
||
81 | end, |
||
82 | |||
83 | IsSpecialtyBag = function(itype,isubtype) |
||
84 | if(strlower(itype or "")==strlower(ACEG_TEXT_AMMO)) then return 1 end |
||
85 | if(strlower(itype or "")==strlower(ACEG_TEXT_QUIVER)) then return 2 end |
||
86 | if(strlower(isubtype or "")==strlower(ACEG_TEXT_SOUL)) then return 3 end |
||
87 | if(strlower(isubtype or "")==strlower(ACEG_TEXT_ENCHANT)) then return 4 end |
||
88 | if(strlower(isubtype or "")==strlower(ACEG_TEXT_ENGINEER)) then return 5 end |
||
89 | if(strlower(isubtype or "")==strlower(ACEG_TEXT_HERB)) then return 6 end |
||
90 | end, |
||
91 | |||
92 | SplitString = function(s,p,n) |
||
93 | if (type(s) ~= "string") then |
||
94 | error("SplitString must be passed a string as the first argument", 2) |
||
95 | end |
||
96 | |||
97 | local l,sp,ep = {},0 |
||
98 | while(sp) do |
||
99 | sp,ep=strfind(s,p) |
||
100 | if(sp) then |
||
101 | tinsert(l,strsub(s,1,sp-1)) |
||
102 | s=strsub(s,ep+1) |
||
103 | else |
||
104 | tinsert(l,s) |
||
105 | break |
||
106 | end |
||
107 | if(n) then n=n-1 end |
||
108 | if(n and (n==0)) then tinsert(l,s) break end |
||
109 | end |
||
110 | return unpack(l) |
||
111 | end, |
||
112 | }) |
||
113 | |||
114 | function MyBagsCoreClass:Initialize() |
||
115 | self.GetOpt = function(var) return self.db:get(self.profilePath,var) end |
||
116 | self.SetOpt = function(var,val) self.db:set(self.profilePath,var,val) end |
||
117 | self.TogOpt = function(var) return self.db:toggle(self.profilePath,var) end |
||
118 | self.Result = function(text, val, map) |
||
119 | if( map ) then val = map[val or 0] or val end |
||
120 | self.cmd:result(text, " ", ACEG_TEXT_NOW_SET_TO, " ", |
||
121 | format(ACEG_DISPLAY_OPTION, val or ACE_CMD_REPORT_NO_VAL) |
||
122 | ) |
||
123 | end |
||
124 | self.Error = function(...) self.cmd:result(format(unpack(arg))) end |
||
125 | self.TogMsg = function(var,text) self.Result(text,self.TogOpt(var),ACEG_MAP_ONOFF) end |
||
126 | self.frame = getglobal(self.frameName) |
||
127 | self.frame.self = self |
||
128 | -- self:IsLive() |
||
129 | end |
||
130 | function MyBagsCoreClass:Enable() |
||
131 | self:RegisterEvents() |
||
132 | self:HookFunctions() |
||
133 | if self.GetOpt("Scale") then |
||
134 | self.frame:SetScale(self.GetOpt("Scale")) |
||
135 | end |
||
136 | self:SetUISpecialFrames() |
||
137 | self:SetFrozen() |
||
138 | self:SetLockTexture() |
||
139 | local point = self.GetOpt("Anchor") |
||
140 | if point then |
||
141 | self.frame:ClearAllPoints() |
||
142 | self.frame:SetPoint(string.upper(point), self.frame:GetParent():GetName(), string.upper(point), 0, 0) |
||
143 | end |
||
144 | if self:CanSaveItems() then |
||
145 | self:LoadDropDown() |
||
146 | else |
||
147 | self.SetOpt("Player") |
||
148 | end |
||
149 | self:ChkCompanion() |
||
150 | if self.GetOpt("Strata") then |
||
151 | self.frame:SetFrameStrata(self.GetOpt("Strata")) |
||
152 | end |
||
153 | end |
||
154 | function MyBagsCoreClass:RegisterEvents() |
||
155 | self:RegisterEvent("BAG_UPDATE") |
||
156 | self:RegisterEvent("BAG_UPDATE_COOLDOWN", "LayoutFrameOnEvent") |
||
157 | self:RegisterEvent("ITEM_LOCK_CHANGED", "LayoutFrameOnEvent") |
||
158 | -- I hate ITEM_LOCK_CHANGED but without it dragging to the actionbars never resets the item button. |
||
159 | -- self:RegisterEvent("UPDATE_INVENTORY_ALERTS", "LayoutFrameOnEvent") |
||
160 | end |
||
161 | function MyBagsCoreClass:HookFunctions() |
||
162 | self:Hook("ToggleBag") |
||
163 | self:Hook("OpenBag") |
||
164 | self:Hook("CloseBag") |
||
165 | end |
||
166 | function MyBagsCoreClass:ToggleBag(bag) |
||
167 | -- self:debug("ToggleBagHook") |
||
168 | if self.GetOpt("Replace") and self:IncludeBag(bag) then |
||
169 | self:Toggle() |
||
170 | else |
||
171 | self.Hooks["ToggleBag"].orig(bag) |
||
172 | end |
||
173 | end |
||
174 | function MyBagsCoreClass:OpenBag(bag) |
||
175 | -- self:debug("OpenBagHook") |
||
176 | if (self.GetOpt("Replace") and self:IncludeBag(bag)) then |
||
177 | self:Open() |
||
178 | elseif not self.isBank then |
||
179 | self.Hooks["OpenBag"].orig(bag) |
||
180 | end |
||
181 | end |
||
182 | function MyBagsCoreClass:CloseBag(bag) |
||
183 | -- self:debug("CloseBagHook") |
||
184 | if not self.Freeze and (self.GetOpt("Replace") and self:IncludeBag(bag)) then |
||
185 | self:Close() |
||
186 | elseif not self.isBank then |
||
187 | self.Hooks["CloseBag"].orig(bag) |
||
188 | end |
||
189 | end |
||
190 | |||
191 | function MyBagsCoreClass:TooltipSetOwner(owner, anchor) |
||
192 | if not owner then owner = UIParent end |
||
193 | local parent = owner:GetParent() |
||
194 | if parent and (parent == self.frame or parent:GetParent() == self.frame ) then |
||
195 | local point = self.GetOpt("Anchor") or "bottomright" |
||
196 | if point == "topleft" or point == "bottomleft" then |
||
197 | anchor = "ANCHOR_RIGHT" |
||
198 | else |
||
199 | anchor = "ANCHOR_LEFT" |
||
200 | end |
||
201 | else |
||
202 | anchor = "ANCHOR_PRESERVE" |
||
203 | end |
||
204 | GameTooltip:SetOwner(owner, anchor) |
||
205 | end |
||
206 | -- Frame Toggle {{{ |
||
207 | function MyBagsCoreClass:Open() |
||
208 | if not self.frame:IsVisible() then self.frame:Show() end |
||
209 | if self.Player and self.Player ~= ace.char.id then |
||
210 | self.Player = ace.char.id |
||
211 | local dropDown = getglobal(self.frameName .. "CharSelectDropDown") |
||
212 | if dropDown then |
||
213 | UIDropDownMenu_SetSelectedValue(dropDown, ace.char.id) |
||
214 | end |
||
215 | end |
||
216 | self:LayoutFrame() |
||
217 | end |
||
218 | function MyBagsCoreClass:Close() |
||
219 | if self.frame:IsVisible() then self.frame:Hide() end |
||
220 | end |
||
221 | function MyBagsCoreClass:Toggle() |
||
222 | if self.frame:IsVisible() then |
||
223 | self:Close() |
||
224 | else |
||
225 | self:Open() |
||
226 | end |
||
227 | end |
||
228 | |||
229 | function MyBagsCoreClass:GetHyperlink(ID) |
||
230 | local _, link = GetItemInfo("item:" .. ID) |
||
231 | return link |
||
232 | end |
||
233 | function MyBagsCoreClass:GetTextLink(ID) |
||
234 | local myName, myLink, myQuality = GetItemInfo("item:" .. ID) |
||
235 | local _,_,_,myColor = GetItemQualityColor(myQuality or 0) |
||
236 | local textLink = "|cff" .. (strsub(myColor,5)) .. "|H" .. myLink .. "|h[" .. myName .. "]|h|r" |
||
237 | return textLink |
||
238 | end |
||
239 | |||
240 | --ITEMBUTTONS-- |
||
241 | function MyBagsCoreClass:ItemButton_OnLoad() |
||
242 | getglobal(this:GetName().."NormalTexture"):SetTexture("Interface\\AddOns\\MyBags\\Skin\\Button"); |
||
243 | ContainerFrameItemButton_OnLoad() |
||
244 | end |
||
245 | function MyBagsCoreClass:ItemButton_OnLeave() |
||
246 | GameTooltip:Hide() |
||
247 | local bagButton = getglobal(this:GetParent():GetName() .. "Bag") |
||
248 | if bagButton then bagButton:UnlockHighlight() end |
||
249 | CursorUpdate() |
||
250 | end |
||
251 | function MyBagsCoreClass:ItemButton_OnClick(button, ignoreShift) |
||
252 | if self.isLive then |
||
253 | if this.hasItem then self.watchLock = 1 end |
||
254 | if self.isBank and this:GetParent():GetID() == BANK_CONTAINER then |
||
255 | BankFrameItemButtonGeneric_OnClick(button) |
||
256 | else |
||
257 | ContainerFrameItemButton_OnClick(button, ignoreShift) |
||
258 | end |
||
259 | else |
||
260 | if button == "LeftButton" and IsControlKeyDown() and not ignoreShift then |
||
261 | local _, _, ID = self:GetInfo(this:GetParent():GetID(), this:GetID() ) |
||
262 | if DressUpItemLink and ID ~= "" then |
||
263 | DressUpItemLink("item:"..ID) |
||
264 | end |
||
265 | elseif (button == "LeftButton" ) and ( IsShiftKeyDown() and not ignoreShift) then |
||
266 | if (ChatFrameEditBox:IsVisible()) then |
||
267 | local _, _, ID = self:GetInfo(this:GetParent():GetID(), this:GetID() ) |
||
268 | local textLink |
||
269 | if ID then textLink = self:GetTextLink(ID) end |
||
270 | if textLink then ChatFrameEditBox:Insert(textLink) end |
||
271 | end |
||
272 | end |
||
273 | end |
||
274 | end |
||
275 | function MyBagsCoreClass:ItemButton_OnEnter() |
||
276 | if self.GetOpt("HlBags") == 1 then |
||
277 | local bagButton = getglobal(this:GetParent():GetName() .. "Bag") |
||
278 | if bagButton then bagButton:LockHighlight() end |
||
279 | end |
||
280 | self:TooltipSetOwner(this) |
||
281 | if self.isLive then |
||
282 | if this:GetParent() == MyBankFrameBank then -- OnEnter for BankItems is in XML, need 1.7 to use actual code |
||
283 | GameTooltip:SetInventoryItem("player", BankButtonIDToInvSlotID(this:GetID())) |
||
284 | else |
||
285 | ContainerFrameItemButton_OnEnter(this) |
||
286 | end |
||
287 | else |
||
288 | local ID |
||
289 | _, _, ID = self:GetInfo(this:GetParent():GetID(), this:GetID()) |
||
290 | if ID then |
||
291 | local hyperlink = self:GetHyperlink(ID) |
||
292 | if hyperlink then GameTooltip:SetHyperlink(hyperlink) end |
||
293 | end |
||
294 | end |
||
295 | if ( this.readable or (IsControlKeyDown() and this.hasItem) ) then |
||
296 | ShowInspectCursor() |
||
297 | end |
||
298 | end |
||
299 | function MyBagsCoreClass:ItemButton_OnDragStart() |
||
300 | if self.isLive then |
||
301 | self:ItemButton_OnClick("LeftButton", 1) |
||
302 | end |
||
303 | end |
||
304 | function MyBagsCoreClass:ItemButton_OnReceiveDrag() |
||
305 | if self.isLive then |
||
306 | self:ItemButton_OnClick("LeftButton", 1) |
||
307 | end |
||
308 | end |
||
309 | function MyBagsCoreClass:ItemButton_OnUpdate(arg1) |
||
310 | end |
||
311 | |||
312 | --BAGBUTTONS-- |
||
313 | function MyBagsCoreClass:BagButton_OnEnter() |
||
314 | local bagFrame = this:GetParent() |
||
315 | local setTooltip = true |
||
316 | self:TooltipSetOwner(this) |
||
317 | if self.isLive then |
||
318 | local invSlot = self:BagIDToInvSlotID(bagFrame:GetID()) |
||
319 | if not invSlot or (not GameTooltip:SetInventoryItem("player", invSlot)) or bagFrame:GetID() == KEYRING_CONTAINER then |
||
320 | setTooltip = false |
||
321 | end |
||
322 | else |
||
323 | _, _, ID = self:GetInfo(this:GetParent():GetID()) |
||
324 | if bagFrame:GetID() == 0 then |
||
325 | GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0,1.0,1.0) |
||
326 | elseif bagFrame:GetID() == KEYRING_CONTAINER then |
||
327 | setTooltip = false |
||
328 | elseif ID then |
||
329 | hyperlink = self:GetHyperlink(ID) |
||
330 | if hyperlink then |
||
331 | GameTooltip:SetHyperlink(hyperlink) |
||
332 | end |
||
333 | else |
||
334 | setTooltip = false |
||
335 | end |
||
336 | end |
||
337 | if not setTooltip then |
||
338 | local keyBinding |
||
339 | if self.isBank then |
||
340 | if self.isLive and not self:IsBagSlotUsable(bagFrame:GetID()) then |
||
341 | GameTooltip:SetText(BANK_BAG_PURCHASE) |
||
342 | if MyBank.atBank then |
||
343 | local cost = GetBankSlotCost() |
||
344 | GameTooltip:AddLine("Purchase:", "", 1, 1, 1) |
||
345 | SetTooltipMoney(GameTooltip, cost) |
||
346 | if GetMoney() > cost then |
||
347 | SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0) |
||
348 | else |
||
349 | SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 0.1, 0.1) |
||
350 | end |
||
351 | GameTooltip:Show() |
||
352 | end |
||
353 | keyBinding = GetBindingKey("TOGGLEBAG"..(4-this:GetID())) |
||
354 | else |
||
355 | GameTooltip:SetText(BANK_BAG) |
||
356 | end |
||
357 | else |
||
358 | if bagFrame:GetID() == 0 then -- SetScript("OnEnter", MainMenuBarBackpackButton:GetScript("OnEnter")) |
||
359 | GameTooltip:SetText(BACKPACK_TOOLTIP, 1.0,1.0,1.0) |
||
360 | keyBinding = GetBindingKey("TOGGLEBACKPACK") |
||
361 | elseif bagFrame:GetID() == KEYRING_CONTAINER then |
||
362 | GameTooltip:SetText(KEYRING, 1.0,1.0,1.0) |
||
363 | keyBinding = GetBindingKey("TOGGLEKEYRING") |
||
364 | else |
||
365 | GameTooltip:SetText(EQUIP_CONTAINER) |
||
366 | end |
||
367 | end |
||
368 | end |
||
369 | if self.GetOpt("HlItems") == 1 then -- Highlight |
||
370 | local i |
||
371 | for i = 1, self.MAXBAGSLOTS do |
||
372 | local button = getglobal(bagFrame:GetName() .. "Item" .. i) |
||
373 | if button then |
||
374 | button:LockHighlight() |
||
375 | end |
||
376 | end |
||
377 | end |
||
378 | end |
||
379 | function MyBagsCoreClass:BagButton_OnLeave() |
||
380 | SetMoneyFrameColor("GameTooltipMoneyFrame", 1.0, 1.0, 1.0); |
||
381 | GameTooltip:Hide() |
||
382 | for i = 1, self.MAXBAGSLOTS do |
||
383 | button = getglobal(this:GetParent():GetName() .. "Item" .. i) |
||
384 | if button then button:UnlockHighlight() end |
||
385 | end |
||
386 | end |
||
387 | function MyBagsCoreClass:BagButton_OnClick(button, ignoreShift) |
||
388 | if self.isBank then |
||
389 | this:SetChecked(nil) |
||
390 | else |
||
391 | this:SetChecked(self:IncludeBag(this:GetID())) |
||
392 | end |
||
393 | if self.isLive then |
||
394 | if button == "LeftButton" then |
||
395 | if not self:IsBagSlotUsable(this:GetParent():GetID()) then |
||
396 | local cost = GetBankSlotCost() |
||
397 | if GetMoney() > cost then |
||
398 | if not StaticPopupDialogs["PURCHASE_BANKBAG"] then return end |
||
399 | StaticPopup_Show("PURCHASE_BANKBAG") |
||
400 | end |
||
401 | return |
||
402 | end |
||
403 | if (not IsShiftKeyDown()) then |
||
404 | self:BagButton_OnReceiveDrag() |
||
405 | else |
||
406 | end |
||
407 | else |
||
408 | if (IsShiftKeyDown()) then |
||
409 | self.db:toggle({self.profilePath, "BagSlot" .. this:GetParent():GetID() }, "Exclude") |
||
410 | self.Hooks["CloseBag"].orig(this:GetParent():GetID()) |
||
411 | self:LayoutFrame() |
||
412 | end |
||
413 | end |
||
414 | end |
||
415 | end |
||
416 | function MyBagsCoreClass:BagButton_OnDragStart() |
||
417 | if self.isLive then |
||
418 | local bagFrame = this:GetParent() |
||
419 | local invID = self:BagIDToInvSlotID(bagFrame:GetID()) |
||
420 | if invID then |
||
421 | PickupBagFromSlot(invID) |
||
422 | PlaySound("BAGMENUBUTTONPRESS") |
||
423 | self.watchLock = 1 |
||
424 | end |
||
425 | end |
||
426 | end |
||
427 | function MyBagsCoreClass:BagButton_OnReceiveDrag() |
||
428 | if self.isLive then |
||
429 | local bagFrame = this:GetParent() |
||
430 | local invID = self:BagIDToInvSlotID(bagFrame:GetID()) |
||
431 | local hadItem |
||
432 | if not invID then |
||
433 | hadItem = PutItemInBackpack() |
||
434 | elseif bagFrame:GetID() == KEYRING_CONTAINER then |
||
435 | PutKeyInKeyRing() |
||
436 | else |
||
437 | hadItem = PutItemInBag(invID) |
||
438 | end |
||
439 | if not hadItem then |
||
440 | if not self:IncludeBag(bagFrame:GetID()) then |
||
441 | if bagFrame:GetID() == KEYRING_CONTAINER then |
||
442 | self.Hooks["ToggleKeyRing"].orig() |
||
443 | else |
||
444 | self.Hooks["ToggleBag"].orig(bagFrame:GetID()) |
||
445 | end |
||
446 | end |
||
447 | end |
||
448 | end |
||
449 | end |
||
450 | |||
451 | function MyBagsCoreClass:LoadDropDown() |
||
452 | local dropDown = getglobal(self.frameName .. "CharSelectDropDown") |
||
453 | local dropDownButton = getglobal(self.frameName .. "CharSelectDropDownButton") |
||
454 | if not dropDown then return end |
||
455 | local last_this = getglobal("this") |
||
456 | setglobal("this", dropDownButton) |
||
457 | UIDropDownMenu_Initialize(dropDown, self.UserDropDown_Initialize) |
||
458 | UIDropDownMenu_SetSelectedValue(dropDown, self:GetCurrentPlayer()) |
||
459 | UIDropDownMenu_SetWidth(140, dropDown) |
||
460 | OptionsFrame_EnableDropDown(dropDown) |
||
461 | setglobal("this", last_this) |
||
462 | end |
||
463 | function MyBagsCoreClass:UserDropDown_Initialize() |
||
464 | --if not KC_Items then return end |
||
465 | local chars |
||
466 | local hasList = 0 |
||
467 | if KC_Items then |
||
468 | chars = KC_Items.common:GetCharList(ace.char.realm, ace.char.faction) |
||
469 | for key, value in chars do |
||
470 | hasList = 1 |
||
471 | MYBAGS_KC_CHARS = chars |
||
472 | break |
||
473 | end |
||
474 | if charCount == 0 then |
||
475 | self.GetOpt("Player") |
||
476 | return |
||
477 | end |
||
478 | elseif MyBagsCache then |
||
479 | chars = MyBagsCache:GetCharList() |
||
480 | for key, value in chars do |
||
481 | hasList = 1 |
||
482 | MYBAGS_CACHE_CHARS = chars |
||
483 | break |
||
484 | end |
||
485 | if hasList == 0 then |
||
486 | self.GetOpt("Player") |
||
487 | return |
||
488 | end |
||
489 | else |
||
490 | return |
||
491 | end |
||
492 | MyBank:debug("Character list is available") |
||
493 | local frame = this:GetParent():GetParent():GetParent() |
||
494 | local selectedValue = UIDropDownMenu_GetSelectedValue(this) |
||
495 | |||
496 | for key, value in chars do |
||
497 | info = { |
||
498 | ["text"] = key, |
||
499 | ["value"] = key, |
||
500 | ["func"] = frame.self.UserDropDown_OnClick, |
||
501 | ["owner"] = frame.self, |
||
502 | ["checked"] = nil, |
||
503 | } |
||
504 | if selectedValue == info.value then info.checked = 1 end |
||
505 | UIDropDownMenu_AddButton(info) |
||
506 | end |
||
507 | end |
||
508 | function MyBagsCoreClass:UserDropDown_OnClick() |
||
509 | self = this.owner |
||
510 | local dropDown = getglobal(self.frameName .. "CharSelectDropDown") |
||
511 | self.Player = this.value |
||
512 | UIDropDownMenu_SetSelectedValue(dropDown, this.value) |
||
513 | self:LayoutFrame() |
||
514 | end |
||
515 | function MyBagsCoreClass:GetCurrentPlayer() |
||
516 | if self.Player then return self.Player end |
||
517 | return ace.char.id |
||
518 | end |
||
519 | |||
520 | function MyBagsCoreClass:CanSaveItems() |
||
521 | local live = self:IsLive() |
||
522 | self.isLive = FALSE |
||
523 | if self:GetInfoFunc() ~= self.GetInfoNone then |
||
524 | self.isLive = live |
||
525 | return TRUE |
||
526 | end |
||
527 | self.isLive = live |
||
528 | return FALSE |
||
529 | end |
||
530 | function MyBagsCoreClass:IsLive() |
||
531 | local isLive = true |
||
532 | local charID = self:GetCurrentPlayer() |
||
533 | if charID ~= ace.char.id then isLive = false end |
||
534 | if self.isBank and not MyBank.atBank then isLive = false end |
||
535 | self.isLive = isLive |
||
536 | return isLive |
||
537 | end |
||
538 | function MyBagsCoreClass:BagIDToInvSlotID(bag, isBank) |
||
539 | if bag == -1 or bag >= 5 and bag <= 10 then isBank = 1 end |
||
540 | if isBank then return BankButtonIDToInvSlotID(bag, 1) end |
||
541 | return ContainerIDToInventoryID(bag) |
||
542 | end |
||
543 | |||
544 | function MyBagsCoreClass:IncludeBag(bag) |
||
545 | if self.isBank and bag == BANK_CONTAINER then return TRUE end |
||
546 | if not self.isBank and bag == KEYRING_CONTAINER then |
||
547 | if self.db:get({self.profilePath, "BagSlot"..bag} , "Exclude") then |
||
548 | return FALSE |
||
549 | end |
||
550 | return TRUE |
||
551 | end |
||
552 | if bag < self.firstBag or bag > (self.firstBag + self.totalBags-1) then |
||
553 | return FALSE |
||
554 | else |
||
555 | if self.db:get({self.profilePath, "BagSlot"..bag} , "Exclude") then |
||
556 | return FALSE |
||
557 | end |
||
558 | return TRUE |
||
559 | end |
||
560 | end |
||
561 | function MyBagsCoreClass:IsBagSlotUsable(bag) |
||
562 | if not self.isBank then return TRUE end |
||
563 | local slots, full = GetNumBankSlots() |
||
564 | if (bag+1 - self.firstBag) <= slots then return TRUE end |
||
565 | return FALSE |
||
566 | end |
||
567 | |||
568 | function MyBagsCoreClass:GetCash() |
||
569 | if self.isLive then return GetMoney() |
||
570 | elseif IsAddOnLoaded("MyBagsCache") then |
||
571 | local charID = self:GetCurrentPlayer() |
||
572 | return MyBagsCache:GetCash(charID) |
||
573 | end |
||
574 | return nil |
||
575 | end |
||
576 | function MyBagsCoreClass:GetInfo(bag, slot) |
||
577 | local infofunc = self:GetInfoFunc() |
||
578 | if infofunc then |
||
579 | return infofunc(self, bag, slot) |
||
580 | end |
||
581 | return nil, 0, nil, nil, nil, nil, nil |
||
582 | end |
||
583 | function MyBagsCoreClass:GetInfoLive(bag, slot) |
||
584 | local texture, count, ID |
||
585 | local locked, quality, readable |
||
586 | local itemLink |
||
587 | |||
588 | self.Player = ace.char.id |
||
589 | if slot ~= nil then |
||
590 | -- it's an item |
||
591 | texture, count, locked, _ , readable = GetContainerItemInfo(bag, slot) |
||
592 | itemLink = GetContainerItemLink(bag, slot) |
||
593 | if itemLink then |
||
594 | _, quality, _, ID = ace.GetItemInfoFromLink(itemLink) |
||
595 | end |
||
596 | else |
||
597 | -- it's a bag |
||
598 | if(bag == KEYRING_CONTAINER) then |
||
599 | count = GetKeyRingSize() |
||
600 | else |
||
601 | count = GetContainerNumSlots(bag) |
||
602 | end |
||
603 | local inventoryID = self:BagIDToInvSlotID(bag) |
||
604 | if inventoryID then |
||
605 | texture = GetInventoryItemTexture("player", inventoryID) |
||
606 | itemLink = GetInventoryItemLink("player", inventoryID) |
||
607 | if itemLink then |
||
608 | _, quality, _, ID = ace.GetItemInfoFromLink(itemLink) |
||
609 | end |
||
610 | locked = IsInventoryItemLocked(inventoryID) |
||
611 | readable = ace.IsSpecialtyBagFromLink(itemLink) |
||
612 | else |
||
613 | texture = "Interface\\Buttons\\Button-Backpack-Up" |
||
614 | count = 16 |
||
615 | end |
||
616 | end |
||
617 | count = tonumber(count) |
||
618 | if count == nil then count = 0 end |
||
619 | return texture, count, ID, locked, quality, readable, nil |
||
620 | end |
||
621 | function MyBagsCoreClass:GetInfoMyBagsCache(bag,slot,charID) |
||
622 | local charID = self:GetCurrentPlayer() |
||
623 | local texture, count, ID, locked, quality, readable, name |
||
624 | if self.isEquipment then |
||
625 | slot = bag |
||
626 | texture, count, ID, quality, name = MyBagsCache:GetInfo("equipment", bag, charID) |
||
627 | else -- data.Texture, data.Count, data.Link, data.Color, data.Name |
||
628 | texture, count, ID, quality, name = MyBagsCache:GetInfo(bag, slot, charID) |
||
629 | if not slot and ID then |
||
630 | local _,_,_,_,c,d=GetItemInfo("item:"..ID) |
||
631 | readable = ace.IsSpecialtyBag(c,d) |
||
632 | end |
||
633 | end |
||
634 | count = tonumber(count) |
||
635 | if count == nil then count = 0 end |
||
636 | return texture, count, ID, nil, quality, readable, name |
||
637 | end |
||
638 | function MyBagsCoreClass:GetInfoNone(bag, slot) |
||
639 | return nil, 0, nil, nil, nil, nil, nil |
||
640 | end |
||
641 | |||
642 | function MyBagsCoreClass:GetSlotCount() |
||
643 | local slots, used, displaySlots = 0, 0, 0 |
||
644 | if self.isBank then |
||
645 | if self:CanSaveItems() or self.isLive then |
||
646 | slots = 24 |
||
647 | displaySlots = 24 |
||
648 | end |
||
649 | for i = 1, slots do |
||
650 | if (self:GetInfo(BANK_CONTAINER, i)) then used = used + 1 end |
||
651 | end |
||
652 | end |
||
653 | for bagIndex = 0, self.totalBags -1 do |
||
654 | local bagFrame = getglobal(self.frameName .. "Bag" .. bagIndex) |
||
655 | if bagFrame and self:IncludeBag(bagFrame:GetID()) then |
||
656 | local bagID = bagFrame:GetID() |
||
657 | local bagSlots, specBag |
||
658 | _, bagSlots, _, _, _, specBag = self:GetInfo(bagID) |
||
659 | bagSlots = ace.tonum(bagSlots) |
||
660 | if not specBag or specBag == "" then |
||
661 | slots = slots + bagSlots |
||
662 | displaySlots = displaySlots + bagSlots |
||
663 | for i = 1, bagSlots do |
||
664 | if self:GetInfo(bagID, i) then used = used + 1 end |
||
665 | end |
||
666 | else |
||
667 | displaySlots = displaySlots + bagSlots |
||
668 | end |
||
669 | end |
||
670 | end |
||
671 | if self:IncludeBag(KEYRING_CONTAINER) then |
||
672 | _, bagSlots, _, _, _, specBag = self:GetInfo(KEYRING_CONTAINER) |
||
673 | displaySlots = displaySlots + bagSlots |
||
674 | end |
||
675 | return slots, used, displaySlots |
||
676 | end |
||
677 | |||
678 | function MyBagsCoreClass:LayoutOptions() |
||
679 | local playerSelectFrame = getglobal(self.frameName .. "CharSelect") |
||
680 | local title = getglobal(self.frameName .. "Name") |
||
681 | local cash = getglobal(self.frameName .. "MoneyFrame") |
||
682 | local slots = getglobal(self.frameName .. "Slots") |
||
683 | local buttons = getglobal(self.frameName .. "Buttons") |
||
684 | self:UpdateTitle() |
||
685 | if self.GetOpt("Title") == TRUE then title:Show() |
||
686 | else title:Hide() end |
||
687 | if self.GetOpt("Cash") == TRUE then |
||
688 | local cashvalue = self:GetCash() |
||
689 | if cashvalue then |
||
690 | MoneyFrame_Update(self.frameName .. "MoneyFrame", cashvalue) |
||
691 | cash:Show() |
||
692 | else |
||
693 | cash:Hide() |
||
694 | end |
||
695 | else cash:Hide() end |
||
696 | if self.GetOpt("Buttons") == TRUE then buttons:Show() |
||
697 | else buttons:Hide() end |
||
698 | self:SetFrameMode(self.GetOpt("Graphics")) |
||
699 | if self.GetOpt("Player") == TRUE then |
||
700 | playerSelectFrame:Show() |
||
701 | else |
||
702 | playerSelectFrame:Hide() |
||
703 | end |
||
704 | playerSelectFrame:ClearAllPoints() |
||
705 | |||
706 | if (self.GetOpt("Graphics")) == "art" then |
||
707 | playerSelectFrame:SetPoint("TOP", self.frameName, "TOP", 22, -38) |
||
708 | self._TOPOFFSET = 32 |
||
709 | elseif self.GetOpt("Title") or self.GetOpt("Buttons") then |
||
710 | playerSelectFrame:SetPoint("TOP", self.frameName, "TOP", 0, -38) |
||
711 | self._TOPOFFSET = 28 |
||
712 | else |
||
713 | playerSelectFrame:SetPoint("TOP", self.frameName, "TOP", 0, -18) |
||
714 | self._TOPOFFSET = 8 |
||
715 | end |
||
716 | if self.GetOpt("Cash") or (not self.isEquipment and self.GetOpt("Count") ~= "none") then |
||
717 | self._BOTTOMOFFSET = 25 |
||
718 | else |
||
719 | self._BOTTOMOFFSET = 3 |
||
720 | end |
||
721 | if (self.frame.isBank) then |
||
722 | -- self:debug("self.frame.isBank") -- does this ever occur? |
||
723 | MYBAGS_BOTTOMOFFSET = MYBAGS_BOTTOMOFFSET+20 |
||
724 | cash:ClearAllPoints() |
||
725 | cash:SetPoint("BOTTOMRIGHT", self.frameName, "BOTTOMRIGHT", 0, 25) |
||
726 | end |
||
727 | |||
728 | if self.GetOpt("Player") == TRUE or self.GetOpt("Graphics") == "art" then |
||
729 | self.curRow = self.curRow + 1 |
||
730 | end |
||
731 | if self.GetOpt("Bag") == "bar" then |
||
732 | self.curRow = self.curRow + 1 |
||
733 | end |
||
734 | local count, used, displaySlots = nil |
||
735 | if not (self.isEquipment) then |
||
736 | count, used, displaySlots = self:GetSlotCount() |
||
737 | count = ace.tonum(count) |
||
738 | displaySlots = ace.tonum(displaySlots) |
||
739 | if self.GetOpt("Count") == "free" then |
||
740 | slots:Show() |
||
741 | slots:SetText(format(MYBAGS_SLOTS_DD, (count - used), count )) |
||
742 | elseif self.GetOpt("Count") == "used" then |
||
743 | slots:Show() |
||
744 | slots:SetText(format(MYBAGS_SLOTS_DD, (used), count )) |
||
745 | else |
||
746 | slots:Hide() |
||
747 | end |
||
748 | if self.GetOpt("Reverse") then |
||
749 | self.reverseOrder = TRUE |
||
750 | else |
||
751 | self.reverseOrder = nil |
||
752 | end |
||
753 | end |
||
754 | if self.GetOpt("AIOI") then |
||
755 | self.aioiOrder = TRUE |
||
756 | local columns = self.GetOpt("Columns") |
||
757 | if not (self.isEquipment) and self.GetOpt("Bag") == "before" then displaySlots = displaySlots + self.totalBags end |
||
758 | columns = ace.tonum(columns) |
||
759 | if self.isEquipment then displaySlots = 20 end |
||
760 | self.curCol = columns - (mod(displaySlots, columns) ) |
||
761 | if self.curCol == columns then self.curCol = 0 end |
||
762 | else |
||
763 | self.aioiOrder = nil |
||
764 | end |
||
765 | |||
766 | end |
||
767 | function MyBagsCoreClass:UpdateTitle() |
||
768 | local title1 = 4 |
||
769 | local title2 = 7 |
||
770 | if self.GetOpt("Graphics") == "art" then |
||
771 | title1 = 5 |
||
772 | title2 = 9 |
||
773 | end |
||
774 | local columns = self.GetOpt("Columns") |
||
775 | local titleString |
||
776 | if columns > title2 then |
||
777 | titleString = MYBAGS_TITLE2 |
||
778 | elseif columns > title1 then |
||
779 | titleString = MYBAGS_TITLE1 |
||
780 | else |
||
781 | titleString = MYBAGS_TITLE0 |
||
782 | end |
||
783 | titleString = titleString .. getglobal(string.upper(self.frameName) .. "_TITLE") |
||
784 | local title = getglobal(self.frameName .. "Name") |
||
785 | local player, realm = ace.SplitString(self:GetCurrentPlayer(), CHARACTER_DELIMITOR) |
||
786 | title:SetText(format(titleString, player, realm)) |
||
787 | end |
||
788 | function MyBagsCoreClass:SetFrameMode(mode) |
||
789 | local frame = self.frame |
||
790 | local frameName = self.frameName |
||
791 | local textureTopLeft, textureTop, textureTopRight |
||
792 | local textureLeft, textureCenter, textureRight |
||
793 | local textureBottomLeft, textureBottom, textureBottomRight |
||
794 | local texturePortrait |
||
795 | local frameTitle |
||
796 | local frameButtonBar = getglobal(frameName .. "Buttons") |
||
797 | textureTopLeft = getglobal(frameName .. "TextureTopLeft") |
||
798 | textureTopCenter = getglobal(frameName .. "TextureTopCenter") |
||
799 | textureTopRight = getglobal(frameName .. "TextureTopRight") |
||
800 | |||
801 | textureLeft = getglobal(frameName .. "TextureLeft") |
||
802 | textureCenter = getglobal(frameName .. "TextureCenter") |
||
803 | textureRight = getglobal(frameName .. "TextureRight") |
||
804 | |||
805 | textureBottomLeft = getglobal(frameName .. "TextureBottomLeft") |
||
806 | textureBottomCenter= getglobal(frameName .. "TextureBottomCenter") |
||
807 | textureBottomRight = getglobal(frameName .. "TextureBottomRight") |
||
808 | texturePortrait = getglobal(frameName .. "Portrait") |
||
809 | frameTitle = getglobal(frameName .. "Name") |
||
810 | frameTitle:ClearAllPoints() |
||
811 | frameButtonBar:ClearAllPoints() |
||
812 | if mode == "art" then |
||
813 | frameTitle:SetPoint("TOPLEFT", frameName, "TOPLEFT", 70, -10) |
||
814 | frameTitle:Show() |
||
815 | frameButtonBar:Show() |
||
816 | frameButtonBar:SetPoint("TOPRIGHT", frameName, "TOPRIGHT", 10, 0) |
||
817 | frame:SetBackdropColor(0,0,0,0) |
||
818 | frame:SetBackdropBorderColor(0,0,0,0) |
||
819 | textureTopLeft:Show() |
||
820 | textureTopCenter:Show() |
||
821 | textureTopRight:Show() |
||
822 | textureLeft:Show() |
||
823 | textureCenter:Show() |
||
824 | textureRight:Show() |
||
825 | textureBottomLeft:Show() |
||
826 | textureBottomCenter:Show() |
||
827 | textureBottomRight:Show() |
||
828 | texturePortrait:Show() |
||
829 | else |
||
830 | frameTitle:SetPoint("TOPLEFT", frameName, "TOPLEFT", 5, -6) |
||
831 | frameButtonBar:SetPoint("TOPRIGHT", frameName, "TOPRIGHT", 0, 0) |
||
832 | textureTopLeft:Hide() |
||
833 | textureTopCenter:Hide() |
||
834 | textureTopRight:Hide() |
||
835 | textureLeft:Hide() |
||
836 | textureCenter:Hide() |
||
837 | textureRight:Hide() |
||
838 | textureBottomLeft:Hide() |
||
839 | textureBottomCenter:Hide() |
||
840 | textureBottomRight:Hide() |
||
841 | texturePortrait:Hide() |
||
842 | if mode == "default" then |
||
843 | local BackColor = self.GetOpt("BackColor") or {0.7,0,0,0} |
||
844 | local a, r, g, b = unpack(BackColor) |
||
845 | frame:SetBackdropColor(r,g,b,a) |
||
846 | frame:SetBackdropBorderColor(1,1,1,a) |
||
847 | else |
||
848 | frame:SetBackdropColor(0,0,0,0) |
||
849 | frame:SetBackdropBorderColor(0,0,0,0) |
||
850 | end |
||
851 | end |
||
852 | end |
||
853 | function MyBagsCoreClass:GetXY(row, col) |
||
854 | return (self._LEFTOFFSET + (col * MYBAGS_COLWIDTH)), (0 - self._TOPOFFSET - (row * MYBAGS_ROWHEIGHT)) |
||
855 | end |
||
856 | function MyBagsCoreClass:LayoutBagFrame(bagFrame) |
||
857 | local bagFrameName = bagFrame:GetName() |
||
858 | local slot |
||
859 | local itemBase = bagFrameName .. "Item" |
||
860 | local bagButton = getglobal(bagFrameName .. "Bag") |
||
861 | local texture, count, _, locked, quality, ammo |
||
862 | local slotColor = ((self.GetOpt("SlotColor")) or MYBAGS_SLOTCOLOR) |
||
863 | local ammoColor = ((self.GetOpt("AmmoColor")) or MYBAGS_AMMOCOLOR) |
||
864 | local shardColor = ((self.GetOpt("ShardColor")) or MYBAGS_SHARDCOLOR) |
||
865 | local enchantColor = ((self.GetOpt("EnchantColor")) or MYBAGS_ENCHANTCOLOR) |
||
866 | local engColor = ((self.GetOpt("EngColor")) or MYBAGS_ENGINEERCOLOR) |
||
867 | local herbColor = ((self.GetOpt("HerbColor")) or MYBAGS_HERBCOLOR) |
||
868 | local keyringColor = ((self.GetOpt("KeyRingColor")) or MYBAGS_KEYRINGCOLOR) |
||
869 | self.watchLock = nil |
||
870 | |||
871 | texture, count, _, locked, _, specialty = self:GetInfo(bagFrame:GetID()) |
||
872 | bagFrame.size = ace.tonum(count) |
||
873 | if bagButton and bagFrame:GetID() ~= BANK_CONTAINER then |
||
874 | if not texture then _, texture = GetInventorySlotInfo("Bag0Slot") end |
||
875 | if not self.isLive or (self.isLive and self:IsBagSlotUsable(bagFrame:GetID())) then |
||
876 | SetItemButtonTextureVertexColor(bagButton, 1.0, 1.0, 1.0) |
||
877 | SetItemButtonDesaturated(bagButton, locked, 0.5, 0.5, 0.5) |
||
878 | else |
||
879 | SetItemButtonTextureVertexColor(bagButton, 1.0, 0.1, 0.1) |
||
880 | end |
||
881 | SetItemButtonTexture(bagButton, texture) |
||
882 | if self.GetOpt("Bag") == "bar" then |
||
883 | local col, row = 0, 0 |
||
884 | if self.GetOpt("Player") or self.GetOpt("Graphics") == "art" then row = 1 end |
||
885 | if self.isBank then |
||
886 | col = (self.GetOpt("Columns") - self.totalBags)/2 |
||
887 | else |
||
888 | col = (self.GetOpt("Columns") - self.totalBags -.5)/2 |
||
889 | end |
||
890 | if bagFrame:GetID() == KEYRING_CONTAINER then |
||
891 | col = col + 5 - self.firstBag |
||
892 | else |
||
893 | col = col + bagFrame:GetID() - self.firstBag |
||
894 | end |
||
895 | bagButton:Show() |
||
896 | bagButton:ClearAllPoints() |
||
897 | bagButton:SetPoint("TOPLEFT", self.frameName, "TOPLEFT", self:GetXY(row, col)) |
||
898 | elseif self.GetOpt("Bag") == "before" then |
||
899 | if self.curCol >= self.GetOpt("Columns") then |
||
900 | self.curCol = 0 |
||
901 | self.curRow = self.curRow + 1 |
||
902 | end |
||
903 | bagButton:Show() |
||
904 | bagButton:ClearAllPoints() |
||
905 | bagButton:SetPoint("TOPLEFT", self.frameName, "TOPLEFT", self:GetXY(self.curRow,self.curCol)) |
||
906 | self.curCol = self.curCol + 1 |
||
907 | else |
||
908 | bagButton:Hide() |
||
909 | end |
||
910 | if not self:IncludeBag(bagFrame:GetID()) or self.isBank then |
||
911 | bagButton:SetChecked(nil) |
||
912 | else |
||
913 | bagButton:SetChecked(1) |
||
914 | end |
||
915 | end |
||
916 | -- local maxIndex = MYBAGS_MAXBAGSLOTS |
||
917 | -- if bagFrame.maxIndex then maxIndex = bagFrame.maxIndex end |
||
918 | if bagFrame.size < 1 or not self:IncludeBag(bagFrame:GetID()) then |
||
919 | bagFrame.size = 0 |
||
920 | else |
||
921 | for slot = 1, bagFrame.size do |
||
922 | local itemButton = getglobal(itemBase .. slot) or CreateFrame("Button", itemBase .. slot, bagFrame, "MyBagsItemButtonTemplate") |
||
923 | itemButton:SetID(slot) |
||
924 | if self.curCol >= self.GetOpt("Columns") then |
||
925 | self.curCol = 0 |
||
926 | self.curRow = self.curRow + 1 |
||
927 | end |
||
928 | itemButton:Show() |
||
929 | itemButton:ClearAllPoints() |
||
930 | itemButton:SetPoint("TOPLEFT", self.frame:GetName(), "TOPLEFT", self:GetXY(self.curRow, self.curCol)) |
||
931 | self.curCol = self.curCol + 1 |
||
932 | texture, count, id, locked, quality = self:GetInfo(bagFrame:GetID(), slot) |
||
933 | if id and id ~= "" then itemButton.hasItem = 1 |
||
934 | else quality = nil end |
||
935 | if self.isLive then |
||
936 | local start,duration, enable = GetContainerItemCooldown(bagFrame:GetID(), slot) |
||
937 | local cooldown = getglobal(itemButton:GetName() .. "Cooldown") |
||
938 | CooldownFrame_SetTimer(cooldown,start,duration,enable) |
||
939 | if duration>0 and enable==0 then |
||
940 | SetItemButtonTextureVertexColor(itemButton, 0.4,0.4,0.4) |
||
941 | end |
||
942 | end |
||
943 | SetItemButtonTexture(itemButton, (texture or "")) |
||
944 | SetItemButtonCount(itemButton, count) |
||
945 | SetItemButtonDesaturated(itemButton, locked, 0.5, 0.5, 0.5) |
||
946 | if locked and locked ~= "" then |
||
947 | itemButton:LockHighlight() |
||
948 | self.watchLock =1 |
||
949 | else itemButton:UnlockHighlight() end |
||
950 | if quality and self.GetOpt("Border") then |
||
951 | SetItemButtonNormalTextureVertexColor(itemButton, ace.ColorConvertHexToDigit(quality)) |
||
952 | else |
||
953 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(slotColor)) |
||
954 | if (specialty == 1 or specialty == 2) then |
||
955 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(ammoColor)) |
||
956 | elseif specialty == 3 then |
||
957 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(shardColor)) |
||
958 | elseif specialty == 4 then |
||
959 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(enchantColor)) |
||
960 | elseif specialty == 5 then |
||
961 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(engColor)) |
||
962 | elseif specialty == 6 then |
||
963 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(herbColor)) |
||
964 | elseif bagFrame:GetID() == KEYRING_CONTAINER then |
||
965 | SetItemButtonNormalTextureVertexColor(itemButton, unpack(keyringColor)) |
||
966 | end |
||
967 | end |
||
968 | end |
||
969 | end |
||
970 | if(bagFrame.size) then |
||
971 | local slot = bagFrame.size + 1 |
||
972 | local itemButton = getglobal(itemBase .. slot) |
||
973 | while itemButton do |
||
974 | itemButton:Hide() |
||
975 | slot = slot + 1 |
||
976 | itemButton = getglobal(itemBase .. slot) |
||
977 | end |
||
978 | end |
||
979 | end |
||
980 | function MyBagsCoreClass:LayoutFrame() |
||
981 | -- local time = GetTime() |
||
982 | -- if not self.frame or not self.frame:IsVisible() then return end |
||
983 | if not self.frame:IsVisible() then return end |
||
984 | self.isLive = self:IsLive() |
||
985 | local bagBase = self.frameName .. "Bag" |
||
986 | local bagIndex, bagFrame |
||
987 | self.curRow, self.curCol = 0,0 |
||
988 | self:LayoutOptions() |
||
989 | if self.isEquipment then |
||
990 | self:LayoutEquipmentFrame(self) |
||
991 | else |
||
992 | if self.reverseOrder then |
||
993 | if not self.isBank then |
||
994 | bagFrame = getglobal(self.frameName .. "KeyRing") |
||
995 | bagFrame:SetID(KEYRING_CONTAINER) |
||
996 | self:LayoutBagFrame(bagFrame) |
||
997 | end |
||
998 | for bag = self.totalBags-1,0,-1 do |
||
999 | bagFrame = getglobal(bagBase .. bag) |
||
1000 | if (bagFrame) then |
||
1001 | self:LayoutBagFrame(bagFrame) |
||
1002 | end |
||
1003 | end |
||
1004 | if self.isBank then |
||
1005 | bagFrame = getglobal(self.frameName .. "Bank") |
||
1006 | self:LayoutBagFrame(bagFrame) |
||
1007 | end |
||
1008 | else |
||
1009 | if self.isBank then |
||
1010 | bagFrame = getglobal(self.frameName .. "Bank") |
||
1011 | self:LayoutBagFrame(bagFrame) |
||
1012 | end |
||
1013 | for bag = 0, self.totalBags-1 do |
||
1014 | bagFrame = getglobal(bagBase .. bag) |
||
1015 | if (bagFrame) then |
||
1016 | self:LayoutBagFrame(bagFrame) |
||
1017 | end |
||
1018 | end |
||
1019 | if not self.isBank then |
||
1020 | bagFrame = getglobal(self.frameName .. "KeyRing") |
||
1021 | bagFrame:SetID(KEYRING_CONTAINER) |
||
1022 | self:LayoutBagFrame(bagFrame) |
||
1023 | end |
||
1024 | end |
||
1025 | end |
||
1026 | if self.curCol == 0 then self.curRow = self.curRow - 1 end |
||
1027 | self.frame:SetWidth(self._LEFTOFFSET + self._RIGHTOFFSET + self.GetOpt("Columns") * MYBAGS_COLWIDTH) |
||
1028 | self.frame:SetHeight(self._TOPOFFSET + self._BOTTOMOFFSET + (self.curRow + 1) * MYBAGS_ROWHEIGHT) |
||
1029 | -- self:debug("LayoutFrame ".. GetTime()-time) |
||
1030 | end |
||
1031 | function MyBagsCoreClass:LayoutFrameOnEvent() |
||
1032 | -- local time = GetTime() |
||
1033 | if event == "UNIT_INVENTORY_CHANGED" and arg1 ~= "player" then return end |
||
1034 | if event == "ITEM_LOCK_CHANGED" and not self.watchLock then return end |
||
1035 | if self.isLive then |
||
1036 | self:LayoutFrame() |
||
1037 | end |
||
1038 | -- self:debug("LayoutFrameOnEvent "..event.." ".. GetTime()-time) |
||
1039 | end |
||
1040 | function MyBagsCoreClass:LockButton_OnClick() |
||
1041 | self.TogOpt("Lock") |
||
1042 | self:SetLockTexture() |
||
1043 | end |
||
1044 | |||
1045 | function MyBagsCoreClass:SetLockTexture() |
||
1046 | local button = getglobal(self.frameName .. "ButtonsLockButtonNormalTexture") |
||
1047 | local texture = "Interface\\AddOns\\MyBags\\Skin\\LockButton-" |
||
1048 | if not self.GetOpt("Lock") then texture = texture .. "Un" end |
||
1049 | texture = texture .. "Locked-Up" |
||
1050 | button:SetTexture(texture) |
||
1051 | if self.GetOpt("Lock") and self.GetOpt("Graphics") == "none" then |
||
1052 | -- self:debug("Mouse clicks pass through") |
||
1053 | self.frame:EnableMouse(nil) |
||
1054 | else |
||
1055 | -- self:debug("Mouse clicks intercepted") |
||
1056 | self.frame:EnableMouse(1) |
||
1057 | end |
||
1058 | end |
||
1059 | function MyBagsCoreClass:SetFrozen() |
||
1060 | if self.GetOpt("Freeze") == "always" then |
||
1061 | self.Freeze = "always" |
||
1062 | elseif self.GetOpt("Freeze") == "sticky" then |
||
1063 | self.Freeze = "sticky" |
||
1064 | else |
||
1065 | self.Freeze = nil |
||
1066 | end |
||
1067 | end |
||
1068 | function MyBagsCoreClass:SetUISpecialFrames() |
||
1069 | if self.GetOpt("NoEsc") then |
||
1070 | for k,v in UISpecialFrames do |
||
1071 | if v == (self.frameName) then |
||
1072 | table.remove(UISpecialFrames, k) |
||
1073 | end |
||
1074 | end |
||
1075 | else |
||
1076 | table.insert(UISpecialFrames, self.frameName) |
||
1077 | end |
||
1078 | end |
||
1079 | |||
1080 | --CHAT CMD OPTIONS {{{ |
||
1081 | function MyBagsCoreClass:SetColumns(cols) |
||
1082 | cols = ace.tonum(cols) |
||
1083 | |||
1084 | if( (cols >= self.minColumns) and (cols <= self.maxColumns) ) then |
||
1085 | self.SetOpt("Columns", cols) |
||
1086 | self:LayoutFrame() |
||
1087 | --self.Result(ONEBAG_TEXT_COLS, cols) |
||
1088 | else |
||
1089 | --self.Result(ONEBAG_COLUMN_LIMIT_MSG, self.minColumns, self.maxColumns) |
||
1090 | end |
||
1091 | end |
||
1092 | function MyBagsCoreClass:SetReplace() |
||
1093 | self.TogMsg("Replace", "Replace default bags") |
||
1094 | self:LayoutFrame() |
||
1095 | end |
||
1096 | function MyBagsCoreClass:SetBagDisplay(opt) |
||
1097 | self.SetOpt("Bag", opt) |
||
1098 | self.Result("Bag Buttons", opt) |
||
1099 | self:LayoutFrame() |
||
1100 | end |
||
1101 | function MyBagsCoreClass:SetGraphicsDisplay(opt) |
||
1102 | local a, r, g, b |
||
1103 | opt, a, r, g, b = unpack(ace.ParseWords(opt)) |
||
1104 | -- self:debug("opt: |" .. opt .."| ") |
||
1105 | if opt ~= "default" and opt~="art" and opt~="none" then |
||
1106 | return |
||
1107 | end |
||
1108 | self.SetOpt("Graphics", opt) |
||
1109 | if a then |
||
1110 | self.SetOpt("BackColor", {ace.tonum(a), ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1111 | else |
||
1112 | self.SetOpt("BackColor") |
||
1113 | end |
||
1114 | self.Result("Background", opt) |
||
1115 | self:LayoutFrame() |
||
1116 | end |
||
1117 | function MyBagsCoreClass:SetHighlight(mode) |
||
1118 | if mode == "items" then |
||
1119 | self.TogMsg("HlItems", "Highlight") |
||
1120 | else |
||
1121 | self.TogMsg("HlBags", "Highlight") |
||
1122 | end |
||
1123 | end |
||
1124 | function MyBagsCoreClass:SetFreeze(opt) |
||
1125 | opt = strlower(opt) |
||
1126 | if opt == "freeze always" then opt = "always" end |
||
1127 | if opt == "freeze sticky" then opt = "sticky" end |
||
1128 | if opt == "freeze none" then opt = "none" end |
||
1129 | self.Result("Freeze", opt) |
||
1130 | self.SetOpt("Freeze", opt) |
||
1131 | self:SetFrozen() |
||
1132 | end |
||
1133 | function MyBagsCoreClass:SetNoEsc() |
||
1134 | self.TogMsg("NoEsc", "NoEsc") |
||
1135 | self:SetUISpecialFrames() |
||
1136 | end |
||
1137 | function MyBagsCoreClass:SetLock() |
||
1138 | self.TogMsg("Lock", "Lock") |
||
1139 | self:SetLockTexture() |
||
1140 | end |
||
1141 | function MyBagsCoreClass:SetTitle() |
||
1142 | self.TogMsg("Title", "Frame Title") |
||
1143 | self:LayoutFrame() |
||
1144 | end |
||
1145 | function MyBagsCoreClass:SetCash() |
||
1146 | self.TogMsg("Cash", "Money Display") |
||
1147 | self:LayoutFrame() |
||
1148 | end |
||
1149 | function MyBagsCoreClass:SetButtons() |
||
1150 | self.TogMsg("Buttons", "Frame Buttons") |
||
1151 | self:LayoutFrame() |
||
1152 | end |
||
1153 | function MyBagsCoreClass:SetAIOI() |
||
1154 | self.TogMsg("AIOI", "toggle partial row placement") |
||
1155 | self:LayoutFrame() |
||
1156 | end |
||
1157 | function MyBagsCoreClass:SetReverse() |
||
1158 | self.TogMsg("Reverse", "reverse bag ordering") |
||
1159 | self:LayoutFrame() |
||
1160 | end |
||
1161 | function MyBagsCoreClass:SetBorder() |
||
1162 | self.TogMsg("Border", "Quality Borders") |
||
1163 | self:LayoutFrame() |
||
1164 | end |
||
1165 | function MyBagsCoreClass:SetPlayerSel() |
||
1166 | if self:CanSaveItems() then |
||
1167 | -- self:debug("CanSaveItems") |
||
1168 | self.TogMsg("Player", "Player selection") |
||
1169 | else |
||
1170 | -- self:debug("Can'tSaveItems") |
||
1171 | self.SetOpt("Player") |
||
1172 | end |
||
1173 | self:LayoutFrame() |
||
1174 | end |
||
1175 | function MyBagsCoreClass:SetCount(mode) |
||
1176 | self.SetOpt("Count", mode) |
||
1177 | self.Result("Count", mode) |
||
1178 | self:LayoutFrame() |
||
1179 | end |
||
1180 | function MyBagsCoreClass:SetScale(scale) |
||
1181 | scale = ace.tonum(scale) |
||
1182 | if scale == 0 then |
||
1183 | self.SetOpt("Scale") |
||
1184 | self.frame:SetScale(self.frame:GetParent():GetScale()) |
||
1185 | self.Result("Scale", ACEG_TEXT_DEFAULT) |
||
1186 | elseif (( scale < ace.tonum(MIN_SCALE_VAL)) or (scale > ace.tonum(MAX_SCALE_VAL))) then |
||
1187 | self.Error("Invalid Scale") |
||
1188 | else |
||
1189 | self.SetOpt("Scale", scale) |
||
1190 | self.frame:SetScale(scale) |
||
1191 | self.Result("Scale", scale) |
||
1192 | end |
||
1193 | end |
||
1194 | function MyBagsCoreClass:SetStrata(strata) |
||
1195 | strata = strupper(strata) |
||
1196 | -- if strata =="BACKGROUND" or strata =="LOW" or strata =="MEDIUM" or strata =="HIGH" or strata =="DIALOG" or strata =="FULLSCREEN" or strata =="FULLSCREEN_DIALOG" or strata =="TOOLTIP" then |
||
1197 | if strata =="BACKGROUND" or strata =="LOW" or strata =="MEDIUM" or strata =="HIGH" or strata =="DIALOG" then |
||
1198 | self.SetOpt("Strata", strata) |
||
1199 | self.frame:SetFrameStrata(strata) |
||
1200 | self.Result("Strata", strata) |
||
1201 | else |
||
1202 | self.Error("Invalid strata") |
||
1203 | end |
||
1204 | end |
||
1205 | function MyBagsCoreClass:Report() |
||
1206 | self.cmd:report({ |
||
1207 | {text="Columns", val=self.GetOpt("Columns")}, |
||
1208 | {text="Graphics", val=self.GetOpt("Graphics")}, |
||
1209 | {text="Lock", val=self.GetOpt("Lock"),map=ACEG_MAP_ONOFF}, |
||
1210 | {text="NoEsc", val=self.GetOpt("NoEsc"),map=ACEG_MAP_ONOFF}, |
||
1211 | {text="Title", val=self.GetOpt("Title"),map=ACEG_MAP_ONOFF}, |
||
1212 | {text="Cash", val=self.GetOpt("Cash"),map=ACEG_MAP_ONOFF}, |
||
1213 | {text="Buttons", val=self.GetOpt("Buttons"),map=ACEG_MAP_ONOFF}, |
||
1214 | {text="Border", val=self.GetOpt("Border"),map=ACEG_MAP_ONOFF}, |
||
1215 | {text="Player", val=self.GetOpt("Player"),map=ACEG_MAP_ONOFF}, |
||
1216 | {text="AIOI", val=self.GetOpt("AIOI"),map=ACEG_MAP_ONOFF}, |
||
1217 | {text="Scale", val=self.GetOpt("Scale")}, |
||
1218 | {text="Strata", val=self.GetOpt("Strata")}, |
||
1219 | {text="Anchor", val=self.GetOpt("Anchor")}, |
||
1220 | {text="Default Slot Color", val=ace.concat(self.GetOpt("SlotColor") or MYBAGS_SLOTCOLOR," ")}, |
||
1221 | }) |
||
1222 | if not self.isEquipment then |
||
1223 | self.cmd:report({ |
||
1224 | {text="Default Slot Color", val=ace.concat(self.GetOpt("SlotColor") or MYBAGS_SLOTCOLOR," ")}, |
||
1225 | {text="Ammo Slot Color", val=ace.concat(self.GetOpt("AmmoColor") or MYBAGS_AMMOCOLOR," ")}, |
||
1226 | {text="Soul Slot Color", val=ace.concat(self.GetOpt("SoulColor") or MYBAGS_SHARDCOLOR," ")}, |
||
1227 | {text="Enchanting Slot Color", val=ace.concat(self.GetOpt("EnchantColor") or MYBAGS_ENCHANTCOLOR," ")}, |
||
1228 | {text="Engineering Slot Color", val=ace.concat(self.GetOpt("EngColor") or MYBAGS_ENGINEERCOLOR," ")}, |
||
1229 | {text="Herb Slot Color", val=ace.concat(self.GetOpt("HerbColor") or MYBAGS_HERBCOLOR," ")}, |
||
1230 | {text="Replace", val=self.GetOpt("Replace"),map=ACEG_MAP_ONOFF}, |
||
1231 | {text="Bag", val=self.GetOpt("Bag")}, |
||
1232 | {text="HlItems", val=self.GetOpt("HlItems"),map=ACEG_MAP_ONOFF}, |
||
1233 | {text="HlBags", val=self.GetOpt("HlBags"),map=ACEG_MAP_ONOFF}, |
||
1234 | {text="Freeze", val=self.GetOpt("Freeze")}, |
||
1235 | {text="Reverse", val=self.GetOpt("Reverse"),map=ACEG_MAP_ONOFF}, |
||
1236 | {text="Count", val=self.GetOpt("Count")}, |
||
1237 | {text="Anchor", val=self.GetOpt("Anchor")}, |
||
1238 | }) |
||
1239 | if not self.isBank then |
||
1240 | self.cmd:report({ |
||
1241 | {text="Companion", val=self.GetOpt("Companion"),map=ACEG_MAP_ONOFF}, |
||
1242 | }) |
||
1243 | end |
||
1244 | end |
||
1245 | end |
||
1246 | function MyBagsCoreClass:ResetSettings() |
||
1247 | self.db:reset(self.profilePath, self.defaults) |
||
1248 | self.Error("Settings reset to default") |
||
1249 | self:ResetAnchor() |
||
1250 | self:SetLockTexture() |
||
1251 | self:SetUISpecialFrames() |
||
1252 | self:SetFrozen() |
||
1253 | self:LayoutFrame() |
||
1254 | end |
||
1255 | function MyBagsCoreClass:ResetAnchor() |
||
1256 | if not self:SetAnchor(self.defaults.Anchor) then return end |
||
1257 | anchorframe = self.frame:GetParent() |
||
1258 | anchorframe:ClearAllPoints() |
||
1259 | anchorframe:SetPoint(self.anchorPoint, self.anchorParent, self.anchorPoint, self.anchorOffsetX, self.anchorOffsetY) |
||
1260 | self.frame:ClearAllPoints() |
||
1261 | self.frame:SetPoint(self.anchorPoint, anchorframe, self.anchorPoint, 0, 0) |
||
1262 | self.Error("Anchor Reset") |
||
1263 | end |
||
1264 | function MyBagsCoreClass:SetAnchor(point) |
||
1265 | if point == "topleft" then |
||
1266 | elseif point == "topright" then |
||
1267 | elseif point == "bottomleft" then |
||
1268 | elseif point == "bottomright" then |
||
1269 | else self.Error("Invalid Entry for Anchor") return end |
||
1270 | local anchorframe = self.frame:GetParent() |
||
1271 | local top = self.frame:GetTop() |
||
1272 | local left = self.frame:GetLeft() |
||
1273 | local top1 = anchorframe:GetTop() |
||
1274 | local left1 = anchorframe:GetLeft() |
||
1275 | if not top or not left or not left1 or not top1 then |
||
1276 | self.Error("Frame must be open to set anchor") return |
||
1277 | end |
||
1278 | self.frame:ClearAllPoints() |
||
1279 | anchorframe:ClearAllPoints() |
||
1280 | anchorframe:SetPoint(string.upper(point), self.frameName, string.upper(point), 0, 0) |
||
1281 | top = anchorframe:GetTop() |
||
1282 | left = anchorframe:GetLeft() |
||
1283 | if not top or not left then |
||
1284 | anchorframe:ClearAllPoints() |
||
1285 | anchorframe:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", left1, top1-10) |
||
1286 | point = string.upper(self.GetOpt("Anchor") or "bottomright") |
||
1287 | self.frame:SetPoint(point, anchorframe:GetName(), point, 0,0) |
||
1288 | self.Error("Frame must be open to set anchor") return |
||
1289 | end |
||
1290 | anchorframe:ClearAllPoints() |
||
1291 | anchorframe:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", left, top-10) |
||
1292 | self.frame:SetPoint(string.upper(point), anchorframe:GetName(), string.upper(point), 0, 0) |
||
1293 | self.SetOpt("Anchor", point) |
||
1294 | self.Result("Anchor", point) |
||
1295 | self.anchorPoint = string.upper(point) |
||
1296 | return TRUE |
||
1297 | end |
||
1298 | function MyBagsCoreClass:SetSpecialtyBagSlotColor(opt) |
||
1299 | local r, g, b |
||
1300 | opt, r, g, b = unpack(ace.ParseWords(opt)) |
||
1301 | -- self:debug("opt: |" .. opt .."| ") |
||
1302 | if opt == "default" then |
||
1303 | if r then |
||
1304 | self.SetOpt("SlotColor", { ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1305 | else |
||
1306 | self.SetOpt("SlotColor") |
||
1307 | end |
||
1308 | end |
||
1309 | if opt == "ammo" then |
||
1310 | if r then |
||
1311 | self.SetOpt("AmmoColor", { ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1312 | else |
||
1313 | self.SetOpt("AmmoColor") |
||
1314 | end |
||
1315 | end |
||
1316 | if opt == "soul" or opt == "shard" then |
||
1317 | if r then |
||
1318 | self.SetOpt("ShardColor", {ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1319 | else |
||
1320 | self.SetOpt("ShardColor") |
||
1321 | end |
||
1322 | end |
||
1323 | if opt == "enchant" then |
||
1324 | if r then |
||
1325 | self.SetOpt("EnchantColor", {ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1326 | else |
||
1327 | self.SetOpt("EnchantColor") |
||
1328 | end |
||
1329 | end |
||
1330 | if opt == "engineer" then |
||
1331 | if r then |
||
1332 | self.SetOpt("EngColor", {ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1333 | else |
||
1334 | self.SetOpt("EngColor") |
||
1335 | end |
||
1336 | end |
||
1337 | if opt == "herb" then |
||
1338 | if r then |
||
1339 | self.SetOpt("HerbColor", {ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1340 | else |
||
1341 | self.SetOpt("HerbColor") |
||
1342 | end |
||
1343 | end |
||
1344 | if opt == "keyring" then |
||
1345 | if r then |
||
1346 | self.SetOpt("KeyRingColor", {ace.tonum(r), ace.tonum(g), ace.tonum(b)}) |
||
1347 | else |
||
1348 | self.SetOpt("KeyRingColor") |
||
1349 | end |
||
1350 | end |
||
1351 | self.Result("SlotColor", opt) |
||
1352 | self:LayoutFrame() |
||
1353 | end |
||
1354 | function MyBagsCoreClass:SetCompanion() |
||
1355 | if self.GetOpt("Companion") then |
||
1356 | self:UnregisterEvent("AUCTION_HOUSE_SHOW") |
||
1357 | self:UnregisterEvent("AUCTION_HOUSE_CLOSED") |
||
1358 | self:UnregisterEvent("BANKFRAME_OPENED") |
||
1359 | self:UnregisterEvent("BANKFRAME_CLOSED") |
||
1360 | self:UnregisterEvent("MAIL_CLOSED") |
||
1361 | self:UnregisterEvent("TRADE_CLOSED") |
||
1362 | self:UnregisterEvent("TRADE_SHOW") |
||
1363 | end |
||
1364 | self.TogMsg("Companion", "Companion") |
||
1365 | self:ChkCompanion() |
||
1366 | end |
||
1367 | function MyBagsCoreClass:ChkCompanion() |
||
1368 | if self.GetOpt("Companion") then |
||
1369 | self:RegisterEvent("AUCTION_HOUSE_SHOW","CompanionOpen") |
||
1370 | self:RegisterEvent("AUCTION_HOUSE_CLOSED","CompanionClose") |
||
1371 | self:RegisterEvent("BANKFRAME_OPENED","CompanionOpen") |
||
1372 | self:RegisterEvent("BANKFRAME_CLOSED","CompanionClose") |
||
1373 | self:RegisterEvent("MAIL_CLOSED","CompanionClose") |
||
1374 | self:RegisterEvent("TRADE_CLOSED","CompanionClose") |
||
1375 | self:RegisterEvent("TRADE_SHOW","CompanionOpen") |
||
1376 | end |
||
1377 | end |
||
1378 |