[7332] Allow provided target for .distance command using player name or shift-link with guid. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
+2
-2
@@ -22,7 +22,7 @@
|
||||
DROP TABLE IF EXISTS `db_version`;
|
||||
CREATE TABLE `db_version` (
|
||||
`version` varchar(120) default NULL,
|
||||
`required_7331_01_mangos_command` bit(1) default NULL
|
||||
`required_7332_01_mangos_command` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
@@ -275,7 +275,7 @@ INSERT INTO `command` VALUES
|
||||
('demorph',2,'Syntax: .demorph\r\n\r\nDemorph the selected player.'),
|
||||
('die',3,'Syntax: .die\r\n\r\nKill the selected player. If no player is selected, it will kill you.'),
|
||||
('dismount',0,'Syntax: .dismount\r\n\r\nDismount you, if you are mounted.'),
|
||||
('distance',3,'Syntax: .distance\r\n\r\nDisplay the distance from your character to the selected creature.'),
|
||||
('distance',3,'Syntax: .distance [$name/$link]\r\n\r\nDisplay the distance from your character to the selected creature/player, or player with name $name, or player/creature/gameobject pointed to shift-link with guid.'),
|
||||
('event',2,'Syntax: .event #event_id\r\nShow details about event with #event_id.'),
|
||||
('event activelist',2,'Syntax: .event activelist\r\nShow list of currently active events.'),
|
||||
('event start',2,'Syntax: .event start #event_id\r\nStart event #event_id. Set start time for event to current moment (change not saved in DB).'),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
ALTER TABLE db_version CHANGE COLUMN required_7331_01_mangos_command required_7332_01_mangos_command bit;
|
||||
|
||||
DELETE FROM `command` WHERE `name` = 'distance';
|
||||
|
||||
INSERT INTO `command` VALUES
|
||||
('distance',3,'Syntax: .distance [$name/$link]\r\n\r\nDisplay the distance from your character to the selected creature/player, or player with name $name, or player/creature/gameobject pointed to shift-link with guid.');
|
||||
+22
-4
@@ -3672,18 +3672,36 @@ bool ChatHandler::HandleGuildDeleteCommand(const char* args)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGetDistanceCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleGetDistanceCommand(const char* args)
|
||||
{
|
||||
Unit* pUnit = getSelectedUnit();
|
||||
WorldObject* obj;
|
||||
|
||||
if(!pUnit)
|
||||
if (*args)
|
||||
{
|
||||
uint64 guid = extractGuidFromLink((char*)args);
|
||||
if(guid)
|
||||
obj = (WorldObject*)ObjectAccessor::GetObjectByTypeMask(*m_session->GetPlayer(),guid,TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
|
||||
|
||||
if(!obj)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = getSelectedUnit();
|
||||
|
||||
if(!obj)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_DISTANCE, m_session->GetPlayer()->GetDistance(pUnit),m_session->GetPlayer()->GetDistance2d(pUnit));
|
||||
PSendSysMessage(LANG_DISTANCE, m_session->GetPlayer()->GetDistance(obj),m_session->GetPlayer()->GetDistance2d(obj));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7331"
|
||||
#define REVISION_NR "7332"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
||||
Reference in New Issue
Block a user