private async Task <bool> MainBehavior() { QBCLog.Info("Using hearthstone; {0} out of {1} tries", ++_retries, MaxRetries); bool onCooldown = false; await UtilityCoroutine.UseHearthStone( UseGarrisonHearthstone, hearthOnCooldownAction : () => onCooldown = true, hearthCastFailedAction : reason => { QBCLog.Warning("Hearth failed. Reason: {0}", reason); _retries++; }); if (_retries >= MaxRetries) { BehaviorDone(string.Format("We have reached our max number of tries ({0}) without successfully hearthing", MaxRetries)); return(true); } if (onCooldown && WaitOnCd) { TreeRoot.StatusText = "Waiting for hearthstone cooldown"; return(true); } BehaviorDone(); return(true); }
private async Task <bool> PurchaseMount() { // Worgens have a ground mount from racial, paladin and warlock have class based mounts so // they do not need to purchase any ground mounts if (RidingLevel > RidingLevelType.None && Me.Race != WoWRace.Worgen && Me.Class != WoWClass.Paladin && Me.Class != WoWClass.Warlock) { // _purchasedMountTimer pervents double purchasing multiple mounts because Mount.GroundMounts is cached. if (!Mount.GroundMounts.Any() && _purchasedMountTimer.IsFinished) { _purchaseMount = true; return(await PurchaseGroundMount()); } // we need to hearth after purchasing our mount if (_purchaseMount) { var onCooldown = false; await UtilityCoroutine.UseHearthStone( hearthOnCooldownAction : () => onCooldown = true, hearthCastedAction : () => _purchaseMount = false, inHearthAreaAction : () => _purchaseMount = false); if (onCooldown) { TreeRoot.StatusText = "Waiting on Hearthstone cooldown"; return(true); } } } // Druids have flightform so do not need to purchase a flying mount. if (RidingLevel >= RidingLevelType.ExpertRiding && Me.Class != WoWClass.Druid && !Mount.FlyingMounts.Any() && _purchasedMountTimer.IsFinished) { return(await PurchaseFlyingMount()); } return(false); }