local addonName, addon = ... local events = addon['events'] or CreateFrame("FRAME") local prices, pricesIlvl local function getItem() return AuctionHouseFrame.CommoditiesSellFrame.ItemDisplay.ItemButton:GetItemLocation() or AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:GetItemLocation() end local function hookItem(self, ...) -- print('hook') local il = getItem() if(il) then if(il:IsValid() and il:IsBagAndSlot()) then local bid = C_Item.GetItemID(il) if(bid) then -- print("hook",self:GetName(), ...) -- print(AuctionHouseFrame.CommoditiesSellFrame.ItemDisplay.ItemButton:GetItemLocation()) -- print(AuctionHouseFrame.ItemSellFrame.ItemDisplay.ItemButton:GetItemLocation()) if(C_AuctionHouse.GetItemCommodityStatus(il) and prices[bid]) then -- print("CPrice", prices[bid]) else local lvl = C_Item.GetCurrentItemLevel(il) -- print(lvl) -- print("Price",lvl,pricesIlvl[bid][lvl]) if(lvl and pricesIlvl[bid] and pricesIlvl[bid][lvl]) then AuctionHouseFrame.ItemSellFrame.PriceInput:SetAmount(pricesIlvl[bid][lvl]) end end end end end end function events:ITEM_SEARCH_RESULTS_UPDATED(event, item) local itemID = item['itemID'] -- print("id",itemID) if(itemID) then pricesIlvl[itemID] = {} end -- pricesIlvl[item['itemID']][item['itemLevel']] = 0 for i = 1, C_AuctionHouse.GetNumItemSearchResults(item) do local result = C_AuctionHouse.GetItemSearchResultInfo(item, i) if(result and result.buyoutAmount) then local itemKey = result['itemKey'] local itemlevel = itemKey.itemLevel if(itemlevel and not pricesIlvl[itemID][itemlevel]) then pricesIlvl[itemID][itemlevel] = 0 end -- print(itemlevel, pricesIlvl[itemID][itemlevel], result.buyoutAmount,result.buyoutAmount