auctioneer API question - different reasons?
  • is it possible for a searcher module to return a different bid/buy reason other than the default one, the searcher module name?

    in the following code from SearcherVendor.lua:
    if buyprice and buyprice <= value then
    return "buy", market
    elseif bidprice and bidprice <= value then
    return "bid", market
    end


    is it possible to add before the return something like
    if buyprice <= value/2 then
    reason = "some reason"
    end


    so that the return becomes something like:
    reason = lib.tabname
    if buyprice and buyprice <= value then
    if buyprice <= value/2 then
    reason = "some reason"
    end
    return "buy", market, reason
    elseif bidprice and bidprice <= value then
    if bidprice <= value/2 then
    reason = "some reason"
    end
    return "bid", market, reason
    end


    does the return statement accept a reason in its parameters? or rather... can SearchUI accept and process such additional data returned by a searcher module?

  • SearchMain expects searcher return values as:

    buyorbid, value, pct, reason = searcher.Search(item)

    but it only tags reason on to the end of the reason string (so you'd end up with "vendor:buy:some reason"), and then only if buyorbid is "bid" or "buy".

    Not sure how well this actually works, as I don't think we actually use this anywhere.

    Possibly related is this old jira ticket http://jira.norganna.org/browse/ASER-209
  • oh well, then if i want to pass different reasons to the SearchUI i'll have to override temporarily the searcher module name in lib.tabname and make sure to poke lib.tabname back at the start of every function, to avoid lua errors... ugly, but it works.

    this is how it looks now:

    local basevalue = market
    local value = market * ((get("Cheapo.vendorcap.pct") / 100)+1)
    lib.tabname = "Cheapo"
    if buyprice and buyprice <= value then
    if buyprice < basevalue then
    lib.tabname = "Vendor"
    end
    return "buy", market
    elseif bidprice and bidprice <= value then
    if bidprice < basevalue then
    lib.tabname = "Vendor"
    end
    return "bid", market
    end


    i'll test a bit more and push the modifications to Curse later tonight.

    edit: pushed the change. I set it currently as beta and i'll change it to release mode in a day or two... it looks good so far

    edit2: didn't find issues with that, not even after 24hours, so i pushed the beta to release mode.
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

privacy
norganna's addons network · tf2 warehouse · scrap warehouse · auctioneer addon · gatherer addon · addon forums · rdrct