aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorp0wer <none@none>2010-02-24 21:30:00 -0600
committerp0wer <none@none>2010-02-24 21:30:00 -0600
commitba51f553fc3a677aa4d8ae846f86f8a560d9982c (patch)
tree38ce0a9b84459c9d1efdf17955fa57ddf69aab1e
parentfc2264bf891b4059a64b680e828731e6f33edd07 (diff)
Add command for administrators to change channel publicity ingame rather than having to manually manipulate the database.
--HG-- branch : trunk
-rw-r--r--sql/updates/7430_world_command.sql1
-rw-r--r--sql/updates/7430_world_trinity_string.sql1
-rw-r--r--sql/world.sql2
-rw-r--r--src/game/Chat.cpp12
-rw-r--r--src/game/Chat.h2
-rw-r--r--src/game/Language.h3
-rw-r--r--src/game/Level3.cpp24
7 files changed, 44 insertions, 1 deletions
diff --git a/sql/updates/7430_world_command.sql b/sql/updates/7430_world_command.sql
new file mode 100644
index 00000000000..a3898c7f96e
--- /dev/null
+++ b/sql/updates/7430_world_command.sql
@@ -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.'); \ No newline at end of file
diff --git a/sql/updates/7430_world_trinity_string.sql b/sql/updates/7430_world_trinity_string.sql
new file mode 100644
index 00000000000..96e046590fb
--- /dev/null
+++ b/sql/updates/7430_world_trinity_string.sql
@@ -0,0 +1 @@
+INSERT INTO trinity_string (entry, content_default) VALUES (5023, 'Channel: %s publicity set to: %u'); \ No newline at end of file
diff --git a/sql/world.sql b/sql/world.sql
index 9d9c6cb9cc5..de34753cf69 100644
--- a/sql/world.sql
+++ b/sql/world.sql
@@ -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 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.'),
+('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.'),
('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.'),
@@ -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),
(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),
+(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),
(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),
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index bbedd5a71f4..c23ee76ee7d 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -130,6 +130,16 @@ ChatCommand * ChatHandler::getCommandTable()
{ 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[] =
{
{ "cinematic", SEC_MODERATOR, false, &ChatHandler::HandleDebugPlayCinematicCommand, "", NULL },
@@ -670,6 +680,8 @@ ChatCommand * ChatHandler::getCommandTable()
{ "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
{ "server", SEC_ADMINISTRATOR, true, NULL, "", serverCommandTable },
+ { "channel", SEC_ADMINISTRATOR, true, NULL, "", channelCommandTable },
+
{ "pet", SEC_GAMEMASTER, false, NULL, "", petCommandTable },
{ "loadpath", SEC_ADMINISTRATOR, false, &ChatHandler::HandleReloadAllPaths, "", NULL },
{ "ahbotoptions", SEC_GAMEMASTER, true, &ChatHandler::HandleAHBotOptionsCommand, "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 1f4b1490c58..9d2d89d09de 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -139,6 +139,8 @@ class ChatHandler
bool HandleCharacterReputationCommand(const char* args);
bool HandleCharacterTitlesCommand(const char* args);
+ bool HandleChannelSetPublic(const char *args);
+
bool HandleDebugAnimCommand(const char* args);
bool HandleDebugArenaCommand(const char * args);
bool HandleDebugBattlegroundCommand(const char * args);
diff --git a/src/game/Language.h b/src/game/Language.h
index 08ec029d5a3..3e954be14d1 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -878,7 +878,8 @@ enum TrinityStrings
LANG_NPCINFO_PHASEMASK = 5020,
LANG_NPCINFO_ARMOR = 5021,
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
LANG_GM_BROADCAST = 6613,
LANG_GM_NOTIFY = 6614,
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 0d56d12a816..e1e67ce99ad 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -7234,6 +7234,30 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args)
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----------------------
*-------------------------------------*/