AdiBags

AdiBags

8M Downloads

Allow plugins to specify a custom sort function

johnkoerner opened this issue ยท 0 comments

commented

I would like to be able to create a plugin that allows for a custom sort function to use TradeskillMaster sources to sort my bags by one of their variables. Currently the sortingFuncs is a local variable in the Section.lua file and cannot overridden.

An example function I would like to use would be:

tsmSort = function(linkA, linkB, nameA, nameB) 
    local itemAId = GetItemInfoInstant(linkA)
    local itemBId = GetItemInfoInstant(linkB)
    local aPrice = TSM_API.GetCustomPriceValue("DBRegionMarketAvg","i:" .. itemAId)
    local bPrice = TSM_API.GetCustomPriceValue("DBRegionMarketAvg","i:" .. itemBId)
    
    return aPrice < bPrice

end

Is this something that AdiBags would be willing to support via the plugin system? If so, I could see it working similar to how the RegisterFilter function works