Exemplo n.º 1
0
        private async Task <bool> TurninQuestAndBuyMount(
            int turninId,
            WoWPoint turninLoc,
            uint questId,
            int vendorId,
            WoWPoint vendorLocation,
            int itemId)
        {
            // Turnin the 'Learn to Ride' quest if in log
            if (_profileHelpers.HasQuest(questId))
            {
                return(await UtilityCoroutine.TurninQuest(turninId, turninLoc, questId));
            }

            // buy the mount
            return(await BuyMount(vendorId, vendorLocation, itemId));
        }
Exemplo n.º 2
0
        private async Task <bool> TrainMount()
        {
            if (!TrainInOutland && !TrainInOldWorld)
            {
                return(false);
            }

            var trainerId = GetTrainerId();

            if (trainerId == 0)
            {
                return(false);
            }

            var trainer = ObjectManager.GetObjectsOfType <WoWUnit>()
                          .Where(u => u.Entry == trainerId && !u.IsDead)
                          .OrderBy(u => u.DistanceSqr).FirstOrDefault();
            WoWPoint trainerLoc;
            string   trainerName;

            if (trainer == null)
            {
                var traderEntry = Styx.CommonBot.ObjectDatabase.Query.GetNpcById((uint)trainerId);
                if (traderEntry == null)
                {
                    return(false);
                }
                trainerLoc  = traderEntry.Location;
                trainerName = traderEntry.Name;
            }
            else
            {
                trainerLoc  = trainer.Location;
                trainerName = trainer.SafeName;
            }

            if (trainer == null || !trainer.WithinInteractRange)
            {
                return(await UtilityCoroutine.MoveTo(trainerLoc, "Riding Trainer: " + trainerName));
            }

            if (await CommonCoroutines.StopMoving())
            {
                return(true);
            }

            // Turnin any quests since they can interfer with training.
            if (trainer.HasQuestTurnin())
            {
                return(await UtilityCoroutine.TurninQuest(trainer, trainer.Location));
            }

            if (!TrainerFrame.Instance.IsVisible)
            {
                trainer.Interact();
                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            TrainerFrame.Instance.BuyAll();
            await CommonCoroutines.SleepForRandomUiInteractionTime();

            return(true);
        }
Exemplo n.º 3
0
        private async Task <bool> PurchaseGroundMount_Alliance()
        {
            switch (Me.Race)
            {
            case WoWRace.Human:
                return(await TurninQuestAndBuyMount(
                           MobId_RandalHunter,
                           _randalHunterLoc,
                           QuestId_LearnToRide_Human,
                           MobId_KatieHunter,
                           _katieHunterLoc,
                           ItemId_PintoBridle));

            case WoWRace.Pandaren:
                return(await TurninQuestAndBuyMount(
                           MobId_MeiLin,
                           _meiLinLoc,
                           QuestId_LearnToRide_Pandaren,
                           MobId_OldWhitenose,
                           _oldWhitenoseLoc,
                           ItemId_ReinsOfTheBlackDragonTurtle));

            case WoWRace.Gnome:
                return(await TurninQuestAndBuyMount(
                           MobId_BinjyFeatherwhistle,
                           _binjyFeatherwhistleLoc,
                           QuestId_LearnToRide_Gnome,
                           MobId_MilliFeatherwhistle,
                           _milliFeatherwhistleLoc,
                           ItemId_BlueMechanostrider));

            case WoWRace.Dwarf:
                return(await TurninQuestAndBuyMount(
                           MobId_UlthamIronhorn,
                           _ulthamIronhornLoc,
                           QuestId_LearnToRide_Dwarf,
                           MobId_VeronAmberstill,
                           _veronAmberstillLoc,
                           ItemId_WhiteRam));

            case WoWRace.NightElf:
                if (InEasternKingdoms)
                {
                    return(await UtilityCoroutine.UseTransport(
                               GameObjectId_Ship_TheBravery,
                               _theBraveryStartLoc,
                               _theBraveryEndLoc,
                               _theBraveryWaitAtLoc,
                               _theBraveryStandAtLoc,
                               _theBraveryGetOffAtLoc));
                }

                if (!InKalimdor)
                {
                    return(false);
                }

                return(await TurninQuestAndBuyMount(
                           MobId_Jartsam,
                           _jartsamLoc,
                           QuestId_LearnToRide_NightElf,
                           MobId_Lelanai,
                           _lelanaiLoc,
                           ItemId_ReinsOfTheStripedNightsaber));

            case WoWRace.Draenei:
                if (InEasternKingdoms)
                {
                    return(await UtilityCoroutine.UseTransport(
                               GameObjectId_Ship_TheBravery,
                               _theBraveryStartLoc,
                               _theBraveryEndLoc,
                               _theBraveryWaitAtLoc,
                               _theBraveryStandAtLoc,
                               _theBraveryGetOffAtLoc));
                }

                // port over to Exodar
                if (InKalimdor && Me.ZoneId != 3557)
                {
                    var portal = ObjectManager.GetObjectsOfType <WoWGameObject>()
                                 .FirstOrDefault(g => g.Entry == GameObjectId_PortalToExodar);

                    if (portal == null || !portal.WithinInteractRange)
                    {
                        return(await(UtilityCoroutine.MoveTo(portal != null ? portal.Location : _exodarPortalLoc, "Exodar portal")));
                    }

                    portal.Interact();
                    await CommonCoroutines.SleepForLagDuration();

                    return(true);
                }
                if (Me.ZoneId != 3557)
                {
                    return(false);
                }

                // Turnin the 'Learn To Ride At The Exodar' quest if in log
                if (_profileHelpers.HasQuest(QuestId_LearnToRideAtTheExodar) && _profileHelpers.IsQuestCompleted(QuestId_LearnToRideAtTheExodar))
                {
                    return(await UtilityCoroutine.TurninQuest(MobId_Aalun, _aalunLoc, QuestId_LearnToRideAtTheExodar));
                }

                return(await TurninQuestAndBuyMount(
                           MobId_Aalun,
                           _aalunLoc,
                           QuestId_LearnToRide_Draenei,
                           MobId_ToralliusThePackHandler,
                           _toralliusThePackHandlerLoc,
                           ItemId_BrownElekk));
            }

            return(false);
        }