Exemplo n.º 1
0
        public ChampionDie(Champion die, Unit killer, int goldFromKill) : base(PacketCmdS2C.PKT_S2C_ChampionDie, die.getNetId())
        {
            buffer.Write(goldFromKill); // Gold from kill?
            buffer.Write((short)0);
            if (killer != null)
                buffer.Write(killer.getNetId());
            else
                buffer.Write((int)0);

            buffer.Write((short)0);
            buffer.Write((short)7);
            buffer.Write(die.getRespawnTimer() / 1000.0f); // Respawn timer, float
        }
Exemplo n.º 2
0
 public SetHealth(Unit u) : base(PacketCmdS2C.PKT_S2C_SetHealth, u.getNetId())
 {
     buffer.Write((short)0x0000); // unk,maybe flags for physical/magical/true dmg
     buffer.Write((float)u.getStats().getMaxHealth());
     buffer.Write((float)u.getStats().getCurrentHealth());
 }
Exemplo n.º 3
0
 public OnAttack(Unit attacker, Unit attacked, AttackType attackType) : base(ExtendedPacketCmd.EPKT_S2C_OnAttack, attacker.getNetId())
 {
     buffer.Write((short)attackType);
     buffer.Write(attacked.getX());
     buffer.Write(attacked.getZ());
     buffer.Write(attacked.getY());
     buffer.Write(attacked.getNetId());
 }
Exemplo n.º 4
0
 public SetTarget2(Unit attacker, Unit attacked) : base(PacketCmdS2C.PKT_S2C_SetTarget2, attacker.getNetId())
 {
     if (attacked != null)
     {
         buffer.Write(attacked.getNetId());
     }
     else
     {
         buffer.Write((int)0);
     }
 }
Exemplo n.º 5
0
        public Dash(Unit u, float toX, float toY, float dashSpeed) : base(PacketCmdS2C.PKT_S2C_Dash, 0)
        {
            buffer.Write((short)1); // nb updates ?
            buffer.Write((byte)5); // unk
            buffer.Write((int)u.getNetId());
            buffer.Write((byte)0); // unk
            buffer.Write((float)dashSpeed); // Dash speed
            buffer.Write((int)0); // unk
            buffer.Write((float)u.getX());
            buffer.Write((float)u.getY());
            buffer.Write((int)0); // unk
            buffer.Write((byte)0);

            buffer.Write((int)0x4c079bb5); // unk
            buffer.Write((uint)0xa30036df); // unk
            buffer.Write((int)0x200168c2); // unk

            buffer.Write((byte)0x00); // Vector bitmask on whether they're int16 or byte

            MovementVector from = u.getMap().toMovementVector(u.getX(), u.getY());
            MovementVector to = u.getMap().toMovementVector(toX, toY);

            buffer.Write((short)from.x);
            buffer.Write((short)from.y);
            buffer.Write((short)to.x);
            buffer.Write((short)to.y);
        }
Exemplo n.º 6
0
 public static void notifyModelUpdate(Unit obj)
 {
     var mp = new UpdateModel(obj.getNetId(), obj.getModel());
     PacketHandlerManager.getInstace().broadcastPacket(mp, Channel.CHL_S2C);
 }
Exemplo n.º 7
0
 public NpcDie(Unit die, Unit killer) : base(ExtendedPacketCmd.EPKT_S2C_NPC_Die, die.getNetId())
 {
     buffer.Write((int)0);
     buffer.Write((short)0);
     buffer.Write(killer.getNetId());
     buffer.Write((short)0); // unk
     buffer.Write((short)7); // unk
     buffer.Write((int)0); // Flags?
 }
Exemplo n.º 8
0
        public SetAnimation(Unit u, List<Tuple<string, string>> animationPairs) : base(PacketCmdS2C.PKT_S2C_SetAnimation, u.getNetId())
        {
            buffer.Write((byte)animationPairs.Count);

            for (int i = 0; i < animationPairs.Count; i++)
            {
                buffer.Write((int)animationPairs[i].Item1.Length);
                foreach (var b in Encoding.Default.GetBytes(animationPairs[i].Item1))
                    buffer.Write(b);

                buffer.Write((int)animationPairs[i].Item2.Length);
                foreach (var b in Encoding.Default.GetBytes(animationPairs[i].Item2))
                    buffer.Write(b);
            }
        }
Exemplo n.º 9
0
 public RemoveBuff(Unit u, string name) : base(PacketCmdS2C.PKT_S2C_RemoveBuff, u.getNetId())
 {
     buffer.Write((short)0x05);
     buffer.Write(RAFManager.getInstance().getHash(name));
     buffer.Write((int)0x0);
     //buffer.Write(u.getNetId());//source?
 }
Exemplo n.º 10
0
 public DamageDone(Unit source, Unit target, float amount, DamageType type) : base(PacketCmdS2C.PKT_S2C_DamageDone, target.getNetId())
 {
     buffer.Write((short)((((short)type) << 4) | 0x04));
     buffer.Write((short)0x4B); // 4.18
     buffer.Write((float)amount); // 4.18
     buffer.Write((int)target.getNetId());
     buffer.Write((int)source.getNetId());
 }
Exemplo n.º 11
0
        public AddBuff(Unit u, Unit source, int stacks, string name) : base(PacketCmdS2C.PKT_S2C_AddBuff)
        {
            buffer.Write(u.getNetId());//target

            buffer.Write((short)0x05); //maybe type?
            buffer.Write((short)0x02);
            buffer.Write((short)0x01); // stacks
            buffer.Write((short)0x00); // bool value
            buffer.Write(RAFManager.getInstance().getHash(name));
            buffer.Write((short)0xde);
            buffer.Write((short)0x88);
            buffer.Write((short)0xc6);
            buffer.Write((short)0xee);
            buffer.Write((short)0x00);
            buffer.Write((short)0x00);
            buffer.Write((short)0x00);
            buffer.Write((short)0x00);
            buffer.Write((short)0x00);
            buffer.Write((short)0x50);
            buffer.Write((short)0xc3);
            buffer.Write((short)0x46);

            if (source != null)
            {
                buffer.Write(source.getNetId()); //source
            }
            else
            {
                buffer.Write((int)0);
            }
        }
Exemplo n.º 12
0
 public RemoveItem(Unit u, short slot, short remaining) : base(PacketCmdS2C.PKT_S2C_RemoveItem, u.getNetId())
 {
     buffer.Write(slot);
     buffer.Write(remaining);
 }
Exemplo n.º 13
0
        public static void notifyTeleport(Unit u, float _x, float _y)
        {
            // Can't teleport to this point of the map
            if (!map.isWalkable(_x, _y))
            {
                _x = MovementVector.targetXToNormalFormat(u.getPosition().X);
                _y = MovementVector.targetYToNormalFormat(u.getPosition().Y);
            }
            else
            {
                u.setPosition(_x, _y);

                //TeleportRequest first(u.getNetId(), u.teleportToX, u.teleportToY, true);
                //sendPacket(currentPeer, first, Channel.CHL_S2C);

                _x = MovementVector.targetXToNormalFormat(_x);
                _y = MovementVector.targetYToNormalFormat(_y);
            }

            var second = new TeleportRequest(u.getNetId(), _x, _y, false);
            PacketHandlerManager.getInstace().broadcastPacketVision(u, second, Channel.CHL_S2C);
        }
Exemplo n.º 14
0
            public UpdateStats(Unit u, bool partial = true) : base(PacketCmdS2C.PKT_S2C_CharStats, 0)
            {
                var stats = new PairList<byte, List<int>>();

                if (partial)
                    stats = u.getStats().getUpdatedStats();
                else
                    stats = u.getStats().getAllStats();

                var masks = new List<byte>();
                byte masterMask = 0;

                foreach (var p in stats)
                {
                    masterMask |= p.Item1;
                    masks.Add(p.Item1);
                }

                masks.Sort();

                buffer.Write((byte)1);
                buffer.Write((byte)masterMask);
                buffer.Write((int)u.getNetId());


                foreach (var m in masks)
                {
                    int mask = 0;
                    byte size = 0;

                    var updatedStats = stats[m];
                    updatedStats.Sort();
                    foreach (var it in updatedStats)
                    {
                        size += u.getStats().getSize(m, it);
                        mask |= it;
                    }
                    //if (updatedStats.Contains((int)FieldMask.FM1_SummonerSpells_Enabled))
                    //  System.Diagnostics.Debugger.Break();
                    buffer.Write((int)mask);
                    buffer.Write((byte)size);

                    for (int i = 0; i < 32; i++)
                    {
                        int tmpMask = (1 << i);
                        if ((tmpMask & mask) > 0)
                        {
                            if (u.getStats().getSize(m, tmpMask) == 4)
                            {
                                float f = u.getStats().getStat(m, tmpMask);
                                var c = BitConverter.GetBytes(f);
                                if (c[0] >= 0xFE)
                                {
                                    c[0] = (byte)0xFD;
                                }
                                buffer.Write(BitConverter.ToSingle(c, 0));
                            }
                            else if (u.getStats().getSize(m, tmpMask) == 2)
                            {
                                short stat = (short)Math.Floor(u.getStats().getStat(m, tmpMask) + 0.5);
                                buffer.Write(stat);
                            }
                            else
                            {
                                byte stat = (byte)Math.Floor(u.getStats().getStat(m, tmpMask) + 0.5);
                                buffer.Write(stat);
                            }
                        }
                    }
                }
            }
Exemplo n.º 15
0
 public BeginAutoAttack(Unit attacker, Unit attacked, int futureProjNetId, bool isCritical) : base(PacketCmdS2C.PKT_S2C_BeginAutoAttack, attacker.getNetId())
 {
     buffer.Write(attacked.getNetId());
     buffer.Write((short)0x80); // unk
     buffer.Write(futureProjNetId); // Basic attack projectile ID, to be spawned later
     if (isCritical)
         buffer.Write((short)0x49);
     else
         buffer.Write((short)0x40); // unk -- seems to be flags related to things like critical strike (0x49)
                                    // not sure what this is, but it should be correct (or maybe attacked x z y?) - 4.18
     buffer.Write((short)0x80);
     buffer.Write((short)0x01);
     buffer.Write(MovementVector.targetXToNormalFormat(attacked.getX()));
     buffer.Write((short)0x80);
     buffer.Write((short)0x01);
     buffer.Write(MovementVector.targetYToNormalFormat(attacked.getY()));
     buffer.Write((short)0xCC);
     buffer.Write((short)0x35);
     buffer.Write((short)0xC4);
     buffer.Write((short)0xD1);
     buffer.Write(attacker.getX());
     buffer.Write(attacker.getY());
 }
Exemplo n.º 16
0
 public SpellAnimation(Unit u, string animationName) : base(PacketCmdS2C.PKT_S2C_SpellAnimation, u.getNetId())
 {
     buffer.Write((int)0x00000005); // unk
     buffer.Write((int)0x00000000); // unk
     buffer.Write((int)0x00000000); // unk
     buffer.Write(1.0f); // unk
     foreach (var b in Encoding.Default.GetBytes(animationName))
         buffer.Write(b);
     buffer.Write((byte)0);
 }
Exemplo n.º 17
0
        public NextAutoAttack(Unit attacker, Unit attacked, int futureProjNetId, bool isCritical, bool initial) : base(PacketCmdS2C.PKT_S2C_NextAutoAttack, attacker.getNetId())
        {
            buffer.Write(attacked.getNetId());
            if (initial)
                buffer.Write((short)0x80); // These flags appear to change only to 0x80 and 0x7F after the first autoattack.
            else
                buffer.Write((short)0x7F);

            buffer.Write(futureProjNetId);
            if (isCritical)
                buffer.Write((short)0x49);
            else
                buffer.Write((short)0x40); // unk -- seems to be flags related to things like critical strike (0x49)

            // not sure what this is, but it should be correct (or maybe attacked x z y?) - 4.18
            buffer.Write("\x40\x01\x7B\xEF\xEF\x01\x2E\x55\x55\x35\x94\xD3");
        }
Exemplo n.º 18
0
 public FaceDirection(Unit u, float relativeX, float relativeY, float relativeZ) : base(PacketCmdS2C.PKT_S2C_FaceDirection, u.getNetId())
 {
     buffer.Write(relativeX);
     buffer.Write(relativeZ);
     buffer.Write(relativeY);
     buffer.Write((byte)0);
     buffer.Write((float)0.0833); // Time to turn ?
 }
Exemplo n.º 19
0
 public StopAutoAttack(Unit attacker) : base(PacketCmdS2C.PKT_S2C_StopAutoAttack, attacker.getNetId())
 {
     buffer.Write((int)0); // Unk. Rarely, this is a net ID. Dunno what for.
     buffer.Write((short)3); // Unk. Sometimes "2", sometimes "11" when the above netId is not 0.
 }
Exemplo n.º 20
0
 public AddGold(Champion richMan, Unit died, float gold) : base(PacketCmdS2C.PKT_S2C_AddGold, richMan.getNetId())
 {
     buffer.Write(richMan.getNetId());
     if (died != null)
     {
         buffer.Write(died.getNetId());
     }
     else
     {
         buffer.Write((int)0);
     }
     buffer.Write(gold);
 }
Exemplo n.º 21
0
        public NextAutoAttack(Unit attacker, Unit attacked, int futureProjNetId, bool isCritical, bool initial) : base(PacketCmdS2C.PKT_S2C_NextAutoAttack, attacker.getNetId())
        {
            buffer.Write(attacked.getNetId());
            if (initial)
                buffer.Write((byte)0x80); // These flags appear to change only to 0x80 and 0x7F after the first autoattack.
            else
                buffer.Write((byte)0x7F);

            buffer.Write(futureProjNetId);
            if (isCritical)
                buffer.Write((byte)0x49);
            else
                buffer.Write((byte)0x40); // unk -- seems to be flags related to things like critical strike (0x49)

            buffer.Write((byte)0x40);
            buffer.Write((byte)0x01);
            buffer.Write((byte)0x7B);
            buffer.Write((byte)0xEF);
            buffer.Write((byte)0xEF);
            buffer.Write((byte)0x01);
            buffer.Write((byte)0x2E);
            buffer.Write((byte)0x55);
            buffer.Write((byte)0x55);
            buffer.Write((byte)0x35);
            buffer.Write((byte)0x94);
            buffer.Write((byte)0xD3);
        }