Example #1
0
        private void OnChat(ServerChatEventArgs args)
        {
            TSPlayer player = TShock.Players[args.Who];

            if (player == null)
            {
                return;
            }

            //Check if the provided text matches any of the defined regexes
            Regex regex = Regexes.Keys.FirstOrDefault(r => r.IsMatch(args.Text));

            if (regex == null)
            {
                return;
            }

            Match match = regex.Match(args.Text);

            int ID = EmoteBubble.AssignNewID();

            if (!String.IsNullOrEmpty(match.Groups["spoken"].Value))
            {
                args.Handled = true;
            }

            NetMessage.SendData(91, -1, -1, NetworkText.Empty, ID, 1, args.Who, 600, Regexes[regex].EmoteID);
        }
Example #2
0
        public static int AttachEmote(int anchorType, int anchorId, int emoteId, int lifeTime)
        {
            int ID = EmoteBubble.AssignNewID();

            //int anchorType = 0; // 0 = npc, 1 = player, 2 = projectile
            //int anchorId = this.Index;
            //ushort meta1 = 0; //id of the above
            //byte lifeTime = 255;
            //int emoteId = EmoteID.WeatherRain;
            //int emote = 1;

            //TSPlayer.All.SendData(PacketTypes.EmoteBubble, "", emoteId, anchorType, meta1, lifeTime, emote, meta1);
            NetMessage.SendData(91, -1, -1, NetworkText.Empty, ID, anchorType, anchorId, lifeTime, emoteId);

            return(ID);
        }