Esempio n. 1
0
 public static byte[] CustomEmoteItem(UserObject userobj, CustomEmoticon item)
 {
     AresTCPPacketWriter packet = new AresTCPPacketWriter();
     packet.WriteString(userobj.Name);
     packet.WriteString(item.Shortcut);
     packet.WriteByte(item.Size);
     packet.WriteBytes(item.Image);
     byte[] buf = packet.ToAresPacket(ProtoMessage.MSG_CHAT_SERVER_CUSTOM_EMOTES_ITEM);
     packet = new AresTCPPacketWriter();
     packet.WriteBytes(buf);
     return packet.ToAresPacket(ProtoMessage.MSG_CHAT_ADVANCED_FEATURES_PROTOCOL);
 }
Esempio n. 2
0
        private static void ProcessCustomEmoteUpload(UserObject userobj, AresTCPPacketReader packet)
        {
            if (!Settings.CanCustomEmotes)
                return;

            ProcessSupportsCustomEmotes(userobj);

            CustomEmoticon emoticon = new CustomEmoticon
            {
                Shortcut = packet.ReadString(),
                Size = packet.ReadByte(),
                Image = packet.ReadBytes()
            };

            userobj.CustomEmoticons.Add(emoticon);

            if (userobj.CustomEmoticons.Count > 16)
                throw new Exception("exceeded custom emoticon maximum");

            byte[] buf = CustomPackets.CustomEmoteItem(userobj, emoticon);

            UserPool.Users.ForEach(x =>
            {
                if (x.LoggedIn && x.Vroom == userobj.Vroom)
                    if (x.SupportsCustomEmoticons)
                        x.SendPacket(buf);
            });
        }