mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/Commands: Allow "$home" to be second parameter of .tele name, to teleport players to homebind
Signed-off-by: Machiavelli <machiavelli.trinity@gmail.com>
This commit is contained in:
1
sql/updates/world/2011_11_20_world_command.sql
Normal file
1
sql/updates/world/2011_11_20_world_command.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE `commands` SET `help`='Syntax: .tele name [#playername] #location\n\nTeleport the given character to a given location. Character can be offline.\n\nTo teleport to homebind, set #location to "$home" (without quotes).' WHERE `name` = 'tele name`;
|
||||
@@ -125,6 +125,29 @@ public:
|
||||
if (!handler->extractPlayerTarget(nameStr, &target, &target_guid, &target_name))
|
||||
return false;
|
||||
|
||||
if (strcmp(teleStr, "$home") == 0) // References target's homebind
|
||||
{
|
||||
if (target)
|
||||
target->TeleportTo(target->m_homebindMapId, target->m_homebindX, target->m_homebindY, target->m_homebindZ, target->GetOrientation());
|
||||
else
|
||||
{
|
||||
QueryResult resultDB = CharacterDatabase.PQuery("SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = %u", target_guid);
|
||||
if (resultDB)
|
||||
{
|
||||
Field* fieldsDB = resultDB->Fetch();
|
||||
uint32 mapId = fieldsDB[0].GetUInt32();
|
||||
uint32 zoneId = fieldsDB[1].GetUInt32();
|
||||
float posX = fieldsDB[2].GetFloat();
|
||||
float posY = fieldsDB[3].GetFloat();
|
||||
float posZ = fieldsDB[4].GetFloat();
|
||||
|
||||
Player::SavePositionInDB(mapId, posX, posY, posZ, 0, zoneId, target_guid);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = handler->extractGameTeleFromLink(teleStr);
|
||||
if (!tele)
|
||||
|
||||
Reference in New Issue
Block a user