mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[10331] More basic chat command parsing functions and its uses.
* Commands .debug update and .modify bit removed as redundent * Command .debug getvalue now can output values in float/int/hex/bitstring formats * Command .debug setvalue now ca accept values in int/float/hex/bitstring formats * Command .debug mod32value renamed to modvaue and can add int/float or apply hex mask (in 3 modes: |= &= &=~ ) to value in update field * Command .debug moditemvalue added similar .debug modvalue for item case. * Command .npc set movetype now propertly update spawned in world creature state. * Command .modify spell renamed to .debug spellmods and restored to working state. * Commands .account password and .account set password now allow use quoted strings for passwords and then now possible set from chat/console passwords with white spaces. * Many commands converted to new functions without modify functionality except better error detection in some cases at wrong command syntax use. * Also fixed warnings in reload commands after prev. chat commit. Thanks to SkirnirMaNGOS for reporting.
This commit is contained in:
parent
fefd648d3e
commit
59e672f1bc
17 changed files with 906 additions and 814 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_10323_02_mangos_command` bit(1) default NULL
|
||||
`required_10331_02_mangos_command` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -538,13 +538,16 @@ INSERT INTO `command` VALUES
|
|||
('debug anim',2,'Syntax: .debug anim #emoteid\r\n\r\nPlay emote #emoteid for your character.'),
|
||||
('debug arena',3,'Syntax: .debug arena\r\n\r\nToggle debug mode for arenas. In debug mode GM can start arena with single player.'),
|
||||
('debug bg',3,'Syntax: .debug bg\r\n\r\nToggle debug mode for battlegrounds. In debug mode GM can start battleground with single player.'),
|
||||
('debug getvalue',3,'Syntax: .debug getvalue #field #isInt\r\n\r\nGet the field #field of the selected creature. If no creature is selected, get the content of your field.\r\n\r\nUse a #isInt of value 1 if the expected field content is an integer.'),
|
||||
('debug getitemvalue',3,'Syntax: .debug getitemvalue #itemguid #field [int|hex|bit|float]\r\n\r\nGet the field #field of the item #itemguid in your inventroy.\r\n\r\nUse type arg for set output format: int (decimal number), hex (hex value), bit (bitstring), float. By default use integer output.'),
|
||||
('debug getvalue',3,'Syntax: .debug getvalue #field [int|hex|bit|float]\r\n\r\nGet the field #field of the selected target. If no target is selected, get the content of your field.\r\n\r\nUse type arg for set output format: int (decimal number), hex (hex value), bit (bitstring), float. By default use integer output.'),
|
||||
('debug moditemvalue',3,'Syntax: .debug modvalue #guid #field [int|float| &= | |= | &=~ ] #value\r\n\r\nModify the field #field of the item #itemguid in your inventroy by value #value. \r\n\r\nUse type arg for set mode of modification: int (normal add/subtract #value as decimal number), float (add/subtract #value as float number), &= (bit and, set to 0 all bits in value if it not set to 1 in #value as hex number), |= (bit or, set to 1 all bits in value if it set to 1 in #value as hex number), &=~ (bit and not, set to 0 all bits in value if it set to 1 in #value as hex number). By default expect integer add/subtract.'),
|
||||
('debug modvalue',3,'Syntax: .debug modvalue #field [int|float| &= | |= | &=~ ] #value\r\n\r\nModify the field #field of the selected target by value #value. If no target is selected, set the content of your field.\r\n\r\nUse type arg for set mode of modification: int (normal add/subtract #value as decimal number), float (add/subtract #value as float number), &= (bit and, set to 0 all bits in value if it not set to 1 in #value as hex number), |= (bit or, set to 1 all bits in value if it set to 1 in #value as hex number), &=~ (bit and not, set to 0 all bits in value if it set to 1 in #value as hex number). By default expect integer add/subtract.'),
|
||||
('debug play cinematic',1,'Syntax: .debug play cinematic #cinematicid\r\n\r\nPlay cinematic #cinematicid for you. You stay at place while your mind fly.\r\n'),
|
||||
('debug play movie',1,'Syntax: .debug play movie #movieid\r\n\r\nPlay movie #movieid for you.'),
|
||||
('debug play sound',1,'Syntax: .debug play sound #soundid\r\n\r\nPlay sound with #soundid.\r\nSound will be play only for you. Other players do not hear this.\r\nWarning: client may have more 5000 sounds...'),
|
||||
('debug setvalue',3,'Syntax: .debug setvalue #field #value #isInt\r\n\r\nSet the field #field of the selected creature with value #value. If no creature is selected, set the content of your field.\r\n\r\nUse a #isInt of value 1 if #value is an integer.'),
|
||||
('debug update',3,'Syntax: .debug update #field #value\r\n\r\nUpdate the field #field of the selected character or creature with value #value.\r\n\r\nIf no #value is provided, display the content of field #field.'),
|
||||
('debug Mod32Value',3,'Syntax: .debug Mod32Value #field #value\r\n\r\nAdd #value to field #field of your character.'),
|
||||
('debug setitemvalue',3,'Syntax: .debug setitemvalue #guid #field [int|hex|bit|float] #value\r\n\r\nSet the field #field of the item #itemguid in your inventroy to value #value.\r\n\r\nUse type arg for set input format: int (decimal number), hex (hex value), bit (bitstring), float. By default expect integer input format.'),
|
||||
('debug setvalue',3,'Syntax: .debug setvalue #field [int|hex|bit|float] #value\r\n\r\nSet the field #field of the selected target to value #value. If no target is selected, set the content of your field.\r\n\r\nUse type arg for set input format: int (decimal number), hex (hex value), bit (bitstring), float. By default expect integer input format.'),
|
||||
('debug spellmods',3,'Syntax: .debug spellmods (flat|pct) #spellMaskBitIndex #spellModOp #value\r\n\r\nSet at client side spellmod affect for spell that have bit set with index #spellMaskBitIndex in spell family mask for values dependent from spellmod #spellModOp to #value.'),
|
||||
('delticket',2,'Syntax: .delticket all\r\n .delticket #num\r\n .delticket $character_name\r\n\rall to dalete all tickets at server, $character_name to delete ticket of this character, #num to delete ticket #num.'),
|
||||
('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.'),
|
||||
|
|
@ -641,7 +644,6 @@ INSERT INTO `command` VALUES
|
|||
('maxskill',3,'Syntax: .maxskill\r\nSets all skills of the targeted player to their maximum VALUESfor its current level.'),
|
||||
('modify arena',1,'Syntax: .modify arena #value\r\nAdd $amount arena points to the selected player.'),
|
||||
('modify aspeed',1,'Syntax: .modify aspeed #rate\r\n\r\nModify all speeds -run,swim,run back,swim back- of the selected player to \"normalbase speed for this move type\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'),
|
||||
('modify bit',1,'Syntax: .modify bit #field #bit\r\n\r\nToggle the #bit bit of the #field field for the selected player. If no player is selected, modify your character.'),
|
||||
('modify bwalk',1,'Syntax: .modify bwalk #rate\r\n\r\nModify the speed of the selected player while running backwards to \"normal walk back speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'),
|
||||
('modify drunk',1,'Syntax: .modify drunk #value\r\n Set drunk level to #value (0..100). Value 0 remove drunk state, 100 is max drunked state.'),
|
||||
('modify energy',1,'Syntax: .modify energy #energy\r\n\r\nModify the energy of the selected player. If no player is selected, modify your energy.'),
|
||||
|
|
@ -660,7 +662,6 @@ INSERT INTO `command` VALUES
|
|||
('modify runicpower',1,'Syntax: .modify runicpower #newrunicpower\r\n\r\nModify the runic power of the selected player. If no player is selected, modify your runic power.'),
|
||||
('modify scale',1,'Syntax: .modify scale #scale\r\n\r\nChange model scale for targeted player (util relogin) or creature (until respawn).'),
|
||||
('modify speed',1,'Syntax: .modify speed #rate\r\n.speed #rate\r\n\r\nModify the running speed of the selected player to \"normal base run speed\"*rate. If no player is selected, modify your speed.\r\n\r\n #rate may range from 0.1 to 10.'),
|
||||
('modify spell',1,''),
|
||||
('modify standstate',2,'Syntax: .modify standstate #emoteid\r\n\r\nChange the emote of your character while standing to #emoteid.'),
|
||||
('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 tp',1,'Syntax: .modify tp #amount\r\n\r\nSet free talent pointes for selected character or character\'s pet. It will be reset to default expected at next levelup/login/quest reward.'),
|
||||
|
|
@ -3076,8 +3077,8 @@ INSERT INTO `mangos_string` VALUES
|
|||
(128,'GUID %i, faction is %i, flags is %i, npcflag is %i, DY flag is %i',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(129,'Wrong faction: %u (not found in factiontemplate.dbc).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(130,'You changed GUID=%i \'s Faction to %i, flags to %i, npcflag to %i, dyflag to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(131,'You changed the spellflatid=%i, val= %i, mark =%i to %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(132,'%s changed your spellflatid=%i, val= %i, mark =%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(131,'You changed the %s spellmod %u to value %i for spell with family bit %u for %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(132,'%s changed your spellmod %u to value %i for spell with family bit %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(133,'%s has access to all taxi nodes now (until logout).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(134,'%s has no more access to all taxi nodes now (only visited accessible).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(135,'%s has given you access to all taxi nodes (until logout).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
|
|
@ -3452,19 +3453,17 @@ INSERT INTO `mangos_string` VALUES
|
|||
(559,'%s reset your level progress.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(560,'The area has been set as explored.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(561,'The area has been set as not explored.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(562,'GUID=%i \'s updateIndex: %i, value: %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(563,'You change GUID=%i \'s UpdateIndex: %i value to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(564,'The value index %u is too big to %u(count: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(565,'Set %u uint32 Value:[OPCODE]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(566,'You Set %u Field:%u to uint32 Value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(567,'Set %u float Value:[OPCODE]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(568,'You Set %u Field:%i to float Value: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(569,'Get %u uint32 Value:[OPCODE]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(570,'The uint32 value of %u in %u is: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(571,'Get %u float Value:[OPCODE]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(572,'The float of %u value in %u is: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(575,'.Mod32Value:[OPCODE]:%u [VALUE]:%i',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(576,'You modified the value of Field:%u to Value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(564,'The value index %u is too big to %s (count: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(565,'Set for %s field:%u to uint32 value:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(566,'You set for %s field:%u to uint32 value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(567,'Set for %s field:%u to to float value:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(568,'You set for %s field:%u to float value: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(569,'Get %s uint32 value:[FIELD]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(570,'%s has uint32 value:[FIELD]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(571,'Get %s float value:[FIELD]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(572,'%s has float value:[FIELD]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(575,'Modify %s uint32 field:%u to sum with:%i = %u (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(576,'You modify for %s uint32 field:%u to sum with:%i = %u (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(577,'You are now invisible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(578,'You are now visible.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(579,'Selected player or creature not have victim.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
|
|
@ -3721,6 +3720,14 @@ INSERT INTO `mangos_string` VALUES
|
|||
(1150,' (Event %i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1151,' (Pool %u Event %i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1152,'[usable]',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1153,'Get %s bitstr value:[FIELD]:%u [VALUE]:%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1154,'%s has bitstr value:[FIELD]:%u [VALUE]:%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1155,'Get %s hex value:[FIELD]:%u [VALUE]:%x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1156,'%s has hex value:[FIELD]:%u [VALUE]:%x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1157,'Modify %s hex field:%u %s %x = %x (hex)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1158,'You modify for %s hex field:%u %s %x = %x (hex)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1159,'Modify %s float field:%u to sum with:%f = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1160,'You modify for %s float field:%u to sum with:%f = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1200,'You try to view cinemitic %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1201,'You try to view movie %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `mangos_string` ENABLE KEYS */;
|
||||
|
|
|
|||
26
sql/updates/10331_01_mangos_mangos_string.sql
Normal file
26
sql/updates/10331_01_mangos_mangos_string.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_10323_02_mangos_command required_10331_01_mangos_mangos_string bit;
|
||||
|
||||
DELETE FROM mangos_string WHERE entry IN (131,132,562,563,564,565,566,567,568,569,570,571,572,575,576,1153,1154,1155,1156,1157,1158,1159,1160);
|
||||
|
||||
INSERT INTO mangos_string VALUES
|
||||
(131,'You changed the %s spellmod %u to value %i for spell with family bit %u for %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(132,'%s changed your spellmod %u to value %i for spell with family bit %u.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(564,'The value index %u is too big to %s (count: %u).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(565,'Set for %s field:%u to uint32 value:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(566,'You set for %s field:%u to uint32 value: %u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(567,'Set for %s field:%u to to float value:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(568,'You set for %s field:%u to float value: %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(569,'Get %s uint32 value:[FIELD]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(570,'%s has uint32 value:[FIELD]:%u [VALUE]:%u',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(571,'Get %s float value:[FIELD]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(572,'%s has float value:[FIELD]:%u [VALUE]:%f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(575,'Modify %s uint32 field:%u to sum with:%i = %u (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(576,'You modify for %s uint32 field:%u to sum with:%i = %u (%i)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1153,'Get %s bitstr value:[FIELD]:%u [VALUE]:%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1154,'%s has bitstr value:[FIELD]:%u [VALUE]:%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1155,'Get %s hex value:[FIELD]:%u [VALUE]:%x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1156,'%s has hex value:[FIELD]:%u [VALUE]:%x',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1157,'Modify %s hex field:%u %s %x = %x (hex)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1158,'You modify for %s hex field:%u %s %x = %x (hex)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1159,'Modify %s float field:%u to sum with:%f = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
|
||||
(1160,'You modify for %s float field:%u to sum with:%f = %f',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||
16
sql/updates/10331_02_mangos_command.sql
Normal file
16
sql/updates/10331_02_mangos_command.sql
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_10331_01_mangos_mangos_string required_10331_02_mangos_command bit;
|
||||
|
||||
DELETE FROM command WHERE name IN (
|
||||
'debug update','debug Mod32Value','debug modvalue','modify spell','debug spellmods','modify bit',
|
||||
'debug getvalue','debug getitemvalue','debug setvalue','debug setitemvalue','debug moditemvalue'
|
||||
);
|
||||
|
||||
INSERT INTO command (name, security, help) VALUES
|
||||
('debug getitemvalue',3,'Syntax: .debug getitemvalue #itemguid #field [int|hex|bit|float]\r\n\r\nGet the field #field of the item #itemguid in your inventroy.\r\n\r\nUse type arg for set output format: int (decimal number), hex (hex value), bit (bitstring), float. By default use integer output.'),
|
||||
('debug getvalue',3,'Syntax: .debug getvalue #field [int|hex|bit|float]\r\n\r\nGet the field #field of the selected target. If no target is selected, get the content of your field.\r\n\r\nUse type arg for set output format: int (decimal number), hex (hex value), bit (bitstring), float. By default use integer output.'),
|
||||
('debug moditemvalue',3,'Syntax: .debug modvalue #guid #field [int|float| &= | |= | &=~ ] #value\r\n\r\nModify the field #field of the item #itemguid in your inventroy by value #value. \r\n\r\nUse type arg for set mode of modification: int (normal add/subtract #value as decimal number), float (add/subtract #value as float number), &= (bit and, set to 0 all bits in value if it not set to 1 in #value as hex number), |= (bit or, set to 1 all bits in value if it set to 1 in #value as hex number), &=~ (bit and not, set to 0 all bits in value if it set to 1 in #value as hex number). By default expect integer add/subtract.'),
|
||||
('debug modvalue',3,'Syntax: .debug modvalue #field [int|float| &= | |= | &=~ ] #value\r\n\r\nModify the field #field of the selected target by value #value. If no target is selected, set the content of your field.\r\n\r\nUse type arg for set mode of modification: int (normal add/subtract #value as decimal number), float (add/subtract #value as float number), &= (bit and, set to 0 all bits in value if it not set to 1 in #value as hex number), |= (bit or, set to 1 all bits in value if it set to 1 in #value as hex number), &=~ (bit and not, set to 0 all bits in value if it set to 1 in #value as hex number). By default expect integer add/subtract.'),
|
||||
('debug setitemvalue',3,'Syntax: .debug setitemvalue #guid #field [int|hex|bit|float] #value\r\n\r\nSet the field #field of the item #itemguid in your inventroy to value #value.\r\n\r\nUse type arg for set input format: int (decimal number), hex (hex value), bit (bitstring), float. By default expect integer input format.'),
|
||||
('debug setvalue',3,'Syntax: .debug setvalue #field [int|hex|bit|float] #value\r\n\r\nSet the field #field of the selected target to value #value. If no target is selected, set the content of your field.\r\n\r\nUse type arg for set input format: int (decimal number), hex (hex value), bit (bitstring), float. By default expect integer input format.'),
|
||||
('debug spellmods',3,'Syntax: .debug spellmods (flat|pct) #spellMaskBitIndex #spellModOp #value\r\n\r\nSet at client side spellmod affect for spell that have bit set with index #spellMaskBitIndex in spell family mask for values dependent from spellmod #spellModOp to #value.');
|
||||
|
||||
|
|
@ -70,6 +70,8 @@ pkgdata_DATA = \
|
|||
10314_02_mangos_command.sql \
|
||||
10323_01_mangos_mangos_string.sql \
|
||||
10323_02_mangos_command.sql \
|
||||
10331_01_mangos_mangos_string.sql \
|
||||
10331_02_mangos_command.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -120,4 +122,6 @@ EXTRA_DIST = \
|
|||
10314_02_mangos_command.sql \
|
||||
10323_01_mangos_mangos_string.sql \
|
||||
10323_02_mangos_command.sql \
|
||||
10331_01_mangos_mangos_string.sql \
|
||||
10331_02_mangos_command.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -184,18 +184,19 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL },
|
||||
{ "getitemstate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemStateCommand, "", NULL },
|
||||
{ "lootrecipient", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugGetLootRecipientCommand, "", NULL },
|
||||
{ "getvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetValueCommand, "", NULL },
|
||||
{ "getitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetItemValueCommand, "", NULL },
|
||||
{ "Mod32Value", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugMod32ValueCommand, "", NULL },
|
||||
{ "getvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugGetValueCommand, "", NULL },
|
||||
{ "moditemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugModItemValueCommand, "", NULL },
|
||||
{ "modvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugModValueCommand, "", NULL },
|
||||
{ "play", SEC_MODERATOR, false, NULL, "", debugPlayCommandTable },
|
||||
{ "send", SEC_ADMINISTRATOR, false, NULL, "", debugSendCommandTable },
|
||||
{ "setaurastate", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetAuraStateCommand, "", NULL },
|
||||
{ "setitemvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetItemValueCommand, "", NULL },
|
||||
{ "setvalue", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSetValueCommand, "", NULL },
|
||||
{ "spellcheck", SEC_CONSOLE, true, &ChatHandler::HandleDebugSpellCheckCommand, "", NULL },
|
||||
{ "spellmods", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpellModsCommand, "", NULL },
|
||||
{ "spawnvehicle", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSpawnVehicleCommand, "", NULL },
|
||||
{ "uws", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateWorldStateCommand, "", NULL },
|
||||
{ "update", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugUpdateCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
|
|
@ -318,7 +319,7 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
static ChatCommand lookupCommandTable[] =
|
||||
{
|
||||
{ "account", SEC_GAMEMASTER, true, NULL, "", lookupAccountCommandTable },
|
||||
{ "achievement", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupAchievementCommand, "", NULL },
|
||||
{ "achievement", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupAchievementCommand, "", NULL },
|
||||
{ "area", SEC_MODERATOR, true, &ChatHandler::HandleLookupAreaCommand, "", NULL },
|
||||
{ "creature", SEC_ADMINISTRATOR, true, &ChatHandler::HandleLookupCreatureCommand, "", NULL },
|
||||
{ "event", SEC_GAMEMASTER, true, &ChatHandler::HandleLookupEventCommand, "", NULL },
|
||||
|
|
@ -347,12 +348,10 @@ ChatCommand * ChatHandler::getCommandTable()
|
|||
{ "speed", SEC_MODERATOR, false, &ChatHandler::HandleModifySpeedCommand, "", NULL },
|
||||
{ "swim", SEC_MODERATOR, false, &ChatHandler::HandleModifySwimCommand, "", NULL },
|
||||
{ "scale", SEC_MODERATOR, false, &ChatHandler::HandleModifyScaleCommand, "", NULL },
|
||||
{ "bit", SEC_MODERATOR, false, &ChatHandler::HandleModifyBitCommand, "", NULL },
|
||||
{ "bwalk", SEC_MODERATOR, false, &ChatHandler::HandleModifyBWalkCommand, "", NULL },
|
||||
{ "fly", SEC_MODERATOR, false, &ChatHandler::HandleModifyFlyCommand, "", NULL },
|
||||
{ "aspeed", SEC_MODERATOR, false, &ChatHandler::HandleModifyASpeedCommand, "", NULL },
|
||||
{ "faction", SEC_MODERATOR, false, &ChatHandler::HandleModifyFactionCommand, "", NULL },
|
||||
{ "spell", SEC_MODERATOR, false, &ChatHandler::HandleModifySpellCommand, "", NULL },
|
||||
{ "tp", SEC_MODERATOR, false, &ChatHandler::HandleModifyTalentCommand, "", NULL },
|
||||
{ "mount", SEC_MODERATOR, false, &ChatHandler::HandleModifyMountCommand, "", NULL },
|
||||
{ "honor", SEC_MODERATOR, false, &ChatHandler::HandleModifyHonorCommand, "", NULL },
|
||||
|
|
@ -2050,21 +2049,41 @@ bool ChatHandler::ExtractInt32(char** args, int32& val)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract to val arg optional signed integer value or use default value. Fail if extracted not signed integer.
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @param defVal default value used if no data for extraction in args
|
||||
* @return true if value extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractOptInt32(char** args, int32& val, int32 defVal)
|
||||
{
|
||||
if (!*args || !**args)
|
||||
{
|
||||
val = defVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
return ExtractInt32(args, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract to val arg unsigned integer value or fail
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @param base set used base for extracted value format (10 for decimal, 16 for hex, etc), 0 let auto select by system internal function
|
||||
* @return true if value extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractUInt32(char** args, uint32& val)
|
||||
bool ChatHandler::ExtractUInt32Base(char** args, uint32& val, uint32 base)
|
||||
{
|
||||
if (!*args || !**args)
|
||||
return false;
|
||||
|
||||
char* tail = *args;
|
||||
|
||||
unsigned long valRaw = strtoul(*args, &tail, 10);
|
||||
unsigned long valRaw = strtoul(*args, &tail, base);
|
||||
|
||||
if (tail != *args && isWhiteSpace(*tail))
|
||||
*(tail++) = '\0';
|
||||
|
|
@ -2080,6 +2099,25 @@ bool ChatHandler::ExtractUInt32(char** args, uint32& val)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract to val arg optional unsigned integer value or use default value. Fail if extracted not unsigned integer.
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @param defVal default value used if no data for extraction in args
|
||||
* @return true if value extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractOptUInt32(char** args, uint32& val, uint32 defVal)
|
||||
{
|
||||
if (!*args || !**args)
|
||||
{
|
||||
val = defVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
return ExtractUInt32(args, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract to val arg float value or fail
|
||||
*
|
||||
|
|
@ -2107,24 +2145,84 @@ bool ChatHandler::ExtractFloat(char** args, float& val)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract to val arg optional float value or use default value. Fail if extracted not float.
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @param defVal default value used if no data for extraction in args
|
||||
* @return true if value extraction successful
|
||||
*/
|
||||
bool ChatHandler::ExtractOptFloat(char** args, float& val, float defVal)
|
||||
{
|
||||
if (!*args || !**args)
|
||||
{
|
||||
val = defVal;
|
||||
return true;
|
||||
}
|
||||
|
||||
return ExtractFloat(args, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract name-like string (from non-numeric or special symbol until whitespace)
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @return name-like string without whitespaces, or NULL if args empty or not appropriate content.
|
||||
* @param lit optional explicit literal requirement. function fail if literal is not starting substring of lit.
|
||||
* Note: function in same way fail if no any literal or literal not fit in this case. Need additional check for select specific fail case
|
||||
* @return name/number-like string without whitespaces, or NULL if args empty or not appropriate content.
|
||||
*/
|
||||
char* ChatHandler::ExtractLiteralArg(char** args)
|
||||
char* ChatHandler::ExtractLiteralArg(char** args, char const* lit /*= NULL*/)
|
||||
{
|
||||
if (!*args || !**args)
|
||||
return NULL;
|
||||
|
||||
if ((*args)[0] == '[' || (*args)[0] == '\'' || (*args)[0] == '"' || (*args)[0] == '|')
|
||||
char* head = *args;
|
||||
|
||||
// reject quoted string or link (|-started text)
|
||||
switch (head[0])
|
||||
{
|
||||
// reject quoted string
|
||||
case '[': case '\'': case '"':
|
||||
return NULL;
|
||||
// reject link (|-started text)
|
||||
case '|':
|
||||
// client replace all | by || in raw text
|
||||
if (head[1] != '|')
|
||||
return NULL;
|
||||
++head; // skip one |
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (lit)
|
||||
{
|
||||
int diff = strncmp(head, lit, strlen(lit));
|
||||
|
||||
if (diff > 0)
|
||||
return NULL;
|
||||
|
||||
char* name = strtok(*args, " ");
|
||||
if (diff < 0 && !head[-diff] && !isWhiteSpace(head[-diff]))
|
||||
return NULL;
|
||||
|
||||
char* arg = head;
|
||||
|
||||
if (head[-diff])
|
||||
{
|
||||
head[-diff] = '\0';
|
||||
|
||||
head += -diff + 1;
|
||||
|
||||
*args = head;
|
||||
}
|
||||
else
|
||||
*args = NULL;
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
char* name = strtok(head, " ");
|
||||
*args = strtok(NULL, "");
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
@ -2158,6 +2256,43 @@ char* ChatHandler::ExtractQuotedArg( char** args )
|
|||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract quote-like string or literal if quote not detected
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @return quote/literal string, or NULL if args empty or not appropriate content.
|
||||
*/
|
||||
char* ChatHandler::ExtractQuotedOrLiteralArg(char** args)
|
||||
{
|
||||
char *arg = ExtractQuotedArg(args);
|
||||
if (!arg)
|
||||
arg = ExtractLiteralArg(args);
|
||||
return arg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract on/off literals as boolean values
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @param val return extracted value if function success, in fail case original value unmodified
|
||||
* @return true at success
|
||||
*/
|
||||
bool ChatHandler::ExtractOnOff(char** args, bool& value)
|
||||
{
|
||||
char* arg = ExtractLiteralArg(args);
|
||||
if (!arg)
|
||||
return false;
|
||||
|
||||
if (strncmp(arg, "on", 3) == 0)
|
||||
value = true;
|
||||
else if (strncmp(arg, "off", 4) == 0)
|
||||
value = false;
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function extract shift-link-like string (any characters guarded by | and |h|r with some additional internal structure check)
|
||||
*
|
||||
|
|
@ -2232,10 +2367,10 @@ char* ChatHandler::ExtractLinkArg( char** args )
|
|||
}
|
||||
|
||||
/**
|
||||
* Function extract nmae/number/quote/shift-link-like string
|
||||
* Function extract name/number/quote/shift-link-like string
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* @return extaractd arg string, or NULL if args empty or not appropriate content.
|
||||
* @return extracted arg string, or NULL if args empty or not appropriate content.
|
||||
*/
|
||||
char* ChatHandler::ExtractArg( char** args )
|
||||
{
|
||||
|
|
@ -2263,10 +2398,10 @@ char* ChatHandler::ExtractArg( char** args )
|
|||
* Function extract name/quote/number/shift-link-like string, and return it if args have more non-whitespace data
|
||||
*
|
||||
* @param args variable pointer to non parsed args string, updated at function call to new position (with skipped white spaces)
|
||||
* if args gave only single arg then args still pointing to this arg (unmodified pointer)
|
||||
* if args have only single arg then args still pointing to this arg (unmodified pointer)
|
||||
* @return extracted string, or NULL if args empty or not appropriate content or have single arg totally.
|
||||
*/
|
||||
char* ChatHandler::ExtractOptArg(char** args)
|
||||
char* ChatHandler::ExtractOptNotLastArg(char** args)
|
||||
{
|
||||
char* arg = ExtractArg(args);
|
||||
|
||||
|
|
|
|||
|
|
@ -161,16 +161,17 @@ class ChatHandler
|
|||
bool HandleDebugArenaCommand(char* args);
|
||||
bool HandleDebugBattlegroundCommand(char* args);
|
||||
bool HandleDebugGetItemStateCommand(char* args);
|
||||
bool HandleDebugGetItemValueCommand(char* args);
|
||||
bool HandleDebugGetLootRecipientCommand(char* args);
|
||||
bool HandleDebugGetValueCommand(char* args);
|
||||
bool HandleDebugGetItemValueCommand(char* args);
|
||||
bool HandleDebugMod32ValueCommand(char* args);
|
||||
bool HandleDebugModItemValueCommand(char* args);
|
||||
bool HandleDebugModValueCommand(char* args);
|
||||
bool HandleDebugSetAuraStateCommand(char* args);
|
||||
bool HandleDebugSetItemValueCommand(char* args);
|
||||
bool HandleDebugSetValueCommand(char* args);
|
||||
bool HandleDebugSpawnVehicleCommand(char* args);
|
||||
bool HandleDebugSpellCheckCommand(char* args);
|
||||
bool HandleDebugUpdateCommand(char* args);
|
||||
bool HandleDebugSpellModsCommand(char* args);
|
||||
bool HandleDebugUpdateWorldStateCommand(char* args);
|
||||
|
||||
bool HandleDebugPlayCinematicCommand(char* args);
|
||||
|
|
@ -288,9 +289,7 @@ class ChatHandler
|
|||
bool HandleModifySwimCommand(char* args);
|
||||
bool HandleModifyScaleCommand(char* args);
|
||||
bool HandleModifyMountCommand(char* args);
|
||||
bool HandleModifyBitCommand(char* args);
|
||||
bool HandleModifyFactionCommand(char* args);
|
||||
bool HandleModifySpellCommand(char* args);
|
||||
bool HandleModifyTalentCommand(char* args);
|
||||
bool HandleModifyHonorCommand(char* args);
|
||||
bool HandleModifyRepCommand(char* args);
|
||||
|
|
@ -557,13 +556,20 @@ class ChatHandler
|
|||
// extraction different type params from args string, all functions update (char** args) to first unparsed tail symbol at return
|
||||
void SkipWhiteSpaces(char** args);
|
||||
bool ExtractInt32(char** args, int32& val);
|
||||
bool ExtractUInt32(char** args, uint32& val);
|
||||
bool ExtractOptInt32(char** args, int32& val, int32 defVal);
|
||||
bool ExtractUInt32Base(char** args, uint32& val, uint32 base);
|
||||
bool ExtractUInt32(char** args, uint32& val) { return ExtractUInt32Base(args,val, 10); }
|
||||
bool ExtractOptUInt32(char** args, uint32& val, uint32 defVal);
|
||||
bool ExtractFloat(char** args, float& val);
|
||||
char* ExtractLiteralArg(char** args); // any literal strings (until whitespace and not started from "['|)
|
||||
bool ExtractOptFloat(char** args, float& val, float defVal);
|
||||
char* ExtractQuotedArg(char** args); // string with " or [] or ' around
|
||||
char* ExtractLinkArg(char** args); // shift-link like arg
|
||||
char* ExtractLiteralArg(char** args, char const* lit = NULL);
|
||||
// literal string (until whitespace and not started from "['|), any or 'lit' if provided
|
||||
char* ExtractQuotedOrLiteralArg(char** args);
|
||||
bool ExtractOnOff(char** args, bool& value);
|
||||
char* ExtractArg(char** args); // any name/number/quote/shift-link strings
|
||||
char* ExtractOptArg(char** args); // extract name/number/quote/shift-link arg only if more data in args for parse
|
||||
char* ExtractOptNotLastArg(char** args); // extract name/number/quote/shift-link arg only if more data in args for parse
|
||||
|
||||
char* extractKeyFromLink(char* text, char const* linkType, char** something1 = NULL);
|
||||
char* extractKeyFromLink(char* text, char const* const* linkTypes, int* found_idx, char** something1 = NULL);
|
||||
|
|
@ -602,6 +608,9 @@ class ChatHandler
|
|||
void HandleCharacterLevel(Player* player, uint64 player_guid, uint32 oldlevel, uint32 newlevel);
|
||||
void HandleLearnSkillRecipesHelper(Player* player,uint32 skill_id);
|
||||
bool HandleGoHelper(Player* _player, uint32 mapid, float x, float y, float const* zPtr = NULL, float const* ortPtr = NULL);
|
||||
bool HandleGetValueHelper(Object* target, uint32 field, char* typeStr);
|
||||
bool HandlerDebugModValueHelper(Object* target, uint32 field, char* typeStr, char* valStr);
|
||||
bool HandleSetValueHelper(Object* target, uint32 field, char* typeStr, char* valStr);
|
||||
template<typename T>
|
||||
void ShowNpcOrGoSpawnInformation(uint32 guid);
|
||||
template <typename T>
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ enum MangosStrings
|
|||
LANG_CURRENT_FACTION = 128,
|
||||
LANG_WRONG_FACTION = 129,
|
||||
LANG_YOU_CHANGE_FACTION = 130,
|
||||
LANG_YOU_CHANGE_SPELLFLATID = 131,
|
||||
LANG_YOURS_SPELLFLATID_CHANGED = 132,
|
||||
LANG_YOU_CHANGE_SPELLMODS = 131,
|
||||
LANG_YOURS_SPELLMODS_CHANGED = 132,
|
||||
LANG_YOU_GIVE_TAXIS = 133,
|
||||
LANG_YOU_REMOVE_TAXIS = 134,
|
||||
LANG_YOURS_TAXIS_ADDED = 135,
|
||||
|
|
@ -551,8 +551,8 @@ enum MangosStrings
|
|||
LANG_EXPLORE_AREA = 560,
|
||||
LANG_UNEXPLORE_AREA = 561,
|
||||
|
||||
LANG_UPDATE = 562,
|
||||
LANG_UPDATE_CHANGE = 563,
|
||||
// 562, // not used
|
||||
// 563, // not used
|
||||
LANG_TOO_BIG_INDEX = 564,
|
||||
LANG_SET_UINT = 565, //log
|
||||
LANG_SET_UINT_FIELD = 566,
|
||||
|
|
@ -564,8 +564,8 @@ enum MangosStrings
|
|||
LANG_GET_FLOAT_FIELD = 572,
|
||||
// 573, //not used
|
||||
// 574, //not used
|
||||
LANG_CHANGE_32BIT = 575, //log
|
||||
LANG_CHANGE_32BIT_FIELD = 576,
|
||||
LANG_CHANGE_INT32 = 575, //log
|
||||
LANG_CHANGE_INT32_FIELD = 576,
|
||||
|
||||
LANG_INVISIBLE_INVISIBLE = 577,
|
||||
LANG_INVISIBLE_VISIBLE = 578,
|
||||
|
|
@ -869,7 +869,15 @@ enum MangosStrings
|
|||
LANG_NPC_GO_INFO_EVENT_STRING = 1150,
|
||||
LANG_NPC_GO_INFO_POOL_EVENT_STRING = 1151,
|
||||
LANG_COMMAND_ITEM_USABLE = 1152,
|
||||
// Room for more level 3 1153-1199 not used
|
||||
LANG_GET_BITSTR = 1153, //log
|
||||
LANG_GET_BITSTR_FIELD = 1154,
|
||||
LANG_GET_HEX = 1155, //log
|
||||
LANG_GET_HEX_FIELD = 1156,
|
||||
LANG_CHANGE_HEX = 1157, //log
|
||||
LANG_CHANGE_HEX_FIELD = 1158,
|
||||
LANG_CHANGE_FLOAT = 1159, //log
|
||||
LANG_CHANGE_FLOAT_FIELD = 1160,
|
||||
// Room for more level 3 1161-1199 not used
|
||||
|
||||
// Debug commands
|
||||
LANG_CINEMATIC_NOT_EXIST = 1200,
|
||||
|
|
|
|||
|
|
@ -193,12 +193,10 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char *old_pass = strtok (args, " ");
|
||||
char *new_pass = strtok (NULL, " ");
|
||||
char *new_pass_c = strtok (NULL, " ");
|
||||
// allow or quoted string with possible spaces or literal without spaces
|
||||
char *old_pass = ExtractQuotedOrLiteralArg(&args);
|
||||
char *new_pass = ExtractQuotedOrLiteralArg(&args);
|
||||
char *new_pass_c = ExtractQuotedOrLiteralArg(&args);
|
||||
|
||||
if (!old_pass || !new_pass || !new_pass_c)
|
||||
return false;
|
||||
|
|
@ -252,28 +250,25 @@ bool ChatHandler::HandleAccountLockCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!*args)
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
return true;
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string argstr = args;
|
||||
if (argstr == "on")
|
||||
if (value)
|
||||
{
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%d'",GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
else
|
||||
{
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%d'",GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||
return true;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,35 +161,28 @@ bool ChatHandler::HandleGMCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string argstr = args;
|
||||
|
||||
if (argstr == "on")
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
m_session->GetPlayer()->SetGameMaster(true);
|
||||
m_session->SendNotification(LANG_GM_ON);
|
||||
#ifdef _DEBUG_VMAPS
|
||||
VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
vMapManager->processCommand("stoplog");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
{
|
||||
m_session->GetPlayer()->SetGameMaster(false);
|
||||
m_session->SendNotification(LANG_GM_OFF);
|
||||
#ifdef _DEBUG_VMAPS
|
||||
VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
vMapManager->processCommand("startlog");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value)
|
||||
{
|
||||
m_session->GetPlayer()->SetGameMaster(true);
|
||||
m_session->SendNotification(LANG_GM_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_session->GetPlayer()->SetGameMaster(false);
|
||||
m_session->SendNotification(LANG_GM_OFF);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Enables or disables hiding of the staff badge
|
||||
bool ChatHandler::HandleGMChatCommand(char* args)
|
||||
{
|
||||
|
|
@ -202,27 +195,28 @@ bool ChatHandler::HandleGMChatCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string argstr = args;
|
||||
|
||||
if (argstr == "on")
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
m_session->GetPlayer()->SetGMChat(true);
|
||||
m_session->SendNotification(LANG_GM_CHAT_ON);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
{
|
||||
m_session->GetPlayer()->SetGMChat(false);
|
||||
m_session->SendNotification(LANG_GM_CHAT_OFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value)
|
||||
{
|
||||
m_session->GetPlayer()->SetGMChat(true);
|
||||
m_session->SendNotification(LANG_GM_CHAT_ON);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_session->GetPlayer()->SetGMChat(false);
|
||||
m_session->SendNotification(LANG_GM_CHAT_OFF);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Enable\Dissable Invisible mode
|
||||
bool ChatHandler::HandleGMVisibleCommand(char* args)
|
||||
{
|
||||
|
|
@ -232,27 +226,28 @@ bool ChatHandler::HandleGMVisibleCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string argstr = args;
|
||||
|
||||
if (argstr == "on")
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
m_session->GetPlayer()->SetGMVisible(true);
|
||||
m_session->SendNotification(LANG_INVISIBLE_VISIBLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
{
|
||||
m_session->SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||
m_session->GetPlayer()->SetGMVisible(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value)
|
||||
{
|
||||
m_session->GetPlayer()->SetGMVisible(true);
|
||||
m_session->SendNotification(LANG_INVISIBLE_VISIBLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_session->SendNotification(LANG_INVISIBLE_INVISIBLE);
|
||||
m_session->GetPlayer()->SetGMVisible(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ChatHandler::HandleGPSCommand(char* args)
|
||||
|
|
@ -901,60 +896,6 @@ bool ChatHandler::HandleModifyFactionCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
//Edit Player Spell
|
||||
bool ChatHandler::HandleModifySpellCommand(char* args)
|
||||
{
|
||||
if(!*args) return false;
|
||||
char* pspellflatid = strtok(args, " ");
|
||||
if (!pspellflatid)
|
||||
return false;
|
||||
|
||||
char* pop = strtok(NULL, " ");
|
||||
if (!pop)
|
||||
return false;
|
||||
|
||||
char* pval = strtok(NULL, " ");
|
||||
if (!pval)
|
||||
return false;
|
||||
|
||||
uint16 mark;
|
||||
|
||||
char* pmark = strtok(NULL, " ");
|
||||
|
||||
uint8 spellflatid = atoi(pspellflatid);
|
||||
uint8 op = atoi(pop);
|
||||
uint16 val = atoi(pval);
|
||||
if(!pmark)
|
||||
mark = 65535;
|
||||
else
|
||||
mark = atoi(pmark);
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SPELLFLATID, spellflatid, val, mark, GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, GetNameLink().c_str(), spellflatid, val, mark);
|
||||
|
||||
WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1+1+2+2));
|
||||
data << uint8(spellflatid);
|
||||
data << uint8(op);
|
||||
data << uint16(val);
|
||||
data << uint16(mark);
|
||||
chr->GetSession()->SendPacket(&data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Edit Player TP
|
||||
bool ChatHandler::HandleModifyTalentCommand (char* args)
|
||||
{
|
||||
|
|
@ -1006,47 +947,37 @@ bool ChatHandler::HandleModifyTalentCommand (char* args)
|
|||
//Enable On\OFF all taxi paths
|
||||
bool ChatHandler::HandleTaxiCheatCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string argstr = args;
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
if (!chr)
|
||||
{
|
||||
chr=m_session->GetPlayer();
|
||||
}
|
||||
|
||||
// check online security
|
||||
else if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
if (argstr == "on")
|
||||
if (value)
|
||||
{
|
||||
chr->SetTaxiCheater(true);
|
||||
PSendSysMessage(LANG_YOU_GIVE_TAXIS, GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_ADDED, GetNameLink().c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (argstr == "off")
|
||||
else
|
||||
{
|
||||
chr->SetTaxiCheater(false);
|
||||
PSendSysMessage(LANG_YOU_REMOVE_TAXIS, GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_TAXIS_REMOVED, GetNameLink().c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Edit Player Aspeed
|
||||
|
|
@ -1628,61 +1559,6 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
//Edit Unit field
|
||||
bool ChatHandler::HandleModifyBitCommand(char* args)
|
||||
{
|
||||
if( !*args )
|
||||
return false;
|
||||
|
||||
Unit *unit = getSelectedUnit();
|
||||
if (!unit)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// check online security
|
||||
if (unit->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player *)unit, 0))
|
||||
return false;
|
||||
|
||||
char* pField = strtok(args, " ");
|
||||
if (!pField)
|
||||
return false;
|
||||
|
||||
char* pBit = strtok(NULL, " ");
|
||||
if (!pBit)
|
||||
return false;
|
||||
|
||||
uint16 field = atoi(pField);
|
||||
uint32 bit = atoi(pBit);
|
||||
|
||||
if (field < OBJECT_END || field >= unit->GetValuesCount())
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
if (bit < 1 || bit > 32)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( unit->HasFlag( field, (1<<(bit-1)) ) )
|
||||
{
|
||||
unit->RemoveFlag( field, (1<<(bit-1)) );
|
||||
PSendSysMessage(LANG_REMOVE_BIT, bit, field);
|
||||
}
|
||||
else
|
||||
{
|
||||
unit->SetFlag( field, (1<<(bit-1)) );
|
||||
PSendSysMessage(LANG_SET_BIT, bit, field);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleModifyHonorCommand (char* args)
|
||||
{
|
||||
if (!*args)
|
||||
|
|
@ -1805,11 +1681,7 @@ bool ChatHandler::HandleLookupTeleCommand(char * args)
|
|||
return false;
|
||||
}
|
||||
|
||||
char const* str = strtok(args, " ");
|
||||
if(!str)
|
||||
return false;
|
||||
|
||||
std::string namepart = str;
|
||||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if(!Utf8toWStr(namepart,wnamepart))
|
||||
|
|
@ -1851,28 +1723,30 @@ bool ChatHandler::HandleWhispersCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
std::string argstr = args;
|
||||
// whisper on
|
||||
if (argstr == "on")
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
m_session->GetPlayer()->SetAcceptWhispers(true);
|
||||
SendSysMessage(LANG_COMMAND_WHISPERON);
|
||||
return true;
|
||||
}
|
||||
|
||||
// whisper off
|
||||
if (argstr == "off")
|
||||
{
|
||||
m_session->GetPlayer()->SetAcceptWhispers(false);
|
||||
SendSysMessage(LANG_COMMAND_WHISPEROFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// whisper on
|
||||
if (value)
|
||||
{
|
||||
m_session->GetPlayer()->SetAcceptWhispers(true);
|
||||
SendSysMessage(LANG_COMMAND_WHISPERON);
|
||||
}
|
||||
// whisper off
|
||||
else
|
||||
{
|
||||
m_session->GetPlayer()->SetAcceptWhispers(false);
|
||||
SendSysMessage(LANG_COMMAND_WHISPEROFF);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Save all players in the world
|
||||
bool ChatHandler::HandleSaveAllCommand(char* /*args*/)
|
||||
{
|
||||
|
|
@ -1921,7 +1795,7 @@ bool ChatHandler::HandleSendMailCommand(char* args)
|
|||
// teleport player to given game_tele.entry
|
||||
bool ChatHandler::HandleTeleNameCommand(char* args)
|
||||
{
|
||||
char* nameStr = ExtractOptArg(&args);
|
||||
char* nameStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
|
|
@ -2267,24 +2141,19 @@ bool ChatHandler::HandleGoCommand(char* args)
|
|||
//teleport at coordinates
|
||||
bool ChatHandler::HandleGoXYCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
char* pmapid = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
float x;
|
||||
if (!ExtractFloat(&args, x))
|
||||
return false;
|
||||
|
||||
float y;
|
||||
if (!ExtractFloat(&args, y))
|
||||
return false;
|
||||
|
||||
float x = (float)atof(px);
|
||||
float y = (float)atof(py);
|
||||
uint32 mapid;
|
||||
if (pmapid)
|
||||
mapid = (uint32)atoi(pmapid);
|
||||
else mapid = _player->GetMapId();
|
||||
if (!ExtractOptUInt32(&args, mapid, _player->GetMapId()))
|
||||
return false;
|
||||
|
||||
return HandleGoHelper(_player, mapid, x, y);
|
||||
}
|
||||
|
|
@ -2292,27 +2161,23 @@ bool ChatHandler::HandleGoXYCommand(char* args)
|
|||
//teleport at coordinates, including Z
|
||||
bool ChatHandler::HandleGoXYZCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
char* pmapid = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py || !pz)
|
||||
float x;
|
||||
if (!ExtractFloat(&args, x))
|
||||
return false;
|
||||
|
||||
float y;
|
||||
if (!ExtractFloat(&args, y))
|
||||
return false;
|
||||
|
||||
float z;
|
||||
if (!ExtractFloat(&args, z))
|
||||
return false;
|
||||
|
||||
float x = (float)atof(px);
|
||||
float y = (float)atof(py);
|
||||
float z = (float)atof(pz);
|
||||
uint32 mapid;
|
||||
if (pmapid)
|
||||
mapid = (uint32)atoi(pmapid);
|
||||
else
|
||||
mapid = _player->GetMapId();
|
||||
if (!ExtractOptUInt32(&args, mapid, _player->GetMapId()))
|
||||
return false;
|
||||
|
||||
return HandleGoHelper(_player, mapid, x, y, &z);
|
||||
}
|
||||
|
|
@ -2379,21 +2244,19 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args)
|
|||
//teleport to grid
|
||||
bool ChatHandler::HandleGoGridCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
char* pmapid = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
float grid_x;
|
||||
if (!ExtractFloat(&args, grid_x))
|
||||
return false;
|
||||
|
||||
float grid_x = (float)atof(px);
|
||||
float grid_y = (float)atof(py);
|
||||
uint32 mapid = pmapid ? (uint32)atoi(pmapid) : _player->GetMapId();
|
||||
float grid_y;
|
||||
if (!ExtractFloat(&args, grid_y))
|
||||
return false;
|
||||
|
||||
uint32 mapid;
|
||||
if (!ExtractOptUInt32(&args, mapid, _player->GetMapId()))
|
||||
return false;
|
||||
|
||||
// center of grid
|
||||
float x = (grid_x-CENTER_GRID_ID+0.5f)*SIZE_OF_GRIDS;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
|||
//mute player for some times
|
||||
bool ChatHandler::HandleMuteCommand(char* args)
|
||||
{
|
||||
char* nameStr = ExtractOptArg(&args);
|
||||
char* nameStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
|
|
@ -450,22 +450,14 @@ bool ChatHandler::HandleGoGraveyardCommand(char* args)
|
|||
{
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
||||
if (!*args)
|
||||
uint32 gyId;
|
||||
if (!ExtractUInt32(&args, gyId))
|
||||
return false;
|
||||
|
||||
char *gyId = strtok(args, " ");
|
||||
if (!gyId)
|
||||
return false;
|
||||
|
||||
int32 i_gyId = atoi(gyId);
|
||||
|
||||
if (!i_gyId)
|
||||
return false;
|
||||
|
||||
WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(i_gyId);
|
||||
WorldSafeLocsEntry const* gy = sWorldSafeLocsStore.LookupEntry(gyId);
|
||||
if (!gy)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST,i_gyId);
|
||||
PSendSysMessage(LANG_COMMAND_GRAVEYARDNOEXIST, gyId);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1114,7 +1106,10 @@ bool ChatHandler::HandleGameObjectPhaseCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleGameObjectNearCommand(char* args)
|
||||
{
|
||||
float distance = (!*args) ? 10.0f : (float)atof(args);
|
||||
float distance;
|
||||
if (!ExtractOptFloat(&args, distance, 10.0f))
|
||||
return false;
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
Player* pl = m_session->GetPlayer();
|
||||
|
|
@ -1895,9 +1890,6 @@ bool ChatHandler::HandleNpcMoveCommand(char* args)
|
|||
*/
|
||||
bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
// 3 arguments:
|
||||
// GUID (optional - you can also select the creature)
|
||||
// stay|random|way (determines the kind of movement)
|
||||
|
|
@ -1905,66 +1897,17 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
|
|||
// this is very handy if you want to do waypoints, that are
|
||||
// later switched on/off according to special events (like escort
|
||||
// quests, etc)
|
||||
char* guid_str = strtok(args, " ");
|
||||
char* type_str = strtok(NULL, " ");
|
||||
char* dontdel_str = strtok(NULL, " ");
|
||||
|
||||
bool doNotDelete = false;
|
||||
|
||||
if (!guid_str)
|
||||
return false;
|
||||
|
||||
uint32 lowguid = 0;
|
||||
Creature* pCreature = NULL;
|
||||
|
||||
if (dontdel_str)
|
||||
uint32 lowguid;
|
||||
Creature* pCreature;
|
||||
if (!ExtractUInt32(&args, lowguid)) // case .setmovetype $move_type (with selected creature)
|
||||
{
|
||||
//sLog.outError("DEBUG: All 3 params are set");
|
||||
|
||||
// All 3 params are set
|
||||
// GUID
|
||||
// type
|
||||
// doNotDEL
|
||||
if (stricmp(dontdel_str, "NODEL") == 0)
|
||||
{
|
||||
//sLog.outError("DEBUG: doNotDelete = true;");
|
||||
doNotDelete = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only 2 params - but maybe NODEL is set
|
||||
if (type_str)
|
||||
{
|
||||
sLog.outError("DEBUG: Only 2 params ");
|
||||
if (stricmp(type_str, "NODEL") == 0)
|
||||
{
|
||||
//sLog.outError("DEBUG: type_str, NODEL ");
|
||||
doNotDelete = true;
|
||||
type_str = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!type_str) // case .setmovetype $move_type (with selected creature)
|
||||
{
|
||||
type_str = guid_str;
|
||||
pCreature = getSelectedCreature();
|
||||
if (!pCreature || pCreature->isPet())
|
||||
return false;
|
||||
lowguid = pCreature->GetDBTableGUIDLow();
|
||||
}
|
||||
else // case .setmovetype #creature_guid $move_type (with selected creature)
|
||||
{
|
||||
lowguid = atoi((char*)guid_str);
|
||||
|
||||
/* impossible without entry
|
||||
if (lowguid)
|
||||
pCreature = ObjectAccessor::GetCreature(*m_session->GetPlayer(),MAKE_GUID(lowguid,HIGHGUID_UNIT));
|
||||
*/
|
||||
|
||||
// attempt check creature existence by DB data
|
||||
if (!pCreature)
|
||||
else // case .setmovetype #creature_guid $move_type (with guid)
|
||||
{
|
||||
CreatureData const* data = sObjectMgr.GetCreatureData(lowguid);
|
||||
if (!data)
|
||||
|
|
@ -1973,31 +1916,39 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
|
|||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Player* player = m_session->GetPlayer();
|
||||
|
||||
if (player->GetMapId() != data->mapid)
|
||||
{
|
||||
lowguid = pCreature->GetDBTableGUIDLow();
|
||||
}
|
||||
PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, lowguid);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// now lowguid is low guid really existing creature
|
||||
// and pCreature point (maybe) to this creature or NULL
|
||||
pCreature = player->GetMap()->GetCreature(ObjectGuid(HIGHGUID_UNIT, data->id, lowguid));
|
||||
}
|
||||
|
||||
MovementGeneratorType move_type;
|
||||
|
||||
std::string type = type_str;
|
||||
|
||||
if (type == "stay")
|
||||
char* type_str = ExtractLiteralArg(&args);
|
||||
if (strncmp(type_str, "stay", strlen(type_str)) == 0)
|
||||
move_type = IDLE_MOTION_TYPE;
|
||||
else if (type == "random")
|
||||
else if (strncmp(type_str, "random", strlen(type_str)) == 0)
|
||||
move_type = RANDOM_MOTION_TYPE;
|
||||
else if (type == "way")
|
||||
else if (strncmp(type_str, "way", strlen(type_str)) == 0)
|
||||
move_type = WAYPOINT_MOTION_TYPE;
|
||||
else
|
||||
return false;
|
||||
|
||||
bool doNotDelete = ExtractLiteralArg(&args, "NODEL") != NULL;
|
||||
if (!doNotDelete && *args) // need fail if false in result wrong literal
|
||||
return false;
|
||||
|
||||
// now lowguid is low guid really existing creature
|
||||
// and pCreature point (maybe) to this creature or NULL
|
||||
|
||||
// update movement type
|
||||
if (doNotDelete == false)
|
||||
if (!doNotDelete)
|
||||
sWaypointMgr.DeletePath(lowguid);
|
||||
|
||||
if (pCreature)
|
||||
|
|
@ -2011,14 +1962,11 @@ bool ChatHandler::HandleNpcSetMoveTypeCommand(char* args)
|
|||
}
|
||||
pCreature->SaveToDB();
|
||||
}
|
||||
if (doNotDelete == false)
|
||||
{
|
||||
PSendSysMessage(LANG_MOVE_TYPE_SET,type_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (doNotDelete)
|
||||
PSendSysMessage(LANG_MOVE_TYPE_SET_NODEL,type_str);
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_MOVE_TYPE_SET,type_str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2128,34 +2076,23 @@ bool ChatHandler::HandleNpcSpawnDistCommand(char* args)
|
|||
//spawn time handling
|
||||
bool ChatHandler::HandleNpcSpawnTimeCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
uint32 stime;
|
||||
if (!ExtractUInt32(&args, stime))
|
||||
return false;
|
||||
|
||||
char* stime = strtok(args, " ");
|
||||
|
||||
if (!stime)
|
||||
return false;
|
||||
|
||||
int i_stime = atoi(stime);
|
||||
|
||||
if (i_stime < 0)
|
||||
Creature *pCreature = getSelectedCreature();
|
||||
if (!pCreature)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
PSendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature *pCreature = getSelectedCreature();
|
||||
uint32 u_guidlow = 0;
|
||||
uint32 u_guidlow = pCreature->GetDBTableGUIDLow();
|
||||
|
||||
if (pCreature)
|
||||
u_guidlow = pCreature->GetDBTableGUIDLow();
|
||||
else
|
||||
return false;
|
||||
|
||||
WorldDatabase.PExecuteLog("UPDATE creature SET spawntimesecs=%i WHERE guid=%u",i_stime,u_guidlow);
|
||||
pCreature->SetRespawnDelay((uint32)i_stime);
|
||||
PSendSysMessage(LANG_COMMAND_SPAWNTIME,i_stime);
|
||||
WorldDatabase.PExecuteLog("UPDATE creature SET spawntimesecs=%i WHERE guid=%u", stime, u_guidlow);
|
||||
pCreature->SetRespawnDelay(stime);
|
||||
PSendSysMessage(LANG_COMMAND_SPAWNTIME, stime);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2314,8 +2251,13 @@ bool ChatHandler::HandleNpcSetPhaseCommand(char* args)
|
|||
//npc deathstate handling
|
||||
bool ChatHandler::HandleNpcSetDeathStateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature* pCreature = getSelectedCreature();
|
||||
if (!pCreature || pCreature->isPet())
|
||||
|
|
@ -2325,16 +2267,10 @@ bool ChatHandler::HandleNpcSetDeathStateCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (strncmp(args, "on", 3) == 0)
|
||||
if (value)
|
||||
pCreature->SetDeadByDefault(true);
|
||||
else if (strncmp(args, "off", 4) == 0)
|
||||
pCreature->SetDeadByDefault(false);
|
||||
else
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
pCreature->SetDeadByDefault(false);
|
||||
|
||||
pCreature->SaveToDB();
|
||||
pCreature->Respawn();
|
||||
|
|
@ -4079,11 +4015,10 @@ bool ChatHandler::HandleCharacterReputationCommand(char* args)
|
|||
//change standstate
|
||||
bool ChatHandler::HandleModifyStandStateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
uint32 anim_id;
|
||||
if (!ExtractUInt32(&args, anim_id))
|
||||
return false;
|
||||
|
||||
uint32 anim_id = atoi(args);
|
||||
|
||||
if (!sEmotesStore.LookupEntry(anim_id))
|
||||
return false;
|
||||
|
||||
|
|
@ -4752,8 +4687,13 @@ bool ChatHandler::HandleRepairitemsCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleWaterwalkCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player *player = getSelectedPlayer();
|
||||
|
||||
|
|
@ -4768,15 +4708,10 @@ bool ChatHandler::HandleWaterwalkCommand(char* args)
|
|||
if (HasLowerSecurity(player, 0))
|
||||
return false;
|
||||
|
||||
if (strncmp(args, "on", 3) == 0)
|
||||
if (value)
|
||||
player->SetMovement(MOVE_WATER_WALK); // ON
|
||||
else if (strncmp(args, "off", 4) == 0)
|
||||
player->SetMovement(MOVE_LAND_WALK); // OFF
|
||||
else
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
player->SetMovement(MOVE_LAND_WALK); // OFF
|
||||
|
||||
PSendSysMessage(LANG_YOU_SET_WATERWALK, args, GetNameLink(player).c_str());
|
||||
if (needReportToTarget(player))
|
||||
|
|
|
|||
|
|
@ -56,40 +56,40 @@
|
|||
//reload commands
|
||||
bool ChatHandler::HandleReloadAllCommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadSkillFishingBaseLevelCommand("");
|
||||
HandleReloadSkillFishingBaseLevelCommand((char*)"");
|
||||
|
||||
HandleReloadAllAchievementCommand("");
|
||||
HandleReloadAllAreaCommand("");
|
||||
HandleReloadAllEventAICommand("");
|
||||
HandleReloadAllLootCommand("");
|
||||
HandleReloadAllNpcCommand("");
|
||||
HandleReloadAllQuestCommand("");
|
||||
HandleReloadAllSpellCommand("");
|
||||
HandleReloadAllItemCommand("");
|
||||
HandleReloadAllGossipsCommand("");
|
||||
HandleReloadAllLocalesCommand("");
|
||||
HandleReloadAllAchievementCommand((char*)"");
|
||||
HandleReloadAllAreaCommand((char*)"");
|
||||
HandleReloadAllEventAICommand((char*)"");
|
||||
HandleReloadAllLootCommand((char*)"");
|
||||
HandleReloadAllNpcCommand((char*)"");
|
||||
HandleReloadAllQuestCommand((char*)"");
|
||||
HandleReloadAllSpellCommand((char*)"");
|
||||
HandleReloadAllItemCommand((char*)"");
|
||||
HandleReloadAllGossipsCommand((char*)"");
|
||||
HandleReloadAllLocalesCommand((char*)"");
|
||||
|
||||
HandleReloadMailLevelRewardCommand("");
|
||||
HandleReloadCommandCommand("");
|
||||
HandleReloadReservedNameCommand("");
|
||||
HandleReloadMangosStringCommand("");
|
||||
HandleReloadGameTeleCommand("");
|
||||
HandleReloadMailLevelRewardCommand((char*)"");
|
||||
HandleReloadCommandCommand((char*)"");
|
||||
HandleReloadReservedNameCommand((char*)"");
|
||||
HandleReloadMangosStringCommand((char*)"");
|
||||
HandleReloadGameTeleCommand((char*)"");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllAchievementCommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadAchievementCriteriaRequirementCommand("");
|
||||
HandleReloadAchievementRewardCommand("");
|
||||
HandleReloadAchievementCriteriaRequirementCommand((char*)"");
|
||||
HandleReloadAchievementRewardCommand((char*)"");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllAreaCommand(char* /*args*/)
|
||||
{
|
||||
//HandleReloadQuestAreaTriggersCommand(""); -- reloaded in HandleReloadAllQuestCommand
|
||||
HandleReloadAreaTriggerTeleportCommand("");
|
||||
HandleReloadAreaTriggerTavernCommand("");
|
||||
HandleReloadGameGraveyardZoneCommand("");
|
||||
//HandleReloadQuestAreaTriggersCommand((char*)""); -- reloaded in HandleReloadAllQuestCommand
|
||||
HandleReloadAreaTriggerTeleportCommand((char*)"");
|
||||
HandleReloadAreaTriggerTavernCommand((char*)"");
|
||||
HandleReloadGameGraveyardZoneCommand((char*)"");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -104,19 +104,19 @@ bool ChatHandler::HandleReloadAllLootCommand(char* /*args*/)
|
|||
bool ChatHandler::HandleReloadAllNpcCommand(char* args)
|
||||
{
|
||||
if (*args!='a') // will be reloaded from all_gossips
|
||||
HandleReloadNpcGossipCommand("a");
|
||||
HandleReloadNpcTrainerCommand("a");
|
||||
HandleReloadNpcVendorCommand("a");
|
||||
HandleReloadPointsOfInterestCommand("a");
|
||||
HandleReloadSpellClickSpellsCommand("a");
|
||||
HandleReloadNpcGossipCommand((char*)"a");
|
||||
HandleReloadNpcTrainerCommand((char*)"a");
|
||||
HandleReloadNpcVendorCommand((char*)"a");
|
||||
HandleReloadPointsOfInterestCommand((char*)"a");
|
||||
HandleReloadSpellClickSpellsCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllQuestCommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadQuestAreaTriggersCommand("a");
|
||||
HandleReloadQuestPOICommand("a");
|
||||
HandleReloadQuestTemplateCommand("a");
|
||||
HandleReloadQuestAreaTriggersCommand((char*)"a");
|
||||
HandleReloadQuestPOICommand((char*)"a");
|
||||
HandleReloadQuestTemplateCommand((char*)"a");
|
||||
|
||||
sLog.outString( "Re-Loading Quests Relations..." );
|
||||
sObjectMgr.LoadQuestRelations();
|
||||
|
|
@ -134,73 +134,73 @@ bool ChatHandler::HandleReloadAllScriptsCommand(char* /*args*/)
|
|||
}
|
||||
|
||||
sLog.outString( "Re-Loading Scripts..." );
|
||||
HandleReloadGameObjectScriptsCommand("a");
|
||||
HandleReloadGossipScriptsCommand("a");
|
||||
HandleReloadEventScriptsCommand("a");
|
||||
HandleReloadQuestEndScriptsCommand("a");
|
||||
HandleReloadQuestStartScriptsCommand("a");
|
||||
HandleReloadSpellScriptsCommand("a");
|
||||
HandleReloadGameObjectScriptsCommand((char*)"a");
|
||||
HandleReloadGossipScriptsCommand((char*)"a");
|
||||
HandleReloadEventScriptsCommand((char*)"a");
|
||||
HandleReloadQuestEndScriptsCommand((char*)"a");
|
||||
HandleReloadQuestStartScriptsCommand((char*)"a");
|
||||
HandleReloadSpellScriptsCommand((char*)"a");
|
||||
SendGlobalSysMessage("DB tables `*_scripts` reloaded.");
|
||||
HandleReloadDbScriptStringCommand("a");
|
||||
HandleReloadDbScriptStringCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllEventAICommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadEventAITextsCommand("a");
|
||||
HandleReloadEventAISummonsCommand("a");
|
||||
HandleReloadEventAIScriptsCommand("a");
|
||||
HandleReloadEventAITextsCommand((char*)"a");
|
||||
HandleReloadEventAISummonsCommand((char*)"a");
|
||||
HandleReloadEventAIScriptsCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllSpellCommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadSkillDiscoveryTemplateCommand("a");
|
||||
HandleReloadSkillExtraItemTemplateCommand("a");
|
||||
HandleReloadSpellAreaCommand("a");
|
||||
HandleReloadSpellChainCommand("a");
|
||||
HandleReloadSpellElixirCommand("a");
|
||||
HandleReloadSpellLearnSpellCommand("a");
|
||||
HandleReloadSpellProcEventCommand("a");
|
||||
HandleReloadSpellBonusesCommand("a");
|
||||
HandleReloadSpellProcItemEnchantCommand("a");
|
||||
HandleReloadSpellScriptTargetCommand("a");
|
||||
HandleReloadSpellTargetPositionCommand("a");
|
||||
HandleReloadSpellThreatsCommand("a");
|
||||
HandleReloadSpellPetAurasCommand("a");
|
||||
HandleReloadSkillDiscoveryTemplateCommand((char*)"a");
|
||||
HandleReloadSkillExtraItemTemplateCommand((char*)"a");
|
||||
HandleReloadSpellAreaCommand((char*)"a");
|
||||
HandleReloadSpellChainCommand((char*)"a");
|
||||
HandleReloadSpellElixirCommand((char*)"a");
|
||||
HandleReloadSpellLearnSpellCommand((char*)"a");
|
||||
HandleReloadSpellProcEventCommand((char*)"a");
|
||||
HandleReloadSpellBonusesCommand((char*)"a");
|
||||
HandleReloadSpellProcItemEnchantCommand((char*)"a");
|
||||
HandleReloadSpellScriptTargetCommand((char*)"a");
|
||||
HandleReloadSpellTargetPositionCommand((char*)"a");
|
||||
HandleReloadSpellThreatsCommand((char*)"a");
|
||||
HandleReloadSpellPetAurasCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllGossipsCommand(char* args)
|
||||
{
|
||||
HandleReloadGossipMenuCommand("a");
|
||||
HandleReloadGossipMenuOptionCommand("a");
|
||||
HandleReloadGossipMenuCommand((char*)"a");
|
||||
HandleReloadGossipMenuOptionCommand((char*)"a");
|
||||
if (*args!='a') // already reload from all_scripts
|
||||
HandleReloadGossipScriptsCommand("a");
|
||||
HandleReloadNpcGossipCommand("a");
|
||||
HandleReloadPointsOfInterestCommand("a");
|
||||
HandleReloadGossipScriptsCommand((char*)"a");
|
||||
HandleReloadNpcGossipCommand((char*)"a");
|
||||
HandleReloadPointsOfInterestCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllItemCommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadPageTextsCommand("a");
|
||||
HandleReloadItemEnchantementsCommand("a");
|
||||
HandleReloadItemRequiredTragetCommand("a");
|
||||
HandleReloadPageTextsCommand((char*)"a");
|
||||
HandleReloadItemEnchantementsCommand((char*)"a");
|
||||
HandleReloadItemRequiredTragetCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleReloadAllLocalesCommand(char* /*args*/)
|
||||
{
|
||||
HandleReloadLocalesAchievementRewardCommand("a");
|
||||
HandleReloadLocalesCreatureCommand("a");
|
||||
HandleReloadLocalesGameobjectCommand("a");
|
||||
HandleReloadLocalesGossipMenuOptionCommand("a");
|
||||
HandleReloadLocalesItemCommand("a");
|
||||
HandleReloadLocalesNpcTextCommand("a");
|
||||
HandleReloadLocalesPageTextCommand("a");
|
||||
HandleReloadLocalesPointsOfInterestCommand("a");
|
||||
HandleReloadLocalesQuestCommand("a");
|
||||
HandleReloadLocalesAchievementRewardCommand((char*)"a");
|
||||
HandleReloadLocalesCreatureCommand((char*)"a");
|
||||
HandleReloadLocalesGameobjectCommand((char*)"a");
|
||||
HandleReloadLocalesGossipMenuOptionCommand((char*)"a");
|
||||
HandleReloadLocalesItemCommand((char*)"a");
|
||||
HandleReloadLocalesNpcTextCommand((char*)"a");
|
||||
HandleReloadLocalesPageTextCommand((char*)"a");
|
||||
HandleReloadLocalesPointsOfInterestCommand((char*)"a");
|
||||
HandleReloadLocalesQuestCommand((char*)"a");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -918,7 +918,7 @@ bool ChatHandler::HandleLoadScriptsCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleAccountSetGmLevelCommand(char* args)
|
||||
{
|
||||
char* accountStr = ExtractOptArg(&args);
|
||||
char* accountStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
std::string targetAccountName;
|
||||
Player* targetPlayer = NULL;
|
||||
|
|
@ -979,8 +979,12 @@ bool ChatHandler::HandleAccountSetPasswordCommand(char* args)
|
|||
if (!targetAccountId)
|
||||
return false;
|
||||
|
||||
char *szPassword1 = strtok (NULL," ");
|
||||
char *szPassword2 = strtok (NULL," ");
|
||||
// FIXME: temporary added until extractAccountId convertion to char** way
|
||||
args = strtok (NULL,"");
|
||||
|
||||
// allow or quoted string with possible spaces or literal without spaces
|
||||
char *szPassword1 = ExtractQuotedOrLiteralArg(&args);
|
||||
char *szPassword2 = ExtractQuotedOrLiteralArg(&args);
|
||||
if (!szPassword1 || !szPassword2)
|
||||
return false;
|
||||
|
||||
|
|
@ -1837,8 +1841,8 @@ bool ChatHandler::HandleLearnAllGMCommand(char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleLearnAllMyClassCommand(char* /*args*/)
|
||||
{
|
||||
HandleLearnAllMySpellsCommand("");
|
||||
HandleLearnAllMyTalentsCommand("");
|
||||
HandleLearnAllMySpellsCommand((char*)"");
|
||||
HandleLearnAllMyTalentsCommand((char*)"");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3359,7 +3363,7 @@ bool ChatHandler::HandleGuildUninviteCommand(char *args)
|
|||
|
||||
bool ChatHandler::HandleGuildRankCommand(char *args)
|
||||
{
|
||||
char* nameStr = ExtractOptArg(&args);
|
||||
char* nameStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
Player* target;
|
||||
uint64 target_guid;
|
||||
|
|
@ -3651,24 +3655,18 @@ bool ChatHandler::HandleUnAuraCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleLinkGraveCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
uint32 g_id;
|
||||
if (!ExtractUInt32(&args, g_id))
|
||||
return false;
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
if (!px)
|
||||
return false;
|
||||
|
||||
uint32 g_id = (uint32)atoi(px);
|
||||
char* teamStr = ExtractLiteralArg(&args);
|
||||
|
||||
uint32 g_team;
|
||||
|
||||
char* px2 = strtok(NULL, " ");
|
||||
|
||||
if (!px2)
|
||||
if (!teamStr)
|
||||
g_team = 0;
|
||||
else if (strncmp(px2,"horde",6)==0)
|
||||
else if (strncmp(teamStr, "horde", strlen(teamStr))==0)
|
||||
g_team = HORDE;
|
||||
else if (strncmp(px2,"alliance",9)==0)
|
||||
else if (strncmp(teamStr, "alliance", strlen(teamStr))==0)
|
||||
g_team = ALLIANCE;
|
||||
else
|
||||
return false;
|
||||
|
|
@ -3988,12 +3986,9 @@ bool ChatHandler::HandleExploreCheatCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleHoverCommand(char* args)
|
||||
{
|
||||
char* px = strtok(args, " ");
|
||||
uint32 flag;
|
||||
if (!px)
|
||||
flag = 1;
|
||||
else
|
||||
flag = atoi(px);
|
||||
if (!ExtractOptUInt32(&args, flag, 1))
|
||||
return false;
|
||||
|
||||
m_session->GetPlayer()->SetHover(flag);
|
||||
|
||||
|
|
@ -4032,7 +4027,7 @@ void ChatHandler::HandleCharacterLevel(Player* player, uint64 player_guid, uint3
|
|||
|
||||
bool ChatHandler::HandleCharacterLevelCommand(char* args)
|
||||
{
|
||||
char* nameStr = ExtractOptArg(&args);
|
||||
char* nameStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
int32 newlevel;
|
||||
bool nolevel = false;
|
||||
|
|
@ -4085,7 +4080,7 @@ bool ChatHandler::HandleLevelUpCommand(char* args)
|
|||
|
||||
if (*args)
|
||||
{
|
||||
nameStr = ExtractOptArg(&args);
|
||||
nameStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
// exception opt second arg: .levelup $name
|
||||
if (!ExtractInt32(&args, addlevel))
|
||||
|
|
@ -5073,17 +5068,19 @@ bool ChatHandler::HandleBanHelper(BanMode mode, char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cnameOrIP = strtok(args, " ");
|
||||
char* cnameOrIP = ExtractArg(&args);
|
||||
if (!cnameOrIP)
|
||||
return false;
|
||||
|
||||
std::string nameOrIP = cnameOrIP;
|
||||
|
||||
char* duration = strtok (NULL," ");
|
||||
if(!duration || !atoi(duration))
|
||||
char* duration = ExtractArg(&args); // time string
|
||||
if(!duration)
|
||||
return false;
|
||||
|
||||
char* reason = strtok (NULL,"");
|
||||
uint32 duration_secs = TimeStringToSecs(duration);
|
||||
|
||||
char* reason = ExtractArg(&args);
|
||||
if(!reason)
|
||||
return false;
|
||||
|
||||
|
|
@ -5111,11 +5108,11 @@ bool ChatHandler::HandleBanHelper(BanMode mode, char* args)
|
|||
break;
|
||||
}
|
||||
|
||||
switch(sWorld.BanAccount(mode, nameOrIP, duration, reason,m_session ? m_session->GetPlayerName() : ""))
|
||||
switch(sWorld.BanAccount(mode, nameOrIP, duration_secs, reason,m_session ? m_session->GetPlayerName() : ""))
|
||||
{
|
||||
case BAN_SUCCESS:
|
||||
if(atoi(duration)>0)
|
||||
PSendSysMessage(LANG_BAN_YOUBANNED,nameOrIP.c_str(),secsToTimeString(TimeStringToSecs(duration),true).c_str(),reason);
|
||||
if (duration_secs > 0)
|
||||
PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(duration_secs,true).c_str(), reason);
|
||||
else
|
||||
PSendSysMessage(LANG_BAN_YOUPERMBANNED, nameOrIP.c_str(), reason);
|
||||
break;
|
||||
|
|
@ -5161,7 +5158,7 @@ bool ChatHandler::HandleUnBanHelper(BanMode mode, char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* cnameOrIP = strtok(args, " ");
|
||||
char* cnameOrIP = ExtractArg(&args);
|
||||
if (!cnameOrIP)
|
||||
return false;
|
||||
|
||||
|
|
@ -5521,23 +5518,20 @@ bool ChatHandler::HandleRespawnCommand(char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleGMFlyCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
bool value;
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player *target = getSelectedPlayer();
|
||||
if (!target)
|
||||
target = m_session->GetPlayer();
|
||||
|
||||
WorldPacket data(12);
|
||||
if (strncmp(args, "on", 3) == 0)
|
||||
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
|
||||
else if (strncmp(args, "off", 4) == 0)
|
||||
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
|
||||
else
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
return false;
|
||||
}
|
||||
data.SetOpcode(value ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY);
|
||||
data << target->GetPackGUID();
|
||||
data << uint32(0); // unknown
|
||||
target->SendMessageToSet(&data, true);
|
||||
|
|
@ -6306,7 +6300,7 @@ bool ChatHandler::HandleAccountCharactersCommand(char* args)
|
|||
bool ChatHandler::HandleAccountSetAddonCommand(char* args)
|
||||
{
|
||||
///- Get the command line arguments
|
||||
char* accountStr = ExtractOptArg(&args);
|
||||
char* accountStr = ExtractOptNotLastArg(&args);
|
||||
|
||||
std::string account_name;
|
||||
uint32 account_id = extractAccountId(accountStr, &account_name);
|
||||
|
|
|
|||
|
|
@ -1649,15 +1649,14 @@ void World::KickAllLess(AccountTypes sec)
|
|||
itr->second->KickPlayer();
|
||||
}
|
||||
|
||||
/// 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)
|
||||
/// Ban an account or ban an IP address, duration_secs if it is positive used, otherwise permban
|
||||
BanReturn World::BanAccount(BanMode mode, std::string nameOrIP, uint32 duration_secs, std::string reason, std::string author)
|
||||
{
|
||||
LoginDatabase.escape_string(nameOrIP);
|
||||
LoginDatabase.escape_string(reason);
|
||||
std::string safe_author=author;
|
||||
LoginDatabase.escape_string(safe_author);
|
||||
|
||||
uint32 duration_secs = TimeStringToSecs(duration);
|
||||
QueryResult *resultAccounts = NULL; //used for kicking
|
||||
|
||||
///- Update the database with ban information
|
||||
|
|
|
|||
|
|
@ -564,7 +564,7 @@ class World
|
|||
|
||||
void KickAll();
|
||||
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, uint32 duration_secs, std::string reason, std::string author);
|
||||
bool RemoveBanAccount(BanMode mode, std::string nameOrIP);
|
||||
|
||||
uint32 IncreaseScheduledScriptsCount() { return (uint32)++m_scheduledScripts; }
|
||||
|
|
|
|||
|
|
@ -38,27 +38,25 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
if (!px)
|
||||
uint32 failnum;
|
||||
if (!ExtractUInt32(&args, failnum) || failnum > 255)
|
||||
return false;
|
||||
|
||||
uint8 failnum = (uint8)atoi(px);
|
||||
if (failnum==0 && *px!='0')
|
||||
uint32 failarg1;
|
||||
if (!ExtractOptUInt32(&args, failarg1, 0))
|
||||
return false;
|
||||
|
||||
char* p1 = strtok(NULL, " ");
|
||||
uint8 failarg1 = p1 ? (uint8)atoi(p1) : 0;
|
||||
|
||||
char* p2 = strtok(NULL, " ");
|
||||
uint8 failarg2 = p2 ? (uint8)atoi(p2) : 0;
|
||||
uint32 failarg2;
|
||||
if (!ExtractOptUInt32(&args, failarg2, 0))
|
||||
return false;
|
||||
|
||||
WorldPacket data(SMSG_CAST_FAILED, 5);
|
||||
data << uint8(0);
|
||||
data << uint32(133);
|
||||
data << uint8(failnum);
|
||||
if (p1 || p2)
|
||||
if (failarg1 || failarg2)
|
||||
data << uint32(failarg1);
|
||||
if (p2)
|
||||
if (failarg2)
|
||||
data << uint32(failarg2);
|
||||
|
||||
m_session->SendPacket(&data);
|
||||
|
|
@ -68,9 +66,6 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *pPlayer = m_session->GetPlayer();
|
||||
Unit* target = getSelectedUnit();
|
||||
if (!target)
|
||||
|
|
@ -79,13 +74,13 @@ bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
char* icon_text = strtok(args, " ");
|
||||
char* flags_text = strtok(NULL, " ");
|
||||
if (!icon_text || !flags_text)
|
||||
uint32 icon;
|
||||
if (!ExtractUInt32(&args, icon))
|
||||
return false;
|
||||
|
||||
uint32 icon = atol(icon_text);
|
||||
uint32 flags = atol(flags_text);
|
||||
uint32 flags;
|
||||
if (!ExtractUInt32(&args, flags))
|
||||
return false;
|
||||
|
||||
DETAIL_LOG("Command : POI, NPC = %u, icon = %u flags = %u", target->GetGUIDLow(), icon,flags);
|
||||
pPlayer->PlayerTalkClass->SendPointOfInterest(target->GetPositionX(), target->GetPositionY(), Poi_Icon(icon), flags, 30, "Test POI");
|
||||
|
|
@ -201,14 +196,14 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleDebugUpdateWorldStateCommand(char* args)
|
||||
{
|
||||
char* w = strtok(args, " ");
|
||||
char* s = strtok(NULL, " ");
|
||||
|
||||
if (!w || !s)
|
||||
uint32 world;
|
||||
if (!ExtractUInt32(&args, world))
|
||||
return false;
|
||||
|
||||
uint32 state;
|
||||
if (!ExtractUInt32(&args, state))
|
||||
return false;
|
||||
|
||||
uint32 world = (uint32)atoi(w);
|
||||
uint32 state = (uint32)atoi(s);
|
||||
m_session->GetPlayer()->SendUpdateWorldState(world, state);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -217,14 +212,9 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(char* args)
|
|||
{
|
||||
// USAGE: .debug play cinematic #cinematicid
|
||||
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
uint32 dwId;
|
||||
if (!ExtractUInt32(&args, dwId))
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 dwId = atoi(args);
|
||||
|
||||
if (!sCinematicSequencesStore.LookupEntry(dwId))
|
||||
{
|
||||
|
|
@ -241,14 +231,9 @@ bool ChatHandler::HandleDebugPlayMovieCommand(char* args)
|
|||
{
|
||||
// USAGE: .debug play movie #movieid
|
||||
// #movieid - ID decimal number from Movie.dbc (1st column)
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
uint32 dwId;
|
||||
if (!ExtractUInt32(&args, dwId))
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 dwId = atoi(args);
|
||||
|
||||
if (!sMovieStore.LookupEntry(dwId))
|
||||
{
|
||||
|
|
@ -266,14 +251,9 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
|||
{
|
||||
// USAGE: .debug playsound #soundid
|
||||
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
uint32 dwSoundId;
|
||||
if (!ExtractUInt32(&args, dwSoundId))
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 dwSoundId = atoi(args);
|
||||
|
||||
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||
{
|
||||
|
|
@ -302,14 +282,14 @@ bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
|||
//Send notification in channel
|
||||
bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
const char *name = "test";
|
||||
|
||||
uint32 code;
|
||||
if (!ExtractUInt32(&args, code) || code > 255)
|
||||
return false;
|
||||
|
||||
const char *name = "test";
|
||||
uint8 code = atoi(args);
|
||||
|
||||
WorldPacket data(SMSG_CHANNEL_NOTIFY, (1+10));
|
||||
data << code; // notify type
|
||||
data << uint8(code); // notify type
|
||||
data << name; // channel name
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
|
|
@ -320,11 +300,12 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args)
|
|||
//Send notification in chat
|
||||
bool ChatHandler::HandleDebugSendChatMsgCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
const char *msg = "testtest";
|
||||
|
||||
uint32 type;
|
||||
if (!ExtractUInt32(&args, type) || type > 255)
|
||||
return false;
|
||||
|
||||
const char *msg = "testtest";
|
||||
uint8 type = atoi(args);
|
||||
WorldPacket data;
|
||||
ChatHandler::FillMessageData(&data, m_session, type, 0, "chan", m_session->GetPlayer()->GetGUID(), msg, m_session->GetPlayer());
|
||||
m_session->SendPacket(&data);
|
||||
|
|
@ -333,7 +314,10 @@ bool ChatHandler::HandleDebugSendChatMsgCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(char* args)
|
||||
{
|
||||
uint32 msg = atol(args);
|
||||
uint32 msg;
|
||||
if (!ExtractUInt32(&args, msg))
|
||||
return false;
|
||||
|
||||
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -612,25 +596,19 @@ bool ChatHandler::HandleDebugArenaCommand(char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleDebugSpawnVehicleCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
uint32 entry;
|
||||
if (!ExtractUInt32(&args, entry))
|
||||
return false;
|
||||
|
||||
char* e = strtok(args, " ");
|
||||
char* i = strtok(NULL, " ");
|
||||
|
||||
if (!e || !i)
|
||||
uint32 id;
|
||||
if (!ExtractUInt32(&args, id))
|
||||
return false;
|
||||
|
||||
uint32 entry = (uint32)atoi(e);
|
||||
uint32 id = (uint32)atoi(i);
|
||||
|
||||
CreatureInfo const *ci = ObjectMgr::GetCreatureTemplate(entry);
|
||||
|
||||
if (!ci)
|
||||
return false;
|
||||
|
||||
VehicleEntry const *ve = sVehicleStore.LookupEntry(id);
|
||||
|
||||
if (!ve)
|
||||
return false;
|
||||
|
||||
|
|
@ -687,83 +665,22 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetItemValueCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok(args, " ");
|
||||
char* f = strtok(NULL, " ");
|
||||
|
||||
if (!e || !f)
|
||||
return false;
|
||||
|
||||
uint32 guid = (uint32)atoi(e);
|
||||
uint32 index = (uint32)atoi(f);
|
||||
|
||||
Item *i = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
|
||||
if (!i)
|
||||
return false;
|
||||
|
||||
if (index >= i->GetValuesCount())
|
||||
return false;
|
||||
|
||||
uint32 value = i->GetUInt32Value(index);
|
||||
|
||||
PSendSysMessage("Item %u: value at %u is %u", guid, index, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetItemValueCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok(args, " ");
|
||||
char* f = strtok(NULL, " ");
|
||||
char* g = strtok(NULL, " ");
|
||||
|
||||
if (!e || !f || !g)
|
||||
return false;
|
||||
|
||||
uint32 guid = (uint32)atoi(e);
|
||||
uint32 index = (uint32)atoi(f);
|
||||
uint32 value = (uint32)atoi(g);
|
||||
|
||||
Item *i = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
|
||||
if (!i)
|
||||
return false;
|
||||
|
||||
if (index >= i->GetValuesCount())
|
||||
return false;
|
||||
|
||||
i->SetUInt32Value(index, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//show animation
|
||||
bool ChatHandler::HandleDebugAnimCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
uint32 emote_id;
|
||||
if (!ExtractUInt32(&args, emote_id))
|
||||
return false;
|
||||
|
||||
uint32 emote_id = atoi(args);
|
||||
m_session->GetPlayer()->HandleEmoteCommand(emote_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
int32 state;
|
||||
if (!ExtractInt32(&args, state))
|
||||
return false;
|
||||
}
|
||||
|
||||
Unit* unit = getSelectedUnit();
|
||||
if (!unit)
|
||||
|
|
@ -773,7 +690,6 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 state = atoi(args);
|
||||
if (!state)
|
||||
{
|
||||
// reset all states
|
||||
|
|
@ -786,18 +702,82 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleSetValueHelper(Object* target, uint32 field, char* typeStr, char* valStr)
|
||||
{
|
||||
ObjectGuid guid = target->GetObjectGuid();
|
||||
|
||||
// not allow access to not existed or critical for work field
|
||||
if (field >= target->GetValuesCount() || field <= OBJECT_FIELD_ENTRY)
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount());
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 base; // 0 -> float
|
||||
if (!typeStr)
|
||||
base = 10;
|
||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||
base = 10;
|
||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||
base = 16;
|
||||
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
||||
base = 2;
|
||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||
base = 0;
|
||||
else
|
||||
return false;
|
||||
|
||||
if(base)
|
||||
{
|
||||
uint32 iValue;
|
||||
if (!ExtractUInt32Base(&valStr, iValue, base))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_SET_UINT), guid.GetString().c_str(), field, iValue);
|
||||
target->SetUInt32Value(field , iValue);
|
||||
PSendSysMessage(LANG_SET_UINT_FIELD, guid.GetString().c_str(), field, iValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
float fValue;
|
||||
if (!ExtractFloat(&valStr, fValue))
|
||||
return false;
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_SET_FLOAT), guid.GetString().c_str(), field, fValue);
|
||||
target->SetFloatValue(field , fValue );
|
||||
PSendSysMessage(LANG_SET_FLOAT_FIELD, guid.GetString().c_str(), field, fValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetItemValueCommand(char* args)
|
||||
{
|
||||
uint32 guid;
|
||||
if (!ExtractUInt32(&args, guid))
|
||||
return false;
|
||||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
return false;
|
||||
|
||||
char* typeStr = ExtractOptNotLastArg(&args);
|
||||
if (!typeStr)
|
||||
return false;
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
return false;
|
||||
|
||||
Item *item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
return HandleSetValueHelper(item, field, typeStr, valStr);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
return false;
|
||||
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
{
|
||||
|
|
@ -806,48 +786,106 @@ bool ChatHandler::HandleDebugSetValueCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = target->GetGUID();
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
return false;
|
||||
|
||||
uint32 Opcode = (uint32)atoi(px);
|
||||
if(Opcode >= target->GetValuesCount())
|
||||
char* typeStr = ExtractOptNotLastArg(&args);
|
||||
if (!typeStr)
|
||||
return false;
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
return false;
|
||||
|
||||
return HandleSetValueHelper(target, field, typeStr, valStr);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGetValueHelper(Object* target, uint32 field, char* typeStr)
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
|
||||
ObjectGuid guid = target->GetObjectGuid();
|
||||
|
||||
if (field >= target->GetValuesCount())
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount());
|
||||
return false;
|
||||
}
|
||||
uint32 iValue;
|
||||
float fValue;
|
||||
bool isint32 = true;
|
||||
if(pz)
|
||||
isint32 = (bool)atoi(pz);
|
||||
if(isint32)
|
||||
|
||||
uint32 base; // 0 -> float
|
||||
if (!typeStr)
|
||||
base = 10;
|
||||
else if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||
base = 10;
|
||||
else if (strncmp(typeStr, "hex", strlen(typeStr)) == 0)
|
||||
base = 16;
|
||||
else if (strncmp(typeStr, "bit", strlen(typeStr)) == 0)
|
||||
base = 2;
|
||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||
base = 0;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (base)
|
||||
{
|
||||
iValue = (uint32)atoi(py);
|
||||
DEBUG_LOG(GetMangosString(LANG_SET_UINT), GUID_LOPART(guid), Opcode, iValue);
|
||||
target->SetUInt32Value( Opcode , iValue );
|
||||
PSendSysMessage(LANG_SET_UINT_FIELD, GUID_LOPART(guid), Opcode,iValue);
|
||||
uint32 iValue = target->GetUInt32Value(field);
|
||||
|
||||
switch(base)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
// starting 0 if need as required bitstring format
|
||||
std::string res;
|
||||
res.reserve(1+32+1);
|
||||
res = iValue & (1 << (32-1)) ? "0" : " ";
|
||||
for (int i = 32; i > 0; --i)
|
||||
res += iValue & (1 << (i-1)) ? "1" : "0";
|
||||
DEBUG_LOG(GetMangosString(LANG_GET_BITSTR), guid.GetString().c_str(), field, res.c_str());
|
||||
PSendSysMessage(LANG_GET_BITSTR_FIELD, guid.GetString().c_str(), field, res.c_str());
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
DEBUG_LOG(GetMangosString(LANG_GET_HEX), guid.GetString().c_str(), field, iValue);
|
||||
PSendSysMessage(LANG_GET_HEX_FIELD, guid.GetString().c_str(), field, iValue);
|
||||
break;
|
||||
case 10:
|
||||
default:
|
||||
DEBUG_LOG(GetMangosString(LANG_GET_UINT), guid.GetString().c_str(), field, iValue);
|
||||
PSendSysMessage(LANG_GET_UINT_FIELD, guid.GetString().c_str(), field, iValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fValue = (float)atof(py);
|
||||
DEBUG_LOG(GetMangosString(LANG_SET_FLOAT), GUID_LOPART(guid), Opcode, fValue);
|
||||
target->SetFloatValue( Opcode , fValue );
|
||||
PSendSysMessage(LANG_SET_FLOAT_FIELD, GUID_LOPART(guid), Opcode,fValue);
|
||||
float fValue = target->GetFloatValue(field);
|
||||
DEBUG_LOG(GetMangosString(LANG_GET_FLOAT), guid.GetString().c_str(), field, fValue);
|
||||
PSendSysMessage(LANG_GET_FLOAT_FIELD, guid.GetString().c_str(), field, fValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetItemValueCommand(char* args)
|
||||
{
|
||||
uint32 guid;
|
||||
if (!ExtractUInt32(&args, guid))
|
||||
return false;
|
||||
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
return false;
|
||||
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr && *args) // optional arg but check format fail case
|
||||
return false;
|
||||
|
||||
Item* item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
return HandleGetValueHelper(item, field, typeStr);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
|
||||
if (!px)
|
||||
return false;
|
||||
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
{
|
||||
|
|
@ -856,115 +894,195 @@ bool ChatHandler::HandleDebugGetValueCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint64 guid = target->GetGUID();
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
return false;
|
||||
|
||||
uint32 Opcode = (uint32)atoi(px);
|
||||
if(Opcode >= target->GetValuesCount())
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr && *args) // optional arg but check format fail case
|
||||
return false;
|
||||
|
||||
return HandleGetValueHelper(target, field, typeStr);
|
||||
}
|
||||
|
||||
bool ChatHandler::HandlerDebugModValueHelper( Object* target, uint32 field, char* typeStr, char* valStr )
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, GUID_LOPART(guid), target->GetValuesCount());
|
||||
ObjectGuid guid = target->GetObjectGuid();
|
||||
|
||||
// not allow access to not existed or critical for work field
|
||||
if (field >= target->GetValuesCount() || field <= OBJECT_FIELD_ENTRY)
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, field, guid.GetString().c_str(), target->GetValuesCount());
|
||||
return false;
|
||||
}
|
||||
uint32 iValue;
|
||||
float fValue;
|
||||
bool isint32 = true;
|
||||
if(pz)
|
||||
isint32 = (bool)atoi(pz);
|
||||
|
||||
if(isint32)
|
||||
uint32 type; // 0 -> float 1 -> int add 2-> bit or 3 -> bit and 4 -> bit and not
|
||||
if (strncmp(typeStr, "int", strlen(typeStr)) == 0)
|
||||
type = 1;
|
||||
else if (strncmp(typeStr, "float", strlen(typeStr)) == 0)
|
||||
type = 0;
|
||||
else if (strncmp(typeStr, "|=", strlen("|=")+1) == 0) // exactly copy
|
||||
type = 2;
|
||||
else if (strncmp(typeStr, "&=", strlen("&=")+1) == 0) // exactly copy
|
||||
type = 3;
|
||||
else if (strncmp(typeStr, "&=~", strlen("&=~")+1) == 0) // exactly copy
|
||||
type = 4;
|
||||
else
|
||||
return false;
|
||||
|
||||
if (type)
|
||||
{
|
||||
iValue = target->GetUInt32Value( Opcode );
|
||||
DEBUG_LOG(GetMangosString(LANG_GET_UINT), GUID_LOPART(guid), Opcode, iValue);
|
||||
PSendSysMessage(LANG_GET_UINT_FIELD, GUID_LOPART(guid), Opcode, iValue);
|
||||
uint32 iValue;
|
||||
if (!ExtractUInt32Base(&valStr, iValue, type == 1 ? 10 : 16))
|
||||
return false;
|
||||
|
||||
uint32 value = target->GetUInt32Value(field);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
default:
|
||||
case 1: // int +
|
||||
value = uint32(int32(value) + int32(iValue));
|
||||
DEBUG_LOG(GetMangosString(LANG_CHANGE_INT32), guid.GetString().c_str(), field, iValue, value, value);
|
||||
PSendSysMessage(LANG_CHANGE_INT32_FIELD, guid.GetString().c_str(), field, iValue, value, value);
|
||||
break;
|
||||
case 2: // |= bit or
|
||||
value |= iValue;
|
||||
DEBUG_LOG(GetMangosString(LANG_CHANGE_HEX), guid.GetString().c_str(), field, typeStr, iValue, value);
|
||||
PSendSysMessage(LANG_CHANGE_HEX_FIELD, guid.GetString().c_str(), field, typeStr, iValue, value);
|
||||
break;
|
||||
case 3: // &= bit and
|
||||
value &= iValue;
|
||||
DEBUG_LOG(GetMangosString(LANG_CHANGE_HEX), guid.GetString().c_str(), field, typeStr, iValue, value);
|
||||
PSendSysMessage(LANG_CHANGE_HEX_FIELD, guid.GetString().c_str(), field, typeStr, iValue, value);
|
||||
break;
|
||||
case 4: // &=~ bit and not
|
||||
value &= ~iValue;
|
||||
DEBUG_LOG(GetMangosString(LANG_CHANGE_HEX), guid.GetString().c_str(), field, typeStr, iValue, value);
|
||||
PSendSysMessage(LANG_CHANGE_HEX_FIELD, guid.GetString().c_str(), field, typeStr, iValue, value);
|
||||
break;
|
||||
}
|
||||
|
||||
target->SetUInt32Value(field, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
fValue = target->GetFloatValue( Opcode );
|
||||
DEBUG_LOG(GetMangosString(LANG_GET_FLOAT), GUID_LOPART(guid), Opcode, fValue);
|
||||
PSendSysMessage(LANG_GET_FLOAT_FIELD, GUID_LOPART(guid), Opcode, fValue);
|
||||
float fValue;
|
||||
if (!ExtractFloat(&valStr, fValue))
|
||||
return false;
|
||||
|
||||
float value = target->GetFloatValue(field);
|
||||
|
||||
value += fValue;
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_CHANGE_FLOAT), guid.GetString().c_str(), field, fValue, value);
|
||||
PSendSysMessage(LANG_CHANGE_FLOAT_FIELD, guid.GetString().c_str(), field, fValue, value);
|
||||
|
||||
target->SetFloatValue(field, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugMod32ValueCommand(char* args)
|
||||
bool ChatHandler::HandleDebugModItemValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
uint32 guid;
|
||||
if (!ExtractUInt32(&args, guid))
|
||||
return false;
|
||||
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
return false;
|
||||
|
||||
uint32 Opcode = (uint32)atoi(px);
|
||||
int Value = atoi(py);
|
||||
|
||||
if(Opcode >= m_session->GetPlayer()->GetValuesCount())
|
||||
{
|
||||
PSendSysMessage(LANG_TOO_BIG_INDEX, Opcode, m_session->GetPlayer()->GetGUIDLow(), m_session->GetPlayer( )->GetValuesCount());
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr)
|
||||
return false;
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
return false;
|
||||
|
||||
Item *item = m_session->GetPlayer()->GetItemByGuid(ObjectGuid(HIGHGUID_ITEM, guid));
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
return HandlerDebugModValueHelper(item, field, typeStr, valStr);
|
||||
}
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_CHANGE_32BIT), Opcode, Value);
|
||||
|
||||
int CurrentValue = (int)m_session->GetPlayer( )->GetUInt32Value( Opcode );
|
||||
|
||||
CurrentValue += Value;
|
||||
m_session->GetPlayer( )->SetUInt32Value( Opcode , (uint32)CurrentValue );
|
||||
|
||||
PSendSysMessage(LANG_CHANGE_32BIT_FIELD, Opcode,CurrentValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugUpdateCommand(char* args)
|
||||
bool ChatHandler::HandleDebugModValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
uint32 updateIndex;
|
||||
uint32 value;
|
||||
|
||||
char* pUpdateIndex = strtok(args, " ");
|
||||
|
||||
Unit* chr = getSelectedUnit();
|
||||
if (chr == NULL)
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!pUpdateIndex)
|
||||
{
|
||||
return true;
|
||||
uint32 field;
|
||||
if (!ExtractUInt32(&args, field))
|
||||
return false;
|
||||
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr && *args) // optional arg but check format fail case
|
||||
return false;
|
||||
|
||||
char* valStr = ExtractLiteralArg(&args);
|
||||
if (!valStr)
|
||||
return false;
|
||||
|
||||
return HandlerDebugModValueHelper(target, field, typeStr, valStr);
|
||||
}
|
||||
updateIndex = atoi(pUpdateIndex);
|
||||
//check updateIndex
|
||||
if(chr->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
bool ChatHandler::HandleDebugSpellModsCommand(char* args)
|
||||
{
|
||||
if (updateIndex>=PLAYER_END) return true;
|
||||
}
|
||||
char* typeStr = ExtractLiteralArg(&args);
|
||||
if (!typeStr)
|
||||
return false;
|
||||
|
||||
uint16 opcode;
|
||||
if (strncmp(typeStr, "flat", strlen(typeStr)) == 0)
|
||||
opcode = SMSG_SET_FLAT_SPELL_MODIFIER;
|
||||
else if (strncmp(typeStr, "pct", strlen(typeStr)) == 0)
|
||||
opcode = SMSG_SET_PCT_SPELL_MODIFIER;
|
||||
else
|
||||
return false;
|
||||
|
||||
uint32 effidx;
|
||||
if (!ExtractUInt32(&args, effidx) || effidx >= 64+32)
|
||||
return false;
|
||||
|
||||
uint32 spellmodop;
|
||||
if (!ExtractUInt32(&args, spellmodop) || spellmodop >= MAX_SPELLMOD)
|
||||
return false;
|
||||
|
||||
int32 value;
|
||||
if (!ExtractInt32(&args, value))
|
||||
return false;
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
if (updateIndex>=UNIT_END) return true;
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char* pvalue = strtok(NULL, " ");
|
||||
if (!pvalue)
|
||||
{
|
||||
value=chr->GetUInt32Value(updateIndex);
|
||||
// check online security
|
||||
if (HasLowerSecurity(chr, 0))
|
||||
return false;
|
||||
|
||||
PSendSysMessage(LANG_UPDATE, chr->GetGUIDLow(),updateIndex,value);
|
||||
return true;
|
||||
}
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SPELLMODS, opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct",
|
||||
spellmodop, value, effidx, GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_SPELLMODS_CHANGED, GetNameLink().c_str(),
|
||||
opcode == SMSG_SET_FLAT_SPELL_MODIFIER ? "flat" : "pct", spellmodop, value, effidx);
|
||||
|
||||
value=atoi(pvalue);
|
||||
|
||||
PSendSysMessage(LANG_UPDATE_CHANGE, chr->GetGUIDLow(),updateIndex,value);
|
||||
|
||||
chr->SetUInt32Value(updateIndex,value);
|
||||
WorldPacket data(opcode, (1+1+2+2));
|
||||
data << uint8(effidx);
|
||||
data << uint8(spellmodop);
|
||||
data << int32(value);
|
||||
chr->GetSession()->SendPacket(&data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -397,18 +397,11 @@ bool ChatHandler::HandleCharacterDeletedOldCommand(char* args)
|
|||
{
|
||||
int32 keepDays = sWorld.getConfig(CONFIG_UINT32_CHARDELETE_KEEP_DAYS);
|
||||
|
||||
if (char* px = strtok(args, " "))
|
||||
{
|
||||
if (!isNumeric(px))
|
||||
if (!ExtractOptInt32(&args, keepDays, sWorld.getConfig(CONFIG_UINT32_CHARDELETE_KEEP_DAYS)))
|
||||
return false;
|
||||
|
||||
keepDays = atoi(px);
|
||||
if (keepDays < 0)
|
||||
return false;
|
||||
}
|
||||
// config option value 0 -> disabled and can't be used
|
||||
else if (keepDays <= 0)
|
||||
return false;
|
||||
|
||||
Player::DeleteOldCharacters((uint32)keepDays);
|
||||
return true;
|
||||
|
|
@ -476,8 +469,9 @@ bool ChatHandler::HandleServerExitCommand(char* /*args*/)
|
|||
/// Display info on users currently in the realm
|
||||
bool ChatHandler::HandleAccountOnlineListCommand(char* args)
|
||||
{
|
||||
char* limit_str = *args ? strtok(args, " ") : NULL;
|
||||
uint32 limit = limit_str ? atoi(limit_str) : 100;
|
||||
uint32 limit;
|
||||
if (!ExtractOptUInt32(&args, limit, 100))
|
||||
return false;
|
||||
|
||||
///- Get the list of accounts ID logged to the realm
|
||||
// 0 1 2 3 4
|
||||
|
|
@ -489,12 +483,9 @@ bool ChatHandler::HandleAccountOnlineListCommand(char* args)
|
|||
/// Create an account
|
||||
bool ChatHandler::HandleAccountCreateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
///- %Parse the command line arguments
|
||||
char *szAcc = strtok(args, " ");
|
||||
char *szPassword = strtok(NULL, " ");
|
||||
char *szAcc = ExtractQuotedOrLiteralArg(&args);
|
||||
char *szPassword = ExtractQuotedOrLiteralArg(&args);
|
||||
if(!szAcc || !szPassword)
|
||||
return false;
|
||||
|
||||
|
|
@ -543,20 +534,12 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
char *filtername = strtok(args, " ");
|
||||
char *filtername = ExtractLiteralArg(&args);
|
||||
if (!filtername)
|
||||
return false;
|
||||
|
||||
char *value_str = strtok(NULL, " ");
|
||||
if (!value_str)
|
||||
return false;
|
||||
|
||||
bool value;
|
||||
if (strncmp(value_str, "on", 3) == 0)
|
||||
value = true;
|
||||
else if (strncmp(value_str, "off", 4) == 0)
|
||||
value = false;
|
||||
else
|
||||
if (!ExtractOnOff(&args, value))
|
||||
{
|
||||
SendSysMessage(LANG_USE_BOL);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10330"
|
||||
#define REVISION_NR "10331"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_10312_02_characters_pet_aura"
|
||||
#define REVISION_DB_MANGOS "required_10323_02_mangos_command"
|
||||
#define REVISION_DB_MANGOS "required_10331_02_mangos_command"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue