private static void ProcessCustomEmoteDelete(UserObject userobj, AresTCPPacketReader packet)
        {
            if (!Settings.CanCustomEmotes)
                return;

            String text = packet.ReadString();
            userobj.CustomEmoticons.RemoveAll(x => x.Shortcut == text);
            byte[] buf = CustomPackets.CustomEmoteDelete(userobj, text);

            UserPool.Users.ForEach(x =>
            {
                if (x.LoggedIn && x.Vroom == userobj.Vroom)
                    if (x.SupportsCustomEmoticons)
                        x.SendPacket(buf);
            });
        }
        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);
            });
        }
 private static void ProcessAddCustomTag(UserObject userobj, AresTCPPacketReader packet)
 {
     while (packet.Remaining > 0)
         userobj.CustomTags.Add(packet.ReadString());
 }
        private static void ProcessVCIgnore(UserObject userobj, AresTCPPacketReader packet)
        {
            if (Settings.CanVoiceChat)
            {
                String name = packet.ReadString();

                if (userobj.VCIgnores.Contains(name))
                {
                    userobj.SendPacket(AresTCPPackets.NoSuch(name + " is voice chat unignored"));
                    userobj.VCIgnores.RemoveAll(x => x == name);
                }
                else
                {
                    userobj.SendPacket(AresTCPPackets.NoSuch(name + " is voice chat ignored"));
                    userobj.VCIgnores.Add(name);
                }
            }
        }
        private static void ProcessVCFirstTo(UserObject userobj, AresTCPPacketReader packet)
        {
            if (Settings.CanVoiceChat)
            {
                String name = packet.ReadString();
                UserObject target = UserPool.Users.Find(x => x.LoggedIn && x.Name == name);

                if (target != null)
                    if (!target.VCIgnores.Contains(userobj.Name))
                        if (target.CanVCPrivate)
                        {
                            byte[] buffer = CustomPackets.VoiceChatFirstTo(userobj.Name, packet.ReadBytes());
                            target.SendPacket(buffer);
                        }
                        else userobj.SendPacket(CustomPackets.VoiceChatNoPrivate(target.Name));
                    else userobj.SendPacket(CustomPackets.VoiceChatIgnored(target.Name));
                else userobj.SendPacket(AresTCPPackets.OfflineUser(name));
            }
        }
 private static void ProcessRemCustomTag(UserObject userobj, AresTCPPacketReader packet)
 {
     while (packet.Remaining > 0)
     {
         String str = packet.ReadString();
         userobj.CustomTags.Remove(str);
     }
 }
 private static void ProcessCustomFont(UserObject userobj, AresTCPPacketReader packet)
 {
     if (packet.Remaining == 2)
     {
         userobj.Font = null;
         UserPool.BroadcastToVroom(userobj.Vroom, CustomPackets.CustomFontDefault(userobj));
     }
     else
     {
         userobj.Font = new Font(packet.ReadByte(), packet.ReadString(), packet.ReadByte(), packet.ReadByte());
         UserPool.BroadcastToVroom(userobj.Vroom, CustomPackets.CustomFont(userobj));
     }
 }
Exemple #8
0
 public void PopulateCredentials(AresTCPPacketReader packet)
 {
     this.Guid = packet.ReadGuid();
     this.FileCount = packet.ReadUInt16();
     packet.SkipByte(); // not used
     this.Port = packet.ReadUInt16();
     this.NodeIP = packet.ReadIP();
     this.NodePort = packet.ReadUInt16();
     packet.SkipBytes(4); // line speed
     this.OrgName = packet.ReadString();
     this.OrgName = UserPool.PrepareUserName(this);
     this.name = this.OrgName;
     this.Version = packet.ReadString();
     this.LocalIP = packet.ReadIP();
     packet.SkipBytes(4); // external ip
     this.CanBrowse = packet.ReadByte() >= 3;
     this.FileCount = this.CanBrowse ? this.FileCount : (ushort)0;
     this.CurrentUploads = packet.ReadByte();
     this.MaxUploads = packet.ReadByte();
     this.CurrentQueued = packet.ReadByte();
     this.Age = packet.ReadByte();
     this.Sex = packet.ReadByte();
     this.Country = packet.ReadByte();
     this.Location = packet.ReadString();
     this.Muzzled = Muzzles.IsMuzzled(this);
 }