mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[7332] Allow provided target for .distance command using player name or shift-link with guid.
This commit is contained in:
parent
654fa0bb1d
commit
fa26c1f8d7
5 changed files with 36 additions and 10 deletions
|
|
@ -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).'),
|
||||
|
|
|
|||
6
sql/updates/7332_01_mangos_command.sql
Normal file
6
sql/updates/7332_01_mangos_command.sql
Normal file
|
|
@ -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.');
|
||||
|
|
@ -186,6 +186,7 @@ pkgdata_DATA = \
|
|||
7324_01_characters_character_spell.sql \
|
||||
7324_02_characters_character_aura.sql \
|
||||
7331_01_mangos_command.sql \
|
||||
7332_01_mangos_command.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -352,4 +353,5 @@ EXTRA_DIST = \
|
|||
7324_01_characters_character_spell.sql \
|
||||
7324_02_characters_character_aura.sql \
|
||||
7331_01_mangos_command.sql \
|
||||
7332_01_mangos_command.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -3218,18 +3218,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)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
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__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue