• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] Multivendor in c++

Status
Not open for further replies.

savenx

Enthusiast
Hello, i was using multivendors from rochet, i was using SQL to create the menus... But how i can create the NPC and the MENUS with C++ ? I Saw the instructions but i dont know how to do it..

Example:

Gems vendor:

•Blue
•Red..

I want to do this in C++, not sql! Thanks!
 

Tommy

Founder
Well, taken from the multivendor README

YOU CAN also send menus from C++. All you need to do is to provide the vendor entry to the
void WorldSession::SendListInventory(ObjectGuid guid, uint32 vendorEntry) function.

You need to call that particular method to send that vendor's inventory.

Here's an example (NOTE: I don't have Visual Studio running, nor am I using this system):

Code:
class multi_vendor : public CreatureScript
{
public:
    multi_vendor() : CreatureScript("multi_vendor") { }

    bool OnGossipHello(Player* player, Creature* creature) override
    {
        player->PlayerTalkClass->ClearMenus();
        if (player->IsInCombat())
        {
            player->GetSession()->SendNotification("You are in combat.");
            return false;
        }

        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Gems", 0, 1); // Send Gems vendor list
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Nevermind..", 0, 2);
        player->SEND_GOSSIP_MENU(1, creature->GetGUID());
        return true;
    }

    bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions) override
    {
        player->PlayerTalkClass->ClearMenus();
        switch (actions)
        {
            case 1: // Gems
                player->GetSession()->SendListInventory(creature->GetGUID(), 1234); // Vendor GUID, Vendor EntryId - Assuming creature is the vendor to tie the script to.
                break;
            case 2: // Nevermind
                player->CLOSE_GOSSIP_MENU();
                break;
        }
    }
};
 
Status
Not open for further replies.
Top