View Single Post
10-09-20, 06:32 PM   #4
Opertune
A Murloc Raider
Join Date: Sep 2020
Posts: 4
Okay, i have an another problem, i can print information's from my specific item but when i want to print minimum buyout price (after gold conversion and after retrieve the minimum value in my table) my function return a random value.

Auction house price :
https://imgur.com/hoWL390

When i print all price and min price :
https://imgur.com/Sqb9AP8

On the screen he return the second price but with other item he return other price.
After many research i've tried differents ways but i have always the same result.

My functions :

Code:
local auctions = {}
local allPrice = {}
local initialQuery
local silverPrice, goldPrice, min

UIConfig.scanButton:SetScript("OnClick",function(self, button, down)
    if initialQuery then
        ScanAuctions()     
        initialQuery = false
    end
end)


function ScanAuctions()
    local continuables = {}

    for i = 0, C_AuctionHouse.GetNumReplicateItems() - 1 do
        auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
        local item = Item:CreateFromItemID(auctions[i][17])
        continuables[item] = true

        item:ContinueOnItemLoad(function()
            auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
            continuables[item] = nil
        end)
    end

    getLowestPrice()
end

function getLowestPrice()
    for i, _ in pairs(auctions) do
        if auctions[i][17] == 152510 then -- Anchor Weed id
            silverPrice = (auctions[i][10] / auctions[i][3]) -- copper price / count
            goldPrice = (silverPrice / 10000) 
            allPrice = {goldPrice}

            min = allPrice[1]
            for j = 1, #allPrice do
                print(allPrice[j]) -- print all price
                if allPrice[j] < min then
                    min = allPrice[j]
                end
            end
        end
    end

    print("Min Price : " .. min) -- print min price
end
  Reply With Quote