Advertisement
randy336

[Trinity] Clear Combat Bug - Gossip NPC

Aug 5th, 2013
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.02 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3. - Developer(s): Ghostcrawler336
  4. - Complete: %100
  5. - ScriptName: 'Clear In Combat'
  6. - Comment: N/A
  7. <--------------------------------------------------------------------------->
  8.     */
  9.     #include "ScriptPCH.h"
  10.      
  11.     class clear_combat : public CreatureScript
  12.     {
  13.             public:
  14.                     clear_combat() : CreatureScript("clear_combat")
  15.                     {
  16.                     }
  17.      
  18.                     bool OnGossipHello(Player * pPlayer, Creature * pCreature)
  19.                     {
  20.                             pPlayer->ADD_GOSSIP_ITEM(4, "Clear My Combat", GOSSIP_SENDER_MAIN, 0);
  21.                             pPlayer->ADD_GOSSIP_ITEM(0, "Nevermind...", GOSSIP_SENDER_MAIN, 3);
  22.                             pPlayer->PlayerTalkClass->SendGossipMenu(9425, pCreature->GetGUID());
  23.                             return true;
  24.                     }
  25.      
  26.                     bool OnGossipSelect(Player * Player, Creature * Creature, uint32 /*uiSender*/, uint32 uiAction)
  27.                     {
  28.                             if(!Player)
  29.                                     return true;
  30.                            
  31.                             switch(uiAction)
  32.                             {
  33.                             case 0: if(!Player->duel) // Checks if a player is in a duel or not.
  34.                                             {
  35.                                                   Player->ClearInCombat();
  36.                                                   ChatHandler(Player->GetSession()).SendSysMessage("Your combat is cleared!");
  37.                                             }
  38.                                     else
  39.                                     {
  40.                                         ChatHandler(Player->GetSession()).SendSysMessage("You're in a duel! You can not use this!!");
  41.                                         Player->PlayerTalkClass->SendCloseGossip();
  42.                                     };
  43.                             }
  44.                             return true;
  45.                     }
  46.      
  47. };
  48.      
  49. void AddSC_clear_combat()
  50. {
  51.             new clear_combat();
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement