Skip to content

Instantly share code, notes, and snippets.

@Salja
Created November 12, 2014 12:28
Show Gist options
  • Save Salja/9b8f8d60a7e4b0717cfb to your computer and use it in GitHub Desktop.
Save Salja/9b8f8d60a7e4b0717cfb to your computer and use it in GitHub Desktop.
.nameannounce V1.0
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index b1faba6..660367b 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -725,6 +725,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "aura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleAuraCommand, "", NULL },
{ "unaura", SEC_ADMINISTRATOR, false, &ChatHandler::HandleUnAuraCommand, "", NULL },
{ "announce", SEC_MODERATOR, true, &ChatHandler::HandleAnnounceCommand, "", NULL },
+ { "nameannounce", SEC_MODERATOR, false, &ChatHandler::HandleNameAnnounceCommand, "", NULL },
{ "notify", SEC_MODERATOR, true, &ChatHandler::HandleNotifyCommand, "", NULL },
{ "goname", SEC_MODERATOR, false, &ChatHandler::HandleGonameCommand, "", NULL },
{ "namego", SEC_MODERATOR, false, &ChatHandler::HandleNamegoCommand, "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 33196b1..afed41f 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -535,6 +535,7 @@ class MANGOS_DLL_SPEC ChatHandler
bool HandleGroupgoCommand(char* args);
bool HandleRecallCommand(char* args);
bool HandleAnnounceCommand(char* args);
+ bool HandleNameAnnounceCommand(char* args);
bool HandleNotifyCommand(char* args);
bool HandleGPSCommand(char* args);
bool HandleTaxiCheatCommand(char* args);
diff --git a/src/game/Language.h b/src/game/Language.h
index d408bfd..adc96a1 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -90,7 +90,10 @@ enum MangosStrings
LANG_GM_NO_WHISPER = 64,
LANG_USING_SCRIPT_LIB_UNKNOWN = 65,
LANG_USING_SCRIPT_LIB_NONE = 66,
- // Room for more level 0 67-99 not used
+ LANG_SYSTEMMESSAGE_MODERATOR = 67,
+ LANG_SYSTEMMESSAGE_GAMEMASTER = 68,
+ LANG_SYSTEMMESSAGE_ADMINISTRATOR = 69,
+ // Room for more level 0 70-99 not used
// level 1 chat
LANG_GLOBAL_NOTIFY = 100,
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 48de089..e0f6558 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -132,6 +132,32 @@ bool ChatHandler::HandleAnnounceCommand(char* args)
return true;
}
+bool ChatHandler::HandleNameAnnounceCommand(char* args)
+{
+ int32 strid = 0;
+
+ if (!*args)
+ return false;
+
+ switch (m_session->GetSecurity()) {
+ case SEC_MODERATOR:
+ strid = LANG_SYSTEMMESSAGE_MODERATOR;
+ break;
+ case SEC_GAMEMASTER:
+ strid = LANG_SYSTEMMESSAGE_GAMEMASTER;
+ break;
+ case SEC_ADMINISTRATOR:
+ strid = LANG_SYSTEMMESSAGE_ADMINISTRATOR;
+ break;
+ default:
+ return false;
+ }
+
+ sWorld.SendWorldText(strid, m_session->GetPlayerName(), args);
+
+ return true;
+}
+
// notification player at the screen
bool ChatHandler::HandleNotifyCommand(char* args)
{
DELETE FROM `command` WHERE NAME = 'nameannounce';
INSERT INTO `command` VALUES
('nameannounce',1,'Syntax: .nameannounce $MessageToBroadcast\r\n\r\nSend a global message to all players online in chat log with colored sender\'s name.');
DELETE FROM `mangos_string` WHERE entry IN (67, 68, 69);
INSERT INTO `mangos_string` VALUES
(67,'|c1f40af20 <Mod>|cffff0000[%s]|c1f40af20 announce:|cffffff00 %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(68,'|c1f40af20 <GM>|cffff0000[%s]|c1f40af20 announce:|cffffff00 %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(69,'|c1f40af20 <Admin>|cffff0000[%s]|c1f40af20 announce:|cffffff00 %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment