Advertisement
Guest User

World Chat System Last master

a guest
Jul 23rd, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.75 KB | None | 0 0
  1. /*
  2. <--------------------------------------------------------------------------->
  3. - Developer(s): Ghostcrawler336
  4. - Made By??
  5. - Complete: %0
  6. - ScriptName: 'World chat'
  7. - Comment: Untested ingame.
  8. <--------------------------------------------------------------------------->
  9. */
  10.  
  11. #include "ScriptPCH.h"
  12. #include "Chat.h"
  13. #include "Common.h"
  14. #include "World.h"
  15. #include "WorldSession.h"
  16.  
  17. /* Colors */
  18. #define MSG_COLOR_ORANGE "|cffFFA500"
  19. #define MSG_COLOR_DARKORANGE "|cffFF8C00"
  20. #define MSG_COLOR_RED "|cffFF0000"
  21. #define MSG_COLOR_LIGHTRED "|cffD63931"
  22. #define MSG_COLOR_ROYALBLUE "|cff4169E1"
  23. #define MSG_COLOR_LIGHTBLUE "|cffADD8E6"
  24. #define MSG_COLOR_YELLOW "|cffFFFF00"
  25. #define MSG_COLOR_GREEN "|cff008000"
  26. #define MSG_COLOR_PURPLE "|cffDA70D6"
  27. #define MSG_COLOR_WHITE  "|cffffffff"
  28. #define MSG_COLOR_SUBWHITE  "|cffbbbbbb"
  29.  
  30. /* Ranks */
  31. #define ADMINISTRATOR "Admin"
  32. #define HEADGM "Head GM"
  33. #define GAMEMASTER "GM"
  34. #define DEVELOPER "Developer"
  35. #define OWNER "Owner"
  36. #define VIP "Vip"
  37. #define PLAYER "Player"
  38. #define EVENTM "Event Master"
  39.  
  40. class World_Chat : public CommandScript
  41. {
  42.     public:
  43.     World_Chat() : CommandScript("World_Chat") { }
  44.  
  45.     static bool HandleWorldChatCommand(ChatHandler * pChat, const char * msg)
  46.     {
  47.         if(!*msg)
  48.             return false;
  49.  
  50.         Player * player = pChat->GetSession()->GetPlayer();
  51.         char message[1024];
  52.  
  53.         switch(player->GetSession()->GetSecurity())
  54.         {
  55.             case SEC_PLAYER:
  56.                 snprintf(message, 1024, "[World][Player][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_LIGHTBLUE, msg);
  57.                 sWorld->SendGlobalText(message, NULL);
  58.             break;
  59.            
  60.                 case SEC_VIP:
  61.                 snprintf(message, 1024, "[World][Vip][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_PURPLE, msg);
  62.                 sWorld->SendGlobalText(message, NULL);
  63.             break;
  64.            
  65.                 case SEC_GAMEMASTER:
  66.                 snprintf(message, 1024, "[World][GM][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(),  MSG_COLOR_YELLOW, msg);
  67.                 sWorld->SendGlobalText(message, NULL);
  68.             break;
  69.            
  70.                 case SEC_EVENTM:
  71.                 snprintf(message, 1024, "[World][Event Master][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_ORANGE, msg);
  72.                 sWorld->SendGlobalText(message, NULL);
  73.             break;
  74.            
  75.                 case SEC_HEADGM:
  76.                 snprintf(message, 1024, "[World][Head GM][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_GREEN, msg);
  77.                 sWorld->SendGlobalText(message, NULL);
  78.             break;
  79.            
  80.            
  81.                 case SEC_DEVELOPER:
  82.                 snprintf(message, 1024, "[World][Developer][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_ROYALBLUE, msg);
  83.                 sWorld->SendGlobalText(message, NULL);
  84.             break;
  85.            
  86.                 case SEC_ADMINISTRATOR:
  87.                 snprintf(message, 1024, "[World][Admin][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_RED, msg);
  88.                 sWorld->SendGlobalText(message, NULL);
  89.             break;
  90.            
  91.                 case SEC_OWNER:
  92.                 snprintf(message, 1024, "[World][Owner][%s%s|r]: %s%s|r", MSG_COLOR_WHITE, player->GetName().c_str(), MSG_COLOR_RED, msg);
  93.                 sWorld->SendGlobalText(message, NULL);
  94.             break;
  95.  
  96.             case SEC_CONSOLE:
  97.                 snprintf(message, 1024, "[World][%sAdministrator|r][%s%s|r]: %s%s|r", MSG_COLOR_RED, MSG_COLOR_LIGHTRED, player->GetName().c_str(),
  98.                     MSG_COLOR_LIGHTBLUE, msg);
  99.                 sWorld->SendGlobalText(message, NULL);
  100.             break;
  101.  
  102.            
  103.            
  104.            
  105.         }
  106.         return true;
  107.     }
  108.     std::vector<ChatCommand> GetCommands() const override
  109.     {
  110.             static std::vector<ChatCommand> HandleWorldChatCommandTable =
  111.             {
  112.                 { "world",  rbac::RBAC_PERM_COMMAND_WORLD_CHAT, true, &HandleWorldChatCommand, ""}
  113.             };
  114.             return HandleWorldChatCommandTable;
  115.     }
  116. };
  117.  
  118. void AddSC_World_Chat()
  119. {
  120.     new World_Chat;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement