Esempio n. 1
0
        public override bool Do()
        {
            if (waitfor.Equals("BG", StringComparison.InvariantCultureIgnoreCase) &&
                !Buffs.HaveBuff("Preparation"))
            {
                PPather.WriteLine("Wait: BG Starting. Stopping Wait");
                return(true);
            }

            bool DoWait = KeepOnWaiting();

            if (DoWait && ActionTimer.IsReady)
            {
                int action = GContext.Main.RNG.Next(3);
                if (action == 0)
                {
                    GContext.Main.SendKey("Common.RotateRight");
                }
                else if (action == 1)
                {
                    GContext.Main.SendKey("Common.RotateLeft");
                }
                else if (action == 2)
                {
                    GContext.Main.SendKey("Common.Jump");
                }
                ActionTimer = new GSpellTimer(30000 + GContext.Main.RNG.Next(10000));
            }
            return(!DoWait);
        }
Esempio n. 2
0
 private static void setFrame()
 {
     if (frame == null)
     {
         frame = GContext.Main.Interface.GetByName("QuestWatchFrame");
         questLines = new string[32];
         updateTimer = new GSpellTimer(5000);
         regex = new Regex("[0-9]{1,2}\\/[0-9]{1,2}$"); //matching a/b at the end of the string where a and b are integers with 1 or 2 digits
     }
     questStatus = new Dictionary<string, bool>();
 }
Esempio n. 3
0
 private static void setFrame()
 {
     if (frame == null)
     {
         frame       = GContext.Main.Interface.GetByName("QuestWatchFrame");
         questLines  = new string[32];
         updateTimer = new GSpellTimer(5000);
         regex       = new Regex("[0-9]{1,2}\\/[0-9]{1,2}$");           //matching a/b at the end of the string where a and b are integers with 1 or 2 digits
     }
     questStatus = new Dictionary <string, bool>();
 }
Esempio n. 4
0
        public static bool CheckLogoutTime(GSpellTimer startTime)
        {
            if (LogoutTime <= 0 || AutoLogout == false)
                return false;

            double logoutTime = startTime.TicksSinceLastReset / 60000;
            if (logoutTime >= LogoutTime)
            {
                //PPather.WriteLine("Limits: Auto Stop Timer Reached. Stopping Glide.");
                return true;
            }
            else
                return false;
        }
Esempio n. 5
0
        public Path CreatePath(Location fromLoc, Location toLoc,
                               float howClose,
                               ILocationHeuristics locationHeuristics)
        {
            GSpellTimer t    = new GSpellTimer(0);
            Spot        from = FindClosestSpot(fromLoc, MinStepLength);
            Spot        to   = FindClosestSpot(toLoc, MinStepLength);

            if (from == null)
            {
                from = AddAndConnectSpot(new Spot(fromLoc));
            }
            if (to == null)
            {
                to = AddAndConnectSpot(new Spot(toLoc));
            }

            Path rawPath = CreatePath(from, to, to.location, howClose, true, locationHeuristics);


            if (rawPath != null && paint != null)
            {
                Location prev = null;
                for (int i = 0; i < rawPath.Count(); i++)
                {
                    Location l = rawPath.Get(i);
                    paint.AddBigMarker(l.X, l.Y, l.Z);
                    if (prev != null)
                    {
                        paint.PaintPath(l.X, l.Y, l.Z + 3, prev.X, prev.Y, prev.Z + 3);
                    }
                    prev = l;
                }
            }
            PPather.WriteLine("CreatePath took " + -t.TicksLeft);
            if (rawPath == null)
            {
                return(null);
            }
            else
            {
                Location last = rawPath.GetLast();
                if (last.GetDistanceTo(toLoc) > 1.0)
                {
                    rawPath.AddLast(toLoc);
                }
            }
            return(rawPath);
        }
