Exemplo n.º 1
0
        public Projectile(
            Game game,
            float x,
            float y,
            int collisionRadius,
            IAttackableUnit owner,
            ITarget target,
            ISpell originSpell,
            float moveSpeed,
            string projectileName,
            int flags       = 0,
            uint netId      = 0,
            bool serverOnly = false
            ) : base(game, x, y, collisionRadius, 0, netId)
        {
            SpellData    = _game.Config.ContentManager.GetSpellData(projectileName);
            OriginSpell  = originSpell;
            _moveSpeed   = moveSpeed;
            Owner        = owner;
            Team         = owner.Team;
            ProjectileId = (int)HashFunctions.HashString(projectileName);
            if (!string.IsNullOrEmpty(projectileName))
            {
                VisionRadius = SpellData.MissilePerceptionBubbleRadius;
            }
            ObjectsHit = new List <IGameObject>();

            Target       = target;
            IsServerOnly = serverOnly;
        }
Exemplo n.º 2
0
        public Projectile(
            Game game,
            float x,
            float y,
            int collisionRadius,
            AttackableUnit owner,
            Target target,
            Spell originSpell,
            float moveSpeed,
            string projectileName,
            int flags  = 0,
            uint netId = 0
            ) : base(game, x, y, collisionRadius, 0, netId)
        {
            SpellData    = _game.Config.ContentManager.GetSpellData(projectileName);
            _originSpell = originSpell;
            _moveSpeed   = moveSpeed;
            Owner        = owner;
            Team         = owner.Team;
            ProjectileId = (int)HashFunctions.HashString(projectileName);
            if (!string.IsNullOrEmpty(projectileName))
            {
                VisionRadius = SpellData.MissilePerceptionBubbleRadius;
            }
            ObjectsHit = new List <GameObject>();

            Target = target;

            if (!target.IsSimpleTarget)
            {
                ((GameObject)target).IncrementAttackerCount();
            }

            owner.IncrementAttackerCount();
        }
Exemplo n.º 3
0
 public RemoveBuff(AttackableUnit u, string name, byte slot)
     : base(PacketCmd.PKT_S2C_RemoveBuff, u.NetId)
 {
     buffer.Write((byte)slot);
     buffer.Write(HashFunctions.HashString(name));
     buffer.Write((int)0x0);
     //buffer.Write(u.NetId);//source?
 }
Exemplo n.º 4
0
        public SynchVersionResponse(List <Pair <uint, ClientInfo> > players, string version, string gameMode, int map)
            : base(PacketCmd.PKT_S2C_SynchVersion)
        {
            buffer.Write((byte)1); // Bit field
            // First bit: doVersionsMatch - If set to 0, the client closes
            // Second bit: Seems to enable a 'ClientMetricsLogger'
            buffer.Write((uint)map); // mapId
            foreach (var player in players)
            {
                var p = player.Item2;
                var summonerSpells = p.SummonerSkills;
                buffer.Write((long)p.UserId);
                buffer.Write((short)0x1E); // unk
                buffer.Write((uint)HashFunctions.HashString(summonerSpells[0]));
                buffer.Write((uint)HashFunctions.HashString(summonerSpells[1]));
                buffer.Write((byte)0);     // bot boolean
                buffer.Write((int)p.Team); // Probably a short
                buffer.fill(0, 64);        // name is no longer here
                buffer.fill(0, 64);
                foreach (var b in Encoding.Default.GetBytes(p.Rank))
                {
                    buffer.Write((byte)b);
                }
                buffer.fill(0, 24 - p.Rank.Length);
                buffer.Write((int)p.Icon);
                buffer.Write((short)p.Ribbon);
            }

            for (var i = 0; i < 12 - players.Count; ++i)
            {
                buffer.Write((long)-1);
                buffer.fill(0, 173);
            }
            foreach (var b in Encoding.Default.GetBytes(version))
            {
                buffer.Write((byte)b);
            }
            buffer.fill(0, 256 - version.Length);
            foreach (var b in Encoding.Default.GetBytes(gameMode))
            {
                buffer.Write((byte)b);
            }
            buffer.fill(0, 128 - gameMode.Length);

            foreach (var b in Encoding.Default.GetBytes("NA1"))
            {
                buffer.Write((byte)b);
            }
            buffer.fill(0, 2333);       // 128 - 3 + 661 + 1546
            buffer.Write((uint)487826); // gameFeatures (turret range indicators, etc.)
            buffer.fill(0, 256);
            buffer.Write((uint)0);
            buffer.fill(1, 19);
        }
Exemplo n.º 5
0
        static BloomFilter <string> CreateBloomFilter(List <ValueDate> valueDateList)
        {
            var a = HashFunctions.HashString("1414878402940000100--714878314580000218|10479|714878314580001618|10424|-0-0");

            var bloomFilter = new BloomFilter <string>(100000, HashFunctions.HashString);

            valueDateList.ForEach(vd =>
            {
                bloomFilter.Add(vd.RowId);
            });

            return(bloomFilter);
        }
