Advertisement
EmuDevs

EmuDevs - Gossip (CreatureScript) Template

May 31st, 2013
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.56 KB | None | 0 0
  1. /*
  2.  *╔═╦═╦═╦╦╦══╦═╦╗─╔╦══╗
  3.  *║╦╣║║║║║╠╗╗║╦╣╚╦╝║══╣
  4.  *║╩╣║║║║║╠╩╝║╩╬╗║╔╬══║
  5.  *╚═╩╩═╩╩═╩══╩═╝╚═╝╚══╝
  6.  *       EmuDevs - (http://emudevs.com)
  7. */
  8.  
  9. class npc_tut : public CreatureScript // npc_tut - Class constructor, name this anything that doesn't conflict with another name
  10. {
  11. public:
  12.     npc_tut() : CreatureScript("npc_tut") { } // npc_tut, should be the same as class npc_tut -- CreatureScript("npc_tut") - This is your 'ScriptName' that you will assign in your database.
  13.  
  14.     bool OnGossipHello(Player* player, Creature* creature) // This will show first when a player clicks on a gossip npc
  15.     {
  16.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "First Menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); // 1. Once the player clicks this menu,
  17.         player->SEND_GOSSIP_MENU(1, creature->GetGUID()); // This sends the menu to the player
  18.         return true;
  19.     }
  20.  
  21.     bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions)
  22.     {
  23.         if (actions == GOSSIP_ACTION_INFO_DEF+1) // 2. the menu will be sent here to finish the action
  24.         {
  25.             player->GetSession()->SendAreaTriggerMessage("GOSSIP_ACTION_INFO_DEF+1");
  26.             player->CLOSE_GOSSIP_MENU();
  27.         }
  28.         return true;
  29.     }
  30. };
  31.  
  32. void AddSC_tutorial() // This is your ScriptLoader.cpp setup function
  33. {
  34.     new npc_tut(); // Call any new classes here as 'new classname();'
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement