Ejemplo n.º 1
0
 // Token: 0x060027D4 RID: 10196 RVA: 0x000F171C File Offset: 0x000EFB1C
 public static void sendChat(EChatMode mode, string text)
 {
     if (!Provider.isServer)
     {
         ChatManager.manager.channel.send("askChat", ESteamCall.SERVER, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
         {
             (byte)mode,
             text
         });
     }
     else if (!Dedicator.isDedicated)
     {
         SteamPlayer steamPlayer = PlayerTool.getSteamPlayer(Provider.client);
         if (steamPlayer == null)
         {
             return;
         }
         Color color  = (!Provider.isPro) ? Color.white : Palette.PRO;
         bool  isRich = false;
         bool  flag   = true;
         if (ChatManager.onChatted != null)
         {
             ChatManager.onChatted(steamPlayer, mode, ref color, ref isRich, text, ref flag);
         }
         if (ChatManager.process(steamPlayer, text) && flag)
         {
             ChatManager.list(Provider.client, mode, color, isRich, text);
         }
     }
 }
Ejemplo n.º 2
0
 public void askChat(CSteamID steamID, byte mode, string text)
 {
     if (Provider.isServer)
     {
         SteamPlayer steamPlayer = PlayerTool.getSteamPlayer(steamID);
         if (steamPlayer == null || steamPlayer.player == null)
         {
             return;
         }
         if (Time.realtimeSinceStartup - steamPlayer.lastChat < ChatManager.chatrate)
         {
             return;
         }
         steamPlayer.lastChat = Time.realtimeSinceStartup;
         if (!steamPlayer.player.tryToPerformRateLimitedAction())
         {
             return;
         }
         if (text.Length < 2)
         {
             return;
         }
         if (text.Length > ChatManager.LENGTH)
         {
             text = text.Substring(0, ChatManager.LENGTH);
         }
         text = text.Trim();
         if (mode == 0)
         {
             if (CommandWindow.shouldLogChat)
             {
                 CommandWindow.Log(Provider.localization.format("Global", new object[]
                 {
                     steamPlayer.playerID.characterName,
                     steamPlayer.playerID.playerName,
                     text
                 }));
             }
         }
         else if (mode == 1)
         {
             if (CommandWindow.shouldLogChat)
             {
                 CommandWindow.Log(Provider.localization.format("Local", new object[]
                 {
                     steamPlayer.playerID.characterName,
                     steamPlayer.playerID.playerName,
                     text
                 }));
             }
         }
         else
         {
             if (mode != 2)
             {
                 return;
             }
             if (CommandWindow.shouldLogChat)
             {
                 CommandWindow.Log(Provider.localization.format("Group", new object[]
                 {
                     steamPlayer.playerID.characterName,
                     steamPlayer.playerID.playerName,
                     text
                 }));
             }
         }
         Color color = Color.white;
         if (steamPlayer.isAdmin && !Provider.hideAdmins)
         {
             color = Palette.ADMIN;
         }
         else if (steamPlayer.isPro)
         {
             color = Palette.PRO;
         }
         bool flag  = false;
         bool flag2 = true;
         if (ChatManager.onChatted != null)
         {
             ChatManager.onChatted(steamPlayer, (EChatMode)mode, ref color, ref flag, text, ref flag2);
         }
         if (ChatManager.process(steamPlayer, text) && flag2)
         {
             if (mode == 0)
             {
                 base.channel.send("tellChat", ESteamCall.OTHERS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                 {
                     steamID,
                     mode,
                     color,
                     flag,
                     text
                 });
             }
             else if (mode == 1)
             {
                 base.channel.send("tellChat", ESteamCall.OTHERS, steamPlayer.player.transform.position, EffectManager.MEDIUM, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                 {
                     steamID,
                     mode,
                     color,
                     flag,
                     text
                 });
             }
             else if (mode == 2 && steamPlayer.player.quests.groupID != CSteamID.Nil)
             {
                 for (int i = 0; i < Provider.clients.Count; i++)
                 {
                     SteamPlayer steamPlayer2 = Provider.clients[i];
                     if (steamPlayer2.player != null && steamPlayer.player.quests.isMemberOfSameGroupAs(steamPlayer2.player))
                     {
                         base.channel.send("tellChat", steamPlayer2.playerID.steamID, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                         {
                             steamID,
                             mode,
                             color,
                             flag,
                             text
                         });
                     }
                 }
             }
         }
     }
 }