Beispiel #1
0
        private void Game_OnGameProcessPacket(GamePacketEventArgs args)
        {
            if (!IsActive())
            {
                return;
            }
            if (!JungleTimer.GetActive())
            {
                return;
            }
            try
            {
                var reader = new BinaryReader(new MemoryStream(args.PacketData));

                byte packetId = reader.ReadByte();
                if (packetId == Packet.S2C.EmptyJungleCamp.Header)
                {
                    //Packet.S2C.EmptyJungleCamp.Struct decoded = Packet.S2C.EmptyJungleCamp.Decoded(args.PacketData);
                    //UpdateCamps(decoded.UnitNetworkId, decoded.CampId, decoded.EmptyType);
                    //Log.LogPacket(args.PacketData);
                    var packet = new GamePacket(args.PacketData);
                    var result = new Packet.S2C.EmptyJungleCamp.Struct();
                    result.CampId        = packet.ReadInteger(6);
                    result.UnitNetworkId = packet.ReadInteger();
                    UpdateCamps(result.UnitNetworkId, result.CampId);
                }
                if (packetId == Packet.S2C.EmptyJungleCamp.Header)
                {
                    var stream = new MemoryStream(args.PacketData);
                    using (var b = new BinaryReader(stream))
                    {
                        int pos    = 0;
                        var length = (int)b.BaseStream.Length;
                        while (pos < length)
                        {
                            int v = b.ReadInt32();
                            if (v == 195) //OLD 194
                            {
                                byte[] h = b.ReadBytes(1);
                                EmptyCamp(b);
                            }
                            pos += sizeof(int);
                        }
                    }
                }
            }
            catch (EndOfStreamException)
            {
            }
        }
Beispiel #2
0
        static void Game_OnGameProcessPacket(GamePacketEventArgs args)
        {
            if (args.PacketData[0] == Packet.S2C.EmptyJungleCamp.Header)
            {
                Packet.S2C.EmptyJungleCamp.Struct camp = Packet.S2C.EmptyJungleCamp.Decoded(args.PacketData);
                Console.WriteLine("disable camp: " + camp.CampId);
                jTimer.disableCamp((byte)camp.CampId);
            }

            if (args.PacketData[0] == 0xE9)
            {
                GamePacket gp = new GamePacket(args.PacketData);
                gp.Position = 21;
                byte campID = gp.ReadByte();
                Console.WriteLine("Enable camp: " + campID);
                jTimer.enableCamp(campID);
            }

            //AfterAttack
            if (args.PacketData[0] == 0x65 && Config.Item("doJungle").GetValue <KeyBind>().Active)
            {
                GamePacket gp = new GamePacket(args.PacketData);
                gp.Position = 1;
                Packet.S2C.Damage.Struct dmg = Packet.S2C.Damage.Decoded(args.PacketData);

                int   targetID            = gp.ReadInteger();
                int   dType               = (int)gp.ReadByte();
                int   Unknown             = gp.ReadShort();
                float DamageAmount        = gp.ReadFloat();
                int   TargetNetworkIdCopy = gp.ReadInteger();
                int   SourceNetworkId     = gp.ReadInteger();
                float dmga = (float)player.GetAutoAttackDamage(ObjectManager.GetUnitByNetworkId <Obj_AI_Base>(targetID));
                if (dmga - 10 > DamageAmount || dmga + 10 < DamageAmount)
                {
                    return;
                }
                if (player.NetworkId != dmg.SourceNetworkId || player.NetworkId == targetID || player.NetworkId == TargetNetworkIdCopy)
                {
                    return;
                }
                Obj_AI_Base targ = ObjectManager.GetUnitByNetworkId <Obj_AI_Base>(dmg.TargetNetworkId);
                if ((int)dmg.Type == 12 || (int)dmg.Type == 4 || (int)dmg.Type == 3)
                {
                    Console.WriteLine("dmg: " + DamageAmount + " : " + dmga);

                    JungleClearer.jungler.doAfterAttack(targ);
                }
            }
        }