jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

TODO: players can sell items to other players #46

Closed jpcsupplies closed 8 years ago

jpcsupplies commented 8 years ago

Need to be able to sell (offer) goods to another player for a unit price.

the other player should get a confirmation prompt and trigger a timer. if they /sell accept they buy the goods - (if they lack inventory space it falls to their feet ? requiring a collector)

if they /sell deny they dont buy the goods, or if a preset timer (eg 2 minutes) runs out

if the seller /sell cancels prior to the buyer responding it immediately ends the timer and cancels the sell offer

This requires some sort of confirmation system to work..

should work similarly to selling to an npc

jpcsupplies commented 8 years ago

Long version of meeting of the Blue Mining Board last night lol - Incorporating the "accept/deny" logic of #35 if possible to avoid doubling up similar logic - (messageofferpay or something along those lines) If we use this from our wiki:

And alter it as follows:

When a player A sells directly to another player B: Write UID of player A to "Steam ID of Seller" Write the product ID being offered to "Product ID" Write flag "Sell" to "Sell" (We can also have other flags like offer, frozen etc) Write the amount to "Quantity" (and deduct that from seller inventory) Write Offer price to "Sell Price" Write our default timout to "timeout" - start clock Write the (confirmed) steam Id or nickname to "Optional ID of trade territory or player" (ID probably better)

Send a notification to Player B screen indicating "they have received an offer from Player A to sell qty X at price Y - type /sell accept to accept offer" (or /sell deny to reject and return ore to seller)

Because the "Order Book" table is also used by station/territory to player trade the player can accept the offer two ways: 1: /sell accept 2: When we implement "registered trade territories" or faction trade the sale will show in their personal market list too - so they can also use /buy qty item price player if they only want to partially accept that price from that player for a partial amount.

Notes:

midspace commented 8 years ago

When a player A sells directly to another player B: Write UID of player A to "Steam ID of Seller"

I don't see where we store player B.

Player A might be helping out player B and selling them dirt cheap Gold. but player C jumps in and takes listed offer of cheap Gold. Unless you meant this for Optional ID

But you can't use it for both Trade Station and Player because the types conflict. SteamId is ulong. EntityId is long. (for ships, and individual cubes). FactionId is long.

jpcsupplies commented 8 years ago

This bit here is the person being sold to UID of seller, Product ID, Sell, Quantity, Sell Price, timeout, [[[[Optional ID of trade territory or player]]]]

and

Write the (confirmed) steam Id or nickname to "Optional ID of trade territory or player" (ID probably better)

UID of seller, Product ID, Sell, Quantity, Sell Price, timeout, Optional ID of trade territory or player

"Sell" can be a keyword - sell / buy / holding / frozen / offer / toplayer whatever which we can use to tell the script how to treat the optional ID (steam id, faction, trade territory) probably have to treat it as a string and convert it to the type the "Sell" keyword specifies.

Seller Steam ID Product ID KEYWORD indicating target record type (buy/sell/trade/offer etc) Quantity Sell Price timeout Target ID

etc ?

jpcsupplies commented 8 years ago

The extra example statuses were along the following lines - but may not necessarily be needed if you already catered for these scenarios -

jpcsupplies commented 8 years ago

Multiplayer Testing: /sell 1 rifle 10 lana result - (good) rifle removed from seller inventory (good) timer starts (good) lana advised of offer

/sell accept (fair) result - not implemented reply

(good) after a few minutes lana notified that offer has expired

(todo) after expiry rifle doesnt seem to return to seller

so all we need is the item coming back if it expires and the sell accept/deny doing stuff so close i can taste it :)

jpcsupplies commented 8 years ago

Seems to work, see alpha milestone for tests.. should be able to close this one.. although id suggest enforcing the range limit on player to player trade too - my main priority is a range check on location 0,0,0 to restrict the NPC market to the centre of the map

jpcsupplies commented 8 years ago

This all works in testing last.

midspace commented 8 years ago

id suggest enforcing the range limit on player to player trade too

It's still there.

market zone checks is separate from player2player range checks.