Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TODO: allow players to sell items to server #31

Closed
jpcsupplies opened this issue Sep 12, 2015 · 11 comments
Closed

TODO: allow players to sell items to server #31

jpcsupplies opened this issue Sep 12, 2015 · 11 comments

Comments

@jpcsupplies
Copy link
Owner

Need the ability for a player to sell a chosen item and qty back to the server in exchange for its listed value

eg
/value iron ore
(replies 2ea)
/sell 20 iron ore
(removes 20 iron ore from their inventory and pays them 40)

optionally the amount they get paid is deducted from the balance of an NPC player in the bank file
eg Merchant
So we will need to create a fake bank entry for the "merchant" this will be paid to and drawn from when players transact with the server. Once we transition to global commodity market the merchant account will behave like a trader that always lists at the same price (based on price table) that way at least one merchant is always active even if its the server itself

long term keep track of available supply of resources too in order to transition to the global market later

@jpcsupplies jpcsupplies added this to the Alpha Release milestone Sep 12, 2015
jpcsupplies added a commit that referenced this issue Sep 19, 2015
Put in some crude logic and psuedo code comments to cope with the
various combinations of options likely to be encountered in the /sell
command
jpcsupplies added a commit that referenced this issue Sep 20, 2015
This auto generates the NPC character and balance, adds a npc starting
bal constant etc..  might need tweaking i can only test offline..
jpcsupplies added a commit that referenced this issue Sep 20, 2015
@jpcsupplies
Copy link
Owner Author

Making painfully slow progress.. but with two kids running around screaming its a wonder it even loaded without errors lol..

The create NPC account bit works tho, but the fact i used the reset command logic makes it a rather messy bit of code.
Im out of the code for the night if you want to trim the fat, i expect the process server part or the protocontract is probably not needed in my create NPC, but it does write a message to game if an NPC had to be created MyAPIGateway.Utilities.ShowMessage("Banker", "Created");
and down the line the same section might be used for creating the faction/player trade markets?

have to see how things progress - so far about the only useful thing i have been able to use from my old IT software development training is designing the milestones, I seem to be sucking at the coding part :(

jpcsupplies added a commit that referenced this issue Sep 20, 2015
The trained monkey (me) got some sleep, last nights key mashing has been
corrected to resemble order instead of chaos..  might need help on regex
tho to make sure its right
@jpcsupplies
Copy link
Owner Author

@midspace
Ok, code should make some sort of sense now. Although my regex filter is basically a guess at the moment.
I am just pondering if i should focus on player to player trade first, or the player to NPC table.

Both seem similar complexity.
/sell all iron 0.5 "Screaming Angel"
logic

  • check valid ore / command line options
  • check player is nearby
  • send them a request to sell - player types /sell approve or deny or times out, or seller /sell cancel
  • if approved make relevant changes to bank balance and carried items

/sell all iron
logic

  • check valid ore / command line options
  • check NPC trade region nearby
  • transfer goods to price table
  • make relevant changes to NPC balance and carried items

Will hold off the "global market "offer table"" till next release, and price logic is used player-player anyway, so we need only worry about player to player trades or selling to the price table at 0.0.0

I m thinking in line with our previous release focusing on player interaction the player to player should be the priority, since the lack of a /buy command is irrelevant.then.

@jpcsupplies
Copy link
Owner Author

@midspace Having trouble building my sell regex - refer notes in code - can i get an assist :)

@midspace
Copy link
Collaborator

Sorry, I've been very busy building a new mining ship on the server.
BTW, someone played demolition derby on the inside of the station. Lots of ship parts drifting about.
I'll have a look at it tomorrow evening. Work has me busy this week.

@jpcsupplies
Copy link
Owner Author

oh well at least players cant complain we didnt leave enough spare parts..
on the up side the /accounts list will probably tell us who logged on recently.....

@jpcsupplies
Copy link
Owner Author

any way we can use this to discriminate material type, for our qty checks?
var physicalItems = MyDefinitionManager.Static.GetPhysicalItemDefinitions();

@midspace
Copy link
Collaborator

any way we can use this to discriminate material type, for our qty checks?

yes. To a degree we're already checking the material types in the MessageSell.ProcessServer().
https://github.com/jpcsupplies/Economy_mod/blob/master/Economy/Data/Scripts/Economy.scripts/Messages/MessageSell.cs

I intend to move those validations into ProcessServer(), as this will better encapsulate the functionality if we extend it later into an API, and it reduces the potential for hackers misusing it, as it will do it's own validation instead of relying upon validation prior to it running.

midspace added a commit that referenced this issue Sep 30, 2015
Restructure validation.
Untested code.
@midspace
Copy link
Collaborator

I've like to move the RangeCheck into the ProcessServer also.

@SaltPepp
Copy link
Collaborator

I've been thinking....
An idea I thought of is that you can trade items for items. This could be a bool setting if true, this feature is enabled.

Sent from my Windows Phone


From: midspacemailto:notifications@github.com
Sent: ‎30/‎09/‎2015 12:21 PM
To: jpcsupplies/Economy_modmailto:Economy_mod@noreply.github.com
Subject: Re: [Economy_mod] TODO: allow players to sell items to server (#31)

any way we can use this to discriminate material type, for our qty checks?

yes. To a degree we're already checking the material types in the MessageSell.ProcessServer().
https://github.com/jpcsupplies/Economy_mod/blob/master/Economy/Data/Scripts/Economy.scripts/Messages/MessageSell.cs

I intend to move those validations into ProcessServer(), as this will better encapsulate the functionality if we extend it later into an API, and it reduces the potential for hackers misusing it, as it will do it's own validation instead of relying upon validation prior to it running.


Reply to this email directly or view it on GitHub:
#31 (comment)

@jpcsupplies
Copy link
Owner Author

Game already works like that now in effect @SaltPepp without an economy players would trade materials with each other. However the economy mod can work similarly; you just send an offer to sell goods to a player for free, then hope they send the goods free back in return. The idea had occurred to me in passing. In financial market terms its considered barter or tether type trade.

re: rangecheck @midspace I always assumed we would be moving that stuff out of the main file, as we did with the other commands, I considered making it in another file, but while it is a placeholder didnt think it would matter yet; and was undecided which would be the best place as rangecheck can be used for other stuff too potentially.

@jpcsupplies
Copy link
Owner Author

All underlying error checks, pricing lookups, item transfers, and payment technologies for this command are now in place. Sell command to sell to server is now fully operational within the stated aims of this milestone. Good Work Everyone. May still be bugs, but basic functionality is ready to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants