[Mini-Release] More NPC Vendor Inventory

11/04/2021 13:15 Steffen Tequila#1
Hey guys!

Many people know that you can only add a maximum of 100 items to an NPC shop,
here I will quickly explain how to increase it.

Example for 150 instead of 100 items for an npc shop


Step 1:
add "__MORE_VENDOR_INVENTORY 150" to your commons
Code:
#define __MORE_VENDOR_INVENTORY 150

Step 2:
search here: ProjectCmn.h(_Common)
this: MAX_VENDOR_INVENTORY

you will find this:

Code:
#define	MAX_VENDOR_INVENTORY	100
change that to:

Code:
#ifndef __MORE_VENDOR_INVENTORY
#define	MAX_VENDOR_INVENTORY	100
#endif // __MORE_VENDOR_INVENTORY
most people when they want to change the slots are just changing one thing like that: MAX_VENDOR_INVENTORY 100 but if you change only this then your neuz leads to a crash if your vendor shop has more as 100 items and you open it. A fix with this is step 3.

Step 3:
search here: WndItemCtrl.h(_Interface)
this: m_pArrayItemElem

you will find this:

Code:
CItemElem*		m_pArrayItemElem[100];
change that to:

Code:
#ifdef __MORE_VENDOR_INVENTORY
CItemElem*		m_pArrayItemElem[__MORE_VENDOR_INVENTORY];
#else // __MORE_VENDOR_INVENTORY
CItemElem*		m_pArrayItemElem[100];
#endif // __MORE_VENDOR_INVENTORY
now you can compile and add more items to an npc shop without crash.

greez, stevyboy.
11/04/2021 16:26 Nιgнтмαяε#2
Not sure how this is a release really lol...

Why are you doing this:
Code:
#ifdef __MORE_VENDOR_INVENTORY
CItemElem*		m_pArrayItemElem[150];
#else
CItemElem*		m_pArrayItemElem[100];
#endif
When you can just do:
Code:
#ifdef __MORE_VENDOR_INVENTORY
CItemElem*		m_pArrayItemElem[MAX_VENDOR_INVENTORY];
#else
CItemElem*		m_pArrayItemElem[100];
#endif
:rollsafe:
11/04/2021 17:38 WaterIsSand#3
I mean, if you're wanting to increase the amount a tab could contain in a shop, then you should also fix the offscreen rendering issue that will lower the user's frames or increase cpu usage in the OnDraw function.
11/04/2021 17:54 Steffen Tequila#4
Quote:
Originally Posted by Nιgнтмαяε View Post
Not sure how this is a release really lol...

Why are you doing this:
Code:
#ifdef __MORE_VENDOR_INVENTORY
CItemElem*		m_pArrayItemElem[150];
#else
CItemElem*		m_pArrayItemElem[100];
#endif
When you can just do:
Code:
#ifdef __MORE_VENDOR_INVENTORY
CItemElem*		m_pArrayItemElem[MAX_VENDOR_INVENTORY];
#else
CItemElem*		m_pArrayItemElem[100];
#endif
:rollsafe:
Its was an example. Of course u can set it 1% easier but the sense is the same and not more importment.