예제 #1
0
        public override bool OnPacketReceived(Packet packet, IClient client)
        {
            if (packet.Opcode == 0x70A1)
            {
                GetLogger().Info("Skill UP = {0} ", packet.ReadInt32());
            }

            if (packet.Opcode == 0x7034)
            {
                byte type = packet.ReadUInt8();

                if (type == 0)
                {
                    byte slot1 = packet.ReadUInt8();
                    byte slot2 = packet.ReadUInt8();
                    GetLogger().Info("Change Slot - Slot = {0} , Slot = {1}", slot1, slot2);
                }
                else if (type == 7)
                {
                    byte droppedslot = packet.ReadUInt8();

                    GetLogger().Info("Item Dropped - Slot = {0}", droppedslot);
                }
            }

            if (packet.Opcode == 0xB0A2)
            {
                ushort masterId = packet.ReadUInt16(); // Yetenek Grubu
                byte   seed     = packet.ReadUInt8();  // Yükseltme Seviyesi
                packet.ReadBytes(2);                   // Unk bytes
                byte currentLevel = packet.ReadUInt8();

                GetLogger().Info("Mastery ID = {0}, Seed = {1} , CurrentLevel = {2}", masterId, seed, currentLevel);

                GetLogger().Info("[0xB0A2]\n" + ByteArrayExtension.HexDump(packet.GetBytes()));
                return(false);
            }

            GetLogger().Info(packet.Opcode.ToString("X"));
            GetLogger().Info(ByteArrayExtension.HexDump(packet.GetBytes()));
            return(true);
        }
예제 #2
0
        public override bool OnPacketReceived(Packet packet, IClient client)
        {
            if (packet.Opcode == 0x133D && !fp_enabled)
            {
                packet.Replace(new Packet(0x2002));
                return(true);
            }

            if (packet.Opcode == 0x133D)
            {
                if (!fp_enabled)
                {
                    return(false);
                }

                try {
                    ushort version = packet.ReadUInt16();
                    packet.ReadAscii();

                    int    size           = packet.ReadUInt16();
                    byte[] bytes          = packet.ReadBytes(size);
                    byte[] decryptedbytes = AES.Decrypt(bytes);

                    PacketReader reader = new PacketReader(decryptedbytes);

                    string fp       = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
                    bool   isVMWare = reader.ReadByte() == 1;
                    bool   isVPC    = reader.ReadByte() == 1;
                    string key      = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));

                    fp user = new fp()
                    {
                        client      = client,
                        hash        = fp,
                        isvmware    = isVMWare,
                        isvpc       = isVPC,
                        providerkey = key
                    };

                    fp find = this.fplist.Find(x => x.client == client);

                    if (user.isvmware && !fp_allow_vmware)
                    {
                        client.Disconnect();
                        GetLogger().Trace("The user will be disconnected due use VMWare.");
                        return(false);
                    }

                    if (user.isvpc && !fp_allow_vpc)
                    {
                        client.Disconnect();
                        GetLogger().Trace("The user will be disconnected due use VPC.");
                        return(false);
                    }

                    if (key != provider_key)
                    {
                        client.Disconnect();
                        GetLogger().Trace("The user will be disconnected due wrong provider key.");
                        return(false);
                    }



                    if (find == null)
                    {
                        this.fplist.Add(user);
                        CheckSameFPs(user);
                    }
                    else
                    {
                        this.fplist.Remove(find);
                        this.fplist.Add(user);
                        CheckSameFPs(user);
                    }

                    GetLogger().Trace("FP:" + user.hash);
                }
                catch (Exception e)
                {
                    GetLogger().Warn(e);
                    GetLogger().Trace("Something went wrong. The User IP = {0}, Packet Hex Bytes = {1}", client.IPAddress, ByteArrayExtension.HexDump(packet.GetBytes()));
                }

                packet.Replace(new Packet(0x2002));
                return(true);
            }

            if (packet.Opcode == 0xA102)
            {
                if (ip_enabled)
                {
                    List <IClient> ips = GetSameIPs(client);

                    if (ips.Count > ip_limit)
                    {
                        Packet resp = new Packet(packet.Opcode, packet.Encrypted, packet.Massive);
                        resp.WriteUInt8(0x02);
                        resp.WriteUInt8(0xF);
                        resp.Lock();
                        packet.Replace(resp);
                    }
                }


                if (fp_enabled)
                {
                    List <fp> fps = GetSameFps(client);

                    if (fps.Count > fp_limit || fps.Count == 0)
                    {
                        Packet resp = new Packet(packet.Opcode, packet.Encrypted, packet.Massive);
                        resp.WriteUInt8(0x02);
                        resp.WriteUInt8(0xF);
                        resp.Lock();
                        packet.Replace(resp);
                    }
                }
            }

            return(true);
        }