FORMAT: -- indicates a started bid, sender of this will be considered "starter" BIDSTART: [ITEM] name[pt]->name[pt]->name[pt]->name[pt] (issue manually? otherwise have to hook some pickup code... oh well, not much) -- only usable by the first bidder (and only if enough pts) ignored otherwise -- starter should reply (if OK) with OK ASK_BUYOUT: [ITEM] name[pt] -- usable by first bidder, requests a bid at the second-most points (if alone, will auto-pass = roll => win) ASK_FIRST_BID: [ITEM] name[pt] -- usable by anyone, requests a bid, ASK_BID: [ITEM] name[pt] -- from starter: confirms bid BID: [ITEM] name[pt] -- from starter: rejects bid as out-of-order BID_OUT_OF_ORDER: [ITEM] name[pt] -- from starter: will try to get name[pt] to do something WAKEUP: name[pt] -- from anyone: will indicate that name[pt] (themselves) has passed up bidding on item ASK_PASS: [ITEM] name[pt] -- from starter: will indicate that name[pt] has passed (can be caused by timeout) PASS: [ITEM] name[pt] -- from starter: will indicate that name[pt] has won the item (through buyout/uncontest-able bid, or roll) WON: [ITEM] name[pt] -- from starter: will indicate that name[pt] is to be rolled on. Roll is triggered automatically. First roll done by each person (that is within the valid range) will count. -- this is re-issued as many times is needed until one winner remains, whereupon a WON message is created ROLL: [ITEM] name[pt],name[pt],name[pt],name[pt] -- from starter: will indicate that the points of the named person has been changed (issued after roll) POINT_UPDATE: name[pt] -- from starter: will terminate bidding on the specified item, in effect removing it. -- SHOULD ONLY BE SET WHEN TESTING. RESET: [ITEM] -- code follows Create list of { name, pt }, sort by points (DESC) local allowBuyout = false; local allowBid = false; local highestPoints = list[1].pt; local amountNextPoints = -1; -- makes it impossible to buyout if alone local ownIndex = getSelfIndex(); local bidPoints = list[ownIndex].pt; local rollPoints = highestPoints*0.2; local currentBidPoints = getCurrentBidPoints(); if ( list[ownIndex+1] ) then amountNextPoints = list[ownIndex+1].pt; end if ( UnitName("player") == list[1].name ) then if ( amountNextPoints > 0 ) then local buyOutRequiredPts = amountNextPoints * 1.2; if ( bidPoints >= buyOutRequiredPts ) then allowBuyout = true; end end if ( amountNextPoints > 0 ) then bidPoints = amountNextPoints; end allowBid = true; end if ( currentBidPoints <= bidPoints ) then allowBid = true; end Divided into three parts: RPS_AutoBase -- handles base functions and communication RPS_AutoClient -- handles client (bidder) responses/interface RPS_AutoServer -- handles server (starter) responses/interface RPS_AutoBase SendMessage(message) AddListener(messageType, function) -- RemoveListener(messageType, function) ExtractNamePointList(message) -- returns a list of entries. Each entry contains this, sorted by pt DESC, name ASC -- { name = "Name of person", pt = # } -- example input and output : "BIDSTART: [ITEM] Grog[38]->Astalon[22]->Killur[38]" -- output = -- { { name = "Grog", pt = 38 }, { name = "Killur", pt = 38 }, { name = "Astalon", pt = 22 } } GetSelfIndex(namePointList) -- returns own index, or nil if not part local name = UnitName("player"); for k, v in namePointList do if ( name == v.name ) then return k; end end return nil; end