Exemplo n.º 1
0
        public int GetCurrentBoss()
        {
            if (!window.Locked)
            {
                window.Click(FightBossConstants.pointPageFightBoss, false, true);

                string input = window.OCRTextSearch(FightBossConstants.rectCurrentBoss, false);

                int start = input.IndexOf("Boss");

                if (start < 0 || input.Length < start + 4 + 1)
                {
                    return(-1);
                }

                start += 4;

                input = input.Substring(start);

                BigInteger boss = window.Parse(input);

                return((int)boss - 1);
            }
            else
            {
                return(-1);
            }
        }
Exemplo n.º 2
0
        public BigInteger GetEXP()
        {
            if (window.Locked)
            {
                return(-1);
            }

            window.Click(SpendEXPConstants.pointPageSpendEXP, false, true);
            string input = window.OCRTextSearch(SpendEXPConstants.rectExp, false);

            int start  = input.IndexOf("have ") + 5;
            int end    = input.IndexOf(" EXP");
            int length = end - start;

            if (start < 1 || length < 1 || start + length > input.Length)
            {
                return(new BigInteger(0));
            }

            input = input.Substring(start, length);

            BigInteger exp = window.Parse(input);

            string diffSinceLast = string.Empty;

            if (currentExp == -1)
            {
                window.Log($"Current Exp: {exp,5}");
            }
            else if (currentExp > -1 && currentExp != exp)
            {
                if (exp > currentExp)
                {
                    gainedExp += exp - currentExp;
                }
                else if (exp < currentExp)
                {
                    allocatedExp += currentExp - exp;
                }

                window.Log($"Current Exp: {exp,5} - GainedExp: {gainedExp,5} - SpendExp {allocatedExp,5} - DiffSinceLast: {exp - currentExp, 6}");
            }

            currentExp = exp;

            return(exp);
        }
Exemplo n.º 3
0
        public void CompleteQuest()
        {
            window.Log($"CompleteQuest");

            window.Click(QuestingConstants.pointPageQuesting, false, true);

            window.Click(QuestingConstants.pointCompleteQuest, false, true);
            window.Click(QuestingConstants.pointCompleteQuest, false, true);

            if (window.OCRTextSearch(QuestingConstants.rectIdleMode, true).Contains("OFF") || window.Locked)
            {
                window.Click(QuestingConstants.pointIdleMode, false, true);
            }
        }
Exemplo n.º 4
0
        public TimeSpan getRunTime()
        {
            if (window.Locked)
            {
                DateTime currentTime = DateTime.Now;

                TimeSpan timeSpan = currentTime - runStartTime;

                return(timeSpan);
            }

            try
            {
                DateTime currentTime = DateTime.Now;
                string   input       = window.OCRTextSearch(RebirthConstants.rectRunTime, true);

                string days = string.Empty;

                if (input.Contains("days"))
                {
                    days  = input.Substring(0, input.IndexOf("days")).Trim();
                    input = input.Substring(input.IndexOf("days") + 4).Trim();
                }
                if (input.Contains("."))
                {
                    input = input.Substring(0, input.LastIndexOf("."));
                }

                switch (input.Length)
                {
                case 1:
                    input = $"00:00:0{input}";
                    break;

                case 2:
                    input = $"00:00:{input}";
                    break;

                case 4:
                    input = $"00:0{input}";
                    break;

                case 5:
                    input = $"00:{input}";
                    break;
                }

                TimeSpan timeSpan = TimeSpan.Parse(input);
                if (!string.IsNullOrWhiteSpace(days))
                {
                    timeSpan = timeSpan + TimeSpan.FromDays(int.Parse(days));
                }

                if (timeSpan != lastTimeSpan)
                {
                    lastTimeSpan = timeSpan;
                    runStartTime = currentTime - timeSpan;
                }
                else
                {
                    timeSpan = DateTime.Now - runStartTime;
                }

                return(timeSpan);
            }
            catch
            {
                TimeSpan timeSpan = DateTime.Now - runStartTime;

                return(timeSpan);
            }
        }