14 - Sort by Market Value

Sorting by market value would make a lot of sense if you have Auctioneer or something similar installed. I tried to patch that, but couldn't find the right place. I'll try again though :-)

For the implementation it would be best if the market value for items was fetched only once, or at least only once for each opening a particular subset.

Name Size MD5 114.5 KiB 6afe0ef74c8a...
User When Change
DerSchreiner Mar 07, 2010 at 18:12 UTC

Added attachment

DerSchreiner Mar 07, 2010 at 17:50 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of DerSchreiner DerSchreiner Mar 07, 2010 at 18:51 UTC - 0 likes

    local function sortMarketValue( a, b)
        if not a then return false end
        if not b then return true end
        if a.marketvalue == b.marketvalue then
            return <
        return a.marketvalue > b.marketvalue

  • Avatar of DerSchreiner DerSchreiner Mar 07, 2010 at 18:47 UTC - 0 likes

    Some modifications to try and not stumble over Research trade skills.
    local function ScanTrade()
        local num = GetNumTradeSkills()
        for i = 1,num do
            local name, kind, _, _, cast = GetTradeSkillInfo( i)
            if kind ~= 'header' and name then
                local trade = {}
                trade.difficulty = DIFFICULTY[kind]
                trade.index i
         = name
                trade.cast  = cast
        = GetTradeSkillItemLink( i)
                trade.recipe = GetTradeSkillRecipeLink( i)
                if (not trade.cast and (not string.find(name, "Research")) then
                    local sell, buy, buyout = Producer:GetPriceData(
                    if buyout == nil then
                        trade.marketvalue = 0
                        trade.marketvalue = buyout
                    trade.marketvalue = 0
                local minMade, maxMade = GetTradeSkillNumMade( i)
                trade.min = minMade or 1
                trade.max = maxMade or 1
                if not then
                    Producer:Debug( 'missing link:', name)
                if not trade.recipe then
                    Producer:Debug( 'missing recipe:', name)
                if == trade.recipe then
                    Producer:Debug( 'link == recipe:', GetLinkID( name)
                trade.reagents = {}
                local numReags = GetTradeSkillNumReagents( i)
                for j = 1,numReags do
                    local rName, rIcon, rNeed = GetTradeSkillReagentInfo( i, j)
                    if rName and rIcon then
                        local rLink = GetTradeSkillReagentItemLink( i, j)
                        table.insert( trade.reagents { name = rName, link = rLink, need = rNeed }) -- icon = rIcon,
                trade.set  = L.Unsorted
                trade.skill = 450
                data.profession[name] = trade

    Last edited Mar 07, 2010 by DerSchreiner
  • Avatar of DerSchreiner DerSchreiner Mar 07, 2010 at 18:14 UTC - 0 likes

    Works now (not perfect, but ok):

    1. moved GetPriceData to Producer.lua
    2. added a sortMarketValue function to CraftFrame
    3. on item list load, add a “marketvalue” to each item
    4. added some options, a bit of localization
    Last edited Mar 07, 2010 by DerSchreiner


Last updated
Mar 07, 2010
Mar 07, 2010
New - Issue has not had initial review yet.
Enhancement - A change which is intended to better the project in some way
Medium - Normal priority.

Reported by

Possible assignees