annotate Shopping.lua @ 122:f1da233629be v57

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