Example #1
0
        private static bool Attack(string command, Variable[] vars, bool quiet, bool force)
        {
            if (vars.Length == 0)
            {
                throw new RunTimeError("Usage: attack (serial)");
            }

            Serial serial = vars[0].AsSerial();

            if (!serial.IsValid)
            {
                throw new RunTimeError($"{command} - Invalid serial");
            }

            if (serial == Targeting.LastTargetInfo.Serial)
            {
                Targeting.AttackLastTarg();
            }
            else
            {
                if (serial.IsMobile)
                {
                    Client.Instance.SendToServer(new AttackReq(serial));
                }
            }

            return(true);
        }
Example #2
0
        public static bool Attack(string command, Argument[] args, bool quiet, bool force)
        {
            if (args.Length == 0)
            {
                throw new RunTimeError(null, "Usage: attack (serial)");
            }

            Serial serial = args[0].AsSerial();

            if (!serial.IsValid)
            {
                throw new RunTimeError(null, "attack - invalid serial");
            }

            if (serial == Targeting.LastTargetInfo.Serial)
            {
                Targeting.AttackLastTarg();
            }
            else
            {
                if (serial.IsMobile)
                {
                    Client.Instance.SendToServer(new AttackReq(serial));
                }
            }

            return(true);
        }