[SUGGESTION] Shop Chest Behaviour

Discussion in 'Suggestion Box Archives' started by nltimv, Sep 17, 2016.


What do you think?

+1 10 vote(s) 90.9%
0 0 vote(s) 0.0%
-1 1 vote(s) 9.1%
  1. Hello EMC,

    Selling things to shop chests is one of the things I do most on EMC. However finding a suitable shop that has a decent price and still has enough space left isn't always easy. In finding a shop that fits the bill, I usually use Azoundria's EMC Market Website. For those of you that don't know this website, it gives a list of shops across all EMC servers that buy/sell any item on EMC.

    Because usually these shops are across multiple SMPs, I'd have to put the items in my Vault, go to another SMP, take the items out of my Vault, and try to find/sell to the shop. If that doesn't work, the cycle starts all over again.

    Because this work is really tedious, I usually leave the items in my vault, and try to sell to the shop. If a message appears and says:

    then I know that there's place for at least 1 more item and I take the items out of my Vault.
    It is way faster than the standard method, especially if you are selling a lot of items at once.

    However, sometimes this shows up:

    which is really annoying, because I just went through the trouble of getting all the items out of my Vault.

    In short, this is how the server checks if one can sell to a chest:
    1. Is there still space in the chest for at least the amount listed on the shop sign?
    2. Does the player have enough items to sell?
    3. Does the shop owner have enough money?

    My suggestion is quite easy and quite simple: Swap the check order so that it checks in the following way:

    1. Does the shop owner have enough money?
    2. Is there still space in the chest for at least the amount listed on the shop sign?
    3. Does the player have enough items to sell?
    This would save me a little more time when going through selling stuff :)
  2. +1
    nltimv likes this.
  3. That's a good idea, I like how you spotted the room for improvement there.
    "Does the player have enough items to sell" should be last because it's the only thing the player itself will be able to change.
    nltimv and Jimbonothing64 like this.
  4. I prefer the current order.

    I understand your reasoning for the change. You're interested in whether or not you should move your items from your vault. There is a different use case that is greatly harmed by the proposed change -- namely the trade-shop method.

    e.g. I need to know if the account has enough space in the chest before I give it balance.

    But also I prefer the order for server efficiency reasons. The owner's balance is the least likely check to fail so it should be the last one checked. (I don't know the code so the check might be done without a DB hit, but I'm not sure.)
  5. But then couldn't "Does the player have enough items to sell?" still come last?
    I'm not sure if I fully understand what you're doing.
  6. If the first check fails, I no longer receive the information about the later checks. This is important information for certain types of trade transactions.

    (trade = swap items with net zero trade of rupees)
    607 likes this.
  7. Ah, okay, you mean first buying one item and then selling another item?
    It makes sense then, thanks for explaining. :)
  8. So, the reason that the money check is done last, is that it interacts with the database to complete the transaction. And we want to minimize the amount of time that database is locked up in a transaction like this.

    Realistically, to accomplish what you suggest, (which is a valid and reasonable suggestion), would require a pre-transaction check, along with the actual transaction check. Essentially doubling the database times.
    We can actually guarantee that the chest won't be changed in that time (based on how the server works), but we can't guarantee that the in-between time, something won't drain their rupees causing inconsistent behavior. So we would have to add that second check to accommodate this possibility.

    In other words, we would have to do this:
    1. Does the shop owner have enough money?
    2. Is there still space in the chest for at least the amount listed on the shop sign?
    3. Does the player have enough items to sell?
    4. Does the shop owner have enough money?
    Which just looks silly when written out that way and reduces efficiency.
    ShelLuser, nltimv, 607 and 1 other person like this.
  9. I fully understand and agree with your reasoning here. After all, it's just a minor inconvenience and because the impact it has on the server and DB, it is simply not worth changing it.
    ShelLuser likes this.
  10. And even if it was changed, you would still run into the same problem, as its likely the shop has some rupees and can buy some of your items, and so you might go move 2 DC's only to find out you could only sell 5 stack before the owner ran out of money.
    607 and nltimv like this.
  11. i have a feeling this has something to do with my mall.....
    nltimv likes this.
  12. For me, moving items isn't useless if I can at least sell something. Some items sold is better than no items sold :p
    Besides, personally, I've rarely seen that happening.
    607 likes this.