mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
* Some changes to command handlers. Patch by ogeraisi
--HG-- branch : trunk
This commit is contained in:
8
sql/updates/5813_world_command.sql
Normal file
8
sql/updates/5813_world_command.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
DELETE FROM `command` WHERE `name` IN ('modify aspeed', 'modify bwalk', 'modify fly', 'modify scale', 'modify speed', 'modify swim');
|
||||
INSERT INTO `commands` VALUES
|
||||
('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 50.'),
|
||||
('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 50.'),
|
||||
('modify fly',1,'.modify fly $parameter\nModify the flying speed of the selected player to \"normal flying speed\"*rate. If no player is selected, modify your speed.\n #rate may range from 0.1 to 50.'),
|
||||
('modify scale',1,'.modify scale $parameter\nModify size of the selected player to \"normal scale\"*rate. If no player is selected, modify your size.\n#rate may range from 0.1 to 10.'),
|
||||
('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 50.'),
|
||||
('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 50.');
|
||||
@@ -243,13 +243,13 @@ bool ChatHandler::HandleAccountAddonCommand(const char* args)
|
||||
|
||||
uint32 account_id = m_session->GetAccountId();
|
||||
|
||||
int lev=atoi(szExp); //get int anyway (0 if error)
|
||||
if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
int expansion=atoi(szExp); //get int anyway (0 if error)
|
||||
if(expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
|
||||
// No SQL injection
|
||||
loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",lev,account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_ADDON,lev);
|
||||
loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'", expansion, account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_ADDON, expansion);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1569,7 +1569,7 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args)
|
||||
|
||||
float ASpeed = (float)atof((char*)args);
|
||||
|
||||
if (ASpeed > 50 || ASpeed < 0)
|
||||
if (ASpeed > 50.0f || ASpeed < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -1617,7 +1617,7 @@ bool ChatHandler::HandleModifySpeedCommand(const char* args)
|
||||
|
||||
float Speed = (float)atof((char*)args);
|
||||
|
||||
if (Speed > 10 || Speed < 0.1)
|
||||
if (Speed > 50.0f || Speed < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -1662,7 +1662,7 @@ bool ChatHandler::HandleModifySwimCommand(const char* args)
|
||||
|
||||
float Swim = (float)atof((char*)args);
|
||||
|
||||
if (Swim > 10.0f || Swim < 0.01f)
|
||||
if (Swim > 50.0f || Swim < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -1707,7 +1707,7 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args)
|
||||
|
||||
float BSpeed = (float)atof((char*)args);
|
||||
|
||||
if (BSpeed > 10.0f || BSpeed < 0.1f)
|
||||
if (BSpeed > 50.0f || BSpeed < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -1752,7 +1752,7 @@ bool ChatHandler::HandleModifyFlyCommand(const char* args)
|
||||
|
||||
float FSpeed = (float)atof((char*)args);
|
||||
|
||||
if (FSpeed > 10.0f || FSpeed < 0.1f)
|
||||
if (FSpeed > 50.0f || FSpeed < 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
@@ -1787,7 +1787,7 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args)
|
||||
return false;
|
||||
|
||||
float Scale = (float)atof((char*)args);
|
||||
if (Scale > 10.0f || Scale <= 0.0f)
|
||||
if (Scale > 10.0f || Scale <= 0.1f)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
||||
@@ -6997,13 +6997,13 @@ bool ChatHandler::HandleAccountSetAddonCommand(const char* args)
|
||||
HasLowerSecurityAccount (NULL,account_id,true))
|
||||
return false;
|
||||
|
||||
int lev=atoi(szExp); //get int anyway (0 if error)
|
||||
if(lev < 0 || lev > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
int expansion = atoi(szExp); //get int anyway (0 if error)
|
||||
if(expansion < 0 || expansion > sWorld.getConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
|
||||
// No SQL injection
|
||||
loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",lev,account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(),account_id,lev);
|
||||
loginDatabase.PExecute("UPDATE account SET expansion = '%d' WHERE id = '%u'",expansion,account_id);
|
||||
PSendSysMessage(LANG_ACCOUNT_SETADDON,account_name.c_str(),account_id,expansion);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user