Add command for administrators to change channel publicity ingame rather than having to manually manipulate the database.

--HG--
branch : trunk
This commit is contained in:
p0wer
2010-02-24 21:30:00 -06:00
parent fc2264bf89
commit ba51f553fc
7 changed files with 44 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
INSERT INTO command VALUES ('channel set public', 3, 'Syntax: .channel set public $channel $public\r\n\r\nChange password-changing ability for a channel. 1 for possible, 0 for GM only.');
@@ -0,0 +1 @@
INSERT INTO trinity_string (entry, content_default) VALUES (5023, 'Channel: %s publicity set to: %u');
+2
View File
@@ -355,6 +355,7 @@ INSERT INTO `command` VALUES
('character rename','2','Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'), ('character rename','2','Syntax: .character rename [$name]\r\n\r\nMark selected in game or by $name in command character for rename at next login.'),
('character reputation','2','Syntax: .character reputation [$player_name]\r\n\r\nShow reputation information for selected player or player find by $player_name.'), ('character reputation','2','Syntax: .character reputation [$player_name]\r\n\r\nShow reputation information for selected player or player find by $player_name.'),
('character titles',2,'Syntax: .character titles [$player_name]\r\n\r\nShow known titles list for selected player or player find by $player_name.'), ('character titles',2,'Syntax: .character titles [$player_name]\r\n\r\nShow known titles list for selected player or player find by $player_name.'),
('channel set public', 3, 'Syntax: .channel set public $channel $public\r\n\r\nChange password-changing ability for a channel. 1 for possible, 0 for GM only.'),
('combatstop','2','Syntax: .combatstop [$playername]\r\nStop combat for selected character. If selected non-player then command applied to self. If $playername provided then attempt applied to online player $playername.'), ('combatstop','2','Syntax: .combatstop [$playername]\r\nStop combat for selected character. If selected non-player then command applied to self. If $playername provided then attempt applied to online player $playername.'),
('cometome','3','SYntax: .cometome $parameter\nMake selected creature come to your current location (new position not saved to DB).'), ('cometome','3','SYntax: .cometome $parameter\nMake selected creature come to your current location (new position not saved to DB).'),
('commands','0','Syntax: .commands\r\n\r\nDisplay a list of available commands for your account level.'), ('commands','0','Syntax: .commands\r\n\r\nDisplay a list of available commands for your account level.'),
@@ -14788,6 +14789,7 @@ INSERT INTO `trinity_string` (`entry`,`content_default`,`content_loc1`,`content_
(5020, 'Phasemask: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5020, 'Phasemask: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5021, 'Armor: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5021, 'Armor: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5022, 'Channel password not changed due to channel being marked public. GM Powers required.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (5022, 'Channel password not changed due to channel being marked public. GM Powers required.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(5023, 'Channel: %s publicity set to: %u', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (6613, '|cfff00000[GM Announcement]: %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (6614, 'Notification to GM''s - ', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
(6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (6615, '|cffffff00[|c1f40af20GM Announce by|r |cffff0000%s|cffffff00]:|r %s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
+12
View File
@@ -130,6 +130,16 @@ ChatCommand * ChatHandler::getCommandTable()
{ NULL, 0, false, NULL, "", NULL } { NULL, 0, false, NULL, "", NULL }
}; };
static ChatCommand channelSetCommandTable[] =
{
{ "public", SEC_ADMINISTRATOR, true, &ChatHandler::HandleChannelSetPublic, "", NULL },
};
static ChatCommand channelCommandTable[] =
{
{ "set", SEC_ADMINISTRATOR, true, NULL, "", channelSetCommandTable },
};
static ChatCommand debugPlayCommandTable[] = static ChatCommand debugPlayCommandTable[] =
{ {
{ "cinematic", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", NULL }, { "cinematic", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", NULL },
@@ -670,6 +680,8 @@ ChatCommand * ChatHandler::getCommandTable()
{ "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable }, { "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
{ "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable }, { "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
{ "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
{ "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable }, { "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
{ "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL }, { "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL },
{ "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL }, { "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL },
+2
View File
@@ -139,6 +139,8 @@ class ChatHandler
bool HandleCharacterReputationCommand(const char* args); bool HandleCharacterReputationCommand(const char* args);
bool HandleCharacterTitlesCommand(const char* args); bool HandleCharacterTitlesCommand(const char* args);
bool HandleChannelSetPublic(const char *args);
bool HandleDebugAnimCommand(const char* args); bool HandleDebugAnimCommand(const char* args);
bool HandleDebugArenaCommand(const char * args); bool HandleDebugArenaCommand(const char * args);
bool HandleDebugBattlegroundCommand(const char * args); bool HandleDebugBattlegroundCommand(const char * args);
+2 -1
View File
@@ -878,7 +878,8 @@ enum TrinityStrings
LANG_NPCINFO_PHASEMASK = 5020, LANG_NPCINFO_PHASEMASK = 5020,
LANG_NPCINFO_ARMOR = 5021, LANG_NPCINFO_ARMOR = 5021,
LANG_CHANNEL_NOT_PUBLIC = 5022, LANG_CHANNEL_NOT_PUBLIC = 5022,
// Room for more Trinity strings 5023-9999 LANG_CHANNEL_PUBLIC_CHANGED = 5023,
// Room for more Trinity strings 5024-9999
// Used for GM Announcements // Used for GM Announcements
LANG_GM_BROADCAST = 6613, LANG_GM_BROADCAST = 6613,
LANG_GM_NOTIFY = 6614, LANG_GM_NOTIFY = 6614,
+24
View File
@@ -7234,6 +7234,30 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
return true; return true;
} }
bool ChatHandler::HandleChannelSetPublic(const char *args)
{
if(!*args)
return false;
std::string channel = strtok((char*)args, " ");
uint32 val = atoi((char*)args);
if(val)
{
CharacterDatabase.PExecute("UPDATE channels SET m_public = 1 WHERE n_name LIKE '%s'", channel);
val = 1;
}
else
{
CharacterDatabase.PExecute("UPDATE channels SET m_public = 0 WHERE n_name LIKE '%s'", channel);
val = 0;
}
PSendSysMessage(LANG_CHANNEL_PUBLIC_CHANGED, channel.c_str(), val);
return true;
}
/*------------------------------------------ /*------------------------------------------
*-------------TRINITY---------------------- *-------------TRINITY----------------------
*-------------------------------------*/ *-------------------------------------*/