Esempio n. 6
0
        static public bool CheckLogoutTime(GSpellTimer startTime)
        {
            if (LogoutTime <= 0 || AutoLogout == false)
            {
                return(false);
            }

            double logoutTime = startTime.TicksSinceLastReset / 60000;

            if (logoutTime >= LogoutTime)
            {
                //PPather.WriteLine("Limits: Auto Stop Timer Reached. Stopping Glide.");
                return(true);
            }
            else
            {
                return(false);
            }
        }
        protected bool BetweenTargetMode(string classname)
        {
            bool bRdy;
            /* RecursiveBot 2.17.1 F
             * The following change was needed to ensure that the profile target was not in range before mounting.
             * ProfileTargetIsWithinRange is set equal to the return value of ProfileTargetWithinRange() during running check.
             */
            bool needtoloot = (Context.CurrentMode != GGlideMode.OneKill) && (Context.IsCorpseNearby || ProfileTargetIsWithinRange);
            bRdy = TRAVELFORMDELAYTIMER.IsReady;
            //Context.Log(" TravelTimer, " + bRdy + " !IsMounted() " + (!IsMounted()) + " -> needtoloot, " + (!needtoloot));
            if (TRAVELFORM == "Delay Mount" && bRdy && !IsMounted())
            {
                if (!needtoloot)
                {
                    Context.Log("Mounting:" + TRAVELFORM);
                    Context.ReleaseSpinRun();
                    Thread.Sleep(500);
                    LeaveForm();
                    Thread.Sleep(500);
                    /* RecursiveBot 2.17.1 E
                     *  Fix for Mount Naming difference in the keys.xml
                     *  old call CastSpell(classname + ".Mount");
                     */
                    CastSpell("PL.Mount");
                    int futile = 30;
                    while (futile > 0)
                    {
                        Thread.Sleep(101);
                        futile--;
                        if (IsMounted()) futile = 0;
                    }
                    if (!IsMounted())
                    {
                        //Didn't change try again in 15 seconds
                        TRAVELFORMDELAYTIMER = new GSpellTimer(15 * 1000, false);
                        return false;
                    }
                    return true;
                }
                //Context.Log("Need to loot - stopped Mount process.");
            }
            //removed the test for the timer. not needed if controlled
            if (TRAVELFORM == "Distance Mount" && !IsMounted())
            {
                if (!needtoloot)
                {
                    Context.Log("Mounting:" + TRAVELFORM);
                    GObjectList.SetCacheDirty();
                    GUnit MOB = GObjectList.GetNearestHostile();
                    if (MOB == null || (MOB != null && MOB.DistanceToSelf > TRAVELFORMDELAY))
                    {
                        Context.ReleaseSpinRun();
                        Thread.Sleep(500);
                        LeaveForm();
                        Thread.Sleep(500);
                        /* RecursiveBot 2.17.1 E
                         *  Fix for Mount Naming difference in the keys.xml
                         *  old way
                         *  CastSpell(classname + ".Mount");
                         */
                        CastSpell("PL.Mount");
                        int futile = 30;
                        while (futile > 0)
                        {
                            Thread.Sleep(101);
                            futile--;
                            if (IsMounted()) futile = 0;
                        }

                        if (!IsMounted())
                        {
                            //Didn't change try again in 15 seconds
                            TRAVELFORMDELAYTIMER = new GSpellTimer(15 * 1000, false);
                            //Context.Log(IsMounted() + " we aren't mounted so fixing to wait 15 seconds.");
                            return false;
                        }
                        return true;
                    }
                    //Context.Log("Hostile is within Range of Distance Mount Setting.");
                }
                //Context.Log("Need to loot - stopped Mount process.");
            }
            return false;
        }
        //Start operations
        public override void OnStartGlide()
        {
            Context.Log("Started " + classname + " " + version);
            SpellList();  //added in 2.15 to build the spell list from config

            GlobalCooldown = new GSpellTimer(1500 + SPELL_DELAY, true);
            Context.CombatLog += new GContext.GCombatLogHandler(Context_CombatLog);
            //Context.ChatLog += new GContext.GChatLogHandler(Context_ChatLog);

            //Run start functions
            SoulShardCount = CountSoulShards();
            PostCombat();
            base.OnStartGlide();
        }
        //Load all custom config values from Glider.config.xml
        public override void LoadConfig()
        {
            USE_SPELLSHUFFLE = Context.GetConfigBool("PicLock.USE_SPELLSHUFFLE");
            MISCDELAY = Context.GetConfigInt("PicLock.MISCDELAY");
            WAIT_FOR_PET = Context.GetConfigInt("PicLock.WAIT_FOR_PET");
            SPELL_DELAY = Context.GetConfigInt("PicLock.SPELL_DELAY");
            USE_FOOD = Context.GetConfigBool("PicLock.USE_FOOD");
            USE_DRINK = Context.GetConfigBool("PicLock.USE_DRINK");
            USE_HEALTHPOTION = Context.GetConfigBool("PicLock.USE_HEALTHPOTION");
            USE_HEALTHSTONE = Context.GetConfigBool("PicLock.USE_HEALTHSTONE");
            EMERGENCY_HEALTH = Context.GetConfigDouble("PicLock.EMERGENCY_HEALTH") / 100;
            MIN_HEALTH_PCT = Context.GetConfigDouble("PicLock.MIN_HEALTH_PCT") / 100;
            MIN_MANA_PCT = Context.GetConfigDouble("PicLock.MIN_MANA_PCT") / 100;
            PRIMARY_ATTACK = Context.GetConfigString("PicLock.PRIMARY_ATTACK");
            SUMMON_DEMON = Context.GetConfigString("PicLock.SUMMON_DEMON");
            MIN_MOB_HEALTH_PCT = Context.GetConfigDouble("PicLock.MIN_MOB_HEALTH_PCT") / 100;
            PET_ATTACK = Context.GetConfigBool("PicLock.PET_ATTACK");
            USE_FELDOMINATION = Context.GetConfigBool("PicLock.USE_FELDOMINATION");
            USE_SOULLINK = Context.GetConfigBool("PicLock.USE_SOULLINK");
            USE_ARMORBUFF = Context.GetConfigBool("PicLock.USE_ARMORBUFF");
            USE_NIGHTFALL = Context.GetConfigBool("PicLock.USE_NIGHTFALL");
            USE_BLOODFURY = Context.GetConfigBool("PicLock.USE_BLOODFURY");
            USE_AMPLIFYCURSE = Context.GetConfigBool("PicLock.USE_AMPLIFYCURSE");
            DEAL_WITH_ADDS = Context.GetConfigBool("PicLock.DEAL_WITH_ADDS");
            USE_FEAR = Context.GetConfigBool("PicLock.USE_FEAR");
            USE_HEALTHFUNNEL = Context.GetConfigBool("PicLock.USE_HEALTHFUNNEL");
            HEALTHFUNNEL_PCT = Context.GetConfigDouble("PicLock.HEALTHFUNNEL_PCT") / 100;
            USE_DRAINLIFE = Context.GetConfigBool("PicLock.USE_DRAINLIFE");
            DRAINLIFE_PCT = Context.GetConfigDouble("PicLock.DRAINLIFE_PCT") / 100;
            USE_DRAINMANA = Context.GetConfigBool("PicLock.USE_DRAINMANA");
            DRAINMANA_PCT = Context.GetConfigDouble("PicLock.DRAINMANA_PCT") / 100;
            USE_LIFETAP = Context.GetConfigBool("PicLock.USE_LIFETAP");
            USE_FEEDMANA = Context.GetConfigBool("PicLock.USE_FEEDMANA");
            FEEDMANA_PCT = Context.GetConfigDouble("PicLock.FEEDMANA_PCT") / 100;
            USE_SACRIFICE = Context.GetConfigString("PicLock.USE_SACRIFICE");
            SACRIFICE_PCT = Context.GetConfigDouble("PicLock.SACRIFICE_PCT") / 100;
            SOULSHARDS_MAX = Context.GetConfigInt("PicLock.SOULSHARDS_MAX");
            DRAINSOUL_PCT = Context.GetConfigDouble("PicLock.DRAINSOUL_PCT") / 100;
            RESUMMON_IN_COMBAT = Context.GetConfigBool("PicLock.RESUMMON_IN_COMBAT");
            SIT_TO_REGEN = Context.GetConfigBool("PicLock.SIT_TO_REGEN");
            USE_DARKPACT = Context.GetConfigBool("PicLock.USE_DARKPACT");
            RETURN_PET = Context.GetConfigBool("PicLock.RETURN_PET");
            FIGHT_BACK = Context.GetConfigBool("PicLock.FIGHT_BACK");
            WAIT_FOR_PET_AGGRO = Context.GetConfigBool("PicLock.WAIT_FOR_PET_AGGRO");
            LAST_RESORT = Context.GetConfigString("PicLock.LAST_RESORT");
            CAST_ADDS = Context.GetConfigBool("PicLock.CAST_ADDS");
            USE_CONSUMESHADOWS = Context.GetConfigBool("PicLock.USE_CONSUMESHADOWS");
            CONSUMESHADOWS_PCT = Context.GetConfigDouble("PicLock.CONSUMESHADOWS_PCT") / 100;
            LEVEL_DIFFERENCE = Context.GetConfigInt("PicLock.LEVEL_DIFFERENCE");
            INITIATE_PVP = Context.GetConfigBool("PicLock.INITIATE_PVP");

            USE_UNSTABLEAFFLICTION = Context.GetConfigBool("PicLock.USE_UNSTABLEAFFLICTION");
            USE_CORRUPTION = Context.GetConfigBool("PicLock.USE_CORRUPTION");
            USE_CURSEOFAGONY = Context.GetConfigBool("PicLock.USE_CURSEOFAGONY");
            USE_SIPHONLIFE = Context.GetConfigBool("PicLock.USE_SIPHONLIFE");
            USE_IMMOLATE = Context.GetConfigBool("PicLock.USE_IMMOLATE");
            USE_SHADOWBURN = Context.GetConfigBool("PicLock.USE_SHADOWBURN");
            USE_SHADOWBOLT = Context.GetConfigBool("PicLock.USE_SHADOWBOLT");
            //USE_HOWLOFTERROR = Context.GetConfigBool("PicLock.USE_HOWLOFTERROR");
            USE_DEATHCOIL = Context.GetConfigBool("PicLock.USE_DEATHCOIL");
            USE_CONFLAGURATE = Context.GetConfigBool("PicLock.USE_CONFLAGURATE");
            USE_INCINERATE = Context.GetConfigBool("PicLock.USE_INCINERATE");

            PET_AGGRO_DELAY = Context.GetConfigInt("PicLock.PET_AGGRO_DELAY");

            GSpellTimer GlobalCooldown = new GSpellTimer(1500 + SPELL_DELAY, true);

            //RAGE - Begin
            try { TRAVELFORM = Context.GetConfigString("PicLock.TravelForm"); }
            catch { Context.Log("ERROR Loading TravelForm"); TRAVELFORM = "Default"; }
            try { TRAVELFORMDELAY = Context.GetConfigInt("PicLock.TravelFormDelay"); }
            catch { Context.Log("ERROR Loading TravelFormDelay"); TRAVELFORMDELAY = 5; }
            try { MOUNTNAME = Context.GetConfigString("PicLock.MountName"); }
            catch { Context.Log("ERROR Loading MountName"); MOUNTNAME = ""; }
            //RAGE - End
        }
Esempio n. 10
0
        public override bool Do()
        {
            if (monster.IsLootable)
            {
                Functions.Interact(monster);

                GSpellTimer bop = new GSpellTimer(500);
                do
                {
                    for (int i = 1; i <= 4; i++)
                    {
                        if (Popup.IsVisible(i))
                        {
                            String text = Popup.GetText(i);
                            PPather.WriteLine("Loot: Got a loot popup ('" + text + "')");
                            if (text == "Looting this item will bind it to you.")
                            {
                                Popup.ClickButton(i, 1);
                            }
                            else
                            {
                                Popup.ClickButton(i, 2);
                            }
                        }
                    }
                } while (!bop.IsReadySlow);
                Thread.Sleep(500);
            }



            /*Skinning start*/
            if (Skin)
            {
                int         attempt = 1;
                GSpellTimer futile  = new GSpellTimer(3000);
                futile.Reset();                 // is 3s enough for skinning to be done?!
                PPather.WriteLine("Want to skin");
                while (monster.IsLootable && !futile.IsReadySlow)
                {
                    ;                     //Waiting for looting to finish
                }
                Thread.Sleep(1000);

                // Check the type of the cursor
                if (!monster.IsCursorOnUnit)
                {
                    Functions.Hover(monster);
                }

                PPather.WriteLine("Loot: Cursor Type is: " + GContext.Main.Interface.CursorType);
                PPather.WriteLine("Loot: Skinnable: " + monster.IsSkinnable);

                // TODO what cursot types are good? 12=skin, ??=mine,  ??=herb
                while (monster.IsValid && monster.IsSkinnable && attempt <= 3)
                {
                    PPather.WriteLine("Loot: Skin. Attempt #" + attempt);
                    Functions.Interact(monster);
                    Thread.Sleep(500);
                    if (GContext.Main.Me.IsInCombat)
                    {
                        return(false);
                    }
                    bool casted = false;
                    while (GContext.Main.Me.IsCasting)
                    {
                        casted = true;
                        Thread.Sleep(1500);
                    }
                    if (!casted)
                    {
                        // looks bad
                        string message = GContext.Main.RedMessage;
                        if (message.StartsWith("Requires "))
                        {
                            // missing skill or too low
                            PPather.WriteLine("Loot: Skill too low to skin: " + message);
                            break;
                        }
                        PPather.WriteLine("Loot: Never entered casting after skin attempt");
                        break;
                    }
                    if (GContext.Main.Me.IsInCombat)
                    {
                        return(false);
                    }

                    attempt++;
                    Thread.Sleep(800);
                    if (GPlayerSelf.Me.Target == null)
                    {
                        break;                         // corpse gone, done
                    }
                }
            }
            /*Skinning end*/
            ppather.Looted(monster);

            // Use default postloot key. If undefined does nothing so don't need to check
            // whether it actually contains a value
            GContext.Main.SendKey("Common.PostLoot");

            return(true);
        }
 bool WaitForEngage(GUnit Target, int Time)
 {
     GSpellTimer BreakLoop = new GSpellTimer(Time, false);
     BreakLoop.Reset();
     while (!BreakLoop.IsReady)
     {
         Thread.Sleep(100);
         if (Target.DistanceToSelf > PullDistance) Target.Approach(PullDistance - 5, false);
         if (Target.Target == Me || Target.Target == Me.Pet || Me.Pet.IsInCombat)
         {
             return true;
         }
         else if (Me.IsUnderAttack) return false;
     }
     return false;
 }
 protected void ResetBTMTimer()
 {
     if (TRAVELFORM == "Distance Mount")
         TRAVELFORMDELAYTIMER = new GSpellTimer(5 * 1000, false);
     else
         TRAVELFORMDELAYTIMER = new GSpellTimer(TRAVELFORMDELAY * 1000, false);
 }
Esempio n. 13
0
        public override bool Do()
        {
            bool  hide;
            int   minutes = 0;
            GUnit Player  = null;

            Player = GetClosestPlayer();

            if (Player != null && Player.DistanceToSelf < AvoidRange)
            {
                GSpellTimer WaitAfterLeave  = new GSpellTimer(10 * 1000);           // wait an exta 10 s
                GSpellTimer SpamTimer       = new GSpellTimer(60 * 1000);           // Spam every 1 min
                System.Media.SoundPlayer sp = new System.Media.SoundPlayer("PlayerNear.wav");
                WaitAfterLeave.Reset();
                SpamTimer.Reset();
                try
                {
                    if (PlaySound)
                    {
                        sp.Load();
                        sp.Play();
                    }
                }
                catch
                {
                }

                do
                {
                    if (Me.IsInCombat)
                    {
                        PPather.WriteLine("AvoidPlayers: I was attacked while hiding");
                        return(false);
                    }

                    if (Me.IsDead)
                    {
                        PPather.WriteLine("AvoidPlayers: I died while hiding");
                        return(false);
                    }

                    hide = false;
                    if (WaitUntilClear == true && GetClosestPlayer() != null)
                    {
                        hide = true;
                    }
                    else if (WaitUntilClear != true && GetClosestPlayer().DistanceToSelf < AvoidRange)
                    {
                        hide = true;
                    }
                    if (hide)
                    {
                        WaitAfterLeave.Reset();
                    }

                    if (Me.PlayerClass.ToString() == "Rogue" && StealthWhileHiding == true && !GPlayerSelf.Me.IsStealth)
                    {
                        GContext.Main.CastSpell(StealthKey);
                    }

                    if (Me.PlayerClass.ToString() == "Druid" && StealthWhileHiding == true && !GPlayerSelf.Me.IsStealth)
                    {
                        if (!Me.HasWellKnownBuff("CatForm"))
                        {
                            GContext.Main.CastSpell(CatFormKey, true, false);                             // if we aren't in cat form, then switch before trying to stealth
                        }
                        GContext.Main.CastSpell(StealthKey, true, false);
                    }

                    if (SpamTimer.IsReady)
                    {
                        SpamTimer.Reset();
                        minutes++;
                        PPather.WriteLine("AvoidPlayers: Waited " + minutes.ToString() + "minutes for players to leave.");
                        if (PlaySound)
                        {
                            sp.Play();
                        }
                        if (minutes >= TimeUntilExit)
                        {
                            PPather.WriteLine("AvoidPlayers: Time to log out");
                            GContext.Main.HearthAndExit();
                            return(false);
                        }
                    }
                    Thread.Sleep(1000);
                } while (!WaitAfterLeave.IsReady);
                return(true);
            }
            return(false);
        }
