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


local _, __private = ...;
local MT = __private.MT;

MT.RegsiterAuctionModOnLoad("FastAuction", 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 = FA_Profile and FA_Profile.profileKeys and FA_Profile.profileKeys[charKey]
        if not currentProfile then return end
        local AutoAuctionDB = FA_Profile and FA_Profile.profiles and FA_Profile.profiles[currentProfile] and FA_Profile.profiles[currentProfile].AuctionPostItemsHistoryPrice
        if AutoAuctionDB and AutoAuctionDB[id] and #AutoAuctionDB[id] > 0 then
            return AutoAuctionDB[id][1][2] * (num or 1)
        end
    end
    MT.AddAuctionMod("FastAuction", mod)
end)