Exemplo n.º 1
0
 public CastSpellResponse(INavGrid navGrid, ISpell s, float x, float y, float xDragEnd, float yDragEnd, uint futureProjNetId, uint spellNetId)
     : base(PacketCmd.PKT_S2C_CAST_SPELL_ANS, s.Owner.NetId)
 {
     Write(Environment.TickCount); // syncID
     Write((byte)0);               // Unk
     Write((short)0x66);           // Buffer size from here
     Write((int)s.GetId());        // Spell hash, for example hash("EzrealMysticShot")
     Write((uint)spellNetId);      // Spell net ID
     Write((byte)(s.Level - 1));
     Write(1.0f);                  // attackSpeedMod
     WriteNetId(s.Owner);
     WriteNetId(s.Owner);
     Write((int)s.Owner.GetChampionHash());
     Write((uint)futureProjNetId); // The projectile ID that will be spawned
     Write((float)x);
     Write((float)navGrid.GetHeightAtLocation(x, y));
     Write((float)y);
     Write((float)xDragEnd);
     Write((float)navGrid.GetHeightAtLocation(xDragEnd, yDragEnd));
     Write((float)yDragEnd);
     Write((byte)0);                                              // numTargets (if >0, what follows is a list of {uint32 targetNetId, uint8 hitResult})
     Write((float)s.SpellData.GetCastTime());                     // designerCastTime
     Write(0.0f);                                                 // extraTimeForCast
     Write((float)s.SpellData.GetCastTime() /*+ s.ChannelTime*/); // designerTotalTime
     Write((float)s.GetCooldown());
     Write(0.0f);                                                 // startCastTime
     Write((byte)0);                                              // flags (isAutoAttack, secondAttack, forceCastingOrChannelling, mShouldOverrideCastPosition)
     Write((byte)s.Slot);
     Write((float)s.SpellData.ManaCost[s.Level]);
     Write((float)s.Owner.X);
     Write((float)s.Owner.GetZ());
     Write((float)s.Owner.Y);
     Write((long)1); // Unk
 }
Exemplo n.º 2
0
        public void NotifyFaceDirection(IAttackableUnit u, Vector2 direction, bool isInstant = true, float turnTime = 0.0833f)
        {
            var height = _navGrid.GetHeightAtLocation(direction);
            var fd     = new FaceDirection(u, direction.X, direction.Y, height, isInstant, turnTime);

            _packetHandlerManager.BroadcastPacketVision(u, fd, Channel.CHL_S2C);
        }
Exemplo n.º 3
0
        public SpawnParticle(INavGrid navGrid, IParticle particle)
            : base(PacketCmd.PKT_S2C_SPAWN_PARTICLE, particle.Owner.NetId)
        {
            Write((byte)1); // number of particles
            Write((uint)particle.Owner.GetChampionHash());
            WriteStringHash(particle.Name);
            Write(0x00000020); // flags ?

            Write((short)0);   // Unk
            WriteStringHash(particle.BoneName);

            Write((byte)1);       // number of targets ?
            WriteNetId(particle.Owner);
            WriteNetId(particle); // Particle net id ?
            WriteNetId(particle.Owner);

            if (particle.Target.IsSimpleTarget)
            {
                Write(0);
            }
            else
            {
                WriteNetId(particle.Target as IGameObject);
            }

            Write(0); // unk

            for (var i = 0; i < 3; ++i)
            {
                var ownerHeight    = navGrid.GetHeightAtLocation(particle.Owner.X, particle.Owner.Y);
                var particleHeight = navGrid.GetHeightAtLocation(particle.X, particle.Y);
                var higherValue    = Math.Max(ownerHeight, particleHeight);
                Write((short)((particle.Target.X - navGrid.MapWidth / 2) / 2));
                Write(higherValue);
                Write((short)((particle.Target.Y - navGrid.MapHeight / 2) / 2));
            }

            Write((uint)0);       // unk
            Write((uint)0);       // unk
            Write((uint)0);       // unk
            Write((uint)0);       // unk
            Write(particle.Size); // Particle size
        }
Exemplo n.º 4
0
        public SpawnCampMonster(INavGrid navGrid, IMonster m)
            : base(PacketCmd.PKT_S2C_OBJECT_SPAWN, m.NetId)
        {
            Write((byte)0x79);
            Write((byte)0x01);
            Write((byte)0x77);
            Write((byte)0x01);

            Write((byte)0x63); // 0x63 (99) for jungle monster, 3 for minion
            WriteNetId(m);
            WriteNetId(m);
            Write((byte)0x40);
            Write(m.X);                                                 //x
            Write(m.GetZ());                                            //z
            Write(m.Y);                                                 //y
            Write(m.X);                                                 //x
            Write(m.GetZ());                                            //z
            Write(m.Y);                                                 //y
            Write(m.Facing.X);                                          //facing x
            Write(navGrid.GetHeightAtLocation(m.Facing.X, m.Facing.Y)); //facing z
            Write(m.Facing.Y);                                          //facing y

            WriteConstLengthString(m.Name, 64);

            WriteConstLengthString(m.Model, 64);

            WriteConstLengthString(m.Name, 64);

            WriteConstLengthString(m.SpawnAnimation, 64);

            Write((int)m.Team);          // Probably a short
            Fill(0, 12);                 // Unk
            Write((int)m.CampId);        // Camp id. Camp needs to exist
            Write(0);                    // Unk
            Write((int)m.CampUnk);
            Write(1);                    // Unk
            Write(m.SpawnAnimationTime); // After this many seconds, the camp icon appears in the minimap
            Write(1191.533936f);         // Unk
            Write(1);                    // Unk
            Fill(0, 40);                 // Unk
            Write(1.0f);                 // Unk
            Fill(0, 13);                 // Unk
            Write((byte)3);              //type 3=champ/jungle; 2=minion
            Write((byte)0xF1);           //<-|
            Write((byte)0xFB);           //  |-> Unk
            Write((byte)0x27);           //  |
            Write((byte)0x00);           //<-|
            Write(m.X);                  //x
            Write(m.Y);                  //y
            Write(-0.8589599f);          // rotation1 from -1 to 1
            Write(0.5120428f);           // rotation2 from -1 to 1
        }
