Ozroth Trading Post [1.7.10]

Started by Ozroth, Apr 03, 2021, 06:48 pm

Previous topic - Next topic

Ozroth

Apr 03, 2021, 06:48 pm Last Edit: Apr 03, 2021, 08:32 pm by Ozroth Reason: grammar
This program was created using minecraft 1.7.10, Computercraft version 1.75 (CraftOS 1.7)

Ozroth Trading Post is a suite of programs designed to run on a preset structure in order to facilitate trade between two players.

You will need 3 computers, a turtle, 4 chests (preferably double chests) and an enclosure that separates the two sides. Basically design it like a normal trading post but instead of glass and flowing water, you wall it off and put chests in between the walls.



3 computers are stacked next to each other with wired modems. 2 clients and the "server." The server is a repeater that forwards messages from client to client and client to turtle. The whole network is wired sans the repeater, which has a wired modem and a wireless modem on top to communicate with the turtle, which is also wireless.


The client uses a command line interface. On initialization, the program greets the user and tells them the existing commands, and also lists a help command for any additional clarification needed for any command.


The main function of the trading post is to trade, so trader A puts items in a chest, uses the "offer" command, then the turtle will pick up the items, identify and evaluate them, then place them in a temporary holding chest. The turtle communicates the contents and quantities of these items to trader B.
If any trader uses the "decline" command, all holding items are returned to each trader. If both traders use the "accept" command, then the items are swapped, a successful trade.

There is also a chat function using the "demand" command. This command temporarily puts you in "demand" mode, which allows you to send messages that are displayed to the other client to request items or otherwise extrapolate on your demands. You can exit this mode and return to "command" mode using "/exit"



Commands
help, demand, exit, clear, offer, accept, decline

• prefix any command with "help" to get more information about that command.

"demand" puts you in demand mode and allows you to chat with the other client.

"exit" exits the trading program

"clear" does term.clear() and clears the screen.

"offer" is the initial offer command that lets the other trader know what items you are putting up.

"accept" sends an "accept" packet to the server. If the server gets an accept packet from both clientA and clientB, it will tell the turtle to swap the items.

"decline" cancels the trade and returns both traders items.

Known bugs/issues:
• There are graphical issues concerning terminal cursor position upon receiving messages from the other client. I've attempted to fix this and simply made the issue worse.

• The turtle's item identification is very rough, which is to say it prints the exact information from turtle.getItemDetail() This can obviously be very confusing to the end-user, especially with modded items such as thermal dynamics, which prints each ore as "Thermaldynamics:ore" with the only difference being the damage values.

• There is no terminal scrolling or other readability features. One can make an offer, spam the chat, clear the terminal, or otherwise change too many menu options and lose important information (the items offered by the other trader)

• The initial architectural design of the trading post may be flawed in that one might be able to gain unauthorized access to the holding chests. Some additional testing may be required to find the perfect design, though I would like to keep the turtle on fuel-less operation (no moves other than turning)

• The computer ID's are hardcoded. Obviously this presents an issue to users of this program.

TODO:
• Graphical user interface, more readability, better management of screen space, etc.
• Better item names
• Better architectural design
• Dynamic ID recognition for ease of deployment and use. Perhaps an initial setup screen to set ID's?
• an actual packet structure?

Downloads:
tradepostClientA: pastebin get 0aeuMFiF
tradepostClientB: pastebin get r4bLv7Xb
tradepostServer: pastebin get 6WeDRTza
tradepostTurtle: pastebin get 34faMVqg

If you are also playing on 1.7.10 or earlier, you will need the pastebin fix: I am unsure of the original author. https://pastebin.com/jCfCfBPn