Stacked item cost
Moderator: Community Managers
Stacked item cost
If a stack of 50 arrows at a vendor is listed as 5 copper, is that 5 copper per arrow or 5 copper for the stack?
Re: Stacked item cost
For the stack.
Re: Stacked item cost
That's what I figured.
So here's the issue. I can certainly charge that for the stack, and that works fine. In fact, that's what my current build does.
But...when you sell a stack back, how do I calculate the value? In other words, if the normal stack size is 20, and you have 30, then you need 1.5x the value of a stack. So each item needs to have a default stack size to compare to. I'm not sure we have that set up in the database to do this properly. I will have to do some checking on that. Some items might be stackable, but the default stack size would be 1, as in you receive 1x the value of the item per item you sell.
So here's the issue. I can certainly charge that for the stack, and that works fine. In fact, that's what my current build does.
But...when you sell a stack back, how do I calculate the value? In other words, if the normal stack size is 20, and you have 30, then you need 1.5x the value of a stack. So each item needs to have a default stack size to compare to. I'm not sure we have that set up in the database to do this properly. I will have to do some checking on that. Some items might be stackable, but the default stack size would be 1, as in you receive 1x the value of the item per item you sell.
Re: Stacked item cost
It would equal to 1 copper per stack of 10... anything less would need to be 0.xx (rounded down to 0 at values lower than 1 copper).... else there would be a gaining glitch.
Re: Stacked item cost
I would think you would only need one field in the database: the individual item cost. You can then do the math to figure out the stack price. If you set the minimum item value to 1 cp, you would never have to worry about rounding issues on partial stacks.
Re: Stacked item cost
That is the most logical approach in my mind, as well. I have yet to implement anything, but will get to it soon.
Re: Stacked item cost
I've been playing with this a bit.
Note that in the database, we have a ton of items with no sell price information, so if you sell them to a vendor you will not receive any money.
But, item 1437532, Inert Essence, is in the database with a sell price of 10c. The stack size on that was 20. If you do the math, each inert essence is worth .5 copper, which is not something we can code for. That means that in the actual game there was some sort of math going on with sell price for a stack (one of the scenarios above). Or, possibly, the sell price is indicative of 1 inert essence, so 20 sold for 200c, which would be the other scenario. If we can spot a vendor item that someone sold a quantity of, and find the sell price of that, we can compare it to the vendor's known sell price of that item to see how it works. I haven't found that instance, yet.
We do eventually need a default or max stack size for each item, for various reasons.
We also need to do a sweep through the logs to get as many sell prices as we can for our items, and then do something to set the rest.
Right now you can exploit a vendor by buying stacks of items (once you buy an item, it is valued at the vendor sale price), separating them into smaller stacks, and then selling the smaller stacks back at the full stack values. Otherwise we are getting closer to the finished product on this.
Note that in the database, we have a ton of items with no sell price information, so if you sell them to a vendor you will not receive any money.
But, item 1437532, Inert Essence, is in the database with a sell price of 10c. The stack size on that was 20. If you do the math, each inert essence is worth .5 copper, which is not something we can code for. That means that in the actual game there was some sort of math going on with sell price for a stack (one of the scenarios above). Or, possibly, the sell price is indicative of 1 inert essence, so 20 sold for 200c, which would be the other scenario. If we can spot a vendor item that someone sold a quantity of, and find the sell price of that, we can compare it to the vendor's known sell price of that item to see how it works. I haven't found that instance, yet.
We do eventually need a default or max stack size for each item, for various reasons.
We also need to do a sweep through the logs to get as many sell prices as we can for our items, and then do something to set the rest.
Right now you can exploit a vendor by buying stacks of items (once you buy an item, it is valued at the vendor sale price), separating them into smaller stacks, and then selling the smaller stacks back at the full stack values. Otherwise we are getting closer to the finished product on this.
Re: Stacked item cost
I dug around a bit in my logs, and I think I understand what happens with stacks, at least on the buying side. Excerpt from chat log follows. Note that between crafting bouts, I used to sell any partial stacks of mats in my crafting bag, and then buy stacks of mats in a particular order, such that my bag would fill up with the various mats in predictable locations in my bag (making it easier to check to see if I had enough of any particular mat to continue, or needed to hit the vendor.
[18:38:41] You sell Adhesive.
[18:38:43] You sell Cleaner.
[18:38:43] You receive 1 copper.
[18:38:44] You lose 5 copper.
[18:38:44] Carwan Dusa says, "There you go."
[18:38:45] You lose 5 copper.
[18:38:45] Carwan Dusa says, "There you go."
[18:38:45] You lose 5 copper.
[18:38:45] Carwan Dusa says, "There you go."
[18:38:48] You lose 5 copper.
[18:38:48] Carwan Dusa says, "There you go."
[18:38:48] You lose 5 copper.
[18:38:48] Carwan Dusa says, "There you go."
[18:38:51] You lose 5 copper.
[18:38:51] Carwan Dusa says, "There you go."
[18:38:52] You sell Softener.
[18:38:52] You receive 2 copper.
[18:38:53] You lose 5 copper.
[18:38:53] Carwan Dusa says, "There you go."
[18:39:01] You lose 5 copper.
[18:39:01] Carwan Dusa says, "There you go."
[18:39:01] You lose 5 copper.
[18:39:01] Carwan Dusa says, "There you go."
[18:39:02] You lose 5 copper.
[18:39:02] Carwan Dusa says, "There you go."
[18:39:02] You lose 5 copper.
[18:39:02] Carwan Dusa says, "There you go."
[18:39:02] You lose 5 copper.
[18:39:02] Carwan Dusa says, "There you go."
[18:39:03] You lose 5 copper.
[18:39:03] Carwan Dusa says, "There you go."
[18:39:04] You lose 5 copper.
[18:39:04] Carwan Dusa says, "There you go."
[18:39:05] You lose 5 copper.
[18:39:05] Carwan Dusa says, "There you go."
Unfortunately, the chat log didn't capture the size of the stacks, but several things can be deduced from the log:
1. The price for a stack of mats was 5c. I always bought whole stacks (at the time, a stack was probably 20; the log is from 2007)
2. The Cleaner (2nd from top) was less than a full stack, and I received 1c.
3. The Adhesive (the top) was too small a stack to register 1c, so I got nothing. I don't know if the code is rounding or performing an INT() function.
Hope that helps.
[18:38:41] You sell Adhesive.
[18:38:43] You sell Cleaner.
[18:38:43] You receive 1 copper.
[18:38:44] You lose 5 copper.
[18:38:44] Carwan Dusa says, "There you go."
[18:38:45] You lose 5 copper.
[18:38:45] Carwan Dusa says, "There you go."
[18:38:45] You lose 5 copper.
[18:38:45] Carwan Dusa says, "There you go."
[18:38:48] You lose 5 copper.
[18:38:48] Carwan Dusa says, "There you go."
[18:38:48] You lose 5 copper.
[18:38:48] Carwan Dusa says, "There you go."
[18:38:51] You lose 5 copper.
[18:38:51] Carwan Dusa says, "There you go."
[18:38:52] You sell Softener.
[18:38:52] You receive 2 copper.
[18:38:53] You lose 5 copper.
[18:38:53] Carwan Dusa says, "There you go."
[18:39:01] You lose 5 copper.
[18:39:01] Carwan Dusa says, "There you go."
[18:39:01] You lose 5 copper.
[18:39:01] Carwan Dusa says, "There you go."
[18:39:02] You lose 5 copper.
[18:39:02] Carwan Dusa says, "There you go."
[18:39:02] You lose 5 copper.
[18:39:02] Carwan Dusa says, "There you go."
[18:39:02] You lose 5 copper.
[18:39:02] Carwan Dusa says, "There you go."
[18:39:03] You lose 5 copper.
[18:39:03] Carwan Dusa says, "There you go."
[18:39:04] You lose 5 copper.
[18:39:04] Carwan Dusa says, "There you go."
[18:39:05] You lose 5 copper.
[18:39:05] Carwan Dusa says, "There you go."
Unfortunately, the chat log didn't capture the size of the stacks, but several things can be deduced from the log:
1. The price for a stack of mats was 5c. I always bought whole stacks (at the time, a stack was probably 20; the log is from 2007)
2. The Cleaner (2nd from top) was less than a full stack, and I received 1c.
3. The Adhesive (the top) was too small a stack to register 1c, so I got nothing. I don't know if the code is rounding or performing an INT() function.
Hope that helps.