Jump to content

Recommended Posts

  • 40 years later...
Posted

Hi, this is my first kernel update and I would need help from Announce

I need to command. ANNOUNCE wrote [system Message] <GM Name> MESSAGE

But I have this:

// global announce
bool ChatHandler::HandleAnnounceCommand(const char* args)
{
   if(!*args)
       return false;

   sWorld.SendWorldText(LANG_SYSTEMMESSAGE, m_session->GetPlayerName(), args);
   return true;
}

//notification player at the screen

And write to me as [system Message] <GM Name> and report it

Please help me? Thank you

I do not need 'Announce New System "

Posted

Ok, I'm give to you a basic idea.

bool ChatHandler::HandleAnnounceCommand(const char* args)
{
   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;
}

-- this is your new string for a base.
|cffff0000[system Message] by|c1f40af20 <Mod>[%s]|cffffff00: %s|r

And the new command will send next msg:

[system Message] by <Mod> Test: Some text.

But you have to define new announce's strings (LANG_SYSTEMMESSAGE_MODERATOR & etc) and delete old one from the project and the base.

Posted
Ok, I'm give to you a basic idea.

bool ChatHandler::HandleAnnounceCommand(const char* args)
{
   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;
}

-- this is your new string for a base.
|cffff0000[system Message] by|c1f40af20 <Mod>[%s]|cffffff00: %s|r

And the new command will send next msg:

[system Message] by <Mod> Test: Some text.

But you have to define new announce's strings (LANG_SYSTEMMESSAGE_MODERATOR & etc) and delete old one from the project and the base.

Why create different strings per SEC level, 1 should suffice with a simple %s that gets replaced by a string for the appropriate level.

Posted
Why create different strings per SEC level, 1 should suffice with a simple %s that gets replaced by a string for the appropriate level.

oh... i see.

If I has correctly understood that more correct way:

bool ChatHandler::HandleAnnounceCommand(const char* args)
{
   if(!*args)
       return false;
   char* secLevel;

   switch(m_session->GetSecurity()) {
     case SEC_MODERATOR:
       secLevel = "Moder";
       break;
     case SEC_GAMEMASTER:
       secLevel = "GM";
       break;
     case SEC_ADMINISTRATOR:
       secLevel = "Admin";
       break;
     default:
       return false;
   }

   sWorld.SendWorldText(LANG_SYSTEMMESSAGE, secLevel, m_session->GetPlayerName(), args);
   return true;
}


|cffff0000[system Message] by|c1f40af20 <%s> %s|cffffff00: %s|r

added

But it wrong way, cause there can't be implemented any localization for these 3 words ("GM" etc)... This isn't really big bug but anyway.

added

This work as well on 9254.

Download as file

commit 50f8fceb47de834d0130e206d41a38c384d20a55
Author: AntiDiavol <[email protected]>
Date:   Thu Jan 28 14:54:38 2010 +0200

   Rewrite announce command.

diff --git a/sql/mangos.sql b/sql/mangos.sql
index 19c9631..a64298a 100644
--- a/sql/mangos.sql
+++ b/sql/mangos.sql
@@ -2903,7 +2903,7 @@ LOCK TABLES `mangos_string` WRITE;
INSERT INTO `mangos_string` VALUES
(1,'You should select a character or a creature.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(2,'You should select a creature.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
-(3,'|cffff0000[system Message]: %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(3,'|cffff0000[system Message]|c1f40af20 <%s> %s|cffffff00: %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(4,'|cffff0000[Event Message]: %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(5,'There is no help for that command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(6,'There is no such command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
diff --git a/sql/updates/Not_in_master_branch_9254_01_mangos_string.sql b/sql/updates/Not_in_master_branch_9254_01_mangos_string.sql
new file mode 100644
index 0000000..967c2cf
--- /dev/null
+++ b/sql/updates/Not_in_master_branch_9254_01_mangos_string.sql
@@ -0,0 +1,3 @@
+DELETE FROM `mangos_string` WHERE entry = 3;
+INSERT INTO `mangos_string` VALUES
+(3,'|cffff0000[system Message]|c1f40af20 <%s> %s|cffffff00: %s|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
\\ No newline at end of file
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 29516d5..752551e 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -127,8 +127,23 @@ bool ChatHandler::HandleAnnounceCommand(const char* args)
{
    if(!*args)
        return false;
-
-    sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args);
+    char* secLevel;
+
+    switch(m_session->GetSecurity()) {
+      case SEC_MODERATOR:
+        secLevel = "Moder";
+        break;
+      case SEC_GAMEMASTER:
+        secLevel = "GM";
+        break;
+      case SEC_ADMINISTRATOR:
+        secLevel = "Admin";
+        break;
+      default:
+        return false;
+    }
+
+    sWorld.SendWorldText(LANG_SYSTEMMESSAGE, secLevel, m_session->GetPlayerName(), args);
    return true;
} 

19070fe68a4469504a1e647d91c6ab78.jpg

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use