Saturday 10 December 2011

TSM Blacklist Modification

In a prior post Dealing with obsessive campers - Part II advanced I detailed how I modifed TSM's post.lua to calculate price cuts differently to bring prices down fast and discourage camping. At the time my server was literally infested with campers and auction bots. There were so many campers at that time the best approach was an indiscriminate blanket approach that simply lowered prices quickly until the camping stopped..

Conditions are a little different now. There's far more cooperation between big auction players, fewer obsessive campers and the worst of the campers (the bot) transferred. On top of which demand is high and supply lower than in the past. I found the old approach too extreme for current conditions but there are still a few obsessive campers in certain markets. A more targeted approach is needed so I tweaked my modification to use the blacklist and only target specific campers.

Most of it still works the same as before except it only kicks in for blacklisted players.


How it works

By default all TSM's blacklist does is ignore your threshold and continue undercutting blacklisted players posting below threshold no matter how low the price goes. This modification changes the way the blacklist works by changing how the undercut is calculated when (and only when) undercutting a player on the blacklist.

For all other posters (posters not blacklisted) undercut calculations are the same as usual.

For blacklisted users, "undercut by" settings of 50c or less are considered to be percentages 1-50%.
The undercut will be 1-50% of the difference between the current lowest price (the camper's price) and your threshold price.

Finally, I changed it to not ever post under your threshold. Not even for blacklisted players.

All of the above only kicks in for blacklisted players. When the lowest priced item was posted by a player not blacklisted everything works as per normal.

In addition maximum price is used just a little differently. If  the lowest price is higher than your Fallback * Maximum Price, it will post at Fallback * Maximum Price. The original code would just post at Fallback instead. This is the only bit that kicks in for all posters not just blacklisted posters. If you don't like this bit there's a comment in the " -- Check if we're posting something too high" section of the replacement code with a small change you can make to revert to original behavior.


Modifying the code


WARNING - This requires editing the code of TSM post.lua. If you don't know what you're doing or feel uncomfortable editing code, don't try this. A mistake could break things so badly you'll wind up having to reinstall and reconfigure TSM from scratch.


1. Open Post.lua in a text editor and make the following  changes. (Note: If you can't find the file you really shouldn't be attempting this!)

2. Make a backup copy of Post.lua (named Post.lua.original or something) just in case you mess things up.

3. In the function Post:QueueItemToPost(queue) find "-- Check if we're posting something too high". It should be on line 420 in the latest version posted 2 Dec 2011 on Curse. Cut that line and everything else after it in to the end of that section of the code *except* the final "end" statement. 17 lines in total (counting empty lines) up to and including line 436.  Leave the "end" statement that was on line 437 before the cut alone.

4. In place of the code you just cut insert the following code.

      -- Special blacklist handling by MoxNix
      if isBlacklist then
        -- Calculate undercuts as a percentage of the difference between
        -- the current lowest price and our threshold using undercut
        -- settings of 50c or less as 1-50%
        if lowestBuyout > threshold then
          local tempp = TSMAuc.Config:GetConfigValue(itemID, "undercut")
          if tempp <= 50 then
            -- consider an undercut of 0c to be 10% (prevents divide by 0 errors)
            if tempp < 1 then
              tempp = 10
            end
            buyout = lowestBuyout - ((lowestBuyout - threshold)/(100/tempp))
         end
      end
    end

    -- Check if we're posting something too high
    if buyout > (fallback * TSMAuc.Config:GetConfigValue(itemID, "fallbackCap")) then
      -- for original Maximum Price behavior change the very next line to buyout = fallback
      buyout = (fallback * TSMAuc.Config:GetConfigValue(itemID, "fallbackCap"))
      fallbackCap = true
    end

    -- Check if we're posting too low!
    if buyout < threshold then
      buyout = threshold
    end

    bid = floor(buyout * TSMAuc.Config:GetConfigValue(itemID, "bidPercent"))

    -- Check if the bid is too low
    if bid < threshold then
      bid = threshold
    end



1 comment:

  1. I've got the opposite problem of someone pushing the price of a mat super high to either make his price look super low or make buying automatically through TSM operations not viable.

    Do you know of anyway to blacklist/remove a seller from the dbmarket calculation?

    ReplyDelete