How to Create a Vendor

Published

Before you decide to make a vendor there are a few important things that you need to figure out. These important bits of information include:

Although these are all quite obvious, the last point did manage to throw me for a loop momentarily. If you're using custom items and you've edited the item.dbc file, placed it within an MPQ in your data folder, and they still show up as red question marks in the vendor panel; then you need to upload the item.dbc file into /bin/data/dbc/ on your server and restart worldserver.

Just in case anyone wants to know what Iā€™m running:


Assuming that you already have both the NPC you'll be using as a vendor and the items that the vendor will be selling created and ready-to-use, we can begin.

You will first need to run SELECT * FROM creature_template WHERE entry = vendorNPCEntryID; on your database to view the data for the vendor NPC. Now that the record for the vendor NPC is up, you only need to edit the npcflag field and set it to 128. The NPC will now be recognized as a vendor. Now use the following query to add an item to the vendor NPC's vendor panel.

    
        /* To insert a single item into the vendor's vendor panel use this query.*/
        INSERT INTO npc_vendor (entry, slot, item, maxcount, incrtime, ExtendedCost) VALUES (0, 0, 0, 0, 0);
    
    
        /* To insert multiple items at once, just chain the values together as seen below. This example allows for two items to be added to the vendor's vendor panel. */
        INSERT INTO npc_vendor (entry, slot, item, maxcount, incrtime, ExtendedCost) VALUES (0, 0, 0, 0, 0, 0, 0), (0, 0, 0, 0, 0, 0);
    

Now that you've created a vendor NPC and populated it's vendor panel with items to sell, you'll need to restart worldserver then you're ready to go!

Field Explanations: