mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7839] Rafactoring player targeting code in chat command and related cleanups/improvments.
* New extractOptFirstArg function for easy get 2 args in case option playe name as first arg. * New extractPlayerTarget function for get player pointer/guid/name for online/offline player base at provided name or if not provided by current seelction with error cases processing. * Property apply mute/unmute in case use different character name from loggined currently for account. * .reset commands can be used from console now * .repairitems comamnd can be used from console now but only to online player.
This commit is contained in:
parent
122c9c5785
commit
1f2670facf
13 changed files with 558 additions and 1128 deletions
|
|
@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
|
||||||
CREATE TABLE `db_version` (
|
CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`creature_ai_version` varchar(120) default NULL,
|
`creature_ai_version` varchar(120) default NULL,
|
||||||
`required_7830_01_mangos_spell_chain` bit(1) default NULL
|
`required_7839_02_mangos_command` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
@ -271,9 +271,9 @@ INSERT INTO `command` VALUES
|
||||||
('ban account',3,'Syntax: .ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
('ban account',3,'Syntax: .ban account $Name $bantime $reason\r\nBan account kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
||||||
('ban character',3,'Syntax: .ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
('ban character',3,'Syntax: .ban character $Name $bantime $reason\r\nBan account and kick player.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
||||||
('ban ip',3,'Syntax: .ban ip $Ip $bantime $reason\r\nBan IP.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
('ban ip',3,'Syntax: .ban ip $Ip $bantime $reason\r\nBan IP.\r\n$bantime: negative value leads to permban, otherwise use a timestring like \"4d20h3s\".'),
|
||||||
('baninfo account',3,'Syntax: .baninfo account\r\nWatch full information about a specific ban.'),
|
('baninfo account',3,'Syntax: .baninfo account $accountid\r\nWatch full information about a specific ban.'),
|
||||||
('baninfo character',3,'Syntax: .baninfo character\r\nWatch full information about a specific ban.'),
|
('baninfo character',3,'Syntax: .baninfo character $charactername \r\nWatch full information about a specific ban.'),
|
||||||
('baninfo ip',3,'Syntax: .baninfo ip\r\nWatch full information about a specific ban.'),
|
('baninfo ip',3,'Syntax: .baninfo ip $ip\r\nWatch full information about a specific ban.'),
|
||||||
('bank',3,'Syntax: .bank\r\n\r\nShow your bank inventory.'),
|
('bank',3,'Syntax: .bank\r\n\r\nShow your bank inventory.'),
|
||||||
('banlist account',3,'Syntax: .banlist account [$Name]\r\nSearches the banlist for a account name pattern or show full list account bans.'),
|
('banlist account',3,'Syntax: .banlist account [$Name]\r\nSearches the banlist for a account name pattern or show full list account bans.'),
|
||||||
('banlist character',3,'Syntax: .banlist character $Name\r\nSearches the banlist for a character name pattern. Pattern required.'),
|
('banlist character',3,'Syntax: .banlist character $Name\r\nSearches the banlist for a character name pattern. Pattern required.'),
|
||||||
|
|
@ -335,15 +335,15 @@ INSERT INTO `command` VALUES
|
||||||
('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'),
|
('gobject setphase',2,'Syntax: .gobject setphase #guid #phasemask\r\n\r\nGameobject with DB guid #guid phasemask changed to #phasemask with related world vision update for players. Gameobject state saved to DB and persistent.'),
|
||||||
('gobject turn',2,'Syntax: .gobject turn #goguid \r\n\r\nSet for gameobject #goguid orientation same as current character orientation.'),
|
('gobject turn',2,'Syntax: .gobject turn #goguid \r\n\r\nSet for gameobject #goguid orientation same as current character orientation.'),
|
||||||
('gobject target',2,'Syntax: .gobject target [#go_id|#go_name_part]\r\n\r\nLocate and show position nearest gameobject. If #go_id or #go_name_part provide then locate and show position of nearest gameobject with gameobject template id #go_id or name included #go_name_part as part.'),
|
('gobject target',2,'Syntax: .gobject target [#go_id|#go_name_part]\r\n\r\nLocate and show position nearest gameobject. If #go_id or #go_name_part provide then locate and show position of nearest gameobject with gameobject template id #go_id or name included #go_name_part as part.'),
|
||||||
('goname',1,'Syntax: .goname $charactername\r\n\r\nTeleport to the given character. Either specify the character name or click on the character\'s portrait, e.g. when you are in a group.'),
|
('goname',1,'Syntax: .goname [$charactername]\r\n\r\nTeleport to the given character. Either specify the character name or click on the character\'s portrait, e.g. when you are in a group. Character can be offline.'),
|
||||||
('gps',1,'Syntax: .gps [$name|$shift-link]\r\n\r\nDisplay the position information for a selected character or creature (also if player name $name provided then for named player, or if creature/gameobject shift-link provided then pointed creature/gameobject if it loaded). Position information includes X, Y, Z, and orientation, map Id and zone Id'),
|
('gps',1,'Syntax: .gps [$name|$shift-link]\r\n\r\nDisplay the position information for a selected character or creature (also if player name $name provided then for named player, or if creature/gameobject shift-link provided then pointed creature/gameobject if it loaded). Position information includes X, Y, Z, and orientation, map Id and zone Id'),
|
||||||
('groupgo',1,'Syntax: .groupgo $charactername\r\n\r\nTeleport the given character and his group to you.'),
|
('groupgo',1,'Syntax: .groupgo [$charactername]\r\n\r\nTeleport the given character and his group to you. Teleported only online characters but original selected group member can be offline.'),
|
||||||
('guid',2,'Syntax: .guid\r\n\r\nDisplay the GUID for the selected character.'),
|
('guid',2,'Syntax: .guid\r\n\r\nDisplay the GUID for the selected character.'),
|
||||||
('guild create',2,'Syntax: .guild create $GuildLeaderName $GuildName\r\n\r\nCreate a guild named $GuildName with the player $GuildLeaderName as leader.'),
|
('guild create',2,'Syntax: .guild create [$GuildLeaderName] $GuildName\r\n\r\nCreate a guild named $GuildName with the player $GuildLeaderName (or selected) as leader.'),
|
||||||
('guild delete',2,'Syntax: .guild delete $GuildName\r\n\r\nDelete guild $GuildName.'),
|
('guild delete',2,'Syntax: .guild delete $GuildName\r\n\r\nDelete guild $GuildName.'),
|
||||||
('guild invite',2,'Syntax: .guild invite $CharacterName $GuildName\r\n\r\nAdd $CharacterName into a guild $GuildName.'),
|
('guild invite',2,'Syntax: .guild invite [$CharacterName] $GuildName\r\n\r\nAdd player $CharacterName (or selected) into a guild $GuildName.'),
|
||||||
('guild rank',2,'Syntax: .guild rank $CharacterName #Rank\r\n\r\nSet for $CharacterName rank #Rank in a guild.'),
|
('guild rank',2,'Syntax: .guild rank $CharacterName #Rank\r\n\r\nSet for $CharacterName rank #Rank in a guild.'),
|
||||||
('guild uninvite',2,'Syntax: .guild uninvite $CharacterName\r\n\r\nRemove $CharacterName from a guild.'),
|
('guild uninvite',2,'Syntax: .guild uninvite [$CharacterName]\r\n\r\nRemove player $CharacterName (or selected) from a guild.'),
|
||||||
('help',0,'Syntax: .help [$command]\r\n\r\nDisplay usage instructions for the given $command. If no $command provided show list available commands.'),
|
('help',0,'Syntax: .help [$command]\r\n\r\nDisplay usage instructions for the given $command. If no $command provided show list available commands.'),
|
||||||
('hidearea',3,'Syntax: .hidearea #areaid\r\n\r\nHide the area of #areaid to the selected character. If no character is selected, hide this area to you.'),
|
('hidearea',3,'Syntax: .hidearea #areaid\r\n\r\nHide the area of #areaid to the selected character. If no character is selected, hide this area to you.'),
|
||||||
('honor add',2,'Syntax: .honor add $amount\r\n\r\nAdd a certain amount of honor (gained today) to the selected player.'),
|
('honor add',2,'Syntax: .honor add $amount\r\n\r\nAdd a certain amount of honor (gained today) to the selected player.'),
|
||||||
|
|
@ -414,8 +414,8 @@ INSERT INTO `command` VALUES
|
||||||
('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'),
|
('modify swim',1,'Syntax: .modify swim #rate\r\n\r\nModify the swim speed of the selected player to \"normal swim speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'),
|
||||||
('modify titles',1,'Syntax: .modify titles #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'),
|
('modify titles',1,'Syntax: .modify titles #mask\r\n\r\nAllows user to use all titles from #mask.\r\n\r\n #mask=0 disables the title-choose-field'),
|
||||||
('movegens',3,'Syntax: .movegens\r\n Show movement generators stack for selected creature or player.'),
|
('movegens',3,'Syntax: .movegens\r\n Show movement generators stack for selected creature or player.'),
|
||||||
('mute',1,'Syntax: .mute $playerName $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName at $timeInMinutes minutes.'),
|
('mute',1,'Syntax: .mute [$playerName] $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'),
|
||||||
('namego',1,'Syntax: .namego $charactername\r\n\r\nTeleport the given character to you.'),
|
('namego',1,'Syntax: .namego [$charactername]\r\n\r\nTeleport the given character to you. Character can be offline.'),
|
||||||
('neargrave',3,'Syntax: .neargrave [alliance|horde]\r\n\r\nFind nearest graveyard linked to zone (or only nearest from accepts alliance or horde faction ghosts).'),
|
('neargrave',3,'Syntax: .neargrave [alliance|horde]\r\n\r\nFind nearest graveyard linked to zone (or only nearest from accepts alliance or horde faction ghosts).'),
|
||||||
('notify',1,'Syntax: .notify $MessageToBroadcast\r\n\r\nSend a global message to all players online in screen.'),
|
('notify',1,'Syntax: .notify $MessageToBroadcast\r\n\r\nSend a global message to all players online in screen.'),
|
||||||
('npc add',2,'Syntax: .npc add #creatureid\r\n\r\nSpawn a creature by the given template id of #creatureid.'),
|
('npc add',2,'Syntax: .npc add #creatureid\r\n\r\nSpawn a creature by the given template id of #creatureid.'),
|
||||||
|
|
@ -497,7 +497,7 @@ INSERT INTO `command` VALUES
|
||||||
('tele add',3,'Syntax: .tele add $name\r\n\r\nAdd current your position to .tele command target locations list with name $name.'),
|
('tele add',3,'Syntax: .tele add $name\r\n\r\nAdd current your position to .tele command target locations list with name $name.'),
|
||||||
('tele del',3,'Syntax: .tele del $name\r\n\r\nRemove location with name $name for .tele command locations list.'),
|
('tele del',3,'Syntax: .tele del $name\r\n\r\nRemove location with name $name for .tele command locations list.'),
|
||||||
('tele group',1,'Syntax: .tele group#location\r\n\r\nTeleport a selected player and his group members to a given location.'),
|
('tele group',1,'Syntax: .tele group#location\r\n\r\nTeleport a selected player and his group members to a given location.'),
|
||||||
('tele name',1,'Syntax: .tele name #playername #location\r\n\r\nTeleport a player to a given location.'),
|
('tele name',1,'Syntax: .tele name [#playername] #location\r\n\r\nTeleport the given character to a given location. Character can be offline.'),
|
||||||
('ticket',2,'Syntax: .ticket on\r\n .ticket off\r\n .ticket #num\r\n .ticket $character_name\r\n\r\non/off for GMs to show or not a new ticket directly, $character_name to show ticket of this character, #num to show ticket #num.'),
|
('ticket',2,'Syntax: .ticket on\r\n .ticket off\r\n .ticket #num\r\n .ticket $character_name\r\n\r\non/off for GMs to show or not a new ticket directly, $character_name to show ticket of this character, #num to show ticket #num.'),
|
||||||
('unaura',3,'Syntax: .unaura #spellid\r\n\r\nRemove aura due to spell #spellid from the selected Unit.'),
|
('unaura',3,'Syntax: .unaura #spellid\r\n\r\nRemove aura due to spell #spellid from the selected Unit.'),
|
||||||
('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'),
|
('unban account',3,'Syntax: .unban account $Name\r\nUnban accounts for account name pattern.'),
|
||||||
|
|
@ -2540,6 +2540,7 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(168,'Locations found are:\n %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(168,'Locations found are:\n %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(169,'Mail sent to %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(169,'Mail sent to %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(170,'You try to hear sound %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(170,'You try to hear sound %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
(171,'You can\'t teleport self to self!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(172,'server console command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(172,'server console command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(173,'You changed runic power of %s to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(173,'You changed runic power of %s to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(174,'%s changed your runic power to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(174,'%s changed your runic power to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
|
@ -2627,7 +2628,6 @@ INSERT INTO `mangos_string` VALUES
|
||||||
(280,'Vendor has too many items (max 128)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(280,'Vendor has too many items (max 128)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(281,'You can\'t kick self, logout instead',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(281,'You can\'t kick self, logout instead',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(282,'Player %s kicked.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(282,'Player %s kicked.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(283,'Player %s not found.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
|
||||||
(284,'Accepting Whisper: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(284,'Accepting Whisper: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(285,'Accepting Whisper: ON',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(285,'Accepting Whisper: ON',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
(286,'Accepting Whisper: OFF',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
(286,'Accepting Whisper: OFF',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||||
|
|
|
||||||
6
sql/updates/7839_01_mangos_mangos_string.sql
Normal file
6
sql/updates/7839_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_7830_01_mangos_spell_chain required_7839_01_mangos_mangos_string bit;
|
||||||
|
|
||||||
|
DELETE FROM mangos_string WHERE entry IN(171,283);
|
||||||
|
|
||||||
|
INSERT INTO mangos_string VALUES
|
||||||
|
(171,'You can\'t teleport self to self!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
22
sql/updates/7839_02_mangos_command.sql
Normal file
22
sql/updates/7839_02_mangos_command.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
ALTER TABLE db_version CHANGE COLUMN required_7839_01_mangos_mangos_string required_7839_02_mangos_command bit;
|
||||||
|
|
||||||
|
DELETE FROM `command` WHERE `name` IN (
|
||||||
|
'baninfo account','baninfo character','baninfo ip','goname','groupgo',
|
||||||
|
'guild create','guild invite','guild rank','guild uninvite','mute',
|
||||||
|
'namego','tele name','unmute'
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO `command` VALUES
|
||||||
|
('baninfo account',3,'Syntax: .baninfo account $accountid\r\nWatch full information about a specific ban.'),
|
||||||
|
('baninfo character',3,'Syntax: .baninfo character $charactername \r\nWatch full information about a specific ban.'),
|
||||||
|
('baninfo ip',3,'Syntax: .baninfo ip $ip\r\nWatch full information about a specific ban.'),
|
||||||
|
('goname',1,'Syntax: .goname [$charactername]\r\n\r\nTeleport to the given character. Either specify the character name or click on the character\'s portrait, e.g. when you are in a group. Character can be offline.'),
|
||||||
|
('groupgo',1,'Syntax: .groupgo [$charactername]\r\n\r\nTeleport the given character and his group to you. Teleported only online characters but original selected group member can be offline.'),
|
||||||
|
('guild create',2,'Syntax: .guild create [$GuildLeaderName] $GuildName\r\n\r\nCreate a guild named $GuildName with the player $GuildLeaderName (or selected) as leader.'),
|
||||||
|
('guild invite',2,'Syntax: .guild invite [$CharacterName] $GuildName\r\n\r\nAdd player $CharacterName (or selected) into a guild $GuildName.'),
|
||||||
|
('guild rank',2,'Syntax: .guild rank [$CharacterName] #Rank\r\n\r\nSet for player $CharacterName (or selected) rank #Rank in a guild.'),
|
||||||
|
('guild uninvite',2,'Syntax: .guild uninvite [$CharacterName]\r\n\r\nRemove player $CharacterName (or selected) from a guild.'),
|
||||||
|
('mute',1,'Syntax: .mute [$playerName] $timeInMinutes\r\n\r\nDisible chat messaging for any character from account of character $playerName (or currently selected) at $timeInMinutes minutes. Player can be offline.'),
|
||||||
|
('namego',1,'Syntax: .namego [$charactername]\r\n\r\nTeleport the given character to you. Character can be offline.'),
|
||||||
|
('tele name',1,'Syntax: .tele name [#playername] #location\r\n\r\nTeleport the given character to a given location. Character can be offline.'),
|
||||||
|
('unmute',1,'Syntax: .unmute [$playerName]\r\n\r\nRestore chat messaging for any character from account of character $playerName (or selected). Character can be ofline.');
|
||||||
|
|
@ -186,6 +186,8 @@ pkgdata_DATA = \
|
||||||
7802_02_characters_character_achievement_progress.sql \
|
7802_02_characters_character_achievement_progress.sql \
|
||||||
7823_01_mangos_item_template.sql \
|
7823_01_mangos_item_template.sql \
|
||||||
7830_01_mangos_spell_chain.sql \
|
7830_01_mangos_spell_chain.sql \
|
||||||
|
7839_01_mangos_mangos_string.sql \
|
||||||
|
7839_02_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
||||||
## Additional files to include when running 'make dist'
|
## Additional files to include when running 'make dist'
|
||||||
|
|
@ -352,4 +354,6 @@ EXTRA_DIST = \
|
||||||
7802_02_characters_character_achievement_progress.sql \
|
7802_02_characters_character_achievement_progress.sql \
|
||||||
7823_01_mangos_item_template.sql \
|
7823_01_mangos_item_template.sql \
|
||||||
7830_01_mangos_spell_chain.sql \
|
7830_01_mangos_spell_chain.sql \
|
||||||
|
7839_01_mangos_mangos_string.sql \
|
||||||
|
7839_02_mangos_command.sql \
|
||||||
README
|
README
|
||||||
|
|
|
||||||
|
|
@ -454,13 +454,13 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
|
|
||||||
static ChatCommand resetCommandTable[] =
|
static ChatCommand resetCommandTable[] =
|
||||||
{
|
{
|
||||||
{ "achievements", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetAchievementsCommand, "", NULL },
|
{ "achievements", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAchievementsCommand, "", NULL },
|
||||||
{ "honor", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetHonorCommand, "", NULL },
|
{ "honor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetHonorCommand, "", NULL },
|
||||||
{ "level", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetLevelCommand, "", NULL },
|
{ "level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetLevelCommand, "", NULL },
|
||||||
{ "spells", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetSpellsCommand, "", NULL },
|
{ "spells", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetSpellsCommand, "", NULL },
|
||||||
{ "stats", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetStatsCommand, "", NULL },
|
{ "stats", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetStatsCommand, "", NULL },
|
||||||
{ "talents", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetTalentsCommand, "", NULL },
|
{ "talents", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetTalentsCommand, "", NULL },
|
||||||
{ "all", SEC_ADMINISTRATOR, false, &ChatHandler::HandleResetAllCommand, "", NULL },
|
{ "all", SEC_ADMINISTRATOR, true, &ChatHandler::HandleResetAllCommand, "", NULL },
|
||||||
{ NULL, 0, false, NULL, "", NULL }
|
{ NULL, 0, false, NULL, "", NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -573,7 +573,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
|
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
|
||||||
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
|
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
|
||||||
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
|
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
|
||||||
{ "reset", SEC_ADMINISTRATOR, false, NULL, "", resetCommandTable },
|
{ "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable },
|
||||||
{ "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
|
{ "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
|
||||||
{ "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
|
{ "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
|
||||||
|
|
||||||
|
|
@ -633,7 +633,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
||||||
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL },
|
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL },
|
||||||
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
|
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
|
||||||
{ "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL },
|
{ "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL },
|
||||||
{ "repairitems", SEC_GAMEMASTER, false, &ChatHandler::HandleRepairitemsCommand, "", NULL },
|
{ "repairitems", SEC_GAMEMASTER, true, &ChatHandler::HandleRepairitemsCommand, "", NULL },
|
||||||
{ "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL },
|
{ "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL },
|
||||||
|
|
||||||
{ NULL, 0, false, NULL, "", NULL }
|
{ NULL, 0, false, NULL, "", NULL }
|
||||||
|
|
@ -1219,7 +1219,7 @@ char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** s
|
||||||
*something1 = strtok(NULL, ":|"); // extract something
|
*something1 = strtok(NULL, ":|"); // extract something
|
||||||
|
|
||||||
strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
|
strtok(cKeysTail, "]"); // restart scan tail and skip name with possible spaces
|
||||||
strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after retturn from function
|
strtok(NULL, " "); // skip link tail (to allow continue strtok(NULL,s) use after return from function
|
||||||
return cKey;
|
return cKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1497,6 +1497,77 @@ std::string ChatHandler::extractPlayerNameFromLink(char* text)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChatHandler::extractPlayerTarget(char* args, Player** player, uint64* player_guid /*=NULL*/,std::string* player_name /*= NULL*/)
|
||||||
|
{
|
||||||
|
if (args && *args)
|
||||||
|
{
|
||||||
|
std::string name = extractPlayerNameFromLink(args);
|
||||||
|
if (name.empty())
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player* pl = objmgr.GetPlayer(name.c_str());
|
||||||
|
|
||||||
|
// if allowed player pointer
|
||||||
|
if(player)
|
||||||
|
*player = pl;
|
||||||
|
|
||||||
|
// if need guid value from DB (in name case for check player existence)
|
||||||
|
uint64 guid = !pl && (player_guid || player_name) ? objmgr.GetPlayerGUIDByName(name) : 0;
|
||||||
|
|
||||||
|
// if allowed player guid (if no then only online players allowed)
|
||||||
|
if(player_guid)
|
||||||
|
*player_guid = pl ? pl->GetGUID() : guid;
|
||||||
|
|
||||||
|
if(player_name)
|
||||||
|
*player_name = pl || guid ? name : "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Player* pl = getSelectedPlayer();
|
||||||
|
// if allowed player pointer
|
||||||
|
if(player)
|
||||||
|
*player = pl;
|
||||||
|
// if allowed player guid (if no then only online players allowed)
|
||||||
|
if(player_guid)
|
||||||
|
*player_guid = pl ? pl->GetGUID() : 0;
|
||||||
|
|
||||||
|
if(player_name)
|
||||||
|
*player_name = pl ? pl->GetName() : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// some from req. data must be provided (note: name is empty if player not exist)
|
||||||
|
if((!player || !*player) && (!player_guid || !*player_guid) && (!player_name || player_name->empty()))
|
||||||
|
{
|
||||||
|
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChatHandler::extractOptFirstArg(char* args, char** arg1, char** arg2)
|
||||||
|
{
|
||||||
|
char* p1 = strtok(args, " ");
|
||||||
|
char* p2 = strtok(NULL, " ");
|
||||||
|
|
||||||
|
if(!p2)
|
||||||
|
{
|
||||||
|
p2 = p1;
|
||||||
|
p1 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(arg1)
|
||||||
|
*arg1 = p1;
|
||||||
|
|
||||||
|
if(arg2)
|
||||||
|
*arg2 = p2;
|
||||||
|
}
|
||||||
|
|
||||||
bool ChatHandler::needReportToTarget(Player* chr) const
|
bool ChatHandler::needReportToTarget(Player* chr) const
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* pl = m_session->GetPlayer();
|
||||||
|
|
|
||||||
|
|
@ -484,10 +484,15 @@ class ChatHandler
|
||||||
char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL);
|
char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL);
|
||||||
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL);
|
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL);
|
||||||
|
|
||||||
|
// if args have single value then it return in arg2 and arg1 == NULL
|
||||||
|
void extractOptFirstArg(char* args, char** arg1, char** arg2);
|
||||||
|
|
||||||
uint32 extractSpellIdFromLink(char* text);
|
uint32 extractSpellIdFromLink(char* text);
|
||||||
uint64 extractGuidFromLink(char* text);
|
uint64 extractGuidFromLink(char* text);
|
||||||
GameTele const* extractGameTeleFromLink(char* text);
|
GameTele const* extractGameTeleFromLink(char* text);
|
||||||
std::string extractPlayerNameFromLink(char* text);
|
std::string extractPlayerNameFromLink(char* text);
|
||||||
|
// select by arg (name/link) or in-game selection online/offline player
|
||||||
|
bool extractPlayerTarget(char* args, Player** player, uint64* player_guid = NULL, std::string* player_name = NULL);
|
||||||
|
|
||||||
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
|
std::string playerLink(std::string const& name) const { return m_session ? "|cffffffff|Hplayer:"+name+"|h["+name+"]|h|r" : name; }
|
||||||
virtual std::string GetNameLink() const { return GetNameLink(m_session->GetPlayer()); }
|
virtual std::string GetNameLink() const { return GetNameLink(m_session->GetPlayer()); }
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,6 @@ enum MangosStrings
|
||||||
LANG_CANNOT_GO_TO_INST_GM = 105,
|
LANG_CANNOT_GO_TO_INST_GM = 105,
|
||||||
LANG_CANNOT_GO_INST_INST = 106,
|
LANG_CANNOT_GO_INST_INST = 106,
|
||||||
LANG_CANNOT_SUMMON_INST_INST = 107,
|
LANG_CANNOT_SUMMON_INST_INST = 107,
|
||||||
|
|
||||||
LANG_SUMMONING = 108,
|
LANG_SUMMONING = 108,
|
||||||
LANG_SUMMONED_BY = 109,
|
LANG_SUMMONED_BY = 109,
|
||||||
LANG_TELEPORTING_TO = 110,
|
LANG_TELEPORTING_TO = 110,
|
||||||
|
|
@ -102,7 +101,6 @@ enum MangosStrings
|
||||||
LANG_NO_PLAYER = 112,
|
LANG_NO_PLAYER = 112,
|
||||||
LANG_APPEARING_AT = 113,
|
LANG_APPEARING_AT = 113,
|
||||||
LANG_APPEARING_TO = 114,
|
LANG_APPEARING_TO = 114,
|
||||||
|
|
||||||
LANG_BAD_VALUE = 115,
|
LANG_BAD_VALUE = 115,
|
||||||
LANG_NO_CHAR_SELECTED = 116,
|
LANG_NO_CHAR_SELECTED = 116,
|
||||||
LANG_NOT_IN_GROUP = 117,
|
LANG_NOT_IN_GROUP = 117,
|
||||||
|
|
@ -167,7 +165,7 @@ enum MangosStrings
|
||||||
|
|
||||||
LANG_MAIL_SENT = 169,
|
LANG_MAIL_SENT = 169,
|
||||||
LANG_SOUND_NOT_EXIST = 170,
|
LANG_SOUND_NOT_EXIST = 170,
|
||||||
// 171, // not used
|
LANG_CANT_TELEPORT_SELF = 171,
|
||||||
LANG_CONSOLE_COMMAND = 172,
|
LANG_CONSOLE_COMMAND = 172,
|
||||||
LANG_YOU_CHANGE_RUNIC_POWER = 173,
|
LANG_YOU_CHANGE_RUNIC_POWER = 173,
|
||||||
LANG_YOURS_RUNIC_POWER_CHANGED = 174,
|
LANG_YOURS_RUNIC_POWER_CHANGED = 174,
|
||||||
|
|
@ -266,7 +264,7 @@ enum MangosStrings
|
||||||
LANG_COMMAND_ADDVENDORITEMITEMS = 280,
|
LANG_COMMAND_ADDVENDORITEMITEMS = 280,
|
||||||
LANG_COMMAND_KICKSELF = 281,
|
LANG_COMMAND_KICKSELF = 281,
|
||||||
LANG_COMMAND_KICKMESSAGE = 282,
|
LANG_COMMAND_KICKMESSAGE = 282,
|
||||||
LANG_COMMAND_KICKNOTFOUNDPLAYER = 283,
|
// 283, not used
|
||||||
LANG_COMMAND_WHISPERACCEPTING = 284,
|
LANG_COMMAND_WHISPERACCEPTING = 284,
|
||||||
LANG_COMMAND_WHISPERON = 285,
|
LANG_COMMAND_WHISPERON = 285,
|
||||||
LANG_COMMAND_WHISPEROFF = 286,
|
LANG_COMMAND_WHISPEROFF = 286,
|
||||||
|
|
|
||||||
|
|
@ -343,26 +343,28 @@ bool ChatHandler::HandleGPSCommand(const char* args)
|
||||||
//Summon Player
|
//Summon Player
|
||||||
bool ChatHandler::HandleNamegoCommand(const char* args)
|
bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
Player* target;
|
||||||
|
uint64 target_guid;
|
||||||
|
std::string target_name;
|
||||||
|
if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
Player* _player = m_session->GetPlayer();
|
||||||
if(name.empty())
|
if (target == _player || target_guid == _player->GetGUID())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
PSendSysMessage(LANG_CANT_TELEPORT_SELF);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *chr = objmgr.GetPlayer(name.c_str());
|
if (target)
|
||||||
if (chr)
|
|
||||||
{
|
{
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(chr->IsBeingTeleported())
|
if (target->IsBeingTeleported())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
PSendSysMessage(LANG_IS_TELEPORTED, nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -371,32 +373,32 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
|
|
||||||
Map* pMap = m_session->GetPlayer()->GetMap();
|
Map* pMap = m_session->GetPlayer()->GetMap();
|
||||||
|
|
||||||
if(pMap->IsBattleGroundOrArena())
|
if (pMap->IsBattleGroundOrArena())
|
||||||
{
|
{
|
||||||
// only allow if gm mode is on
|
// only allow if gm mode is on
|
||||||
if (!chr->isGameMaster())
|
if (!target->isGameMaster())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_GO_TO_BG_GM,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if both players are in different bgs
|
// if both players are in different bgs
|
||||||
else if (chr->GetBattleGroundId() && m_session->GetPlayer()->GetBattleGroundId() != chr->GetBattleGroundId())
|
else if (target->GetBattleGroundId() && m_session->GetPlayer()->GetBattleGroundId() != target->GetBattleGroundId())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,chr->GetName());
|
PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,nameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// all's well, set bg id
|
// all's well, set bg id
|
||||||
// when porting out from the bg, it will be reset to 0
|
// when porting out from the bg, it will be reset to 0
|
||||||
chr->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId());
|
target->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId());
|
||||||
// remember current position as entry point for return at bg end teleportation
|
// remember current position as entry point for return at bg end teleportation
|
||||||
chr->SetBattleGroundEntryPoint(chr->GetMapId(),chr->GetPositionX(),chr->GetPositionY(),chr->GetPositionZ(),chr->GetOrientation());
|
target->SetBattleGroundEntryPoint(target->GetMapId(),target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),target->GetOrientation());
|
||||||
}
|
}
|
||||||
else if(pMap->IsDungeon())
|
else if (pMap->IsDungeon())
|
||||||
{
|
{
|
||||||
Map* cMap = chr->GetMap();
|
Map* cMap = target->GetMap();
|
||||||
if( cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId() )
|
if (cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId())
|
||||||
{
|
{
|
||||||
// cannot summon from instance to instance
|
// cannot summon from instance to instance
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
||||||
|
|
@ -405,9 +407,9 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// we are in instance, and can summon only player in our group with us as lead
|
// we are in instance, and can summon only player in our group with us as lead
|
||||||
if ( !m_session->GetPlayer()->GetGroup() || !chr->GetGroup() ||
|
if (!m_session->GetPlayer()->GetGroup() || !target->GetGroup() ||
|
||||||
(chr->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
|
(target->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) ||
|
||||||
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()) )
|
(m_session->GetPlayer()->GetGroup()->GetLeaderGUID() != m_session->GetPlayer()->GetGUID()))
|
||||||
// the last check is a bit excessive, but let it be, just in case
|
// the last check is a bit excessive, but let it be, just in case
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,nameLink.c_str());
|
||||||
|
|
@ -417,31 +419,31 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),"");
|
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),"");
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(target))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
ChatHandler(target).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(chr->isInFlight())
|
if (target->isInFlight())
|
||||||
{
|
{
|
||||||
chr->GetMotionMaster()->MovementExpired();
|
target->GetMotionMaster()->MovementExpired();
|
||||||
chr->m_taxi.ClearTaxiDestinations();
|
target->m_taxi.ClearTaxiDestinations();
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
chr->SaveRecallPosition();
|
target->SaveRecallPosition();
|
||||||
|
|
||||||
// before GM
|
// before GM
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
m_session->GetPlayer()->GetClosePoint(x,y,z,chr->GetObjectSize());
|
m_session->GetPlayer()->GetClosePoint(x,y,z,target->GetObjectSize());
|
||||||
chr->TeleportTo(m_session->GetPlayer()->GetMapId(),x,y,z,chr->GetOrientation());
|
target->TeleportTo(m_session->GetPlayer()->GetMapId(),x,y,z,target->GetOrientation());
|
||||||
}
|
}
|
||||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
else
|
||||||
{
|
{
|
||||||
// check offline security
|
// check offline security
|
||||||
if (HasLowerSecurity(NULL, guid))
|
if (HasLowerSecurity(NULL, target_guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),GetMangosString(LANG_OFFLINE));
|
PSendSysMessage(LANG_SUMMONING, nameLink.c_str(),GetMangosString(LANG_OFFLINE));
|
||||||
|
|
||||||
|
|
@ -452,12 +454,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
m_session->GetPlayer()->GetPositionZ(),
|
m_session->GetPlayer()->GetPositionZ(),
|
||||||
m_session->GetPlayer()->GetOrientation(),
|
m_session->GetPlayer()->GetOrientation(),
|
||||||
m_session->GetPlayer()->GetZoneId(),
|
m_session->GetPlayer()->GetZoneId(),
|
||||||
guid);
|
target_guid);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_NO_PLAYER, args);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -466,30 +463,31 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
|
||||||
//Teleport to Player
|
//Teleport to Player
|
||||||
bool ChatHandler::HandleGonameCommand(const char* args)
|
bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
Player* target;
|
||||||
|
uint64 target_guid;
|
||||||
|
std::string target_name;
|
||||||
|
if (!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player* _player = m_session->GetPlayer();
|
Player* _player = m_session->GetPlayer();
|
||||||
|
if (target == _player || target_guid == _player->GetGUID())
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
|
||||||
if(name.empty())
|
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
SendSysMessage(LANG_CANT_TELEPORT_SELF);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *chr = objmgr.GetPlayer(name.c_str());
|
|
||||||
if (chr)
|
if (target)
|
||||||
{
|
{
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string chrNameLink = playerLink(name);
|
std::string chrNameLink = playerLink(target_name);
|
||||||
|
|
||||||
Map* cMap = chr->GetMap();
|
Map* cMap = target->GetMap();
|
||||||
if(cMap->IsBattleGroundOrArena())
|
if (cMap->IsBattleGroundOrArena())
|
||||||
{
|
{
|
||||||
// only allow if gm mode is on
|
// only allow if gm mode is on
|
||||||
if (!_player->isGameMaster())
|
if (!_player->isGameMaster())
|
||||||
|
|
@ -499,7 +497,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if both players are in different bgs
|
// if both players are in different bgs
|
||||||
else if (_player->GetBattleGroundId() && _player->GetBattleGroundId() != chr->GetBattleGroundId())
|
else if (_player->GetBattleGroundId() && _player->GetBattleGroundId() != target->GetBattleGroundId())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,chrNameLink.c_str());
|
PSendSysMessage(LANG_CANNOT_GO_TO_BG_FROM_BG,chrNameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -507,7 +505,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
}
|
}
|
||||||
// all's well, set bg id
|
// all's well, set bg id
|
||||||
// when porting out from the bg, it will be reset to 0
|
// when porting out from the bg, it will be reset to 0
|
||||||
_player->SetBattleGroundId(chr->GetBattleGroundId(), chr->GetBattleGroundTypeId());
|
_player->SetBattleGroundId(target->GetBattleGroundId(), target->GetBattleGroundTypeId());
|
||||||
// remember current position as entry point for return at bg end teleportation
|
// remember current position as entry point for return at bg end teleportation
|
||||||
_player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
|
_player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
|
||||||
}
|
}
|
||||||
|
|
@ -519,7 +517,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
if (_player->GetGroup())
|
if (_player->GetGroup())
|
||||||
{
|
{
|
||||||
// we are in group, we can go only if we are in the player group
|
// we are in group, we can go only if we are in the player group
|
||||||
if (_player->GetGroup() != chr->GetGroup())
|
if (_player->GetGroup() != target->GetGroup())
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY,chrNameLink.c_str());
|
PSendSysMessage(LANG_CANNOT_GO_TO_INST_PARTY,chrNameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -539,28 +537,27 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
|
|
||||||
// if the player or the player's group is bound to another instance
|
// if the player or the player's group is bound to another instance
|
||||||
// the player will not be bound to another one
|
// the player will not be bound to another one
|
||||||
InstancePlayerBind *pBind = _player->GetBoundInstance(chr->GetMapId(), chr->GetDifficulty());
|
InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty());
|
||||||
if(!pBind)
|
if (!pBind)
|
||||||
{
|
{
|
||||||
Group *group = _player->GetGroup();
|
Group *group = _player->GetGroup();
|
||||||
InstanceGroupBind *gBind = group ? group->GetBoundInstance(chr->GetMapId(), chr->GetDifficulty()) : NULL;
|
|
||||||
if(!gBind)
|
|
||||||
{
|
|
||||||
// if no bind exists, create a solo bind
|
// if no bind exists, create a solo bind
|
||||||
InstanceSave *save = sInstanceSaveManager.GetInstanceSave(chr->GetInstanceId());
|
InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target->GetDifficulty()) : NULL;
|
||||||
if(save) _player->BindToInstance(save, !save->CanReset());
|
// if no bind exists, create a solo bind
|
||||||
}
|
if (!gBind)
|
||||||
|
if (InstanceSave *save = sInstanceSaveManager.GetInstanceSave(target->GetInstanceId()))
|
||||||
|
_player->BindToInstance(save, !save->CanReset());
|
||||||
}
|
}
|
||||||
|
|
||||||
_player->SetDifficulty(chr->GetDifficulty());
|
_player->SetDifficulty(target->GetDifficulty());
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
|
PSendSysMessage(LANG_APPEARING_AT, chrNameLink.c_str());
|
||||||
if (_player->IsVisibleGloballyFor(chr))
|
if (needReportToTarget(target))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_APPEARING_TO, GetNameLink().c_str());
|
ChatHandler(target).PSendSysMessage(LANG_APPEARING_TO, GetNameLink().c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(_player->isInFlight())
|
if (_player->isInFlight())
|
||||||
{
|
{
|
||||||
_player->GetMotionMaster()->MovementExpired();
|
_player->GetMotionMaster()->MovementExpired();
|
||||||
_player->m_taxi.ClearTaxiDestinations();
|
_player->m_taxi.ClearTaxiDestinations();
|
||||||
|
|
@ -571,20 +568,17 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
|
|
||||||
// to point to see at target with same orientation
|
// to point to see at target with same orientation
|
||||||
float x,y,z;
|
float x,y,z;
|
||||||
chr->GetContactPoint(m_session->GetPlayer(),x,y,z);
|
target->GetContactPoint(_player,x,y,z);
|
||||||
|
|
||||||
_player->TeleportTo(chr->GetMapId(), x, y, z, _player->GetAngle( chr ), TELE_TO_GM_MODE);
|
_player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
|
||||||
{
|
{
|
||||||
// check offline security
|
// check offline security
|
||||||
if (HasLowerSecurity(NULL, guid))
|
if (HasLowerSecurity(NULL, target_guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
|
PSendSysMessage(LANG_APPEARING_AT, nameLink.c_str());
|
||||||
|
|
||||||
|
|
@ -592,10 +586,11 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
float x,y,z,o;
|
float x,y,z,o;
|
||||||
uint32 map;
|
uint32 map;
|
||||||
bool in_flight;
|
bool in_flight;
|
||||||
if(Player::LoadPositionFromDB(map,x,y,z,o,in_flight,guid))
|
if (!Player::LoadPositionFromDB(map,x,y,z,o,in_flight,target_guid))
|
||||||
{
|
return false;
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(_player->isInFlight())
|
if (_player->isInFlight())
|
||||||
{
|
{
|
||||||
_player->GetMotionMaster()->MovementExpired();
|
_player->GetMotionMaster()->MovementExpired();
|
||||||
_player->m_taxi.ClearTaxiDestinations();
|
_player->m_taxi.ClearTaxiDestinations();
|
||||||
|
|
@ -605,70 +600,37 @@ bool ChatHandler::HandleGonameCommand(const char* args)
|
||||||
_player->SaveRecallPosition();
|
_player->SaveRecallPosition();
|
||||||
|
|
||||||
_player->TeleportTo(map, x, y, z,_player->GetOrientation());
|
_player->TeleportTo(map, x, y, z,_player->GetOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_NO_PLAYER, args);
|
|
||||||
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Teleport player to last position
|
// Teleport player to last position
|
||||||
bool ChatHandler::HandleRecallCommand(const char* args)
|
bool ChatHandler::HandleRecallCommand(const char* args)
|
||||||
{
|
{
|
||||||
Player* chr = NULL;
|
Player* target;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target))
|
||||||
if(!*args)
|
return false;
|
||||||
{
|
|
||||||
chr = getSelectedPlayer();
|
|
||||||
if(!chr)
|
|
||||||
chr = m_session->GetPlayer();
|
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
else if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
chr = objmgr.GetPlayer(name.c_str());
|
if (target->IsBeingTeleported())
|
||||||
|
|
||||||
if(!chr)
|
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_NO_PLAYER, args);
|
PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(target).c_str());
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check online security
|
|
||||||
if (HasLowerSecurity(chr, 0))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(chr->IsBeingTeleported())
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, GetNameLink(chr).c_str());
|
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(chr->isInFlight())
|
if(target->isInFlight())
|
||||||
{
|
{
|
||||||
chr->GetMotionMaster()->MovementExpired();
|
target->GetMotionMaster()->MovementExpired();
|
||||||
chr->m_taxi.ClearTaxiDestinations();
|
target->m_taxi.ClearTaxiDestinations();
|
||||||
}
|
}
|
||||||
|
|
||||||
chr->TeleportTo(chr->m_recallMap, chr->m_recallX, chr->m_recallY, chr->m_recallZ, chr->m_recallO);
|
target->TeleportTo(target->m_recallMap, target->m_recallX, target->m_recallY, target->m_recallZ, target->m_recallO);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1989,18 +1951,12 @@ bool ChatHandler::HandleSaveAllCommand(const char* /*args*/)
|
||||||
//Send mail by command
|
//Send mail by command
|
||||||
bool ChatHandler::HandleSendMailCommand(const char* args)
|
bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// format: name "subject text" "mail text"
|
// format: name "subject text" "mail text"
|
||||||
|
Player* target;
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
uint64 target_guid;
|
||||||
if(name.empty())
|
std::string target_name;
|
||||||
{
|
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
char* tail1 = strtok(NULL, "");
|
char* tail1 = strtok(NULL, "");
|
||||||
if(!tail1)
|
if(!tail1)
|
||||||
|
|
@ -2042,14 +1998,6 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
std::string subject = msgSubject;
|
std::string subject = msgSubject;
|
||||||
std::string text = msgText;
|
std::string text = msgText;
|
||||||
|
|
||||||
uint64 receiver_guid = objmgr.GetPlayerGUIDByName(name);
|
|
||||||
if(!receiver_guid)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// from console show not existed sender
|
// from console show not existed sender
|
||||||
uint32 sender_guidlo = m_session ? m_session->GetPlayer()->GetGUIDLow() : 0;
|
uint32 sender_guidlo = m_session ? m_session->GetPlayer()->GetGUIDLow() : 0;
|
||||||
|
|
||||||
|
|
@ -2057,11 +2005,9 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
uint32 stationery = MAIL_STATIONERY_GM;
|
uint32 stationery = MAIL_STATIONERY_GM;
|
||||||
uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0;
|
uint32 itemTextId = !text.empty() ? objmgr.CreateItemText( text ) : 0;
|
||||||
|
|
||||||
Player *receiver = objmgr.GetPlayer(receiver_guid);
|
WorldSession::SendMailTo(target,messagetype, stationery, sender_guidlo, GUID_LOPART(target_guid), subject, itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_NONE);
|
||||||
|
|
||||||
WorldSession::SendMailTo(receiver,messagetype, stationery, sender_guidlo, GUID_LOPART(receiver_guid), subject, itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_NONE);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
|
||||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2069,23 +2015,20 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||||
// teleport player to given game_tele.entry
|
// teleport player to given game_tele.entry
|
||||||
bool ChatHandler::HandleTeleNameCommand(const char * args)
|
bool ChatHandler::HandleTeleNameCommand(const char * args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
char* nameStr;
|
||||||
|
char* teleStr;
|
||||||
|
extractOptFirstArg((char*)args,&nameStr,&teleStr);
|
||||||
|
if(!teleStr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
Player* target;
|
||||||
if(name.empty())
|
uint64 target_guid;
|
||||||
{
|
std::string target_name;
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
if(!extractPlayerTarget(teleStr,&target,&target_guid,&target_name))
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* tail = strtok(NULL, "");
|
|
||||||
if(!tail)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||||
GameTele const* tele = extractGameTeleFromLink(tail);
|
GameTele const* tele = extractGameTeleFromLink(teleStr);
|
||||||
if(!tele)
|
if(!tele)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||||
|
|
@ -2093,16 +2036,15 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *chr = objmgr.GetPlayer(name.c_str());
|
if (target)
|
||||||
if (chr)
|
|
||||||
{
|
{
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string chrNameLink = playerLink(name);
|
std::string chrNameLink = playerLink(target_name);
|
||||||
|
|
||||||
if(chr->IsBeingTeleported()==true)
|
if(target->IsBeingTeleported()==true)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
|
PSendSysMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -2110,35 +2052,33 @@ bool ChatHandler::HandleTeleNameCommand(const char * args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(),"", tele->name.c_str());
|
PSendSysMessage(LANG_TELEPORTING_TO, chrNameLink.c_str(),"", tele->name.c_str());
|
||||||
if (needReportToTarget(chr))
|
if (needReportToTarget(target))
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetNameLink().c_str());
|
ChatHandler(target).PSendSysMessage(LANG_TELEPORTED_TO_BY, GetNameLink().c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if(chr->isInFlight())
|
if(target->isInFlight())
|
||||||
{
|
{
|
||||||
chr->GetMotionMaster()->MovementExpired();
|
target->GetMotionMaster()->MovementExpired();
|
||||||
chr->m_taxi.ClearTaxiDestinations();
|
target->m_taxi.ClearTaxiDestinations();
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
chr->SaveRecallPosition();
|
target->SaveRecallPosition();
|
||||||
|
|
||||||
chr->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation);
|
target->TeleportTo(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation);
|
||||||
}
|
}
|
||||||
else if (uint64 guid = objmgr.GetPlayerGUIDByName(name))
|
else
|
||||||
{
|
{
|
||||||
// check offline security
|
// check offline security
|
||||||
if (HasLowerSecurity(NULL, guid))
|
if (HasLowerSecurity(NULL, target_guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
|
PSendSysMessage(LANG_TELEPORTING_TO, nameLink.c_str(), GetMangosString(LANG_OFFLINE), tele->name.c_str());
|
||||||
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
|
Player::SavePositionInDB(tele->mapId,tele->position_x,tele->position_y,tele->position_z,tele->orientation,
|
||||||
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),guid);
|
MapManager::Instance().GetZoneId(tele->mapId,tele->position_x,tele->position_y,tele->position_z),target_guid);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
PSendSysMessage(LANG_NO_PLAYER, name.c_str());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2222,32 +2162,17 @@ bool ChatHandler::HandleTeleGroupCommand(const char * args)
|
||||||
//Summon group of player
|
//Summon group of player
|
||||||
bool ChatHandler::HandleGroupgoCommand(const char* args)
|
bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||||
{
|
{
|
||||||
if(!*args)
|
Player* target;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player *player = objmgr.GetPlayer(name.c_str());
|
|
||||||
if (!player)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_NO_PLAYER, args);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(player, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Group *grp = player->GetGroup();
|
Group *grp = target->GetGroup();
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = GetNameLink(target);
|
||||||
|
|
||||||
if(!grp)
|
if(!grp)
|
||||||
{
|
{
|
||||||
|
|
@ -2281,7 +2206,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args)
|
||||||
if (HasLowerSecurity(pl, 0))
|
if (HasLowerSecurity(pl, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string plNameLink = playerLink(name);
|
std::string plNameLink = GetNameLink(pl);
|
||||||
|
|
||||||
if(pl->IsBeingTeleported()==true)
|
if(pl->IsBeingTeleported()==true)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -52,104 +52,89 @@ static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
||||||
//mute player for some times
|
//mute player for some times
|
||||||
bool ChatHandler::HandleMuteCommand(const char* args)
|
bool ChatHandler::HandleMuteCommand(const char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
char* nameStr;
|
||||||
|
char* delayStr;
|
||||||
|
extractOptFirstArg((char*)args,&nameStr,&delayStr);
|
||||||
|
if(!delayStr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
Player* target;
|
||||||
if(name.empty())
|
uint64 target_guid;
|
||||||
{
|
std::string target_name;
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
|
||||||
|
|
||||||
|
// find only player from same account if any
|
||||||
|
if(!target)
|
||||||
|
{
|
||||||
|
if(WorldSession* session = sWorld.FindSession(account_id))
|
||||||
|
target = session->GetPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *timetonotspeak = strtok(NULL, " ");
|
uint32 notspeaktime = (uint32) atoi(delayStr);
|
||||||
if(!timetonotspeak)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 notspeaktime = (uint32) atoi(timetonotspeak);
|
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
|
||||||
if(!guid)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player *chr = objmgr.GetPlayer(guid);
|
|
||||||
|
|
||||||
// must have strong lesser security level
|
// must have strong lesser security level
|
||||||
if(HasLowerSecurity (chr,guid,true))
|
if(HasLowerSecurity (target,target_guid,true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
|
|
||||||
|
|
||||||
time_t mutetime = time(NULL) + notspeaktime*60;
|
time_t mutetime = time(NULL) + notspeaktime*60;
|
||||||
|
|
||||||
if (chr)
|
if (target)
|
||||||
chr->GetSession()->m_muteTime = mutetime;
|
target->GetSession()->m_muteTime = mutetime;
|
||||||
|
|
||||||
loginDatabase.PExecute("UPDATE account SET mutetime = " I64FMTD " WHERE id = '%u'",uint64(mutetime), account_id );
|
loginDatabase.PExecute("UPDATE account SET mutetime = " I64FMTD " WHERE id = '%u'",uint64(mutetime), account_id );
|
||||||
|
|
||||||
if(chr)
|
if(target)
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime);
|
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notspeaktime);
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_DISABLE_CHAT, nameLink.c_str(), notspeaktime);
|
PSendSysMessage(LANG_YOU_DISABLE_CHAT, nameLink.c_str(), notspeaktime);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//unmute player
|
//unmute player
|
||||||
bool ChatHandler::HandleUnmuteCommand(const char* args)
|
bool ChatHandler::HandleUnmuteCommand(const char* args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
Player* target;
|
||||||
|
uint64 target_guid;
|
||||||
|
std::string target_name;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
uint32 account_id = target ? target->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(target_guid);
|
||||||
if(name.empty())
|
|
||||||
|
// find only player from same account if any
|
||||||
|
if(!target)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
if(WorldSession* session = sWorld.FindSession(account_id))
|
||||||
SetSentErrorMessage(true);
|
target = session->GetPlayer();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
|
||||||
if(!guid)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player *chr = objmgr.GetPlayer(guid);
|
|
||||||
|
|
||||||
// must have strong lesser security level
|
// must have strong lesser security level
|
||||||
if(HasLowerSecurity (chr,guid,true))
|
if(HasLowerSecurity (target,target_guid,true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
|
if (target)
|
||||||
|
|
||||||
if (chr)
|
|
||||||
{
|
{
|
||||||
if(chr->CanSpeak())
|
if(target->CanSpeak())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
|
SendSysMessage(LANG_CHAT_ALREADY_ENABLED);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
chr->GetSession()->m_muteTime = 0;
|
target->GetSession()->m_muteTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
loginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id );
|
loginDatabase.PExecute("UPDATE account SET mutetime = '0' WHERE id = '%u'", account_id );
|
||||||
|
|
||||||
if(chr)
|
if(target)
|
||||||
ChatHandler(chr).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
|
ChatHandler(target).PSendSysMessage(LANG_YOUR_CHAT_ENABLED);
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
|
PSendSysMessage(LANG_YOU_ENABLE_CHAT, nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -2077,18 +2062,11 @@ bool ChatHandler::HandleModifyMorphCommand(const char* args)
|
||||||
//kick player
|
//kick player
|
||||||
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
Player* target;
|
||||||
{
|
if(!extractPlayerTarget((char*)args,&target))
|
||||||
Player* player = getSelectedPlayer();
|
|
||||||
|
|
||||||
if(!player)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if(player==m_session->GetPlayer())
|
if (m_session && target==m_session->GetPlayer())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
SendSysMessage(LANG_COMMAND_KICKSELF);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -2096,43 +2074,12 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(player, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
player->GetSession()->KickPlayer();
|
// send before target pointer invalidate
|
||||||
}
|
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,GetNameLink(target).c_str());
|
||||||
else
|
target->GetSession()->KickPlayer();
|
||||||
{
|
|
||||||
std::string name = extractPlayerNameFromLink((char*)args);
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(m_session && name==m_session->GetPlayer()->GetName())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check online security
|
|
||||||
Player* player = ObjectAccessor::Instance().FindPlayerByName(name.c_str());
|
|
||||||
if (player && HasLowerSecurity(player, 0))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
|
||||||
|
|
||||||
if(sWorld.KickPlayer(name))
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE,nameLink.c_str());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER,nameLink.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2160,48 +2107,15 @@ bool ChatHandler::HandleModifyPhaseCommand(const char* args)
|
||||||
//show info of player
|
//show info of player
|
||||||
bool ChatHandler::HandlePInfoCommand(const char* args)
|
bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
{
|
{
|
||||||
Player* target = NULL;
|
char* nameStr;
|
||||||
uint64 targetGUID = 0;
|
char* subcommandStr;
|
||||||
|
extractOptFirstArg((char*)args,&nameStr,&subcommandStr);
|
||||||
|
|
||||||
char* px = strtok((char*)args, " ");
|
Player* target;
|
||||||
char* py = NULL;
|
uint64 target_guid;
|
||||||
|
std::string target_name;
|
||||||
std::string name;
|
if(!extractPlayerTarget(nameStr,&target,&target_guid,&target_name))
|
||||||
|
|
||||||
if (px)
|
|
||||||
{
|
|
||||||
name = extractPlayerNameFromLink(px);
|
|
||||||
if(name.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
target = objmgr.GetPlayer(name.c_str());
|
|
||||||
if (target)
|
|
||||||
py = strtok(NULL, " ");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
targetGUID = objmgr.GetPlayerGUIDByName(name);
|
|
||||||
if(targetGUID)
|
|
||||||
py = strtok(NULL, " ");
|
|
||||||
else
|
|
||||||
py = px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!target && !targetGUID)
|
|
||||||
{
|
|
||||||
target = getSelectedPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!target && !targetGUID)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 accId = 0;
|
uint32 accId = 0;
|
||||||
uint32 money = 0;
|
uint32 money = 0;
|
||||||
|
|
@ -2216,8 +2130,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
if (HasLowerSecurity(target, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
targetGUID = target->GetGUID();
|
|
||||||
name = target->GetName(); // re-read for case getSelectedPlayer() target
|
|
||||||
accId = target->GetSession()->GetAccountId();
|
accId = target->GetSession()->GetAccountId();
|
||||||
money = target->GetMoney();
|
money = target->GetMoney();
|
||||||
total_player_time = target->GetTotalPlayedTime();
|
total_player_time = target->GetTotalPlayedTime();
|
||||||
|
|
@ -2228,33 +2140,25 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check offline security
|
// check offline security
|
||||||
if (HasLowerSecurity(NULL, targetGUID))
|
if (HasLowerSecurity(NULL, target_guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// 0
|
// 0
|
||||||
QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
QueryResult *result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
total_player_time = fields[0].GetUInt32();
|
total_player_time = fields[0].GetUInt32();
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
Tokens data;
|
Tokens data;
|
||||||
if (!Player::LoadValuesArrayFromDB(data,targetGUID))
|
if (!Player::LoadValuesArrayFromDB(data,target_guid))
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
money = Player::GetUInt32ValueFromArray(data, PLAYER_FIELD_COINAGE);
|
money = Player::GetUInt32ValueFromArray(data, PLAYER_FIELD_COINAGE);
|
||||||
level = Player::GetUInt32ValueFromArray(data, UNIT_FIELD_LEVEL);
|
level = Player::GetUInt32ValueFromArray(data, UNIT_FIELD_LEVEL);
|
||||||
|
accId = objmgr.GetPlayerAccountIdByGUID(target_guid);
|
||||||
accId = objmgr.GetPlayerAccountIdByGUID(targetGUID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string username = GetMangosString(LANG_ERROR);
|
std::string username = GetMangosString(LANG_ERROR);
|
||||||
|
|
@ -2283,9 +2187,9 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
delete result;
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(targetGUID), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency);
|
PSendSysMessage(LANG_PINFO_ACCOUNT, (target?"":GetMangosString(LANG_OFFLINE)), nameLink.c_str(), GUID_LOPART(target_guid), username.c_str(), accId, security, last_ip.c_str(), last_login.c_str(), latency);
|
||||||
|
|
||||||
std::string timeStr = secsToTimeString(total_player_time,true,true);
|
std::string timeStr = secsToTimeString(total_player_time,true,true);
|
||||||
uint32 gold = money /GOLD;
|
uint32 gold = money /GOLD;
|
||||||
|
|
@ -2293,7 +2197,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
|
||||||
uint32 copp = (money % GOLD) % SILVER;
|
uint32 copp = (money % GOLD) % SILVER;
|
||||||
PSendSysMessage(LANG_PINFO_LEVEL, timeStr.c_str(), level, gold,silv,copp );
|
PSendSysMessage(LANG_PINFO_LEVEL, timeStr.c_str(), level, gold,silv,copp );
|
||||||
|
|
||||||
if ( py && strncmp(py, "rep", 3) == 0 )
|
if( subcommandStr && strncmp(subcommandStr, "rep", 3) == 0 )
|
||||||
{
|
{
|
||||||
if(!target)
|
if(!target)
|
||||||
{
|
{
|
||||||
|
|
@ -2422,27 +2326,18 @@ bool ChatHandler::HandleTicketCommand(const char* args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink(px);
|
uint64 target_guid;
|
||||||
if(name.empty())
|
if(!extractPlayerTarget(px,NULL,&target_guid))
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
|
||||||
|
|
||||||
if(!guid)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// ticket $char_name
|
// ticket $char_name
|
||||||
GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(guid));
|
GMTicket* ticket = ticketmgr.GetGMTicket(GUID_LOPART(target_guid));
|
||||||
if(!ticket)
|
if(!ticket)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string time = TimeToTimestampStr(ticket->GetLastUpdate());
|
std::string time = TimeToTimestampStr(ticket->GetLastUpdate());
|
||||||
|
|
||||||
ShowTicket(guid, ticket->GetText(), time.c_str());
|
ShowTicket(target_guid, ticket->GetText(), time.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -2492,27 +2387,20 @@ bool ChatHandler::HandleDelTicketCommand(const char *args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name = extractPlayerNameFromLink(px);
|
Player* target;
|
||||||
if(name.empty())
|
uint64 target_guid;
|
||||||
{
|
std::string target_name;
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
if(!extractPlayerTarget(px,&target,&target_guid,&target_name))
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(name);
|
|
||||||
|
|
||||||
if(!guid)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// delticket $char_name
|
// delticket $char_name
|
||||||
ticketmgr.Delete(GUID_LOPART(guid));
|
ticketmgr.Delete(GUID_LOPART(target_guid));
|
||||||
|
|
||||||
// notify players about ticket deleting
|
// notify players about ticket deleting
|
||||||
if(Player* sender = objmgr.GetPlayer(guid))
|
if(target)
|
||||||
sender->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
target->GetSession()->SendGMTicketGetTicket(0x0A,0);
|
||||||
|
|
||||||
std::string nameLink = playerLink(name);
|
std::string nameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,nameLink.c_str());
|
PSendSysMessage(LANG_COMMAND_TICKETPLAYERDEL,nameLink.c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -3663,39 +3551,11 @@ bool ChatHandler::HandleWpImportCommand(const char *args)
|
||||||
//rename characters
|
//rename characters
|
||||||
bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
||||||
{
|
{
|
||||||
Player* target = NULL;
|
Player* target;
|
||||||
uint64 targetGUID = 0;
|
uint64 target_guid;
|
||||||
std::string oldname;
|
std::string target_name;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||||
char* px = strtok((char*)args, " ");
|
|
||||||
|
|
||||||
if(px)
|
|
||||||
{
|
|
||||||
oldname = extractPlayerNameFromLink(px);
|
|
||||||
if(oldname.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
target = objmgr.GetPlayer(oldname.c_str());
|
|
||||||
|
|
||||||
if (!target)
|
|
||||||
targetGUID = objmgr.GetPlayerGUIDByName(oldname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!target && !targetGUID)
|
|
||||||
{
|
|
||||||
target = getSelectedPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!target && !targetGUID)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(target)
|
if(target)
|
||||||
{
|
{
|
||||||
|
|
@ -3710,13 +3570,13 @@ bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check offline security
|
// check offline security
|
||||||
if (HasLowerSecurity(NULL, targetGUID))
|
if (HasLowerSecurity(NULL, target_guid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string oldNameLink = playerLink(oldname);
|
std::string oldNameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGUID));
|
PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid));
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '1' WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -3725,39 +3585,11 @@ bool ChatHandler::HandleCharacterRenameCommand(const char* args)
|
||||||
// customize characters
|
// customize characters
|
||||||
bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
|
bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
|
||||||
{
|
{
|
||||||
Player* target = NULL;
|
Player* target;
|
||||||
uint64 targetGUID = 0;
|
uint64 target_guid;
|
||||||
std::string oldname;
|
std::string target_name;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target,&target_guid,&target_name))
|
||||||
char* px = strtok((char*)args, " ");
|
|
||||||
|
|
||||||
if(px)
|
|
||||||
{
|
|
||||||
oldname = extractPlayerNameFromLink(px);
|
|
||||||
if(oldname.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
target = objmgr.GetPlayer(oldname.c_str());
|
|
||||||
|
|
||||||
if (!target)
|
|
||||||
targetGUID = objmgr.GetPlayerGUIDByName(oldname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!target && !targetGUID)
|
|
||||||
{
|
|
||||||
target = getSelectedPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!target && !targetGUID)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(target)
|
if(target)
|
||||||
{
|
{
|
||||||
|
|
@ -3767,10 +3599,10 @@ bool ChatHandler::HandleCharacterCustomizeCommand(const char* args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string oldNameLink = playerLink(oldname);
|
std::string oldNameLink = playerLink(target_name);
|
||||||
|
|
||||||
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGUID));
|
PSendSysMessage(LANG_CUSTOMIZE_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(target_guid));
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(targetGUID));
|
CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '8' WHERE guid = '%u'", GUID_LOPART(target_guid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -4054,41 +3886,16 @@ bool ChatHandler::HandleEventStopCommand(const char* args)
|
||||||
|
|
||||||
bool ChatHandler::HandleCombatStopCommand(const char* args)
|
bool ChatHandler::HandleCombatStopCommand(const char* args)
|
||||||
{
|
{
|
||||||
Player *player;
|
Player* target;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target))
|
||||||
if(*args)
|
|
||||||
{
|
|
||||||
std::string playername = extractPlayerNameFromLink((char*)args);
|
|
||||||
if(playername.empty())
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
player = objmgr.GetPlayer(playername.c_str());
|
|
||||||
|
|
||||||
if(!player)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player = getSelectedPlayer();
|
|
||||||
|
|
||||||
if (!player)
|
|
||||||
player = m_session->GetPlayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(player, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
player->CombatStop();
|
target->CombatStop();
|
||||||
player->getHostilRefManager().deleteReferences();
|
target->getHostilRefManager().deleteReferences();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4320,16 +4127,11 @@ bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/)
|
bool ChatHandler::HandleRepairitemsCommand(const char* args)
|
||||||
{
|
{
|
||||||
Player *target = getSelectedPlayer();
|
Player* target;
|
||||||
|
if(!extractPlayerTarget((char*)args,&target))
|
||||||
if(!target)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_NO_CHAR_SELECTED);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(target, 0))
|
if (HasLowerSecurity(target, 0))
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -2452,31 +2452,6 @@ void World::KickAllLess(AccountTypes sec)
|
||||||
itr->second->KickPlayer();
|
itr->second->KickPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Kick (and save) the designated player
|
|
||||||
bool World::KickPlayer(const std::string& playerName)
|
|
||||||
{
|
|
||||||
SessionMap::const_iterator itr;
|
|
||||||
|
|
||||||
// session not removed at kick and will removed in next update tick
|
|
||||||
for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
|
||||||
{
|
|
||||||
if(!itr->second)
|
|
||||||
continue;
|
|
||||||
Player *player = itr->second->GetPlayer();
|
|
||||||
if(!player)
|
|
||||||
continue;
|
|
||||||
if( player->IsInWorld() )
|
|
||||||
{
|
|
||||||
if (playerName == player->GetName())
|
|
||||||
{
|
|
||||||
itr->second->KickPlayer();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
|
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
|
||||||
BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author)
|
BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -472,7 +472,6 @@ class World
|
||||||
bool IsPvPRealm() { return (getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); }
|
bool IsPvPRealm() { return (getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); }
|
||||||
bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
|
bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
|
||||||
|
|
||||||
bool KickPlayer(const std::string& playerName);
|
|
||||||
void KickAll();
|
void KickAll();
|
||||||
void KickAllLess(AccountTypes sec);
|
void KickAllLess(AccountTypes sec);
|
||||||
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
|
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7838"
|
#define REVISION_NR "7839"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue