WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + itemCount * 8 * 4);
// Player GUID here ?
data << uint64(_player->GetGUID());
size_t countPos = data.wpos();
data << uint8(count);
for (uint8 slot = 0; slot < itemCount; ++slot)
if (VendorItem const* item = items->GetItem(slot))
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(item->item))
uint32 leftInStock = 0xFFFFFFFF;
int32 price = item->IsGoldRequired(itemTemplate) ? uint32(floor(itemTemplate->BuyPrice)) : 0;
data << uint32(slot + 1); // client expects counting to start at 1
data << uint32(item->item);
data << uint32(itemTemplate->DisplayInfoID);
data << int32(leftInStock);
data << uint32(price);
data << uint32(itemTemplate->MaxDurability);
data << uint32(itemTemplate->BuyCount);
data << uint32(item->ExtendedCost);
You need to edit the buyitemfromslot (buying packet handler) code
The multivendor modification does that.
Actually, you could just take the multivendor modification.
If you dont do it like I did there, you cant have more than 150 items in the NPC, no matter how many vendors you try to send. You will hit a wall when you try to buy the items and the client only can send slots up to 150 making you unable to identify which item in which list the player decided to buy and so.
You would need to save the vendor entry used by the player (same as I did) and then use the entry to get the vendor list later in the packet handler and then see if the item is real.
WIth the multivendor modification you can have unlimited amount of vendors in the NPC.
You could also try the same code /emoticons/default_smile.png (use the same idea, parts of code) Its not a big edit.
Around 9 lines needed for what you want. Unless you want to copy over the send function, which is pretty much a copy paste.
Incase you are trying to just use the player to send the vendor, you need to do further edits to the buying part for example the check for if the NPC is interactable by the player (this is where you are atm)
Note that you also need to code buyback and selling and so also (modify the handlers)