--[[--
	by enpingking (url = https://ngabbs.com/read.php?tid=45700523&_fu=1409755%2C2&rand=83)
--]]--


local __addon, __private = ...;
local MT = __private.MT;
local CT = __private.CT;
local VT = __private.VT;

MT.RegsiterAuctionModOnLoad("AutoAuction", function()
    local mod = {};
    function mod.F_QueryPriceByID(id, num)
        if not id then return end
        local realmKey = GetRealmName()
        local charKey = UnitName("player") .. " - " .. realmKey
        local currentProfile = ZL_Profile and ZL_Profile.profileKeys and ZL_Profile.profileKeys[charKey]
        if not currentProfile then return end
        local AutoAuctionDB = ZL_Profile and ZL_Profile.profiles and ZL_Profile.profiles[currentProfile] and ZL_Profile.profiles[currentProfile].AuctionPostItemsHistoryPrice
        if AutoAuctionDB and AutoAuctionDB[id] and #AutoAuctionDB[id] > 0 then
            return AutoAuctionDB[id][1][2] * (num or 1)
        end
        return
    end
    MT.AddAuctionMod("AutoAuction", mod)
end)