Esempio n. 1
0
        protected bool DoAttack()
        {
            MMob mob;

            try
            {
                mob = Vision.First(x => x.Index == CurrentEnemy);
            }
            catch
            {
                return(false);
            }

            var packet = new MSingleAttackPacket(Player.ClientId);

            packet.Target = new MTarget(CurrentEnemy, -2);

            packet.AttackerId       = Player.ClientId;
            packet.AttackerPosition = Player.Position;
            packet.TargetPosition   = mob.Position;

            packet.SkillId   = GetNextSkill();
            packet.FlagLocal = 1;
            packet.Motion    = 4;
            packet.CurrentMp = -1;

            OnAttackMob?.Invoke(this, packet);
            return(true);
        }
Esempio n. 2
0
        public void SingleAttack(ushort clientId, MPosition attackerPosition, MPosition targetPosition, MTarget target, short skilId)
        {
            var packet = new MSingleAttackPacket(clientId)
            {
                AttackCount      = AttackCount,
                AttackerPosition = attackerPosition,
                AttackerId       = clientId,

                Target         = target,
                TargetPosition = targetPosition,

                CurrentMp = -1,
                SkillId   = skilId,
                FlagLocal = 1,
                Motion    = 4,
            };

            Connection.Send(W2Marshal.GetBytes(packet));
        }