Advertisement
carcar21

Untitled

Jul 31st, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. /*####################################
  2. # #
  3. # #
  4. # Made By Emulation #
  5. ###################################### */
  6.  
  7. #include "ScriptMgr.h"
  8. #include "ObjectMgr.h"
  9. #include "MapManager.h"
  10. #include "Chat.h"
  11. #include "Common.h"
  12. #include "Language.h"
  13. #include "CellImpl.h"
  14. #include "GridNotifiers.h"
  15.  
  16. class recallCommand : public CommandScript
  17. {
  18. public:
  19. recallCommand() : CommandScript("recallCommand"){}
  20.  
  21. ChatCommand* GetCommands() const
  22. {
  23. static ChatCommand recallCommandTable[] =
  24. {
  25. { "go", SEC_PLAYER, true, &HandleRecallGoCommand, "", NULL },
  26. { "set", SEC_PLAYER, false, &HandleRecallSetCommand, "", NULL },
  27. { NULL, 0, false, NULL, "", NULL }
  28. };
  29.  
  30. static ChatCommand commandTable[] =
  31. {
  32. { "hearth", SEC_PLAYER, true, NULL, "", recallCommandTable },
  33. { NULL, 0, false, NULL, "", NULL }
  34. };
  35.  
  36. return commandTable;
  37. }
  38.  
  39. static bool HandleRecallGoCommand(ChatHandler * handler, const char * args)
  40. {
  41. if(!*args)
  42. return false;
  43.  
  44. Player* me = handler->GetSession()->GetPlayer();
  45. GameTele const* location = handler->extractGameTeleFromLink((char*)args);
  46.  
  47. if(!location)
  48. {
  49. hander->SendSysMessage(LAND_COMMAND_TELE_NOTFOUND);
  50. handler->SetSentErrorMessage(true);
  51. return false;
  52. }
  53. if(me->IsInCombat())
  54. {
  55. handler->SendSysMessage(LANG_YOU_IN_COMBAT);
  56. handler->SetSentErrorMessage(true);
  57. return false;
  58. }
  59. MapEntry const* map = sMapStore.LookypEntry(tele->mapId);
  60. if(!map || map->IsBattlegroundOrArena())
  61. {
  62. handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
  63. handler->SetSentErrorMessage(true);
  64. return false;
  65. }
  66.  
  67. if(me->IsInFlight())
  68. {
  69. me->GetMotionMaster()->MovementExpired();
  70. me->CleanupAfterTaxiFlight();
  71. }
  72. else
  73. me->CastSpell(me, 8690, 0);
  74.  
  75. return true;
  76. }
  77.  
  78.  
  79. static bool HandleRecallSetCommand(ChatHandler* handler, const char* args)
  80. {
  81. Player* me = handler->GetSession()->GetPlayer();
  82.  
  83. if(me->IsInCombat())
  84. {
  85. me->GetSession()->SendNotification("You can't set your location while in combat.");
  86. return false;
  87. }
  88. if(me->IsBattleGroundOrArena())
  89. {
  90. me->GetSession()->SendNotification("You can't set your location in an arena or battleground.");
  91. return false;
  92. }
  93. else
  94. me->SetBindPoint(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetMapId(), me->GetZoneId());
  95.  
  96. return true;
  97. }
  98. };
  99.  
  100. void AddSC_recallcommand()
  101. {
  102. new recallCommand();
  103. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement