Exemplo n.º 1
0
        public BaseCheck(MemoryAddress address, string failCase, FailType failType)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address), "Invalid address for base check");
            }

            Address = address;
            FailCase = address.ConvertToRightDataType(failCase);

            FailType = failType;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Use this instead of rewriting Chat.AddActionMsgToChat() when adding text to a failed conditon.
        /// </summary>
        /// <param name="player">The orignator</param>
        /// <param name="type">Normal : Displays failText string. Critical: Displays critViewText string.</param>
        protected void FailText(GameObject player, FailType type)
        {
            switch (type)
            {
            case FailType.Normal:
                Chat.AddActionMsgToChat(player, $"{failText}", $"");
                break;

            case FailType.Critical:
                Chat.AddActionMsgToChat(player, $"{player.ExpensiveName()} {critViewText}.", $"{player.ExpensiveName()} {critViewText}.");
                break;
            }
        }
Exemplo n.º 3
0
        public IEnumerator MarkTestForAutomaticFailure(FailType failType, Type name, string message)
        {
            string realName = failType == FailType.Class ? name.Name : name.Name.Split('<', '>')[1];

            if (failType == FailType.Test)
            {
                if (AutomationMaster.TestRunContext.CompletedTests.Contains(realName))
                {
                    yield return(StartCoroutine(Q.assert.Fail(string.Format("The test, \"{0}\", was marked for failure using an assertion - but the test was already run!", realName))));
                }
            }
            AutomationMaster.AutoSkips.Add(new KeyValuePair <string[], string>(new string[] { failType == FailType.Class ? "class" : "test", realName }, message));
            yield return(null);
        }
