annotate Shopping.lua @ 124:e31b02b24488

Updated for 8.0 pre-patch and BfA.
author yellowfive
date Tue, 17 Jul 2018 09:57:39 -0700
parents f1da233629be
children 318c93e0cd6b
rev   line source
yellowfive@57 1 local Amr = LibStub("AceAddon-3.0"):GetAddon("AskMrRobot")
yellowfive@57 2 local L = LibStub("AceLocale-3.0"):GetLocale("AskMrRobot", true)
yellowfive@57 3 local AceGUI = LibStub("AceGUI-3.0")
yellowfive@57 4
yellowfive@57 5 local _frameShop
yellowfive@57 6 local _panelContent
yellowfive@57 7 local _cboPlayers
yellowfive@57 8 local _selectedPlayer
yellowfive@81 9
yellowfive@57 10 local _specs = {
yellowfive@57 11 [1] = true,
yellowfive@81 12 [2] = true,
yellowfive@81 13 [3] = true,
yellowfive@81 14 [4] = true,
yellowfive@57 15 }
yellowfive@81 16
yellowfive@57 17 local _chk1
yellowfive@57 18 local _chk2
yellowfive@81 19 local _chk3
yellowfive@81 20 local _chk4
yellowfive@57 21 local _isAhOpen = false
yellowfive@57 22
yellowfive@89 23 local function incrementTableItem(tbl, key, inc)
yellowfive@89 24 tbl[key] = tbl[key] and tbl[key] + inc or inc
yellowfive@89 25 end
yellowfive@89 26
yellowfive@57 27 local function onShopFrameClose(widget)
yellowfive@57 28 AceGUI:Release(widget)
yellowfive@57 29 _frameShop = nil
yellowfive@57 30 _cboPlayers = nil
yellowfive@57 31 _chk1 = nil
yellowfive@57 32 _chk2 = nil
yellowfive@81 33 _chk3 = nil
yellowfive@81 34 _chk4 = nil
yellowfive@57 35 _panelContent = nil
yellowfive@57 36 end
yellowfive@57 37
yellowfive@57 38 function Amr:HideShopWindow()
yellowfive@57 39 if not _frameShop then return end
yellowfive@57 40 _frameShop:Hide()
yellowfive@57 41 end
yellowfive@57 42
yellowfive@57 43 local function onPlayerChange(widget, eventName, value)
yellowfive@57 44 _selectedPlayer = value
yellowfive@57 45 Amr:RefreshShoppingUi()
yellowfive@57 46 end
yellowfive@57 47
yellowfive@57 48 local function onSpecClick(widget)
yellowfive@57 49 local spec = widget:GetUserData("spec")
yellowfive@57 50 _specs[spec] = not _specs[spec]
yellowfive@57 51
yellowfive@57 52 Amr:RefreshShoppingUi()
yellowfive@57 53 end
yellowfive@57 54
yellowfive@57 55 local function onItemClick(widget)
yellowfive@57 56 local name = widget:GetUserData("itemName")
yellowfive@57 57 if name then
yellowfive@57 58 QueryAuctionItems(name)
yellowfive@57 59 end
yellowfive@57 60 end
yellowfive@57 61
yellowfive@124 62
yellowfive@57 63 function Amr:ShowShopWindow()
yellowfive@124 64
yellowfive@57 65 if not _frameShop then
yellowfive@57 66 _frameShop = AceGUI:Create("AmrUiFrame")
yellowfive@57 67 _frameShop:SetStatusTable(Amr.db.profile.shopWindow) -- window position is remembered in db
yellowfive@57 68 _frameShop:SetCallback("OnClose", onShopFrameClose)
yellowfive@57 69 _frameShop:SetLayout("None")
yellowfive@57 70 _frameShop:SetWidth(500)
yellowfive@57 71 _frameShop:SetHeight(500)
yellowfive@57 72 _frameShop:SetBorderColor(Amr.Colors.BorderBlue)
yellowfive@57 73 _frameShop:SetBackgroundColor(Amr.Colors.Bg)
yellowfive@57 74
yellowfive@61 75 if Amr.db.profile.options.uiScale ~= 1 then
yellowfive@61 76 local scale = tonumber(Amr.db.profile.options.uiScale)
yellowfive@61 77 _frameShop:SetScale(scale)
yellowfive@61 78 end
yellowfive@61 79
yellowfive@57 80 local lbl = AceGUI:Create("AmrUiLabel")
yellowfive@124 81 _frameShop:AddChild(lbl)
yellowfive@57 82 lbl:SetWidth(400)
yellowfive@57 83 lbl:SetFont(Amr.CreateFont("Bold", 28, Amr.Colors.White))
yellowfive@57 84 lbl:SetText(L.ShopTitle)
yellowfive@57 85 lbl:SetWordWrap(false)
yellowfive@57 86 lbl:SetJustifyH("CENTER")
yellowfive@57 87 lbl:SetPoint("TOP", _frameShop.content, "TOP", 0, 30)
yellowfive@57 88
yellowfive@57 89 lbl:SetCallback("OnMouseDown", function(widget) _frameShop:StartMove() end)
yellowfive@57 90 lbl:SetCallback("OnMouseUp", function(widget) _frameShop:EndMove() end)
yellowfive@57 91
yellowfive@57 92 -- player picker
yellowfive@57 93 _cboPlayers = AceGUI:Create("AmrUiDropDown")
yellowfive@57 94 _cboPlayers:SetWidth(400)
yellowfive@124 95 _frameShop:AddChild(_cboPlayers)
yellowfive@57 96 _cboPlayers:SetPoint("TOPLEFT", _frameShop.content, "TOPLEFT", 0, -30)
yellowfive@57 97
yellowfive@57 98 -- spec pickers
yellowfive@57 99 _chk1 = AceGUI:Create("AmrUiCheckBox")
yellowfive@57 100 _chk1:SetUserData("spec", 1)
yellowfive@57 101 _chk1:SetCallback("OnClick", onSpecClick)
yellowfive@57 102 _frameShop:AddChild(_chk1)
yellowfive@124 103 _chk1:SetPoint("TOPLEFT", _cboPlayers.frame, "BOTTOMLEFT", 0, -20)
yellowfive@57 104
yellowfive@57 105 _chk2 = AceGUI:Create("AmrUiCheckBox")
yellowfive@57 106 _chk2:SetUserData("spec", 2)
yellowfive@57 107 _chk2:SetCallback("OnClick", onSpecClick)
yellowfive@57 108 _frameShop:AddChild(_chk2)
yellowfive@124 109 _chk2:SetPoint("LEFT", _chk1.frame, "RIGHT", 30, 0)
yellowfive@57 110
yellowfive@81 111 _chk3 = AceGUI:Create("AmrUiCheckBox")
yellowfive@81 112 _chk3:SetUserData("spec", 3)
yellowfive@81 113 _chk3:SetCallback("OnClick", onSpecClick)
yellowfive@81 114 _frameShop:AddChild(_chk3)
yellowfive@124 115 _chk3:SetPoint("LEFT", _chk2.frame, "RIGHT", 30, 0)
yellowfive@81 116
yellowfive@81 117 _chk4 = AceGUI:Create("AmrUiCheckBox")
yellowfive@81 118 _chk4:SetUserData("spec", 4)
yellowfive@81 119 _chk4:SetCallback("OnClick", onSpecClick)
yellowfive@81 120 _frameShop:AddChild(_chk4)
yellowfive@124 121 _chk4:SetPoint("LEFT", _chk3.frame, "RIGHT", 30, 0)
yellowfive@81 122
yellowfive@57 123 _panelContent = AceGUI:Create("AmrUiPanel")
yellowfive@57 124 _panelContent:SetLayout("None")
yellowfive@57 125 _panelContent:SetTransparent()
yellowfive@124 126 _frameShop:AddChild(_panelContent)
yellowfive@57 127 _panelContent:SetPoint("TOPLEFT", _chk1.frame, "BOTTOMLEFT", 0, -10)
yellowfive@57 128 _panelContent:SetPoint("BOTTOMRIGHT", _frameShop.content, "BOTTOMRIGHT")
yellowfive@57 129
yellowfive@57 130 -- update shopping list data
yellowfive@57 131 local player = Amr:ExportCharacter()
yellowfive@57 132 Amr:UpdateShoppingData(player)
yellowfive@57 133
yellowfive@57 134 -- fill player list
yellowfive@57 135 local playerList = {}
yellowfive@57 136 for name, data in pairs(Amr.db.global.Shopping) do
yellowfive@57 137 table.insert(playerList, { text = name, value = name })
yellowfive@57 138 end
yellowfive@57 139 _cboPlayers:SetItems(playerList)
yellowfive@57 140
yellowfive@57 141 -- set default selected player
yellowfive@57 142 if not _selectedPlayer then
yellowfive@57 143 _selectedPlayer = player.Name .. "-" .. player.Realm
yellowfive@57 144 end
yellowfive@57 145 _cboPlayers:SelectItem(_selectedPlayer)
yellowfive@57 146
yellowfive@57 147 Amr:RefreshShoppingUi()
yellowfive@57 148
yellowfive@57 149 -- set event on dropdown after UI has been initially rendered
yellowfive@57 150 _cboPlayers:SetCallback("OnChange", onPlayerChange)
yellowfive@57 151 else
yellowfive@57 152 _frameShop:Show()
yellowfive@57 153 Amr:RefreshShoppingUi()
yellowfive@57 154 end
yellowfive@57 155
yellowfive@57 156 _frameShop:Raise()
yellowfive@57 157 end
yellowfive@57 158
yellowfive@57 159 -- helper to render a section of the shopping list
yellowfive@57 160 local function renderShopSection(list, scroll, header)
yellowfive@57 161 if not list or next(list) == nil then return end
yellowfive@57 162
yellowfive@57 163 local w = 440
yellowfive@57 164
yellowfive@57 165 local panel = AceGUI:Create("AmrUiPanel")
yellowfive@57 166 panel:SetLayout("None")
yellowfive@57 167 panel:SetTransparent()
yellowfive@57 168 panel:SetWidth(w)
yellowfive@57 169 panel:SetHeight(40)
yellowfive@57 170 scroll:AddChild(panel)
yellowfive@57 171
yellowfive@57 172 local lbl = AceGUI:Create("AmrUiLabel")
yellowfive@124 173 panel:AddChild(lbl)
yellowfive@57 174 lbl:SetWidth(w)
yellowfive@57 175 lbl:SetFont(Amr.CreateFont("Regular", 18, Amr.Colors.TextHeaderActive))
yellowfive@57 176 lbl:SetText(header)
yellowfive@57 177 lbl:SetPoint("BOTTOMLEFT", panel.content, "BOTTOMLEFT")
yellowfive@57 178
yellowfive@57 179 for itemId, count in pairs(list) do
yellowfive@57 180 panel = AceGUI:Create("AmrUiPanel")
yellowfive@57 181 panel:SetLayout("None")
yellowfive@57 182 panel:SetTransparent()
yellowfive@57 183 panel:SetWidth(w)
yellowfive@57 184 panel:SetHeight(30)
yellowfive@57 185 scroll:AddChild(panel)
yellowfive@57 186
yellowfive@57 187 lbl = AceGUI:Create("AmrUiLabel")
yellowfive@124 188 panel:AddChild(lbl)
yellowfive@89 189 lbl:SetWidth(40)
yellowfive@57 190 lbl:SetWordWrap(false)
yellowfive@57 191 lbl:SetFont(Amr.CreateFont("Bold", 20, Amr.Colors.White))
yellowfive@57 192 lbl:SetText(count .. "x")
yellowfive@57 193 lbl:SetPoint("LEFT", panel.content, "LEFT")
yellowfive@57 194
yellowfive@57 195 local icon = AceGUI:Create("AmrUiIcon")
yellowfive@57 196 icon:SetBorderWidth(1)
yellowfive@57 197 icon:SetIconBorderColor(Amr.Colors.White)
yellowfive@57 198 icon:SetWidth(18)
yellowfive@57 199 icon:SetHeight(18)
yellowfive@124 200 panel:AddChild(icon)
yellowfive@57 201 icon:SetPoint("LEFT", lbl.frame, "RIGHT", 5, 0)
yellowfive@57 202
yellowfive@57 203 local btn = AceGUI:Create("AmrUiTextButton")
yellowfive@57 204 btn:SetWidth(w - 30 - 18 - 15)
yellowfive@57 205 btn:SetJustifyH("LEFT")
yellowfive@57 206 btn:SetWordWrap(false)
yellowfive@57 207 btn:SetFont(Amr.CreateFont("Bold", 14, Amr.Colors.White))
yellowfive@57 208 btn:SetHoverFont(Amr.CreateFont("Bold", 14, Amr.Colors.White))
yellowfive@57 209 btn:SetCallback("OnClick", onItemClick)
yellowfive@57 210 panel:AddChild(btn)
yellowfive@124 211 btn:SetPoint("LEFT", icon.frame, "RIGHT", 5, 0)
yellowfive@57 212
yellowfive@57 213 Amr.GetItemInfo(itemId, function(obj, name, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture)
yellowfive@57 214 -- set icon, name, and a tooltip
yellowfive@57 215 obj.itemIcon:SetIcon(texture)
yellowfive@57 216 obj.itemText:SetText(link:gsub("%[", ""):gsub("%]", ""))
yellowfive@57 217 obj.itemText:SetUserData("itemName", name)
yellowfive@57 218 Amr:SetItemTooltip(obj.itemText, link)
yellowfive@57 219 end, { itemIcon = icon, itemText = btn })
yellowfive@57 220 end
yellowfive@57 221
yellowfive@57 222 end
yellowfive@57 223
yellowfive@89 224 -- get the number of a specified gem/enchant/material that the player currently owns
yellowfive@57 225 local function getOwnedCount(itemId)
yellowfive@57 226 local ret = 0
yellowfive@57 227
yellowfive@57 228 local list = Amr.db.char.BagItemsAndCounts
yellowfive@57 229 if list and list[itemId] then
yellowfive@57 230 ret = ret + list[itemId]
yellowfive@57 231 end
yellowfive@57 232
yellowfive@124 233 local bankBags = Amr.db.char.BankItemsAndCounts
yellowfive@124 234 if bankBags then
yellowfive@124 235 for bagId,bagList in pairs(bankBags) do
yellowfive@124 236 if bagList[itemId] then
yellowfive@124 237 ret = ret + bagList[itemId]
yellowfive@124 238 end
yellowfive@124 239 end
yellowfive@57 240 end
yellowfive@57 241
yellowfive@57 242 return ret
yellowfive@57 243 end
yellowfive@57 244
yellowfive@89 245 local function removeOwned(list, owned)
yellowfive@89 246
yellowfive@89 247 for itemId, count in pairs(list) do
yellowfive@89 248 -- load up how many of an item we have
yellowfive@89 249 if not owned.loaded[itemId] then
yellowfive@89 250 owned.counts[itemId] = getOwnedCount(itemId)
yellowfive@89 251 owned.loaded[itemId] = true
yellowfive@89 252 end
yellowfive@89 253
yellowfive@89 254 -- see how many we can remove from the required count
yellowfive@89 255 local used = math.min(owned.counts[itemId], count)
yellowfive@89 256
yellowfive@89 257 -- update owned count so we can't double-use something
yellowfive@89 258 owned.counts[itemId] = owned.counts[itemId] - used;
yellowfive@89 259
yellowfive@89 260 -- reduce the requirement, removing entirely if we have it completely covered
yellowfive@89 261 list[itemId] = list[itemId] - used;
yellowfive@89 262 if list[itemId] == 0 then
yellowfive@89 263 list[itemId] = nil
yellowfive@89 264 end
yellowfive@89 265 end
yellowfive@89 266 end
yellowfive@89 267
yellowfive@89 268 function Amr:RefreshShoppingUi()
yellowfive@89 269
yellowfive@89 270 local posToCheck = { _chk1, _chk2, _chk3, _chk4 }
yellowfive@89 271 local chk
yellowfive@89 272
yellowfive@89 273 -- reset spec checkboxes
yellowfive@89 274 for specPos = 1,4 do
yellowfive@89 275 chk = posToCheck[specPos]
yellowfive@89 276 chk:SetVisible(false)
yellowfive@89 277 chk:SetChecked(false)
yellowfive@89 278 end
yellowfive@89 279
yellowfive@89 280 -- clear out any previous data
yellowfive@89 281 _panelContent:ReleaseChildren()
yellowfive@89 282
yellowfive@89 283 local data = Amr.db.global.Shopping[_selectedPlayer]
yellowfive@89 284 if not data then
yellowfive@89 285 _panelContent:SetLayout("None")
yellowfive@89 286
yellowfive@89 287 local lbl = AceGUI:Create("AmrUiLabel")
yellowfive@124 288 _panelContent:AddChild(lbl)
yellowfive@89 289 lbl:SetFont(Amr.CreateFont("Italic", 18, Amr.Colors.TextTan))
yellowfive@89 290 lbl:SetText(L.ShopEmpty)
yellowfive@89 291 lbl:SetJustifyH("CENTER")
yellowfive@89 292 lbl:SetPoint("TOP", _panelContent.content, "TOP", 0, -30)
yellowfive@89 293 else
yellowfive@89 294 local allStuff = { gems = {}, enchants = {}, materials = {} }
yellowfive@89 295 local hasStuff = false
yellowfive@89 296 local visited = {}
yellowfive@89 297
yellowfive@89 298 for specPos = 1,4 do
yellowfive@89 299 -- set labels on checkboxes
yellowfive@89 300 if data.specs[specPos] and data.specs[specPos] ~= 0 then
yellowfive@89 301 chk = posToCheck[specPos]
yellowfive@89 302 chk:SetText(L.SpecsShort[data.specs[specPos]])
yellowfive@89 303 chk:SetVisible(true)
yellowfive@89 304 chk:SetChecked(_specs[specPos])
yellowfive@89 305
yellowfive@89 306 -- gather up all stuff for checked specs
yellowfive@89 307 if _specs[specPos] then
yellowfive@89 308 hasStuff = true
yellowfive@89 309
yellowfive@89 310 for inventoryId, stuff in pairs(data.stuff[specPos]) do
yellowfive@89 311 if not visited[inventoryId] then
yellowfive@89 312 if stuff.gems then
yellowfive@89 313 for itemId, count in pairs(stuff.gems) do
yellowfive@89 314 incrementTableItem(allStuff.gems, itemId, count)
yellowfive@89 315 end
yellowfive@89 316 end
yellowfive@89 317
yellowfive@89 318 if stuff.enchants then
yellowfive@89 319 for itemId, count in pairs(stuff.enchants) do
yellowfive@89 320 incrementTableItem(allStuff.enchants, itemId, count)
yellowfive@89 321 end
yellowfive@89 322 end
yellowfive@89 323
yellowfive@89 324 if stuff.materials then
yellowfive@89 325 for itemId, count in pairs(stuff.materials) do
yellowfive@89 326 incrementTableItem(allStuff.materials, itemId, count)
yellowfive@89 327 end
yellowfive@89 328 end
yellowfive@89 329
yellowfive@89 330 -- make sure not to count the same physical item twice
yellowfive@89 331 if inventoryId ~= -1 then
yellowfive@89 332 visited[inventoryId] = true
yellowfive@89 333 end
yellowfive@89 334 end
yellowfive@89 335 end
yellowfive@89 336 end
yellowfive@89 337
yellowfive@89 338 end
yellowfive@89 339
yellowfive@89 340 end
yellowfive@89 341
yellowfive@89 342 if hasStuff then
yellowfive@89 343 -- remove what we already own
yellowfive@89 344 local owned = { counts = {}, loaded = {} }
yellowfive@89 345 removeOwned(allStuff.gems, owned)
yellowfive@89 346 removeOwned(allStuff.enchants, owned)
yellowfive@89 347 removeOwned(allStuff.materials, owned)
yellowfive@89 348
yellowfive@89 349 _panelContent:SetLayout("Fill")
yellowfive@89 350
yellowfive@89 351 local scroll = AceGUI:Create("AmrUiScrollFrame")
yellowfive@89 352 scroll:SetLayout("List")
yellowfive@89 353 _panelContent:AddChild(scroll)
yellowfive@89 354
yellowfive@89 355 renderShopSection(allStuff.gems, scroll, L.ShopHeaderGems)
yellowfive@89 356 renderShopSection(allStuff.enchants, scroll, L.ShopHeaderEnchants)
yellowfive@89 357 renderShopSection(allStuff.materials, scroll, L.ShopHeaderMaterials)
yellowfive@89 358 end
yellowfive@89 359 end
yellowfive@89 360
yellowfive@89 361 end
yellowfive@89 362
yellowfive@124 363 -- compare gear to everything the player owns, and return the minimum gems/enchants/materials needed to optimize,
yellowfive@124 364 -- grouped by inventory ID so that we can combine multiple specs without double-counting
yellowfive@89 365 local function getShoppingData(player, gear, spec)
yellowfive@89 366
yellowfive@89 367 local ret = {}
yellowfive@89 368
yellowfive@89 369 -- used to prevent considering the same item twice
yellowfive@89 370 local usedItems = {}
yellowfive@89 371
yellowfive@89 372 for slotId, optimalItem in pairs(gear) do
yellowfive@124 373 local matchItem = Amr:FindMatchingItem(optimalItem, player, usedItems)
yellowfive@89 374 local inventoryId = optimalItem.inventoryId or -1
yellowfive@89 375
yellowfive@89 376 -- find gem/enchant differences on the best-matching item
yellowfive@89 377
yellowfive@124 378 -- gems
yellowfive@124 379 if not optimalItem.relicBonusIds and (not matchItem or not matchItem.relicBonusIds) then
yellowfive@124 380 for i = 1, 3 do
yellowfive@89 381 local g = optimalItem.gemIds[i]
yellowfive@89 382 local isGemEquipped = g ~= 0 and matchItem and matchItem.gemIds and matchItem.gemIds[i] == g
yellowfive@89 383
yellowfive@89 384 if not isGemEquipped then
yellowfive@89 385 if not ret[inventoryId] then
yellowfive@89 386 ret[inventoryId] = { gems = {}, enchants = {}, materials = {} }
yellowfive@89 387 end
yellowfive@89 388 incrementTableItem(ret[inventoryId].gems, g, 1)
yellowfive@89 389 end
yellowfive@89 390 end
yellowfive@89 391 end
yellowfive@89 392
yellowfive@89 393 -- enchant
yellowfive@89 394 if optimalItem.enchantId and optimalItem.enchantId ~= 0 then
yellowfive@89 395 local e = optimalItem.enchantId
yellowfive@89 396 local isEnchantEquipped = matchItem and matchItem.enchantId and matchItem.enchantId == e
yellowfive@89 397
yellowfive@89 398 if not isEnchantEquipped then
yellowfive@124 399 -- enchant info
yellowfive@124 400 local enchInfo = Amr.db.char.ExtraEnchantData[e]
yellowfive@89 401 if enchInfo then
yellowfive@89 402 if not ret[inventoryId] then
yellowfive@89 403 ret[inventoryId] = { gems = {}, enchants = {}, materials = {} }
yellowfive@89 404 end
yellowfive@89 405 incrementTableItem(ret[inventoryId].enchants, enchInfo.itemId, 1)
yellowfive@89 406
yellowfive@89 407 if enchInfo.materials then
yellowfive@89 408 for k, v in pairs(enchInfo.materials) do
yellowfive@89 409 incrementTableItem(ret[inventoryId].materials, k, v)
yellowfive@89 410 end
yellowfive@89 411 end
yellowfive@89 412 end
yellowfive@89 413 end
yellowfive@89 414 end
yellowfive@89 415 end
yellowfive@89 416
yellowfive@89 417 return ret
yellowfive@89 418 end
yellowfive@89 419
yellowfive@57 420 -- look at both gear sets and find stuff that a player needs to acquire to gem/enchant their gear
yellowfive@57 421 function Amr:UpdateShoppingData(player)
yellowfive@57 422
yellowfive@57 423 local required = {
yellowfive@89 424 stuff = {},
yellowfive@57 425 specs = player.Specs
yellowfive@57 426 }
yellowfive@57 427
yellowfive@57 428 local enchantItemIdToId = {}
yellowfive@57 429
yellowfive@124 430 for i, spec in ipairs(required.specs) do
yellowfive@124 431 local gear = Amr.db.char.GearSets[spec]
yellowfive@124 432 if gear then
yellowfive@124 433 required.stuff[i] = getShoppingData(player, gear, spec)
yellowfive@124 434 else
yellowfive@124 435 required.stuff[i] = {}
yellowfive@124 436 end
yellowfive@57 437 end
yellowfive@57 438
yellowfive@57 439 Amr.db.global.Shopping[player.Name .. "-" .. player.Realm] = required
yellowfive@57 440 end
yellowfive@57 441
yellowfive@57 442 Amr:AddEventHandler("AUCTION_HOUSE_SHOW", function()
yellowfive@57 443 _isAhOpen = true
yellowfive@57 444 if Amr.db.profile.options.shopAh then
yellowfive@57 445 Amr:ShowShopWindow()
yellowfive@57 446 end
yellowfive@57 447 end)
yellowfive@57 448
yellowfive@57 449 Amr:AddEventHandler("AUCTION_HOUSE_CLOSED", function()
yellowfive@57 450 _isAhOpen = false
yellowfive@57 451 if Amr.db.profile.options.shopAh then
yellowfive@57 452 Amr:HideShopWindow()
yellowfive@57 453 end
yellowfive@122 454 end)