Exemplo n.º 6
0
        public Projectile(
            Game game,
            float x,
            float y,
            int collisionRadius,
            IAttackableUnit owner,
            ITarget target,
            ISpell originSpell,
            float moveSpeed,
            string projectileName,
            int flags       = 0,
            uint netId      = 0,
            bool serverOnly = false,
            bool gudumlu    = false

            ) : base(game, x, y, collisionRadius, 0, netId)
        {
            SpellData    = _game.Config.ContentManager.GetSpellData(projectileName);
            OriginSpell  = originSpell;
            _moveSpeed   = moveSpeed;
            Owner        = owner;
            Team         = owner.Team;
            ProjectileId = (int)HashFunctions.HashString(projectileName);
            if (!string.IsNullOrEmpty(projectileName))
            {
                VisionRadius = SpellData.MissilePerceptionBubbleRadius;
            }
            ObjectsHit = new List <IGameObject>();
            if (gudumlu)
            {
                var         lastDist = 1000.0f;
                IGameObject lastObj  = this;
                var         objects  = _game.ObjectManager.GetObjects();
                foreach (var obj in objects)
                {
                    if (GetDistanceTo(obj.Value) < lastDist)
                    {
                        lastObj  = obj.Value;
                        lastDist = GetDistanceTo(obj.Value);
                    }
                }
                hedef = lastObj;
            }
            Target       = target;
            IsServerOnly = serverOnly;
        }
Exemplo n.º 7
0
        public SpawnParticle(Particle particle)
            : base(PacketCmd.PKT_S2C_SpawnParticle, particle.Owner.NetId)
        {
            buffer.Write((byte)1); // number of particles
            buffer.Write((uint)particle.Owner.getChampionHash());
            buffer.Write((uint)HashFunctions.HashString(particle.Name));
            buffer.Write((int)0x00000020); // flags ?

            buffer.Write((short)0);        // Unk
            buffer.Write((uint)HashFunctions.HashString(particle.BoneName));

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

            if (particle.Target.IsSimpleTarget)
            {
                buffer.Write((int)0);
            }
            else
            {
                buffer.Write((particle.Target as GameObject).NetId);
            }

            buffer.Write((int)0); // unk

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

            buffer.Write((uint)0);              // unk
            buffer.Write((uint)0);              // unk
            buffer.Write((uint)0);              // unk
            buffer.Write((uint)0);              // unk
            buffer.Write((float)particle.Size); // Particle size
        }
Exemplo n.º 8
0
        public AvatarInfo(ClientInfo player)
            : base(PacketCmd.PKT_S2C_AvatarInfo, player.Champion.NetId)
        {
            int runesRequired = 30;

            foreach (var rune in player.Champion.RuneList._runes)
            {
                buffer.Write((short)rune.Value);
                buffer.Write((short)0x00);
                runesRequired--;
            }
            for (int i = 1; i <= runesRequired; i++)
            {
                buffer.Write((short)0);
                buffer.Write((short)0);
            }

            var summonerSpells = player.SummonerSkills;

            buffer.Write((uint)HashFunctions.HashString(summonerSpells[0]));
            buffer.Write((uint)HashFunctions.HashString(summonerSpells[1]));

            int talentsRequired = 80;
            var talentsHashes   = new Dictionary <int, byte>()
            {
                { 0, 0 } // hash, level
            };

            foreach (var talent in talentsHashes)
            {
                buffer.Write((int)talent.Key);    // hash
                buffer.Write((byte)talent.Value); // level
                talentsRequired--;
            }
            for (int i = 1; i <= talentsRequired; i++)
            {
                buffer.Write((int)0);
                buffer.Write((byte)0);
            }

            buffer.Write((short)30); // avatarLevel
        }
Exemplo n.º 9
0
        public AddBuff(AttackableUnit u, AttackableUnit source, int stacks, float time, BuffType buffType, string name, byte slot)
            : base(PacketCmd.PKT_S2C_AddBuff, u.NetId)
        {
            buffer.Write((byte)slot);                     //Slot
            buffer.Write((byte)buffType);                 //Type
            buffer.Write((byte)stacks);                   // stacks
            buffer.Write((byte)0x00);                     // Visible was (byte)0x00
            buffer.Write(HashFunctions.HashString(name)); //Buff id

            buffer.Write((int)0);                         // <-- Probably runningTime

            buffer.Write((float)0);                       // <- ProgressStartPercent

            buffer.Write((float)time);

            if (source != null)
            {
                buffer.Write(source.NetId); //source
            }
            else
            {
                buffer.Write((int)0);
            }
        }
Exemplo n.º 10
0
 public void WriteStringHash(string str)
 {
     Write(HashFunctions.HashString(str));
 }
Exemplo n.º 11
0
 /// <returns>spell's unique ID</returns>
 public int GetId()
 {
     return((int)HashFunctions.HashString(SpellName));
 }