Cuberite Forum
Working on Trady, related questions - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Working on Trady, related questions (/thread-562.html)

Pages: 1 2


Working on Trady, related questions - Taugeshtu - 09-14-2012

Hi there!
Writing a ChestShop analog (probably a bit more comfortable and functional Smile you know).
Got a bug: When I rightclick a sign - I got only one OnBlockPlace hook call, and... Yes, with [-1, 255, -1] coords Dodgy
I rightclick with my arm, nothing equipped... And I don't think it causes a problem. Somehow original ChestShop manages to work with whatever client sends (probably, some player's sigh line magic, but that would be sooo fucked up).


RE: Working on Trady, related questions - FakeTruth - 09-14-2012

That's strange.. I do get the correct coordinates when right clicking a sign


RE: Working on Trady, related questions - Taugeshtu - 09-14-2012

I use r857 special, with "hotfixed" chests...


RE: Working on Trady, related questions - xoft - 09-14-2012

What client version, 1.2.5 or 1.3.2?

FakeTruth, the chest hotfix means only that I changed the offset to inventory slots in cWindow::Clicked(); I didn't commit that change because it breaks all other windows while fixing chests Wink


RE: Working on Trady, related questions - Taugeshtu - 09-14-2012

Client 1.2.5


RE: Working on Trady, related questions - FakeTruth - 09-15-2012

I tried it with 1.3.2 .. don't know what 1.2.5 will do


RE: Working on Trady, related questions - xoft - 09-24-2012

Say, I have a question regarding this plugin. How are you storing players' "money"? And how do you plan on transacting it, and maybe even share with other plugins? Will there be a possibility of sending "money" from one player to another? How about using real money to buy in-game "money"? This all will have to be solved somehow.

I think it'd be wise for the server itself to provide "money" services for players. That way you could make the "payments" secure and shareable.
On the base level, it would mean that each player will get another variable, AccountBalance. Then the plugins could manipulate that.
A next step would be to have a transactor that could be told "take N money from player A and give it to player B". That way safe transactions, without duplicating or losing money, can be implemented.


RE: Working on Trady, related questions - Taugeshtu - 09-24-2012

Storing: hashtable during runtime + file for long-term storage.
Transactions: really simple, increase one value in hashtable, decrease another.
Sending money: I haven't decided yet. I would like to make two options: barter economy and money economy. With barter you trade some items (by default - gold nuggets), with money you trade, you know, money Smile In "barter" way you just drop nuggets to another player
Real money trading (aka "donations"): No. The simpliest way I could imagine it would requie a php script that will take real money payments and will store them in "to process" file, and then plugin will hooks to that file and proceed payments. And I'm not interested in web scripting Smile Besides, taking payments isn't what I would call "easy deal".

As for integrated "money"... Wouldn't it be wiser to have an option on shared plugins data? So we could make even more crazy stuff. This has been discussed several times, but still no implementation.
Why it can't be safe through plugin? Smile I bet it can. Chances that server will accudently shut down in between "take money from A" and "give money to B" are same for plugin code and for source code. Besides, in both cases it will lead only to aborting operation (remember, server have had no time to save data about new player A balance).
The only way I could imagine plugin implementation of money to be unsecure is the case when hacker has a root access to server's FS. And that's a doomsday anyway, so why bother?


RE: Working on Trady, related questions - ThuGie - 09-24-2012

Uhm,

Sorry not interested in the plugin but..
Isnt it already posible to interact with other plugins ?
I hope i aint wrong i once made a plugin that was interacting with another plugin.
There was a zone or still is a zone plugin.

And my plugin was able to read the zone's plugin data as to see if a player was inside or not.
Might wanna check up on this though.
Hope i aint giving false hopes or misunderstanding your meaning with interact.
This was at least before the new plugin system btw.


RE: Working on Trady, related questions - xoft - 09-24-2012

Well, most servers that I know that have ingame money allow users to buy that ingame money using real money. It's a way for those servers to earn their hosting costs. So there will probably need to be a system for real money input into the system somehow. And once you have real world money involved, things can't ever be so simple as "hashtable during runtime". Imagine a few players losing their ingame money due to some serverside mishap. This would be really, really bad.

With transactions, I was aiming at multithreading - if the account balance is made available to multiple plugins, several plugins can simultaneously access that value, it needs proper locking. Simple scenario: plugins first query the account balance and then decrease it if there's enough funds. If two plugins are multithreaded so that they both first check and only then they decrease the account balance, it could result in a negative balance.

About shared plugins data - that is very difficult to do, if not impossible; on the other hand, the account balance per-player variable is relatively easy to do. That's why I was even considering it. There's not a chance of the shared data being implemented in reasonable future, but there's a good chance of the variable, if you just say so.
ThuGie: each plugin runs in a separate Lua VM, so they cannot share any variables. They can interact only by using outside objects - files, maybe events etc.