Esempio n. 1
0
 // Token: 0x060004AE RID: 1198 RVA: 0x0002574C File Offset: 0x0002394C
 public void OnNewChatMessage(GameObject go, long senderID, Vector3 pos, Talker.Type type, string user, string text)
 {
     text = text.Replace('<', ' ');
     text = text.Replace('>', ' ');
     this.AddString(user, text, type);
     this.AddInworldText(go, senderID, pos, type, user, text);
 }
Esempio n. 2
0
    // Token: 0x060004B3 RID: 1203 RVA: 0x00025CA4 File Offset: 0x00023EA4
    private void AddString(string user, string text, Talker.Type type)
    {
        Color color = Color.white;

        if (type != Talker.Type.Whisper)
        {
            if (type == Talker.Type.Shout)
            {
                color = Color.yellow;
                text  = text.ToUpper();
            }
            else
            {
                color = Color.white;
            }
        }
        else
        {
            color = new Color(1f, 1f, 1f, 0.75f);
            text  = text.ToLowerInvariant();
        }
        string text2 = string.Concat(new string[]
        {
            "<color=orange>",
            user,
            "</color>: <color=#",
            ColorUtility.ToHtmlStringRGBA(color),
            ">",
            text,
            "</color>"
        });

        this.AddString(text2);
    }
Esempio n. 3
0
        public static bool Prefix(ref GameObject go, long senderID, Vector3 pos, Talker.Type type, ref string user, ref string text)
        {
            if (senderID == Player.m_localPlayer.GetPlayerID())
            {
                // InputText_Patch.PrintOut("Not processing own message" + text);
                return(true);
            }

            if (text.StartsWith("START_") && text.EndsWith("#END"))
            {
                ReceivedPackets.Add(text);
                if (ReceivedPackets.Count == PacketNum)
                {
                    InputText_Patch.PrintOut("1/4 Merging exploration data.");
                    AssembleMapData();
                    InputText_Patch.PrintOut("data parsed, exploration content: " + ExplorationData.Where(x => x).Count());
                    DataReadyForMerge = true;
                    InputText_Patch.PrintOut("2/4 Data reassembly done.");
                }
            }
            else
            {
            }
            return(true);
        }
Esempio n. 4
0
 public static bool Prefix(GameObject go, long senderID, Vector3 position, Talker.Type type, string user, string text)
 {
     if (text.StartsWith("START_") && text.EndsWith("#END"))
     {
         return(false);
     }
     return(true);
 }
Esempio n. 5
0
 public static void SendLocalChatMessage(string localPlayerName, string text, Talker.Type type)
 {
     if (Player.m_localPlayer != null)
     {
         Chat.instance.m_hideTimer = -3f;
         Chat.instance.m_chatWindow.gameObject.SetActive(true);
         Chat.instance.AddString(localPlayerName, text, type);
     }
 }
Esempio n. 6
0
            private static bool Prefix(ref string user, ref string text, ref Talker.Type type, ref Vector3 pos)
            {
                if (!ZNet.instance.IsServer() || IsChatMessageIgnored(user, text))
                {
                    return(true);
                }

                ValheimEventHandler.OnPlayerMessage(type, user, text, pos);

                return(true);
            }
