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

Features and Questions #51

Open
do-oy opened this issue May 9, 2024 · 14 comments
Open

Features and Questions #51

do-oy opened this issue May 9, 2024 · 14 comments

Comments

@do-oy
Copy link

do-oy commented May 9, 2024

Right now you have a working gui for managing the buying and selling of items between players. Therefore, I have several questions:

  1. now the version is only trading between players, is it possible to integrate an admin store, for example, there is a product with floating prices among players, but the “admin” can always buy or sell an item at a set price in the config.
product apple
     name Apple
     construction item minecraft:apple
     adminPriceBuy 10
     adminPriceSell 15 

How difficult is it and would you like to do such an implementation? (in fact, this can already be implemented like this - create an Admin Shop character and make a demand and offer for sale of 9999999 items, but the implementation described above would simplify everything many times over.

  1. Economic system, the documentation describes different methods, but it is quite difficult to understand how it works, or should work, for example, the common economics api is on Github, but it is absolutely not clear to the average user how to attach it to Stonks, it is not clear how to download it, because on the Git Hub they offer to build it, but it is not clear what to do. Maybe we can create step by step guide?
@nahkd123
Copy link
Owner

  1. About admin shop:
  • If you want a separate UI for admin shop: Admin shop is not in the scope of Stonks, as Stonks tries to simulate the stock market, rather than acting like regular shop where you can buy or sell unlimited units. There are other server-side mods out there that does the thing you described.
  • If you want to define "admin's offer" where players can buy or sell if that offer happens to be the top one: It is possible to implement, through I'd prefer to use admin command to insert a new infinite units offer instead of defining in config.
  1. Yeah I would say the current economy adapter system is confusing for most user at current state.
  • For Common Economy API, you are supposed to find a mod that uses it (you don't need to install Common Economy API; it is included with Stonks by default). The id is the ID of the economy mod that is provided from that mod (which means you have to find it in its wiki or source code). The decimals is the number of decimals that will be applied on top of the underlying data. For example: if the underlying data is 1000 and decimals is 2, the value is 10.00 or 10. However, I do want to get rid of decimals in the future and use the parser that came with economy mod to parse inputs.
  • For scoreboard: It's like Common Economy API, but use player's score from scoreboard instead of value from economy mod. The decimals acts just like Common Economy API adapter.
  • To attach economy adapter to Stonks, you add a new useAdapter <ID of the adapter> to the top-level of the config (eg: right under useAdapter stonks.fabric.adapter.provided.ItemsAdapter line). Then for the adapter config, it will be indented under your useAdapter. For example:
useAdapter stonks.fabric.adapter.provided.CommonEconomyAdapter
    id modid:economy
    decimals 2

@do-oy
Copy link
Author

do-oy commented May 10, 2024

  1. Yes, other mods exist, but for other versions and kernels, so for fabric 1.20.6 I would say you have the only mod that can implement this system. Buying and selling is very important at stock prices.

Can you describe in more detail about the admin command how it should work?

@nahkd123
Copy link
Owner

Right now, Stonks admin command only have 1 subcommand: /stonks about. My future plan is to add a way to interact the underlying service through in-game command. So to force create a new offer, it would be something like this:

/stonks create-offer <"buy" | "sell"> <Product ID> <Player | UUID | "admin"> <Price Per Unit> <Amount | "infinite">
/stonks instant-offer buy <Product ID> <Amount> <Balance limit>
/stonks instant-offer sell <Product ID> <Amount>
/stonks remove-offer <Offer ID>
/stonks claim-offer <Offer ID>

So to create a new admin's offer, you would use /stonks create-offer <"buy" | "sell"> my_product admin 10.0 infinite. Any offers that is worse than admin's offers (in this case, it will be any offers with price per unit lower than $10 for buy or greater than $10 for sell) will never be filled.

@do-oy
Copy link
Author

do-oy commented May 10, 2024

It turns out that to add 100 products, I have to run 200 commands (for buying and selling). Will this be convenient for creating a market?
That's why I asked about a certain config where this can be automated.

@nahkd123
Copy link
Owner

I'm trying to keep the structure where the service and interface are 2 separate things. It is possible to add adminBuyPrice to config, but in the future where you choose to host the service as standalone server (and share that service to multiple Minecraft server instances), the interface side of Stonks would no longer know if that product have admin price. Offers, on the other hand, stores directly in the service.

For the automation part, you can generate commands into a single .mcfunction and run them.

@do-oy
Copy link
Author

do-oy commented May 10, 2024

Yes, I remembered that you wanted to separate the service and the interface.

What if the service uses this pricing configuration? (That is, make a separate config for the service)

And in general, would you be interested in implementing this? Or don't you have time for this? Perhaps it would be easier for me to write what we are talking about in JS (I know JS mostly and have seen the KubeJS project)

@nahkd123
Copy link
Owner

My alternative solution is to improve the "product construction data" to accept complex objects instead of just string. The initial idea of construction data is to construct the product as item or "countable objects", but it can be used for defining further info about the product, like fixed price for example.

@do-oy
Copy link
Author

do-oy commented May 10, 2024

Ok, i see. In any case, this covers this feature, please tell me if we should expect it in the near future or are you currently working on other projects?

@nahkd123
Copy link
Owner

Yeah well, I am working on other projects right now (not related to Minecraft) but if anyone want to make a pull request, please make a PR to next/1.20.x branch.

@do-oy
Copy link
Author

do-oy commented May 10, 2024

Regarding the 2nd question.

For example, now diamond-economy (https://modrinth.com/mod/diamond-economy) is running on 1.20.6 and fabric. How can I link it?

There is no information about the adapter either https://github.com/IAmSneak/diamond-economy, how can you find out which one they use?

@do-oy
Copy link
Author

do-oy commented May 10, 2024

for example i tryied to do:

useAdapter stonks.fabric.adapter.provided.CommonEconomyAdapter
    diamondeconomy modid:diamondeconomy
    decimals 0

or

useAdapter stonks.fabric.adapter.provided.CommonEconomyAdapter
    id modid:diamondeconomy
    decimals 1

and i have a warn:

[10:09:49 WARN]: =====
[10:09:49 WARN]: Warning: Economy adapter for Stonks is not configured!
[10:09:49 WARN]: Please configure Stonks to use with your economy mod!
[10:09:49 WARN]: 
[10:09:49 WARN]: Example:
[10:09:49 WARN]:     // Use myScoreboard for economy (with 3 decimals place)
[10:09:49 WARN]:     useAdapter stonks.fabric.adapter.provided.ScoreboardEconomyAdapter
[10:09:49 WARN]:         objective myObjective
[10:09:49 WARN]:         decimals 3 // score == 12300 -> balance == $12.3
[10:09:49 WARN]:     // Or use economy from mods with Patbox's Common Economy API
[10:09:49 WARN]:     useAdapter stonks.fabric.adapter.provided.CommonEconomyAdapter
[10:09:49 WARN]:         account modid:account
[10:09:49 WARN]: =====

@nahkd123
Copy link
Owner

diamond-economy doesn't seem to use Common Economy API, so the adapter doesn't work.

@do-oy
Copy link
Author

do-oy commented May 10, 2024

Is there anything that actually works? I can’t even imagine what can be used as economic mods to make it work somehow. Here is an example of documentation where mods fits

image

@nahkd123
Copy link
Owner

nahkd123 commented May 11, 2024

Yeah I would say the number of mods that uses Patbox's Common Economy API is really small (like, next to none). You can try porting BasiqueEvangelist's common bridge to 1.20.6 (usually it's just version bump) and use that. Or I can try adding new economy adapter that consume items, like gold, emerald or diamond for example.

One of many problems in server-side Fabric right now is not enough people using server-side mods, so I don't have enough info on which API/mods I should provide official support. I'd love to improve this situation someday, but right now, it looks like the whole server-side modding scene is targeted at users with modding knowledge.


Tasks:

  • Hook with diamond-economy or add items economy adapter

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

No branches or pull requests

2 participants