Merchant Issues Thread

Old bugs stored here for reference.
Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Wed Jan 02, 2013 6:38 pm

I have been messing with this for a few days in my spare time but I now have various currency showing up in the buy list, this is all loaded from the db, so far it supports 2 items, status, station cash, and coins, here is a screen shot of my test.
Image

The actual buy logic isn't in place yet, just been trying to get the list to display. I added several fields to the merchant_inventory table in the db, if those are all left blank it will use the old method wich was price from the items table. I like this method as multiple merchants can have the same list of items for diffrent prices, we can also expand this method for faction or guild req per item like live has.

I currently have added 7 fields to merchant_inventory, let me know if any one else has a better idea on how to do this or if I should just commit my work once I finish the buy logic.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Merchant Issues Thread

Post by John Adams » Thu Jan 03, 2013 3:51 pm

Looks good, Jab. Only question I have is, where does the item Price value come from? Is that in the item packet itself, or from the merchant list display packet? I know we used to have a sell_price in Items, but I think we hacked that in by processing merchant item lists and doing an update to raw_items. If the price (far as you can see) is in the merchant list display packet, I think you got the fields in the right place.

Just remember, to keep your Resident DB Guy happy and sane, minimize the amount of useless data - ie., if 7 fields times 100,000 entries are all 0's, we can think of a smarter way of setting up cost lists. Although I suppose if the 7 fields are in `items`, they are still 0's, eh? :)