Esempio n. 14
0
        public override bool Do()
        {
            GPlayerSelf Me = GContext.Main.Me;

            Helpers.Mount.Dismount();
            ppather.Face(monster);

            if (monster.SetAsTarget(false))
            {
                GUnit         target = monster;
                GCombatResult res;
                do
                {
                    ppather.UnBlacklist(target);
                    ppather.TargetIs(target);
                    target.TouchHealthDrop();
                    ppather.StartCombat();
                    res = ppather.KillTarget(target, Me.IsInCombat);
                    PPather.WriteLine("Kill result is: " + res);
                    if (res == GCombatResult.Bugged || res == GCombatResult.OtherPlayerTag)
                    {
                        // TODO make sure to wait out evaders that are attackign us, they usually stop after a few seconds
                        if (res == GCombatResult.Bugged)
                        {
                            GSpellTimer t = new GSpellTimer(3000);
                            while (Me.IsInCombat && !t.IsReadySlow)
                            {
                                ;
                            }
                        }
                        ppather.Blacklist(target);
                    }
                    if (res == GCombatResult.Died)
                    {
                        return(true);                        // sigh
                    }
                    if (res == GCombatResult.Success ||
                        res == GCombatResult.SuccessWithAdd)
                    {
                        ppather.Killed(target);
                    }

                    if (res == GCombatResult.SuccessWithAdd)
                    {
                        target = Me.Target;
                    }
                    else
                    {
                        target.Refresh(true);
                        Thread.Sleep(100);

                        // wait for combat flag to expire unless we have attackers
                        {
                            GSpellTimer t = new GSpellTimer(2000);
                            while (Me.IsInCombat && GObjectList.GetNearestAttacker(0) == null && !t.IsReadySlow)
                            {
                                ;
                            }
                            //PPather.WriteLine("t: " + (2000 - t.TicksLeft));
                        }
                        if (ppather.IsItSafeAt(null, GContext.Main.Me) && !Me.IsInCombat)
                        {
                            if (GContext.Main.Me.Target != null)
                            {
                                GContext.Main.ClearTarget();
                            }
                            ppather.Rest();
                        }
                    }
                } while (res == GCombatResult.SuccessWithAdd && target != null);
            }
            else
            {
                PPather.WriteLine("!Warning:Can not target monster " + monster.Name);
                ppather.Blacklist(monster);
            }

            return(true);            // !?!?
        }
