Open jpcsupplies opened 8 years ago
I would allow any online player to trade with any other online player. (Unless range is a factor for communications).
yes, i benchmarked the "5km" range thing from small ship antenna range. If we can hook into antenna ranges available to players, we could simply use the range of whatever antenna the player happened to have access to when he traded instead of the arbitrary 5kms. But for simplicity (given i have no idea how to access antennas in modapi) i figured calculate x5km to be the easier short term logic.
We can look up the cube definition, and get the max range of an antenna.
Otherwise, there is an API called GetPlayerRelayedBroadcasters
.
I haven't tried it, but it looks to check if one player can broadcast to another, along a relay network if need be.
ooh now that sounds pretty funky.. at this rate our mod has a good chance of either being a featured mod in an update.. or keen steals the idea like in FTL lol.. Using relay networks would definitely fit the realism model... and space trade gives the game a pretty good side aim to go with it. I once built a 80km relay network on the void server.. frustratingly tho remote control didnt work, only cameras.. but that was still pretty cool... with this mod it means we can pull down prices and initiate trades.. sounds fun
This topic may be superseded in part or complimented by #71
To begin with - raw basics - Create a market zone, default to all items black listed. Need a set price and blacklist command that can only be used by owner of market. They can only put carried or stored items into this market. Market bank file? Should it use players money, or should we allocate a money pool a player can use to limit purchases; and draw on/contribute to as needed.
Bonus points:
Allow them to add items to market by dropping items into a special crate, not just command line commands.
#71 - can the market follow a players ship?
#93 - allow players to manage their trade zone location?
Some way to flag the market as player only or faction. Faction allows founder/leaders to add/remove stock and adjust pricing. Should we allow a faction market /and/ a individual player market, or just flag a market as faction to allow leaders to help manage the founders market?
User configurable options:
Just a thought, that availability (neutral, allied) might be set on a per item basis, rather than the market.
That' a good idea (sorry i thought i replied to this already.. must have been one of the times my internet dropped).
Will our databases require much to cater for that scenario? More to the point will this require much extra code to implement?
I suppose best baby steps strategy to start with is allow the placeholders in the database, but create just a basic register command for players at this stage. We can add a flag to it later that allows members/leaders/owner of the market founders faction to maintain the market as well.
The reason i suggest this approach is we can just draw from the players bank balance, instead of needing to maintain a parallel balance.
Logic:
The factional settings in the data store are easy. The difficulty is always in how to represent it to the user, and in having the user make changes. Editing 1 item at a time is tedious. I think this is where an editable dialog would kick the solution for a goal.
Example, a command that was /editmarketplace
and it brought that player's own marketplace in a full text dialog, with 2 buttons (ok and cancel)....
-- Blacklisted (Y/N), Buy, Sell, Restriction (All/Neutral/Allied), Item
-- Ores
N 1 1.10 All Ice
Y 1 1.10 All Uranium Ore
Y 1 1.10 All Iron Ore
Y 1 1.10 All Silicon Ore
-- Ingots
N 2 2.20 All Uranium Ingot
N 2 2.20 All Iron Ingot
N 2 2.20 All Silicon Wafer
-- Components
N 5 5.50 All Steel Plate
N 8 8.80 All Metal Grid
-- Ammo
N 200 220 Neutral 5.56x45mm NATO magazine
N 1 1 Allied 25x184mm NATO ammo container
N 1 1 Allied 200mm missile container
The text could be formatting and displayed to the user ready for editing. The user simply has to make adjustments and hit the OK button.
Interpreting the content is easy enough with RegEx, and we can push back errors to the user to correct.
ie.,
-- Blacklisted (Y/N), Buy, Sell, Restriction (All/Neutral/Allied), Item
-- Ores
N 1 1.10 All Ice
Y11.10 All Uranium Ore ### Cannot read line.
Y 1 1.10 All Iro Ore ### Cannot find item name.
Y 1 1.10 All Silicon Ore
Y 1 1.30 All Silicon Ore ### Duplicate item.
X 1 1.30 All Gold Ore ### Invalid options.
I think we need to lean on Keen for the Editable dialog, and add a second button.
Although interesting makes mod too difficult for players to use scrap this one.
We can use the basic behaviour of NPC markets, just have grouping categories for mass blacklist toggling short term. As for an interactive input -
Any API way to force the LCD text edit box up ? ie spawn invisible lcd, propogate the text field, pop it up on screen
Not relevent here but the api also appears able to catch if a player hits the "X" in top right corner, or the "ok" button on message boxes.
how flexible is the SESE wrapper ? presumably it cant be used to force a dialog minus the need for an lcd?
Either that or we integrate with a switch panel and an lcd.. eg LCD: -- Ingots =[ N 2 2.20 All Uranium Ingot ]= =[ THIS ]= is moved with up/down N 2 2.20 All Iron Ingot N 2 2.20 All Silicon Wafer
SWITCH PANEL: [ up ] [ down ] [ select next] [ toggle option ]
Press select/next
=[ {N} 2 2.20 All Uranium Ingot ]= { THIS } is moved with "select/next"
pressing "toggle" would make it flip from Y to N If we choose a price field capture the next chat input ?Without a proper screen text output facilitiy not much else we can do?
Suggested commands /shop /trade /market /tradezone (/tz abbreviated)? /tz register name range - eg /tz register "K Mart" 1000 Allows player to request that a market by the name "k mart" with a trade range of 1000 be registered from their current location. (or we can target a block? eg lcd/beacon/cargo crate etc) This will calculate the registration/taxation fee and prompt the player - It will cost 10000 credits to register a trade zone here of radius 1000, and 1% tax on every sale, continue /yes /no ?
eg 10 credits per metre radius, and 0.001% tax per metre (configurable by admin) other factors such as distance from middle of map too could effect price.
/tz unregister name - eg /tz unregister "K mart" remove the market transfer all stock into current player storage (should we message faction leaders if its a faction shop?)
/tz move name - eg /tz move "K mart" move the market to their current location - charge a fee for this.. eg 1000 ? or 100 per km moved ? It follows beacon Now.
/tz factionmode on | off | company (\ coop might be better flag name) - sets if it is a faction market - ie (on) faction owners/leaders can manage stock. or (company) if all faction members can manage stock (ie faction is a company) or (off) only the person registering can manage stock (default)
The owner can buy/sell into their own market for free and without tax (since it uses their bank balance anyway)
If it is set "company" all faction members buy and sell at the cost price (except market owner) but the owners and leaders can add or remove stock for free. When selling into the market tax is deducted before paying the staff member selling into the market. Eg sell 1 explosive for 100, 100 is deducted from the market owners balance, and 99 is paid to the staff member, and 1 is paid to the server npc. if it is set "on" faction owner and leaders can add or remove stock at no cost like market owner(or the load/unload commands could be used, and the buy/sell at cost behavior carries to them too), but faction members buy and sell at normal buy and sell prices. if it is set "on" profits get divided evenly between owners and leaders?? (not sure how this should work - perhaps a per sale basis, subtract difference between buy and sell price and divide equally between the "board of directors" - should company mode pay non leaders? or maybe company mode trigger an extra wages/commission system under the proposed mission system?)
/tz buy/sell/blacklist/restrict set various options on items eg /tz buy grid 30, /tz sell grid 40, /tz restrict grid U, /tz blacklist grid N
/tz unload # item - (only available if faction or company set.??) Same as sell command but no money changes hands. Transfers amount # of item from inventory into the current market. Sends a message to owners/leaders of market that player X unloaded X amount of item into market. Can later be integrated with mission system for restock missions.
/tz load player # item - only available to market/faction owners/leaders. Transfers from market stock quantity # of item to "player" inventory. Receiving player gets confirmation to accept or reject. Must be in market zone. Sends message to owner/leader/player that amount # of item has been transferred to their inventory. Can be used on self if you are owner/leader.
/tz restrict all|class U|S|F|A|N set all items to specified restrict setting eg /tz restrict ingots F
/tz blacklist all|class Y|N sets all items or of specified class (eg ore, tool, ingot, component, ammo, gas) to be tradeable or not. eg /tz blacklist ore N
Editable?
we could have a [tradezone] tag for lcds, and use them for configuring the black list?
eg list all items in table
Blacklist | Item name | buy | sell | restrict
N | Iron Ore | 0.005 | 0.01 | U (U= unrestricted trade with all)
Y | stone | 0.00001 | 0.1 | S (s=trade with self only, same as Y blacklisted)
N | magnesium | 1 | 2 | F (f=trade with own faction only)
N | rifle | 10 | 30 | A (A=trade with faction and allies only)
N | drill | 10 | 15 | N (n= trade with neutral, allied or faction only)
By default all are set to Y and N (yes blacklisted, restricted to neutral)
Alternate config - remove blacklst entirely and just use restrict flag (since S works like blacklisted anyway)
I am thinking we should also add an "upper limit" option too - ie set stone to be buy and sellable, but refuse to buy any more over 10000 stock
..And the buy only sell only option too maybe.. this can be achieved by making restriction flag for both buy and sell not just trade in general.
Data structures: Player market list: Market Name, Owner, location, radius, faction flag
Raw stock list: market name, item name, blacklisted, restriction buy, restriction sell, buy price, sell price, stock, buy limit.
buy/sell Restriction flags: U= unrestricted trade with all (including enemies) s=trade with self only, same as blacklisted f=trade with own faction only A=trade with faction and allies only n= trade with neutral, allied or faction only
Faction flags: Y=yes its a faction shared market - leaders of faction can control it too and share profits N=no its an independent trader - only you can control it C=company faction - faction is treated like a trade company and all members are staff, leaders share profits
Additional admin configurable settings - range limit (maximum market radius) eg 5000 - grid size of station could also be used to increase or decrease limit slightly minimum stations grid size (eg how big a station needs to be before you can register a market?) Register charge per metre radius eg 10 Tax rate per metre radius eg 0.001% can be turned off by setting 0
\ can possibly live without blacklist entirely since restriction buy/sell performs same task in more detail
*\ separating market owner/market name from market item will allow a market to be sold off to another player if we decided to add such a feature
**\ restrictions market must not overlap, market must contain a space station owned by player of minimum size X, market must not have the same name as another market
***\ a trade zone set as non-faction can still restrict the sale of certain items to members of that players faction only.
****\ outlaw status - items blacklisted by the main NPC market could be considered illegal goods if traded by player stations? Or should we add something new for this later. Or should we create an additional secret faction mode flag for this purpose.
I'm not sure of the correct issue to put this under, but further work still needs to be completed for player controlled trade zones.
Thoughts on using an Lcd for management of the market.
I've considered these commands. /tz load "My market name"
and /tz save "My market name"
To be carried out while pointing at an LCD.
Load, will take details from the specified market name the player has, and place it into the Private text field of the LCD. This is to allow the player to see all details of the items in their market (or copy the text and use a text editor). This will allow them to make changes to all items in one go, instead of trying to use a command for each and every item in their market. Once a player has finished with changes, they will use the save command, which will update the market they specify. They can reuse the same details on a second market (at any range), to update other markets to have the same details. Items that are blacklisted by the server will not appear in the Load, and will be ignored during save. Any issues during the save step will update text LCD text with descriptive information about which line that failed and why it failed.
Details to be displayed include the item name, current stocks, blacklist, limits, sell price and buy price.
The only details that can be edited are, Item blacklist, Item limits, Item sell price, and buy price.
Detail in the LCD should appears as such:
# Any text behind the # will be ignored. They may be removed.
# Items will be displayed in alphabetical order.
# The values are:
# Limit/Quantity | Sell/Buy | Restriction | "Name"
# Do not modify the name as this is used to identify the item.
# Do not modify the Quantity. It will have no effect.
# A limit of -1 means it is blacklisted.
# A limit of 0 or more, means your market will not not allow you stock any more items above that value (no one can sell you more), but it will sell any items it has in stock. You can overstock your own market if you wish, but no one else can.
# Sell Price, is the price you sell at, which another player will pay to buy from you.
# Buy price, is the price you buy at, which another player will receive in credits to sell to you.
# The keyword RESET will reset the buy and sell price to that of the default market as set by the server.
# The % used in either of the buy or sell price, will apply that % based on the other value.
# Ie., a buy price of 3.73, and a sell price of 5% will apply a 5% markup to the buy and become 3.9165
# a sell price of 3.9 and a buy price of 5%, will apply a 5% markdown to the sell and become 3.705
# Restriction flags are not yet implemented and are placeholders for how to trade with faction members, allies, neutral players and enemies.
#
# Limit/Quantity | Sell/Buy | Restriction | "Name"
## Ores
-1/0 | 0.13/0.12 | U | "Stone"
1000000/12.956 | 0.07/0.06 | A | "Uranium Ore"
## Ingots
-1/0 | 0.19/0.17 | U | "Gravel"
10000/0 | RESET | U | "Gold Ingot"
1000000/5500 | 12.36/10.99 | A | "Uranium Ingot"
## Components
10000000/9888 | 5%/3.73 | U | "Steel Plate"
## Ammo
## Tools
10/10 | 10.73/0.65 | A | "Automatic Rifle"
100/0 | 15.94/5.28 | A | "Elite Automatic Rifle"
10/10 | 12.68/1.20 | U | "MyObjectBuilder_PhysicalGunObject/WelderItem" (Welder)
I agree with all you suggest BTW - although i would be more inclined to use our search logic instead of exposing the raw object builder ids, everything else is a yes i agree.
I just realized this also resolves one aspect of requests for price automation. If they set their sell price the % will auto reset the buy price too. Nice.
I wish there was a way of not using the raw object builder ids, but it's the only guaranteed way of identifying the item. Currently there are a bunch of items in the game which are trees, but their description shows up as "Welder". All of them. Currently there is no way to determine one object from another if they have the same description.
I'll be amending the text above as I go along.
Looking back at earlier comments, using the proper name reads better, so I may have to look at using some more smarts in the code to check for non-unique names, and fall back to the object builder ids gracefully.
actually that edit you did above breaking it up into categories looks like a good way to do it.. switch a category to an object builder id? they dont see the id, but we still get the benefit backend. also makes it easier for shopkeepers to find the types of item they want to edit faster
Have re-specced this see later posts.