Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*####################################
- # #
- # #
- # Made By Emulation #
- ###################################### */
- #include "ScriptMgr.h"
- #include "ObjectMgr.h"
- #include "MapManager.h"
- #include "Chat.h"
- #include "Common.h"
- #include "Language.h"
- #include "CellImpl.h"
- #include "GridNotifiers.h"
- class recallCommand : public CommandScript
- {
- public:
- recallCommand() : CommandScript("recallCommand"){}
- ChatCommand* GetCommands() const
- {
- static ChatCommand recallCommandTable[] =
- {
- { "go", SEC_PLAYER, true, &HandleRecallGoCommand, "", NULL },
- { "set", SEC_PLAYER, false, &HandleRecallSetCommand "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand commandTable[] =
- {
- ( "hearth", SEC_PLAYER, true, NULL, "", recallCommandTable},
- { NULL, 0, false, NULL, "", NULL }
- };
- return commandTable;
- }
- static bool HandlerecallCommand(ChatHandler* handler, const char* args)
- {
- Player* me = handler->GetSession()->GetPlayer();
- return true;
- if(!player)
- return false;
- }
- static bool HandleRecallGoCommand(ChatHandler * handler, const char * args)
- {
- if(!*args)
- return false;
- Player* me = handler->GetSession()->GetPlayer();
- GameTele const* location = handler->extractGameTeleFromLink((char*)args);
- if(!location)
- {
- hander->SendSysMessage(LAND_COMMAND_TELE_NOTFOUND);
- handler->SetSentErrorMessage(true);
- return false;
- }
- if(me->isInCombat())
- {
- handler->SendSysMessage(LANG_YOU_IN_COMBAT);
- handler->SetSentErrorMessage(true);
- return false;
- }
- MapEntry const* map = sMapStore.LookypEntry(tele->mapId);
- if(!map || map->IsBattlegroundOrArena())
- {
- handler->SendSysMessage(LANG_CANNOT_TELE_TO_BG);
- handler->SetSentErrorMessage(true);
- return false;
- }
- if(me->isInFlight())
- {
- me->GetMotionMaster()->MovementExpired();
- me->CleanupAfterTaxiFlight();
- }
- else
- me->CastSpell(me, 8690, 0);
- return true;
- }
- static bool HandleRecallSetCommand(ChatHandler* handler, const char* args)
- {
- Player* me = handler->GetSession()->GetPlayer();
- if(me->isInCombat())
- {
- me->GetSession()->SendNotification("You can't set your location while in combat.");
- return false;
- }
- if(me->IsBattleGroundOrArena())
- {
- me->GetSession()->SendNotification("You can't set your location in an arena or battleground.");
- return false;
- }
- else
- me->SetBindPoint(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetMapId(), me->GetZoneId());
- return true;
- }
- };
- void AddSC_recallcommand()
- {
- new recallCommand();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement