Added new command: .repairitems - repairs all items of selected player

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
dythzer 2008-10-26 18:11:12 +01:00 committed by VladimirMangos
parent 6169f57ab9
commit e98a123027
8 changed files with 43 additions and 1 deletions

View file

@ -358,6 +358,7 @@ INSERT INTO `command` VALUES
('reload all_spell',3,'Syntax: .reload all_spell\r\n\r\nReload all `spell_*` tables with reload support added and that can be _safe_ reloaded.'),
('reload all_locales',3,'Syntax: .reload all_locales\r\n\r\nReload all `locales_*` tables with reload support added and that can be _safe_ reloaded.'),
('reload config',3,'Syntax: .reload config\r\n\r\nReload config settings (by default stored in mangosd.conf). Not all settings can be change at reload: some new setting values will be ignored until restart, some values will applied with delay or only to new objects/maps, some values will explicitly rejected to change at reload.'),
('repairitems',2,'Syntax: .repairitems\r\n\r\nRepair all selected player''s items.'),
('reset all',3,'Syntax: .reset all spells\r\n\r\nSyntax: .reset all talents\r\n\r\nRequest reset spells or talents at next login each existed character.'),
('reset honor',3,'Syntax:\r\n.reset honor [Playername]\r\n Reset all honor data for targeted character.'),
('reset level',3,'Syntax:\r\n.reset level [Playername]\r\n Reset level to 1 including reset stats and talents. Equipped items with greater level requirement can be lost.'),
@ -2403,6 +2404,8 @@ INSERT INTO `mangos_string` VALUES
(333,'GM mode is OFF',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(334,'GM Chat Badge is ON',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(335,'GM Chat Badge is OFF',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(336,'You repair all %s''s items.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(337,'All your items repaired by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(400,'|cffff0000[System Message]:|rScripts reloaded',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(401,'You change security level of account %s to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(402,'%s changed your security level to %i.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),

View file

@ -0,0 +1,5 @@
DELETE FROM mangos_string WHERE entry IN (336,337);
INSERT INTO mangos_string VALUES
(336,'You repair all %s''s items.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(337,'All your items repaired by %s.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View file

@ -0,0 +1,4 @@
DELETE FROM command WHERE name IN ('repairitems');
INSERT INTO command VALUES
('repairitems',2,'Syntax: .repairitems\r\n\r\nRepair all selected player''s items.');

View file

@ -109,6 +109,9 @@ pkgdata_DATA = \
2008_10_26_01_mangos_mangos_string.sql \
2008_10_27_01_npc_option.sql \
2008_10_27_02_locales_npc_option.sql \
2008_10_28_01_mangos_mangos_string.sql \
2008_10_28_02_mangos_mangos_string.sql \
2008_10_28_03_mangos_command.sql \
README
## Additional files to include when running 'make dist'
@ -199,4 +202,7 @@ EXTRA_DIST = \
2008_10_26_01_mangos_mangos_string.sql \
2008_10_27_01_npc_option.sql \
2008_10_27_02_locales_npc_option.sql \
2008_10_28_01_mangos_mangos_string.sql \
2008_10_28_02_mangos_mangos_string.sql \
2008_10_28_03_mangos_command.sql \
README

View file

@ -527,6 +527,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
{ "chardelete", SEC_CONSOLE, true, &ChatHandler::HandleCombatStopCommand, "", NULL },
{ "sendmessage", SEC_ADMINISTRATOR, true, &ChatHandler::HandleSendMessageCommand, "", NULL },
{ "repairitems", SEC_GAMEMASTER, false, &ChatHandler::HandleRepairitemsCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};

View file

@ -406,6 +406,7 @@ class ChatHandler
bool HandleComeToMeCommand(const char *args);
bool HandleCombatStopCommand(const char *args);
bool HandleSendMessageCommand(const char * args);
bool HandleRepairitemsCommand(const char* args);
//! Development Commands
bool HandleSetValue(const char* args);

View file

@ -317,7 +317,9 @@ enum MangosStrings
LANG_GM_OFF = 333,
LANG_GM_CHAT_ON = 334,
LANG_GM_CHAT_OFF = 335,
// Room for more level 2 336-399 not used
LANG_YOU_REPAIR_ITEMS = 336,
LANG_YOUR_ITEMS_REPAIRED = 337,
// Room for more level 2 338-399 not used
// level 3 chat
LANG_SCRIPTS_RELOADED = 400,

View file

@ -4047,3 +4047,23 @@ bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
CorpsesErase();
return true;
}
bool ChatHandler::HandleRepairitemsCommand(const char* args)
{
Player *target = getSelectedPlayer();
if(!target)
{
PSendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
// Repair items
target->DurabilityRepairAll(false, 0, false);
PSendSysMessage(LANG_YOU_REPAIR_ITEMS, target->GetName());
if(needReportToTarget(target))
ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetName());
return true;
}