示例#1
0
        public virtual void refreshWaypoints()
        {
            if (targetUnit == null || (distanceWith(targetUnit) <= stats.getRange() && waypoints.Count == 1))
            {
                return;
            }

            if (distanceWith(targetUnit) <= stats.getRange() - 2.0f)
            {
                setWaypoints(new List <Vector2> {
                    new Vector2(x, y)
                });
            }
            else
            {
                Target t = new Target(waypoints[waypoints.Count - 1]);
                if (t.distanceWith(targetUnit) >= 25.0f)
                {
                    setWaypoints(new List <Vector2> {
                        new Vector2(x, y), new Vector2(targetUnit.getX(), targetUnit.getY())
                    });
                }
            }
        }
示例#2
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());
 }
示例#3
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);
        }
示例#4
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());
 }