[6960] Implement ".modify runnicpower" command.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Arthorius 2008-12-28 03:15:12 +03:00 committed by VladimirMangos
parent 70c7dda068
commit 41cbc67dfc
9 changed files with 59 additions and 3 deletions

View file

@ -22,7 +22,7 @@
DROP TABLE IF EXISTS `db_version`;
CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`required_6958_01_mangos_spell_proc_event` bit(1) default NULL
`required_6960_02_mangos_string` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
--
@ -343,6 +343,7 @@ INSERT INTO `command` VALUES
('modify mount',1,'Syntax:\r\n.modify mount #id #speed\r\nDisplay selected player as mounted at #id creature and set speed to #speed value.'),
('modify rage',1,'Syntax: .modify rage #newrage\r\n\r\nModify the rage of the selected player. If no player is selected, modify your rage.'),
('modify rep',2,'Syntax: .modify rep #repId (#repvalue | $rankname [#delta])\r\nSets the selected players reputation with faction #repId to #repvalue or to $reprank.\r\nIf the reputation rank name is provided, the resulting reputation will be the lowest reputation for that rank plus the delta amount, if specified.\r\nYou can use \'.pinfo rep\' to list all known reputation ids, or use \'.lookup faction $name\' to locate a specific faction id.'),
('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,''),
('modify speed',1,'Syntax:\r\n.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,''),
@ -2330,6 +2331,8 @@ INSERT INTO `mangos_string` VALUES
(169,'Mail sent to %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(170,'You try to hear sound %u but it doesn\'t exist.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(172,'server console command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(173,'You changed runic power of %s to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(174,'%s changed your runic power to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(200,'No selection.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(201,'Object GUID is: lowpart %u highpart %X',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(202,'The name was too long by %i characters.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),

View file

@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_6958_01_mangos_spell_proc_event required_6960_01_mangos_command bit;
DELETE FROM `command` WHERE `name` = 'modify runicpower';
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.');

View file

@ -0,0 +1,6 @@
ALTER TABLE db_version CHANGE COLUMN required_6960_01_mangos_command required_6960_02_mangos_string bit;
DELETE FROM `mangos_string` WHERE `entry` IN (173,174);
INSERT INTO `mangos_string` VALUES
(173,'You changed runic power of %s to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(174,'%s changed your runic power to %i/%i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View file

@ -101,6 +101,8 @@ pkgdata_DATA = \
6941_01_mangos_spell_learn_spell.sql \
6944_01_mangos_mangos_string.sql \
6958_01_mangos_spell_proc_event.sql \
6960_01_mangos_command.sql \
6960_02_mangos_string.sql \
README
## Additional files to include when running 'make dist'
@ -182,4 +184,6 @@ EXTRA_DIST = \
6941_01_mangos_spell_learn_spell.sql \
6944_01_mangos_mangos_string.sql \
6958_01_mangos_spell_proc_event.sql \
6960_01_mangos_command.sql \
6960_02_mangos_string.sql \
README

View file

@ -108,6 +108,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "hp", SEC_MODERATOR, false, &ChatHandler::HandleModifyHPCommand, "", NULL },
{ "mana", SEC_MODERATOR, false, &ChatHandler::HandleModifyManaCommand, "", NULL },
{ "rage", SEC_MODERATOR, false, &ChatHandler::HandleModifyRageCommand, "", NULL },
{ "runicpower", SEC_MODERATOR, false, &ChatHandler::HandleModifyRunicPowerCommand, "", NULL },
{ "energy", SEC_MODERATOR, false, &ChatHandler::HandleModifyEnergyCommand, "", NULL },
{ "money", SEC_MODERATOR, false, &ChatHandler::HandleModifyMoneyCommand, "", NULL },
{ "speed", SEC_MODERATOR, false, &ChatHandler::HandleModifySpeedCommand, "", NULL },

View file

@ -156,6 +156,7 @@ class ChatHandler
bool HandleModifyHPCommand(const char* args);
bool HandleModifyManaCommand(const char* args);
bool HandleModifyRageCommand(const char* args);
bool HandleModifyRunicPowerCommand(const char* args);
bool HandleModifyEnergyCommand(const char* args);
bool HandleModifyMoneyCommand(const char* args);
bool HandleModifyASpeedCommand(const char* args);

View file

@ -168,7 +168,9 @@ enum MangosStrings
LANG_SOUND_NOT_EXIST = 170,
// 171, // not used
LANG_CONSOLE_COMMAND = 172,
// Room for more level 1 173-199 not used
LANG_YOU_CHANGE_RUNIC_POWER = 173,
LANG_YOURS_RUNIC_POWER_CHANGED = 174,
// Room for more level 1 175-199 not used
// level 2 chat
LANG_NO_SELECTION = 200,

View file

@ -827,6 +827,40 @@ bool ChatHandler::HandleModifyRageCommand(const char* args)
return true;
}
// Edit Player Runic Power
bool ChatHandler::HandleModifyRunicPowerCommand(const char* args)
{
if(!*args)
return false;
int32 rune = atoi((char*)args)*10;
int32 runem = atoi((char*)args)*10;
if (rune <= 0 || runem <= 0 || runem < rune)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
return false;
}
Player *chr = getSelectedPlayer();
if (chr == NULL)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
PSendSysMessage(LANG_YOU_CHANGE_RUNIC_POWER, chr->GetName(), rune/10, runem/10);
if (needReportToTarget(chr))
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetName(), rune/10, runem/10);
chr->SetMaxPower(POWER_RUNIC_POWER,runem );
chr->SetPower(POWER_RUNIC_POWER, rune );
return true;
}
//Edit Player Faction
bool ChatHandler::HandleModifyFactionCommand(const char* args)
{

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6959"
#define REVISION_NR "6960"
#endif // __REVISION_NR_H__