Esempio n. 7
0
        public static void OnPlayerMessage(Talker.Type type, string user, string message, Vector3 pos)
        {
            switch (type)
            {
            case Talker.Type.Whisper:
                if (!Main.Configuration.Events[ValheimEvent.OnPlayerWhisper].Value)
                {
                    return;
                }

                Utils.PostMessage(message, $"{user} said");
                break;

            case Talker.Type.Normal:
                if (!Main.Configuration.Events[ValheimEvent.OnPlayerMessage].Value)
                {
                    return;
                }

                Utils.PostMessage(message, $"{user} said");
                break;

            case Talker.Type.Shout:
                if (!Main.Configuration.Events[ValheimEvent.OnPlayerShout].Value)
                {
                    return;
                }
                if (Main.Configuration.UpperCaseShout.Value)
                {
                    message = message.ToUpper();
                }

                Utils.PostMessage(message, $"{user} yelled");
                break;

            case Talker.Type.Ping:
                if (!Main.Configuration.Events[ValheimEvent.OnPlayerPing].Value)
                {
                    return;
                }

                Utils.PostMessage($"Location: ({pos.x}x, {pos.y}y, {pos.z}z)", $"{user} pinged");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Esempio n. 8
0
 // Token: 0x06000284 RID: 644 RVA: 0x0001463C File Offset: 0x0001283C
 public void Say(Talker.Type type, string text)
 {
     ZLog.Log(string.Concat(new object[]
     {
         "Saying ",
         type,
         "  ",
         text
     }));
     this.m_nview.InvokeRPC(ZNetView.Everybody, "Say", new object[]
     {
         (int)type,
         Game.instance.GetPlayerProfile().GetName(),
         text
     });
 }
Esempio n. 9
0
            public static bool SendText(Chat self, Talker.Type type, string text)
            {
                var Ply = Player.m_localPlayer;

                if (Ply)
                {
                    ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "StaffMessage", new object[]
                    {
                        text,
                        (int)type,
                        Ply.GetHeadPoint(),
                        Ply.GetPlayerName()
                    });
                }
                return(CONST.SKIP);
            }
Esempio n. 10
0
    // Token: 0x060004B0 RID: 1200 RVA: 0x00025AAC File Offset: 0x00023CAC
    private void AddInworldText(GameObject go, long senderID, Vector3 position, Talker.Type type, string user, string text)
    {
        Chat.WorldTextInstance worldTextInstance = this.FindExistingWorldText(senderID);
        if (worldTextInstance == null)
        {
            worldTextInstance            = new Chat.WorldTextInstance();
            worldTextInstance.m_talkerID = senderID;
            worldTextInstance.m_gui      = UnityEngine.Object.Instantiate <GameObject>(this.m_worldTextBase, base.transform);
            worldTextInstance.m_gui.gameObject.SetActive(true);
            worldTextInstance.m_textField = worldTextInstance.m_gui.transform.Find("Text").GetComponent <Text>();
            this.m_worldTexts.Add(worldTextInstance);
        }
        worldTextInstance.m_name     = user;
        worldTextInstance.m_type     = type;
        worldTextInstance.m_go       = go;
        worldTextInstance.m_position = position;
        Color color;

        switch (type)
        {
        case Talker.Type.Whisper:
            color = new Color(1f, 1f, 1f, 0.75f);
            text  = text.ToLowerInvariant();
            goto IL_104;

        case Talker.Type.Shout:
            color = Color.yellow;
            text  = text.ToUpper();
            goto IL_104;

        case Talker.Type.Ping:
            color = new Color(0.6f, 0.7f, 1f, 1f);
            text  = "PING";
            goto IL_104;
        }
        color = Color.white;
IL_104:
        worldTextInstance.m_textField.color = color;
        worldTextInstance.m_textField.GetComponent <Outline>().enabled = (type > Talker.Type.Whisper);
        worldTextInstance.m_timer = 0f;
        worldTextInstance.m_text  = text;
        this.UpdateWorldTextField(worldTextInstance);
    }
Esempio n. 11
0
        private static void ChatMessage(Talker.Type type, string username, string message)
        {
            Player playerSender = Player.m_localPlayer;

            foreach (Player player in Player.GetAllPlayers())
            {
                if (player.GetPlayerName().ToLower().Equals(username.ToLower()))
                {
                    playerSender = player;
                    break;
                }
            }

            if (playerSender)
            {
                if (type == Talker.Type.Shout)
                {
                    if (ZRoutedRpc.instance != null)
                    {
                        ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", new object[]
                        {
                            playerSender.GetHeadPoint(),
                            2,
                            username,
                            message
                        });
                    }
                    return;
                }
                ZNetView nview = playerSender.GetComponent <Talker>().GetComponent <ZNetView>();

                if (nview)
                {
                    nview.InvokeRPC(ZNetView.Everybody, "Say", new object[]
                    {
                        (int)type,
                        username,
                        message
                    });
                }
            }
        }
Esempio n. 12
0
    // Token: 0x060004B7 RID: 1207 RVA: 0x00025F24 File Offset: 0x00024124
    public void SendText(Talker.Type type, string text)
    {
        Player localPlayer = Player.m_localPlayer;

        if (localPlayer)
        {
            if (type == Talker.Type.Shout)
            {
                ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "ChatMessage", new object[]
                {
                    localPlayer.GetHeadPoint(),
                    2,
                    localPlayer.GetPlayerName(),
                    text
                });
                return;
            }
            localPlayer.GetComponent <Talker>().Say(type, text);
        }
    }
Esempio n. 13
0
    // Token: 0x060004B5 RID: 1205 RVA: 0x00025D70 File Offset: 0x00023F70
    private void InputText()
    {
        string text = this.m_input.text;

        if (text == "/resetspawn")
        {
            PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
            if (playerProfile != null)
            {
                playerProfile.ClearCustomSpawnPoint();
            }
            this.AddString("Reseting spawn point");
            return;
        }
        if (text == "/killme")
        {
            HitData hitData = new HitData();
            hitData.m_damage.m_damage = 99999f;
            Player.m_localPlayer.Damage(hitData);
            return;
        }
        Talker.Type type = Talker.Type.Normal;
        if (text.StartsWith("/s ") || text.StartsWith("/S "))
        {
            type = Talker.Type.Shout;
            text = text.Substring(3);
        }
        if (text.StartsWith("/w ") || text.StartsWith("/W "))
        {
            type = Talker.Type.Whisper;
            text = text.Substring(3);
        }
        if (text.StartsWith("/wave"))
        {
            Player.m_localPlayer.StartEmote("wave", true);
            return;
        }
        if (text.StartsWith("/sit"))
        {
            Player.m_localPlayer.StartEmote("sit", false);
            return;
        }
        if (text.StartsWith("/challenge"))
        {
            Player.m_localPlayer.StartEmote("challenge", true);
            return;
        }
        if (text.StartsWith("/cheer"))
        {
            Player.m_localPlayer.StartEmote("cheer", true);
            return;
        }
        if (text.StartsWith("/nonono"))
        {
            Player.m_localPlayer.StartEmote("nonono", true);
            return;
        }
        if (text.StartsWith("/thumbsup"))
        {
            Player.m_localPlayer.StartEmote("thumbsup", true);
            return;
        }
        if (text.StartsWith("/point"))
        {
            Player.m_localPlayer.FaceLookDirection();
            Player.m_localPlayer.StartEmote("point", true);
            return;
        }
        this.SendText(type, text);
    }
Esempio n. 14
0
 public static bool Prefix(Chat __instance, long senderID, Talker.Type type, ref string user, ref string text)
 {
     return(Events.Server.CHAT.OnNewChatMessage(__instance, senderID, type, ref user, ref text));
 }
Esempio n. 15
0
 static void Prefix(ref Chat __instance, ref GameObject go, ref long senderID, ref Vector3 pos, ref Talker.Type type, ref string user, ref string text)
 {
     __instance.m_hideTimer = 0f;
 }
 public static void OnNewChatMessage(GameObject go, long senderID, Vector3 pos, Talker.Type type, string user, string text)
 {
     if (!user.Equals(config.Username) && config.ShowChatYell)
     {
         if (type == Talker.Type.Shout)
         {
             console.print(user + " yelled " + text);
         }
     }
 }
Esempio n. 17
0
        private static bool Prefix(ref Chat __instance, GameObject go, long senderID, Vector3 pos, Talker.Type type, string user, string text)
        {
            if (Configuration.Current.Chat.IsEnabled)
            {
                Player Author = Helper.getPlayerBySenderId(senderID);

                // Handle Ping Changes
                if (type == Talker.Type.Ping && Configuration.Current.Chat.pingDistance > 1)
                {
                    text = text.Replace('<', ' ');
                    text = text.Replace('>', ' ');

                    // Restrict the ping display to players only within a certain radius of the creator of the ping
                    if (Vector3.Distance(Author.transform.position, Player.m_localPlayer.transform.position) >= Configuration.Current.Chat.pingDistance)
                    {
                        // exit
                        return(false);
                    }

                    __instance.AddInworldText(go, senderID, pos, type, user, text);
                    return(false);
                }

                // Handle Shout distances and types
                if (type == Talker.Type.Shout && Configuration.Current.Chat.shoutDistance > 1)
                {
                    // Restrict the shout display to players only within a certain radius
                    if (Vector3.Distance(Author.transform.position, Player.m_localPlayer.transform.position) <= Configuration.Current.Chat.shoutDistance)
                    {
                        // rerturn to default behavior
                        return(true);
                    }
                    else
                    {
                        // Only add string to chat window and show no ping
                        if (Configuration.Current.Chat.outOfRangeShoutsDisplayInChatWindow)
                        {
                            __instance.AddString(user, text, Talker.Type.Shout);
                        }
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 18
0
 private static void Prefix(ref Chat __instance, ref GameObject go, ref long senderID, ref Vector3 pos, ref Talker.Type type, ref string user, ref string text)
 {
     if (ValheimPermissions.ServerMode)
     {
         /*
          * ZNetPeer peer = ZNet.instance.GetPeer(senderID);
          * string peerSteamID = ((ZSteamSocket)peer.m_socket).GetPeerID().m_SteamID.ToString(); // Get the SteamID from peer.
          * string permission = "hackshardgaming.valheimpermission.consoleaccess";
          * bool result = ValheimDB.CheckUserPermission(peerSteamID, permission);
          * if (result)
          * {
          *  RPC.ProcessClientSideCommand(senderID, text);
          *  return;
          * }
          */
     }
     else
     {
         if (senderID == ZRoutedRpc.instance.GetServerPeerID())
         {
             Debug.Loguntagged($"{user}: {text}");
         }
     }
 }
Esempio n. 19
0
 public static bool OnNewChatMessage(Chat self, long senderID, Talker.Type type, ref string user, ref string text)
 {
     return(CONST.NOSKIP);
 }
Esempio n. 20
0
        private static void Prefix(ref Chat __instance, ref GameObject go, ref long senderID, ref Vector3 pos, ref Talker.Type type, ref string user, ref string text)
        {
            // Add the last received message of a specific user so that we can format the floating text later.
            var userInfo = new UserMessageInfo()
            {
                GameObject = go,
                Position   = pos,
                SenderID   = senderID,
                Type       = type,
                User       = user,
                Text       = text
            };

            VChatPlugin.ReceivedMessageInfo.AddOrUpdate(senderID, userInfo, (key, oldValue) => userInfo);
        }
Esempio n. 21
0
            public static bool OnNewChatMessage(Chat self, ref float ___m_hideTimer, GameObject go, long senderID, Vector3 pos, Talker.Type type, ref string user, ref string text)
            {
                if (type != Talker.Type.Ping)
                {
                    ___m_hideTimer = 0f;
                    typeof(Chat).GetMethod("AddString", CONST.ALLFLAGS, null, new Type[] {
                        typeof(string), typeof(string), typeof(Talker.Type)
                    }, null).Invoke(self, new object[] {
                        user, text, type
                    });
                    return(CONST.SKIP);
                }
                ;

                typeof(Chat).GetMethod("AddInworldText", CONST.ALLFLAGS).Invoke(self, new object[] {
                    go, senderID, pos, type, user, text
                });
                return(CONST.SKIP);
            }
Esempio n. 22
0
 public static void AddString(this Chat instance, string user, string text, Talker.Type type)
 {
     throw new NotImplementedException("Stub");
 }
 private static void OnNewChatMessage_Postfix(Chat __instance, GameObject go, long senderID, Vector3 pos, Talker.Type type, string user, string text)
 {
     // Resetting this to 0 restarts the window hide timer (and makes the window visible)
     sHideTimerField.SetValue(__instance, 0.0f);
 }
Esempio n. 24
0
 private static bool Prefix(Chat __instance, Talker.Type type, string text)
 {
     return(Events.Client.CHAT.SendText(__instance, type, text));
 }
Esempio n. 25
0
        private static bool Prefix(ref Chat __instance, ref string user, ref string text, ref Talker.Type type)
        {
            // Pings should not add a message to the chat.
            if (type == Talker.Type.Ping)
            {
                return(false);
            }

            __instance.AddString(VChatPlugin.GetFormattedMessage(new CombinedMessageType(type), user, text));
            return(false);
        }
Esempio n. 26
0
        private static bool Prefix(Chat __instance, ref long senderID, ref Vector3 pos, ref Talker.Type type,
                                   ref string user, ref string text)
        {
            Log.LogInfo($"[Chat] [{Enum.GetName(typeof(Talker.Type), type)}] {user} ({senderID}) {pos}: {text}");

            // Prevent OOC messages from appearing on the player's head.
            if (!IsOOC(text))
            {
                return(true);
            }
            text = text.Replace('<', ' ');
            text = text.Replace('>', ' ');
            __instance.AddString(user, text, type);
            return(false);
        }
Esempio n. 27
0
        private static bool Prefix(Chat __instance, ref string user, ref string text, ref Talker.Type type)
        {
            if (!IsOOC(text))
            {
                return(true);
            }
            text = text.Substring(text.IndexOf(" "));

            var message = $"<color={ColorUtility.ToHtmlStringRGBA(Color.blue)}>[OOC] {user}:{text}</color>";

            __instance.AddString(message);

            return(false);
        }
Esempio n. 28
0
            private static bool Prefix(ref long senderID, ref string user, ref string text, ref Talker.Type type)
            {
                if (text.ToLower().StartsWith("!user") || text.ToLower().StartsWith("!group"))
                {
                    RPC.ProcessClientSideCommand(senderID, text);
                }

                return(true);
            }
Esempio n. 29
0
 private static bool Prefix(Chat __instance, ref float ___m_hideTimer, GameObject go, long senderID, Vector3 pos, Talker.Type type, ref string user, ref string text)
 {
     Valgrind.Events.Client.CHAT.OnNewChatMessage(__instance, ref ___m_hideTimer, go, senderID, pos, type, ref user, ref text);
     return(false);
 }