Exemplo n.º 4
0
    void BuyFail(FailType type, string moreInfo)
    {
        switch (type)
        {
        case FailType.BUYFAIL:
            //CurErrorInfo = Utils.DicDesc(1002) + moreInfo;
            break;

        case FailType.FETCH_PRODUCTLIST_FAIL:
            //CurErrorInfo = Utils.DicDesc(1003);
            break;

        case FailType.PRODUCT_NOT_EXSIT:
            //CurErrorInfo = Utils.DicDesc(1004) + moreInfo;
            break;

        case FailType.CANCEL:
            //CurErrorInfo = Utils.DicDesc(1000);
            break;

        case FailType.CANNOTBUY:
            //CurErrorInfo = Utils.DicDesc(1005);
            break;

        case FailType.PRODUCTLIST_EMPTY:
            break;

        default:
            CurErrorInfo = moreInfo;
            break;
        }
        Debug.Log("buyFail");
        if (null != m_delFinish)
        {
            m_delFinish(false);
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// Processes the routine of engaging & fighting an enemy.
        /// </summary>
        /// <param name="target">The ID of the target to engage.</param>
        /// <param name="monster">The monster object for the monster you're engaging</param>
        /// <param name="mode">Special mode considerations for engaging this target.</param>
        /// <param name="fail"></param>
        /// <returns></returns>
        public static bool Fight(int target, Monster monster, Mode mode, out FailType fail)
        {
            fail      = FailType.NoFail;
            _fighting = true;
            float targetX = 0;
            float targetZ = 0;

            job.SetBattle(true);

            fface.Navigator.Reset();

            if (mode == Mode.Meshing)
            {
                List <Node> path         = new List <Node>();
                float       destinationX = fface.NPC.PosX(target);
                float       destinationZ = fface.NPC.PosZ(target);

                path = GetPath(destinationX, destinationZ);

                if (!path.Any())
                {
                    fail      = FailType.NoPath;
                    _fighting = false;
                }

                while (path.Any() && job.CanStillAttack(target) && DistanceTo(target) > (monster.HitBox * 1.5) && _fighting)
                {
                    if (!fface.NPC.IsClaimed(target) && _fighting)
                    {
                        Target(target);
                        job.UseClaim();
                    }
                    if (_fighting)
                    {
                        targetX = path[0].X;
                        targetZ = path[0].Z;
                        if (!IsPositionSafe(Convert.ToInt32(targetX), Convert.ToInt32(targetZ)))
                        {
                            _fighting = false;
                        }
                        fface.Navigator.HeadingTolerance  = 2;
                        fface.Navigator.DistanceTolerance = 0.7;
                        path.RemoveAt(0);
                        fface.Navigator.Goto(() => targetX, () => targetZ, false);
                    }
                    Thread.Sleep(1);
                }
                fface.Navigator.Reset();
            }

            // battle routine
            while (job.CanStillAttack(target) && _fighting)
            {
                while (fface.Player.Status == Status.Fighting && fface.Target.ID != target)
                {
                    fface.Windower.SendString("/attackoff");
                    Thread.Sleep(3000);
                    fface.Windower.SendKeyPress(KeyCode.EscapeKey);
                    Thread.Sleep(1000);
                }

                // TARGET
                Target(target);

                // FACE TARGET
                fface.Navigator.FaceHeading(target);



                // CLAIM
                if (!fface.NPC.IsClaimed(target) && _fighting)
                {
                    switch (mode)
                    {
                    case Mode.StrictPathing:
                    {
                        // We don't want to wonder too far from our strict path. Use Strict Pathing.
                        if (DistanceTo(target) >= monster.HitBox * 1.5)
                        {
                            fface.Navigator.Reset();
                        }
                        Thread.Sleep(500);
                        job.UseRangedClaim();
                        break;
                    }

                    case Mode.Meshing:
                    case Mode.None:
                    {
                        job.UseClaim();
                        break;
                    }
                    }
                }

                // ENGAGE

                if (fface.Player.Status != Status.Fighting && job.CanStillAttack(target) && _fighting)
                {
                    job.Engage();
                }

                // make sure we're in the correct position
                if (!job.Position(target, monster, mode))
                {
                    _fighting = false;
                }

                if (job.GetHaltActions())
                {
                    Thread.Sleep(2);
                    continue;
                }

                // PLAYER STUFF
                if (fface.Player.Status == Status.Fighting && _fighting && fface.Player.MainJob != Job.GEO && fface.Player.MainJob != Job.WHM && fface.Player.MainJob != Job.BRD && fface.Player.MainJob != Job.BLM)
                {
                    job.UseHeals();

                    job.UseAbilities();

                    if (fface.Player.TPCurrent >= 1000)
                    {
                        job.UseWeaponskills();
                    }

                    job.UseSpells();
                }
                else if ((fface.Player.MainJob == Job.WHM || fface.Player.MainJob == Job.BLM || fface.Player.MainJob == Job.GEO || fface.Player.MainJob == Job.BRD) && _fighting)
                {
                    fface.Navigator.Reset();

                    if (fface.Player.MainJob == Job.BLM)
                    {
                        job.UseAbilities();
                    }

                    job.UseSpells();
                }

                Thread.Sleep(2);
            }
            Thread.Sleep(500);
            if (!_fighting && fface.Player.Status == Status.Fighting)
            {
                WriteLog("[NAV] Monster is out of mesh. Giving up...");
                fface.Windower.SendString("/attackoff");
                Thread.Sleep(3000);
                if (fface.Target.IsLocked)
                {
                    fface.Windower.SendString("/lockon");
                    Thread.Sleep(500);
                }
            }

            fface.Windower.SendKey(KeyCode.NP_Number2, false);
            fface.Windower.SendKey(KeyCode.NP_Number4, false);
            fface.Windower.SendKey(KeyCode.NP_Number6, false);
            job.SetBattle(false);
            _fighting = false;
            if (!_fighting || fface.NPC.HPPCurrent(target) != 0)
            {
                return(false);
            }
            Black.Clear();
            return(true);
        }
Exemplo n.º 6
0
 public FailCondition(FailType type)
 {
     m_failed = false;
     m_failureIncludesExplosion = false;
     m_failType = type;
 }
Exemplo n.º 7
0
 public void AddFailure(FailType type, string msg, int?ts)
 {
     Add(Failure.Make(type, msg, ts));
 }
Exemplo n.º 8
0
 public static Failure Make(FailType type, string msg, int?ts)
 {
     return(new Failure {
         Type = type, Message = msg, Timestep = ts
     });
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataUpdateException"/> class.
 /// </summary>
 /// <param name="info">The information.</param>
 /// <param name="context">The context.</param>
 /// <param name="reason">The reason.</param>
 protected DataUpdateException(SerializationInfo info, StreamingContext context, FailType reason)
     : base(info, context)
 {
     this.reason = (FailType)info.GetInt32("reason");
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataUpdateException"/> class.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="ex">The ex.</param>
 /// <param name="reason">The reason.</param>
 public DataUpdateException(string message, Exception ex, FailType reason)
     : base(message, ex)
 {
     this.reason = reason;
 }
Exemplo n.º 11
0
    public void Failed(FailType type)
    {
        //Debug.Log("Failed: " + type);
        if (_step<triggers.Length)
        {
            switch (type)
            {
                case FailType.Error:
                    //Debug.Log("Player has made an error");
                    //_anim.SetTrigger(triggers[_step]);
                    break;

                case FailType.TooLong:
                    _anim.SetTrigger(triggers[_step]);
                    break;
            }
        }
    }