Esempio n. 15
0
        public override bool Do()
        {
            Helpers.Mount.Dismount();

            while (true)
            {
                Functions.Interact(npc);
                Thread.Sleep(1000);

                if (GossipFrame.IsVisible())
                {
                    //PPather.WriteLine("Buy: Got a gossip frame");
                    if (GossipFrame.ClickOptionText("browse your") ||
                        GossipFrame.ClickOptionText("Sid") ||
                        GossipFrame.ClickOptionText("What do you have"))
                    {
                        Thread.Sleep(2000);                         // Lag
                    }
                }

                if (MerchantFrame.IsVisible())
                {
                    GMerchant Merchant = new GMerchant();

                    string[] toBuy;
                    int[]    toBuyQuantities;
                    GetShoppingList(out toBuy, out toBuyQuantities);

                    GSpellTimer sanity = new GSpellTimer(5000);

                    for (int i = 0; i < toBuy.Length; i++)
                    {
                        sanity.Reset();

                        int lastCount = Inventory.GetItemCount(toBuy[i], false);
                        int curCount  = lastCount;

                        do
                        {
                            GContext.Main.EnableCursorHook();
                            if (!Merchant.BuyOnAnyPage(toBuy[i]))
                            {
                                PPather.WriteLine("!Info:Buy: Unable to buy [" + toBuy[i] + "], skipping");
                                break;
                            }
                            Thread.Sleep(2000);

                            curCount = Inventory.GetItemCount(toBuy[i], false);

                            // inventory went up so reset the timer
                            if (curCount > lastCount)
                            {
                                sanity.Reset();
                            }

                            // PPather.WriteLine(string.Format("  {0} -> {1} of {2}", lastCount, curCount, toBuyQuantities[i]));
                            lastCount = curCount;

                            if (sanity.IsReady)
                            {
                                PPather.WriteLine("!Info:Buy: Waiting too long buying [" + toBuy[i] + "], skipping");
                                break;
                            }
                        } while (curCount < toBuyQuantities[i]);
                        GContext.Main.DisableCursorHook();
                    }

                    if (Merchant.IsRepairEnabled)                       // Might as well fix it up while we're here.
                    {
                        PPather.WriteLine("Buy: Repairing");
                        Functions.ClickRepairButton(Merchant);
                    }

                    Functions.Closeit(Merchant);
                }
                else
                {
                    PPather.WriteLine("!Info: Never got merchant frame");
                    GContext.Main.SendKey("Common.Escape");                     // Close whatever frame popped up
                }
                return(true);
            }
        }
 //No PVP yet, wait for death
 void WaitForPlayerDeath()
 {
     GSpellTimer WaitTime = new GSpellTimer(30 * 1000);
     Random RandomClass = new Random();
     while (!WaitTime.IsReady)
     {
         SendKey("Common.Jump");
         Thread.Sleep(RandomClass.Next(5000, 10000));
         SendKey("Common.Sit");
         Thread.Sleep(RandomClass.Next(5000, 10000));
     }
 }
