View Full Version : Potions with charges(5-10) only have one when bought from merchant
ZombieSoul
02-02-2017, 06:30 PM
First, I'd like to say thank you to everyone that has made this software possible, I have been able to get a server up and play with little problems that I couldn't figure out.
But one thing I'm struggling with and I'm posting in the bugs section because it's starting to look like a bug in the merchant code to me, but it is very possible that I messed up on something. I've read and searched all I can find, and see mentions of this issue years ago and I assumed it was fixed.
I have used Akka's windows installer so it has the PEQ database with minimal modifications(adding merchants etc, no item mods) and RoF2 client.
I can add a potion with maxcharges=10 (10 dose blood of the wolf) to my merchant. It shows up correctly on the merchant listing the charges, when you select it it also shows 10 charges beside the buy button, but when I buy it, it has 1 charge.
I can #giveitem the same item and it is fine, but not when bought from the merchant. 5 Dose potions also are the same way.
Is this a bug or did I mess something up somehow? I've spent good bit of time searching for the answer to that question and tried to trace the buy code a bit but that would take me a while to wrap my head around.
Thanks in advance
Uleat
02-02-2017, 08:12 PM
I know a similar issue came up a few years ago..could have been the #giveitem code.
Wasn't aware the merchant code was doing the same..I'll take a look at the current repo code.
Uleat
02-02-2017, 08:14 PM
Do you have a zone/merchant where these particular items are sold?
EDIT:
Just queried the database and there are no stackable potions for sell by any merchant.
Are you referring to a corner case? One where a player may have sold back alchemy combines?
ZombieSoul
02-02-2017, 09:27 PM
I added the 10 dose and 5 dose blood wolf potions to a vendor, since I play solo I was trying to find a way to provide a way to buy these, but when I buy them from the vendor after adding it to his list, it all looks fine until I buy one then I get a 10 dose potion with 1 charge
edit:by vendor I mean't merchant
steps to reproduce, add a merchant add a 10 dose potion from the database, it will all look fine until you try to buy it.
ZombieSoul
02-02-2017, 09:43 PM
Your reply got me thinking, so I summoned a 10 dose, used a few charges, sold it to a vendor with 6 charges, the merchant after the sale said there was a quantity of 6 of those potions in stock, when I bought it I got a 6 charge potion and it was removed from the vendor, so something a bit odd there but works.
Also realized there is some thing a bit off with charges left and price charged(charges full price for 6 doses left on a 10) but not really concerning me, EQ merchants always felt like they were ripping you off. lol
I appreciate you looking at this, seems like there is underlying issues, I've seen a few server patch notes during my search saying they fixed dosed potions.. some of them more than one attempt at fixing so guessing this may not be an easy fix.
Uleat
02-03-2017, 05:38 PM
Looking over the code..and with my lack of knowledge of client behaviors regarding this particular case..I probably won't make any alterations to the code.
I know those stack-based potions were active when I first started playing around with eqemu..but, they were removed - probably because the clients don't handle them properly.
The number of systems that would have to be modded to ensure that 'public' code would not be exploited makes me cringe :(
There are vials of charge-based potions that will probably suit your needs.
As well, you might be able to alter those potions to make them charge-based by changing their maxcount to '1' and maxcharges to the previous maxcount number. (That's not tested..but, I think it should work.)
If you need a query to make the changes, I might be able to help with that.
EDIT: I probably narfled the garthok on those field names...
ZombieSoul
02-03-2017, 05:56 PM
I thought those were charge based potions already, I've looked in the database and maxcharges = 10 is listed for the 10 dose Blood of the Wolf
stock PEQ item number 14534
I have been looking through the code it does some very ..odd.. stuff when setting the charges like using quantity for charges and other things:
int16 charges = 0;
if (item->Stackable || item->MaxCharges > 1)
charges = mp->quantity;
else
charges = item->MaxCharges;
possibly for supporting different clients.. I'm currently setting up the tools to build this to do some testing.
I'm sure there are reasons it does this, but I'm not able to fully understand yet. I could be way off base but the above seems to be that quantity and charges are used interchangeably for some things in building the item the player receives.
Uleat
02-03-2017, 06:17 PM
Let me look over this again..I thought I had seen that as stacksize..not maxcharges - but, you are correct.
ZombieSoul
02-08-2017, 09:17 PM
I have finally got around to building a fix for this, had some fun attempting to build 64 bit and gave up. I traced through the code and came up with this:
client_packet.cpp/line 12216 after comments were added(added tmpmer_used conditional)
int16 freeslotid = INVALID_INDEX;
int16 charges = 0;
//Items sold by vendors that have MaxCharges > 1 should be set to MaxCharges
//They should never be selling partial charges unless it is from temporary table
//mp-quantity was calculated above for stackables and temp table items
if (item->Stackable || (tmpmer_used && item->MaxCharges > 1))
charges = mp->quantity;
else
charges = item->MaxCharges;
EQEmu::ItemInstance* inst = database.CreateItem(item, charges);
It seems to work but may need more testing.
This is my first edit on the source, but so far it seems to be working for charged items that merchants provide, If I run into issues with it I'll update this post.
Any input is welcome of course and thanks for your time and work.
Uleat
02-08-2017, 10:16 PM
Thanks for this :)
I haven't forgotten you..but, I did get bogged down pretty hard in a current project and I'm trying to resolve some issues there.
I'll look that over (and keep an eye on this thread) to see if it can be pushed into the repo.
ZombieSoul
02-08-2017, 11:10 PM
I know you are busy with other projects, if I can contribute at all to this awesome project that is great with me. my personal opinion that this is a bandaid until the whole code that that transposes quantity and charges around can be reworked. If this works for now i may revisit it long into the future when i've figured out more of how all the systems work.
offtopic:
I check the commits daily since I picked up EQEmu it is always interesting to see what is being worked on. (and not trying to derail here but I do hope all that work you are doing on bots can be reused on mercs, I actually looked over the rogue code days before you started making commits on it because I just enabled mercs and my rogue was doing the twirling dance and found it was basically a copy and paste of the bot code)
Uleat
02-08-2017, 11:33 PM
Yeah, I think there has been several flips on philosophy regarding bots.
Mercs should follow the same behavior as that of live, since that's where they originate.
Bots, on the other hand, are not and can be implemented as we choose.
But, you are correct..mercs were essentially a cut-and-paste from the bot code in the beginning.
That code should work with mercs..but, the timer issue would need to be worked out.
I had to add a timer to the bot class and I'm not familiar enough with mercs to know what they use..but, it should be possible.
(Though, I wouldn't recommend the "back-off" code..unless live npcs do that too - not to be confused with pet back_off..)
ZombieSoul
02-08-2017, 11:37 PM
I agree mercs should act like live, but I nearly died laughing when I saw my first merc rogue fight.
Uleat
02-08-2017, 11:56 PM
I'm wanting to add a new spell 'type' to the npc spell ai - a hate redux cycle.
And maybe even a hate buff for tanks.
That's kinda where I'm hung up atm since I have to go down into Mob::Spell_AI to address issues there first.
ZombieSoul
02-09-2017, 12:26 AM
It sounds like you are headed in the right direction, though from what I saw of the code looking over it a few minutes trying to figure out why my rogue was flipping out and realizing it was always teleporting behind the mob, It would take me a great deal of time to understand what is all going on there. but as an old timer once told me. as long as you keep taking steps, doesn't matter if they are big or small, eventually you'll get somewhere.
and I appreciate everything you and anyone else that has contributed to the project that we enjoy.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.