EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=621)
-   -   Are merchant lists with more than 28 items possible? (https://www.eqemulator.org/forums/showthread.php?t=5016)

Drawde 02-03-2003 12:23 AM

Are merchant lists with more than 28 items possible?
 
Currently in EQEmu if a merchant's item list has more than 28 items, it will appear blank.
Merchants on the EQ live servers often have many more items than this (usually when players sell things to them), so it must be possible somehow.
Being able to have more than 28 items per list would be VERY handy for tradeskill item merchants, which
I'm working on ATM. There are so many different moulds, patterns etc. that there aren't enough merchants
for the number of lists needed!

Divide 02-03-2003 04:38 AM

I maybe wrong but i think the limit is 28 or 30 items

Trumpcard 02-03-2003 04:52 AM

Heres where we send the number of items

int cpisize = sizeof(MerchantItem_Struct) + (29 * sizeof(MerchantItemD_S
truct));^M
MerchantItem_Struct* cpi = (MerchantItem_Struct*) new uchar[cpisize];^M
memset(cpi, 0, cpisize);^M

const Item_Struct *item;
for (unsigned int i=0;i<database.GetMerchantListNumb(merchant_id) && i <
29; i++)

Im not much of a packet mangler, so
Im not sure if we can just up this number, but we can always check..

I'll see if I can up it to 36 tonight and see if it works.

Lyenu X`Arie 02-03-2003 08:52 AM

Do this:

int cpisize = sizeof(MerchantItem_Struct) + (36 * sizeof(MerchantItemD_S
truct));
MerchantItem_Struct* cpi = (MerchantItem_Struct*) new uchar[cpisize];
memset(cpi, 0, cpisize);

const Item_Struct *item;
for (unsigned int i=0;i<database.GetMerchantListNumb(merchant_id) && i <
36; i++)

Although I'm pretty sure you could make it dynamic by doing something like this...

int32 numitems = database.GetMerchantListNumb(merchant_id);
int cpisize = sizeof(MerchantItem_Struct) + (numitems * sizeof(MerchantItemD_Struct));
MerchantItem_Struct* cpi = (MerchantItem_Struct*) new uchar[cpisize];
memset(cpi, 0, cpisize);

const Item_Struct *item;
for (unsigned int i=0; i <
numitems; i++)

Trumpcard 02-03-2003 08:57 AM

Probably a better idea.. Be alot more flexible to do it that way..

killspree 02-03-2003 10:23 AM

EQlive merchant max atm is 80 items. They did this so it would allow bazaar traders to sell more items, since I believe that code is based off of merchant code.

Divide 02-03-2003 04:29 PM

So it was 29 Now its more, well i was halfass right, lol
But i think Kill is right about the bazaar code

Bigpull 02-05-2003 01:31 AM

EQLive does send an 80 item list, however the server side merchant list is > 80.

Code:

--- ../../../cvs/NightDumps/Source/zone/client_process.cpp        2003-02-03 08:38:21.000000000 -0700
+++ client_process.cpp        2003-02-05 05:24:38.000000000 -0700
@@ -5287,12 +5287,12 @@
 
 void Client::BulkSendMerchantInventory(int merchant_id, int16 npcid) {
        const Item_Struct* handyitem = NULL;
-        int cpisize = sizeof(MerchantItem_Struct) + (29 * sizeof(MerchantItemD_Struct));
+        int cpisize = sizeof(MerchantItem_Struct) + (80 * sizeof(MerchantItemD_Struct));
        MerchantItem_Struct* cpi = (MerchantItem_Struct*) new uchar[cpisize];
        memset(cpi, 0, cpisize);
 
        const Item_Struct *item;
-        for (unsigned int i=0;i<database.GetMerchantListNumb(merchant_id) && i < 29; i++)
+        for (unsigned int i=0;i<database.GetMerchantListNumb(merchant_id) && i < 80; i++)
        {
                item=database.GetItem(database.GetMerchantData(merchant_id,i+1));
                if (item)
@@ -5301,9 +5301,9 @@
                        memcpy(&cpi->packets[cpi->count].item, item, sizeof(Item_Struct));
                        cpi->packets[cpi->count].item.equipSlot = i;
                        cpi->count++;
-                        if (cpi->count >= 29)
+                        if (cpi->count >= 81)
                        {
-                                cout << "ERROR: cpi->count>=29 in BulkSendMerchantInventory()" << endl;
+                                cout << "ERROR: cpi->count>=81 in BulkSendMerchantInventory()" << endl;
                                return;
                        }
                }


Trumpcard 02-05-2003 03:33 AM

Have you been able to test this out? If it works ok, I'll look into rolling it into the code.

Bigpull 02-05-2003 06:52 AM

Aye, not sure about the >= 81 check. cpi->check shouldn't/can't ever go above 80.

Trumpcard 02-05-2003 07:49 AM

I think 80 items is more than enough...

I might try to do it dynamiclly like Lyn suggested that way we only pass what we need to pass, and just put a cap on it at 80 like you did.

I'll try to tinker with it tonight.

Drawde 02-05-2003 08:23 AM

That would be really useful, especially for merchants selling spell scrolls or tradeskill supplies.
80 items is more than enough (probably about 40-50 items is the max that you'd ever need), larger numbers might cause too much lag anyway (clicking on a merchant with a lot of items often causes brief server lag whilst the item data is loaded from the DB)


All times are GMT -4. The time now is 12:52 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.