Esempio n. 17
0
        public override bool Do()
        {
            Helpers.Mount.Dismount();

            int n = 3;

            // Todo, special for mines
            if (node.IsMineral)
            {
                n = 6;
            }
            do
            {
                Functions.Interact(node);
                if (GContext.Main.Me.IsInCombat)
                {
                    return(false);
                }
                bool casted = false;
                Thread.Sleep(500);

                while (GContext.Main.Me.IsCasting)
                {
                    casted = true;
                    Thread.Sleep(200);
                }

                if (!casted)
                {
                    // looks bad
                    string message = GContext.Main.RedMessage;
                    if (message.StartsWith("Requires "))
                    {
                        // missing skill or too low
                        PPather.WriteLine("Pickup: Missing skill or too low: " + message);
                        return(true);
                    }
                }

                if (GContext.Main.Me.IsInCombat)
                {
                    return(false);
                }
                GSpellTimer bop = new GSpellTimer(500);
                do
                {
                    for (int i = 1; i <= 4; i++)
                    {
                        if (Popup.IsVisible(i))
                        {
                            String text = Popup.GetText(i);
                            PPather.WriteLine("Pickup: Got a loot popup ('" + text + "')");
                            if (text == "Looting this item will bind it to you.")
                            {
                                Popup.ClickButton(i, 1);
                            }
                            else
                            {
                                Popup.ClickButton(i, 2);
                            }
                        }
                    }
                } while (!bop.IsReadySlow);
                if (GContext.Main.Me.IsInCombat)
                {
                    return(false);
                }
                Thread.Sleep(2000);
                if (GContext.Main.Me.IsInCombat)
                {
                    return(false);
                }
                n--;
            } while (node.IsValid && n > 0);
            ppather.PickedUp(node);


            return(true);
        }