Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!
I had a LOT of trouble trying to understand the whole "AddVendorItem( 0, IK3_SWD, 1, 15, 27, 50 );" thing and wanted to have my own custom npc for certain items, and well i finally figured it out. I couldn't find a straight answer and only scattered forum posts with dead links, so i decided to make a small tutorial for those who were in my same spot.
Adding a new npc:
I followed RynoKabbage's guide, but i found that his link for flyfftools was dead, so you can use this link for
You must be registered to see links
or the link in the comments on his guide.
Adding "__ADDSHOPITEM": note:I'm assuming whoever is reading this already knows how to compile there source.
This is how i made it work, i'm not sure if there's an easier way but in the folders: accountserver, cacheserver, certifier, coreserver, databaseserver, neuz, and world server there are files named "versioncommon.h". In the first few lines you should see lines like "#define __Server", well within those you need to add "#define __ADDSHOPITEM" to each versioncommon.h in every one of those folders.
Mover.cpp part:
now in your _COMMON folder you're going to want to open "mover.cpp". Start by searching for "#endif //__CSC_VER11_3" there should be 3 occurrences of that bit of text, the second one is the one you want to start with.
note: the example above is just the start of the clip of code and not the whole thing.
now on the 3rd occurrence of that line your searched you're going to do the same thing you did above, right below the "#endif" you paste the code below.
Code:
#ifdef __ADDSHOPITEM
for( int i = 0; i < MAX_VENDOR_INVENTORY_TAB; i++ )
{
if( pCharacter->m_venderItemAry3[i].GetSize() )
return TRUE;
}
#endif
Project.cpp part:
Now in your _COMMON folder you're going to want to open "Project.cpp". Start by searching for "#endif //__CSC_VER11_3" there should be 3 occurrences of that bit of text, the first one is the one you want.
Just as the mover.cpp, you need to paste the code below directly under the "#endif //__CSC_VER11_3".
Now you're going to search again in "Project.cpp" for "#endif // __TELEPORTER", the second occurrence towards the middle is what you want. You'll as always post the snip of code directly under the searched term.
Now in your _COMMON folder you're going to want to open "Project.h". Start by searching for "#endif // __TELEPORTER". There should be 1 occurrence, that's one you want.
And for the last thing you need to do, one last time, directly under the "#endif" you need to paste the code below:
the snip of code you need to add items now is "AddShopItem( 0, PUT_ITEM_ID_HERE );".
You place it where you see "AddVendorItem( 0, IK3_MASK, -1, 1, 2, 100 );"
Once you've done all of that, you'll need to use merge.exe to get new res files and put them in your client folder for the shops to load.
Of course you put the id of the item you want where it tells you to, and the 0 is the vender slot number. You can find item id's in the file "propItem.txt". Some things can't be sold and you'll have to go through your "propItem.txt" with the id you found and change the shopable value to 1. You also go into that file to change prices. Edit: Looking around i found a snip of code that lets you change the price of the item in the character.inc, but it's a little wonky and it only lets you change the price once. So two different shops with the addshopitem line and a price change, they'd both have the price of the first query. "AddShopItem( 0, PUT_ITEM_ID_HERE, X);" The X is where the price goes, you don't have to have it in your line, only if you want to change the price for said item.