Concept: async trading. Replaces Bazaar & Sell
Core idea: players can make "sell" orders & "buy" orders
What are orders? This could get as complicated as "Offers cards ABC for cards XYZ" but let's keep it simple: Offers are selling/buying single cards for coins
Players can build a deck which they then list a price that's per card. So I have a deck of 3 frogs, 5 wolves, 2 cocks & put a price of 1 then players can buy those individual cards for that amount
When you offer to sell the cards are removed from your collection. If you want them back you can always buy them back like any other player would (fun activity: list cards to sell at 2 a piece, buy a cards back at 1 from other players. This is totally fine)
So a buy order is basically the same thing, you list cards & say how much you want to buy them at
Players can then insta-sell or insta-buy. Ideally the UI should make create-sell-order & make-sell-order pretty much transparent. So I can build up a deck & it'll list "These can be bought for X" & anything I can't buy for X or which I want to buy for less I can then make an order for
Issues: subgold prices. What if I want to sell commons for a coin & a half? Could be like current bazaar: round up at end. So can list decimal prices, but then 1.5 will sell as 2, kind of opens up for being annoying to cut in line with sell orders tho, like listing sell price as 1.9 to get sells over someone listing 2, & people have to buy like 10 copies, bla. Initial implementation will just be in integers. Could always move towards tracking pennies
So how to store this in db? Currently we don't have a SQL backend but I'm considering it so I'm going to try avoid getting too specific on the storage, focus on the structure
We need to track an ordered list of buys & sells. (Card, Price): (User, Quantity)
Ideally we show a list of prices somehow, so want some query that efficiently gets '(Card, Quantity, min(Price)) group by Card with Quantity summed over the set of cards at min price'
Then if the user breaks that quantity in their order creation, query "Next lowest price & quantity after $price" where $price can bump multiple times as one digs through the orderbook
Now this is a bit annoying because maybe I just want to see that there's 4 giant frogs for sale, but only 1 is at min price, so the interface really may just want to say how many are available & what their min price is, letting me find out that only 2 are going for 2g while the remaining 2 are going for 20g. In reality I don't expect a large price gap, if there's a low price it's probably coming alongside a large quantity
I'm guessing CG won't like this idea, but other's like Chap might like it: Potentially remove Nymph pack, let them stay showing up in shard packs, & let async trading distribute them further