Exemplo n.º 5
0
        public SpawnMonster(INavGrid navGrid, IMonster m)
            : base(PacketCmd.PKT_S2C_OBJECT_SPAWN)
        {
            WriteNetId(m);
            Write((short)345);
            Write((short)343);

            Write((byte)0x63); // 0x63 (99) for jungle monster, 3 for minion
            WriteNetId(m);
            WriteNetId(m);
            Write((byte)0x40);
            Write(m.X);                                                 //x
            Write(m.GetZ());                                            //z
            Write(m.Y);                                                 //y
            Write(m.X);                                                 //x
            Write(m.GetZ());                                            //z
            Write(m.Y);                                                 //y
            Write(m.Facing.X);                                          //facing x
            Write(navGrid.GetHeightAtLocation(m.Facing.X, m.Facing.Y)); //facing z
            Write(m.Facing.Y);                                          //facing y

            WriteConstLengthString(m.Name, 64);

            WriteConstLengthString(m.Model, 64);

            WriteConstLengthString(m.Name, 64);

            Fill(0, 64);        // empty

            Write((int)m.Team); // Probably a short
            Fill(0, 12);
            Write(1);           //campId 1
            Write(100);
            Write(74);
            Write((long)1);
            Write(115.0066f);
            Write((byte)0);

            Fill(0, 11);
            Write(1.0f);        // Unk
            Fill(0, 13);
            Write((byte)3);     //type 3=champ/jungle; 2=minion
            Write(13337);
            Write(m.X);         //x
            Write(m.Y);         //y
            Write(-0.8589599f); // rotation1 from -1 to 1
            Write(0.5120428f);  //rotation2 from -1 to 1
        }
Exemplo n.º 6
0
        public SpawnProjectile(INavGrid navGrid, IProjectile p)
            : base(PacketCmd.PKT_S2C_SPAWN_PROJECTILE, p.NetId)
        {
            var targetZ = navGrid.GetHeightAtLocation(p.Target.X, p.Target.Y);

            Write(p.X);
            Write(p.GetZ() + 100.0f);
            Write(p.Y);
            Write(p.X);
            Write(p.GetZ());
            Write(p.Y);
            Write(-0.992436f);    // Rotation X
            Write(0);             // Rotation Z
            Write(-0.122766f);    // Rotation Y
            Write(-1984.871338f); // Unk
            Write(-166.666656f);  // Unk
            Write(-245.531418f);  // Unk
            Write(p.X);
            Write(p.GetZ() + 100.0f);
            Write(p.Y);
            Write(p.Target.X);
            Write(navGrid.GetHeightAtLocation(p.Target.X, p.Target.Y));
            Write(p.Target.Y);
            Write(p.X);
            Write(p.GetZ());
            Write(p.Y);
            Write(0);                // Unk ((float)castDelay ?)
            Write(p.GetMoveSpeed()); // Projectile speed
            Write(0);                // Unk
            Write(0);                // Unk
            Write(0x7f7fffff);       // Unk
            Write((byte)0);          // Unk
            if (!p.Target.IsSimpleTarget)
            {
                Write((short)0x6B); // Buffer size from here
            }
            else
            {
                Write((short)0x66); // Buffer size from here
            }
            Write(p.ProjectileId);  // projectile ID (hashed name)
            Write(0);               // Second net ID
            Write((byte)0);         // spellLevel
            Write(1.0f);            // attackSpeedMod
            WriteNetId(p.Owner);
            WriteNetId(p.Owner);

            if (p.Owner is IChampion c)
            {
                Write(c.GetChampionHash());
            }
            else
            {
                Write(0);
            }

            WriteNetId(p);
            Write(p.Target.X);
            Write(navGrid.GetHeightAtLocation(p.Target.X, p.Target.Y));
            Write(p.Target.Y);
            Write(p.Target.X);
            Write(navGrid.GetHeightAtLocation(p.Target.X, p.Target.Y) + 100.0f);
            Write(p.Target.Y);
            if (!p.Target.IsSimpleTarget)
            {
                Write((byte)0x01); // numTargets
                WriteNetId(p.Target as IAttackableUnit);
                Write((byte)0);    // hitResult
            }
            else
            {
                Write((byte)0); // numTargets
            }
            Write(1.0f);        // designerCastTime -- Doesn't seem to matter
            Write(0);           // extraTimeForCast -- Doesn't seem to matter
            Write(1.0f);        // designerTotalTime -- Doesn't seem to matter
            Write(0.0f);        // cooldown -- Doesn't seem to matter
            Write(0.0f);        // startCastTime -- Doesn't seem to matter
            Write((byte)0x00);  // flags?
            Write((byte)0x30);  // slot?
            Write(0.0f);        // manaCost?
            Write(p.X);
            Write(p.GetZ());
            Write(p.Y);
            Write(0); // Unk
            Write(0); // Unk
        }