fwiw, we used to have a merchant_multiplier table long ago, LE implemented that so we could offset prices based on faction and such. Somewhere along the line, we lost it (can't remember why) so I removed it from the schema. Code might still be there. code has been yanked, but here's the original post.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Thu Jan 03, 2013 4:34 pm

The price is in the merchant list packet. Currently every thing works locally, including the buy logic I implemented late last night and through out the day today, and on the first try too wich leads me to believe something is broken some where as nothing works on the first try...

I added the following fields to my merchant_inventory table

Code: Select all

	`price_item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`price_item_qty` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
	`price_item2_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`price_item2_qty` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
	`price_status` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`price_coins` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`price_stationcash` INT(10) UNSIGNED NOT NULL DEFAULT '0',
Most of the time only price_coins will be set though... the rest will be 0. As I have said many times before I am not a DB guy so if there is a better way to store this info let me know.

This all works locally so far, do you want me to commit the code and table changes or wait until something is figured out with the DB?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Merchant Issues Thread

Post by John Adams » Thu Jan 03, 2013 7:01 pm

Go ahead and commit the DB and code changes. I gave it much thought while unpacking books this afternoon :D and honestly, cannot think of a better way to deliver all that data. While a billion blank sint32's may drive me nuts, they are everywhere already so what's a few million more? :D

Good job, Jab. jobjab. yeah.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Thu Jan 03, 2013 7:36 pm

All code is on the Dev SVN and table updates on the db patcher (even remembered to change the minor version in version.h and also remembered to commit version.h :D ).

Let me know if there are any issues or I screwed something else up, tested on both DoV and CoE and couldn't find any issues.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Merchant Issues Thread

Post by John Adams » Fri Jan 04, 2013 7:44 am

Jabantiz wrote:Let me know if there are any issues or I screwed something else up, tested on both DoV and CoE and couldn't find any issues.
Jab, any thoughts on if this breaks merchants for older clients?

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Fri Jan 04, 2013 11:15 am

It might not display correctly in older clients but all the logic will still work. I believe it is just a struct issue and had planned to look into it today, the only thing that DoV+ will have that older clients don't is the station cash, and the code doesn't support buying with that yet.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Fri Jan 04, 2013 2:18 pm

It was just a struct issue, I updated the older struct and tested on SF and it worked, only thing older clients don't have is station cash.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Fri Jan 04, 2013 2:59 pm

Fixed the multiple stacks of the same item issue on the buy back list, code is on Dev SVN

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Merchant Issues Thread

Post by John Adams » Fri Jan 04, 2013 4:24 pm

Cool beans. Thanks for looking at that.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Fri Jan 04, 2013 6:16 pm

- Some vendors are showing the Sell tab first. Most are ok. Not sure what is causing this odd behavior, but it is consistent (always happens on the same vendor, not inconsistently).
Just commited a possible fix for this to Dev SVN. It looks like live sends another blank version of the merchant list packet that forces the client to reorder the tabs, I implemented this packet and have not been able to find a single merchant with tabs in the wrong order.

This also brings up
- Merchants with merchant_id assigned but no merchants inventory built, show the contents of the previous vender viewed instead of an empty window. And, the initial Sell tab does not show player items to sell until you switch to Buy Back and back to Sell (rev 267).
It seems that if the packet is sent with no items in it then the client uses the last group of lists it had recieved, don't think this issue can be fixed by us.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Merchant Issues Thread

Post by John Adams » Sat Jan 05, 2013 4:46 pm

Hmm, first time I tried opening a merchant, my zone crashed. Haven't debugged it yet, because of course it's in a catch{} so it eats anything that's actually crashing.

All tables updated, using TSO items list still though. I'll mess with it more later if you do not already know what's up.
16:43:33 D Command : Player 'Killer' (1), Command: frommerchant
16:43:33 E Zone : Exception caught when in ZoneServer::ClientProcess() for zone 'QueensColony'! ZoneServer::ClientProcess, 2299

Edit: And of course, the stack is completely useless. Wish someone could tell me why.
ntdll.dll!773115de()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!773115de()
ntdll.dll!7730014e()
EQ2World__Debug.exe!std::_Iterator_base12::~_Iterator_base12() Line 133 + 0x1e bytes C++
> EQ2World__Debug.exe!std::_Deque_const_iterator<EQ2Packet *,std::allocator<EQ2Packet *> >::~_Deque_const_iterator<EQ2Packet *,std::allocator<EQ2Packet *> >() + 0x43 bytes C++
EQ2World__Debug.exe!std::_Deque_iterator<EQ2Packet *,std::allocator<EQ2Packet *> >::~_Deque_iterator<EQ2Packet *,std::allocator<EQ2Packet *> >() + 0x43 bytes C++
EQ2World__Debug.exe!std::_Tree_const_iterator<std::_Tree_val<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,Emote *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Emote *> >,0> > >::~_Tree_const_iterator<std::_Tree_val<std::_Tmap_traits<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,Emote *,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Emote *> >,0> > >() + 0x43 bytes C++
2648ded8()
EQ2World__Debug.exe!TaoCrypt::isMMX() + 0x4f bytes C++
cdcd0000()

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Sat Jan 05, 2013 5:18 pm

I was able to reproduce and track the bug down, it seems to be in the following code in Command_SendMerchantWindow() in commands.cpp

Code: Select all

			/*PacketStruct* packet = configReader.getStruct("WS_UpdateMerchant", GetVersion());
			if (packet) {
				packet->setDataByName("spawn_id", 0xFFFFFFFF);
				packet->setDataByName("type", 16);
				EQ2Packet* outapp = packet->serialize();
				if (outapp)
					client->QueuePacket(outapp);
				safe_delete(packet);
			}*/
I changed it around a little from what is on SVN to try and get it to work but for what ever reason when it uses the old price (all new fields are 0) this code crashes, mainly packet->serialize(), no clue why this packet is even effected by the price as it was the blank packet to make sure the tabs are ordered correctly...

I will play with it some more to try and get an actual fix but commenting it out there is no crash.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Merchant Issues Thread

Post by Jabantiz » Sat Jan 05, 2013 5:50 pm

Figured out the problem and as usual it was a stupid mistake on my part, odd that it didn't crash for me before though, commited the fix to Dev SVN.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Merchant Issues Thread

Post by John Adams » Sat Jan 05, 2013 6:01 pm

<<-- QA machine!

Locked

Who is online

Users browsing this forum: No registered users and 0 guests