Advertisement
Rochet2

GossipChange

May 11th, 2017
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.85 KB | None | 0 0
  1. #include "ScriptMgr.h"
  2. #include "Player.h"
  3. #include "Creature.h"
  4. #include "ScriptedCreature.h"
  5.  
  6. class TestGossip : public CreatureScript
  7. {
  8. public:
  9.     TestGossip() : CreatureScript("TestGossip") { }
  10.  
  11.     static bool OnGossipHello(Player* player, Creature* creature)
  12.     {
  13.         // code
  14.         return true;
  15.     }
  16.  
  17.     static bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
  18.     {
  19.         player->PlayerTalkClass->ClearMenus();
  20.         // code
  21.         return true;
  22.     }
  23.  
  24.     static bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code)
  25.     {
  26.         player->PlayerTalkClass->ClearMenus();
  27.         // code
  28.         return true;
  29.     }
  30.  
  31.     struct MyAI : public ScriptedAI
  32.     {
  33.         MyAI(Creature* creature) : ScriptedAI(creature) { }
  34.         bool GossipHello(Player* player) override
  35.         {
  36.             return OnGossipHello(player, me);
  37.         }
  38.         bool GossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
  39.         {
  40.             uint32 sender = player->PlayerTalkClass->GetGossipOptionSender(gossipListId);
  41.             uint32 action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
  42.             return OnGossipSelect(player, me, sender, action);
  43.         }
  44.         bool GossipSelectCode(Player* player, uint32 menuId, uint32 gossipListId, char const* code) override
  45.         {
  46.             uint32 sender = player->PlayerTalkClass->GetGossipOptionSender(gossipListId);
  47.             uint32 action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
  48.             return OnGossipSelectCode(player, me, sender, action, code);
  49.         }
  50.     };
  51.  
  52.     CreatureAI* GetAI(Creature* creature) const override
  53.     {
  54.         return new MyAI(creature);
  55.     }
  56. };
  57.  
  58. void AddSC_TestGossip()
  59. {
  60.     new TestGossip;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement