[10106] More modes for .go commands

* Now '.go' command can be used with creature_entry/gameobject_entry shift links (output of .lookup creature/object commands)
* Now '.go object' command sipport id-mode and name part mode similar .go creature case: .go object id #gameobject_id or .go object $namepart.
* HandleGoHelper use in more commands also.
This commit is contained in:
VladimirMangos 2010-06-26 14:57:36 +04:00
parent e203a235ba
commit a504b4d200
13 changed files with 439 additions and 235 deletions

View file

@ -599,17 +599,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
if (!Player::LoadPositionFromDB(map,x,y,z,o,in_flight,target_guid))
return false;
// stop flight if need
if (_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->m_taxi.ClearTaxiDestinations();
}
// save only in non-flight case
else
_player->SaveRecallPosition();
_player->TeleportTo(map, x, y, z,_player->GetOrientation());
return HandleGoHelper(_player, map, x, y, &z);
}
return true;
@ -633,15 +623,7 @@ bool ChatHandler::HandleRecallCommand(const char* args)
return false;
}
// stop flight if need
if(target->isInFlight())
{
target->GetMotionMaster()->MovementExpired();
target->m_taxi.ClearTaxiDestinations();
}
target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
return true;
return HandleGoHelper(target, target->m_recallMap, target->m_recallX, target->m_recallY, &target->m_recallZ, &target->m_recallO);
}
//Edit Player HP
@ -1780,18 +1762,7 @@ bool ChatHandler::HandleTeleCommand(const char * args)
return false;
}
// stop flight if need
if(_player->isInFlight())
{
_player->GetMotionMaster()->MovementExpired();
_player->m_taxi.ClearTaxiDestinations();
}
// save only in non-flight case
else
_player->SaveRecallPosition();
_player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
return true;
return HandleGoHelper(_player, tele->mapId, tele->position_x, tele->position_y, &tele->position_z, &tele->orientation);
}
bool ChatHandler::HandleLookupAreaCommand(const char* args)
@ -2030,17 +2001,7 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
if (needReportToTarget(target))
ChatHandler(target).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetNameLink().c_str());
// stop flight if need
if(target->isInFlight())
{
target->GetMotionMaster()->MovementExpired();
target->m_taxi.ClearTaxiDestinations();
}
// save only in non-flight case
else
target->SaveRecallPosition();
target->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation);
return HandleGoHelper(target, tele->mapId, tele->position_x, tele->position_y, &tele->position_z, &tele->orientation);
}
else
{
@ -2226,16 +2187,20 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
return true;
}
bool ChatHandler::HandleGoHelper( Player* player, uint32 mapid, float x, float y, float const* zPtr )
bool ChatHandler::HandleGoHelper( Player* player, uint32 mapid, float x, float y, float const* zPtr, float const* ortPtr)
{
float z;
float ort = player->GetOrientation();
if (zPtr)
{
z = *zPtr;
if (ortPtr)
ort = *ortPtr;
// check full provided coordinates
if(!MapManager::IsValidMapCoord(mapid,x,y,z))
if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
{
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
SetSentErrorMessage(true);
@ -2266,7 +2231,7 @@ bool ChatHandler::HandleGoHelper( Player* player, uint32 mapid, float x, float y
else
player->SaveRecallPosition();
player->TeleportTo(mapid, x, y, z, player->GetOrientation());
player->TeleportTo(mapid, x, y, z, ort);
return true;
}