Advertisement
EmuDevs

EmuDevs - GameObjectScript GameObject Gossip Template

Aug 19th, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.30 KB | None | 0 0
  1. /*
  2.     EmuDevs ~ emudevs.com
  3. */
  4. class go_tut : public GameObjectScript // go_tut - Class constructor, name this anything that doesn't conflict with another name
  5. {
  6. public:
  7.     go_tut() : GameObjectScript("go_tut") { } // go_tut, should be the same as class go_tut -- GameObjectScript("go_tut") - This is your 'ScriptName' that you will assign in your database.
  8.  
  9.     bool OnGossipHello(Player* player, GameObject* go) OVERRIDE // This will show first when a player clicks on a GameObject (Gossip)
  10.     {
  11.         player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "First Menu", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); // 1. Once the player clicks this menu,
  12.         player->SEND_GOSSIP_MENU(1, go->GetGUID()); // This sends the menu to the player
  13.         return true;
  14.     }
  15.  
  16.     bool OnGossipSelect(Player* player, GameObject* go, uint32 /*sender*/, uint32 actions) OVERRIDE
  17.     {
  18.         if (actions == GOSSIP_ACTION_INFO_DEF+1) // 2. the menu will be sent here to finish the action
  19.         {
  20.             player->GetSession()->SendAreaTriggerMessage("GOSSIP_ACTION_INFO_DEF+1");
  21.             player->CLOSE_GOSSIP_MENU();
  22.         }
  23.         return true;
  24.     }
  25. };
  26.  
  27. void AddSC_tutorial() // This is your ScriptLoader.cpp setup function
  28. {
  29.     new go_tut(); // Call any new classes here as 'new classname();'
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement