PDA

View Full Version : Merchant Bug and Fix


Waeric
05-03-2002, 08:00 AM
Merchants currently have a bug in 3.1.1 where they miss the last item in the list of items to be sold.

zone/client_process.cpp:

case OP_ShopRequest: {

...

for(int x=1; x < database.GetMerchantListNumb(merchantid) && x < 30; x++)

should be:

for(int x=0; x < database.GetMerchantListNumb(merchantid) && x < 29; x++)

...

uint16 item_nr = database.GetMerchantData(merchantid,x);

should be:

uint16 item_nr = database.GetMerchantData(merchantid,x+1);

...

item->equipSlot = x-1; // this needs to be incremented in loop.

should be:

item->equipSlot = x; // this needs to be incremented in loop.

Waeric
05-03-2002, 09:20 AM
There is also a problem with the merchant id loading one place is in struct NPCType, it is int8 merchanttype, when it should be something like uint32 merchanttype. I'm not looking at the source at this second and there may be other places than this one.

Drawde
05-04-2002, 06:43 AM
That last bug sounds like it's the reason that only merchant IDs below 256 work.. since the ID gets mistakenly converted to a single-byte INT it can't store numbers higher than that.

Waeric
05-04-2002, 09:44 AM
Yep that's exactly it =)

Wiz
05-05-2002, 05:04 AM
This fixes it, but makes the first item of the list dissapear instead :p

Waeric
05-08-2002, 04:42 AM
It fixes it if you follow it to the letter (or number in this case), as you found out =)