Sign in to follow this  

How to Create a Vendor

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:

  • What items will the vendor sell.
  • Are any of the items rare or available in limited quantity?
  • If any of the items are rare or available in limited quantity, how often should the vendor restock those items?
  • In what order should the items be displayed in the vendor panel?
  • Are any of the items being sold custom?

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:

  • Windows 8, x64 — Home
  • Debian 7, x64 — Server
  • TrinityCore — Latest version as of 20/June/2015
  • WoTLK 3.3.5a


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:

  • entry – The entry ID of the vendor NPC. This is under the entry field of the creature_template table.
  • slot – The position in the vendor panel where this item will be located. As you can see in the image below, the slots are numbered left-to-right and top-to-bottom. This pattern repeats over all pages, but the numbers will continue incrementing.
  • item – The entry ID of the item being sold. This is under the entry field of the item_template table.
  • maxcount – The maximum number of items carried by the vendor at any time. If you want the vendor to carry an unlimited number of the item then set this to 0 else set it to any positive number. In the image below the maxcount value is circled.
  • incrtime – The time, in seconds (not milliseconds!), between restocks. As an example of how this is used… If maxcount is set to 4, incrtime set to 30, and the BuyCount field on the item in the item_template table is set to 2 then the vendor restocks 2 of the item every 30 seconds up to a total of 4 items.
  • ExtendedCost – The value here corresponds to the ID in ItemExtendedCost.dbc and that ID controls the item’s non monetary price, be it honor points, arena points, different types of badges or any combination of the above. (Taken from the TrinityCore documentation)

Recommended Comments

The links in the tutorial above may be out of date. If they are, then you can most-likely find an up-to-date link to the blog here.

Share this comment

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now