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;
}
}
};