Exemplo n.º 1
0
        private static async Task <bool> CombatMovement()
        {
            if (_combatMovement == null)
            {
                _combatMovement = new Movement(TargetManager.CombatObject,
                                               (float)TargetManager.PullDistance,
                                               String.Format("Combat {0}", TargetManager.CombatObject.Name));
            }


            TreeRoot.StatusText = "Combat Movement Behavior";
            var result = await _combatMovement.MoveTo_Result(false);

            if (result == MoveResult.Failed)
            {
                if (_combatMovement.CanNavigateFailures > 2)
                {
                    GarrisonBase.Debug("Behavior Combat Movement FAILED for {0}", TargetManager.CombatObject.Name);
                    TargetManager.CombatObject.IgnoredTimer = WaitTimer.TenSeconds;
                    TargetManager.CombatObject = null;
                    _combatMovement            = null;
                    return(false);
                }

                return(true);
            }

            if (result != MoveResult.ReachedDestination)
            {
                return(true);
            }

            _combatMovement = null;
            return(false);
        }
Exemplo n.º 2
0
        //internal static void RefreshFollowerIds()
        //{
        //    GarrisonBase.Debug("Refreshing Follower Ids..");

        //    FollowerIdsCollected.Clear();
        //    FollowerIdsNotCollected.Clear();
        //    BuildingIdsWithFollowerWorking.Clear();
        //    CurrentActiveFollowers = 0;
        //    FollowerIdsAll = LuaCommands.GetAllFollowerIDs();
        //    foreach (var id in FollowerIdsAll)
        //    {
        //        if (LuaCommands.IsFollowerCollected(id))
        //            FollowerIdsCollected.Add(id);
        //        else
        //            FollowerIdsNotCollected.Add(id);
        //    }

        //    GarrisonBase.Log("Found a total of {0} collected followers!", FollowerIdsCollected.Count);
        //}

        internal static void RefreshFollowers()
        {
            GarrisonBase.Debug("Refreshing Followers..");

            BuildingIdsWithFollowerWorking.Clear();
            CurrentActiveFollowers = 0;

            foreach (var follower in GarrisonInfo.Followers)
            {
                var followerId = Convert.ToInt32(follower.Id);
                var f          = new Follower(follower);

                Followers.Add(followerId, f);

                if (f.Status != GarrisonFollowerStatus.Inactive)
                {
                    CurrentActiveFollowers++;
                }
                if (f.AssignedBuildingId > -1)
                {
                    BuildingIdsWithFollowerWorking.Add(f.AssignedBuildingId);
                }
            }

            GarrisonBase.Log("Followers Active {0} / {1}", CurrentActiveFollowers, MaxActiveFollowers);
        }
Exemplo n.º 3
0
        private static async Task <bool> Looting()
        {
            if (StyxWoW.Me.IsMoving && await CommonCoroutines.StopMoving())
            {
                await CommonCoroutines.SleepForLagDuration();
            }

            if (TargetManager.LootableObject.IsValid)
            {
                bool success = await CommonCoroutines.WaitForLuaEvent(
                    "LOOT_CLOSED",
                    4200,
                    null,
                    TargetManager.LootableObject.Interact);

                if (TargetManager.LootableObject.InteractionAttempts > 1)
                {
                    GarrisonBase.Debug("LootObject interaction attempts has excedeed max! Ignoring {0}", TargetManager.LootableObject.Name);
                    IgnoreLootableObject();
                    ResetLoot();
                    return(false);
                }

                if (success)
                {
                    await CheckLootFrame();

                    IgnoreLootableObject();
                    ResetLoot();
                }
            }

            return(true);
        }
Exemplo n.º 4
0
 private static void MerchantFrameOpened()
 {
     GarrisonBase.Debug("Updating Merchant Frame Info..");
     IsOpen = true;
     MerchantItems.Clear();
     NumMerchantItems.Reset();
 }
Exemplo n.º 5
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }

            if (IsDone)
            {
                return(false);
            }

            if (await StartMovement.MoveTo())
            {
                return(true);
            }

            if (!InteractionObjectValid)
            {
                GarrisonBase.Err("Interaction Object Id {0} not valid or found!", InteractionEntryId);
                return(false);
            }

            if (GossipHelper.IsOpen)
            {
                int index = QuestHelper.GetAvailableQuestIndexFromGossipFrame(QuestID);
                if (index == -1)
                {
                    GarrisonBase.Err("Failed to find quest {0} in gossip frame!", QuestID);
                    return(false);
                }
                GossipFrame.Instance.SelectAvailableQuest(index);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

            if (await Movement())
            {
                return(true);
            }

            if (await Interaction())
            {
                return(true);
            }

            if (_specialMovement != null && await _specialMovement.ClickToMove())
            {
                return(true);
            }

            if (await EndMovement.MoveTo())
            {
                return(true);
            }

            IsDone = true;
            return(false);
        }
Exemplo n.º 6
0
        private static void LuaBuyMerchantItem(int index, int amount)
        {
            string lua = String.Format("BuyMerchantItem(\"{0}\"" + ", \"{1}\");", index, amount);

            GarrisonBase.Debug("LuaCommand: BuyMerchantItem {0} / {1}", index, amount);
            Lua.DoString(lua);
        }
Exemplo n.º 7
0
        public override void Initalize()
        {
            Movement.IgnoreTaxiCheck = true;
            _selectedTaxiNode        = null;
            _taxiMovement            = null;
            _taxiNpc           = null;
            _nonVisiblityCount = 0;

            GarrisonBase.Debug("UseFlightPath Destination {0}", _destination.ToString());

            _destinationFlightPathInfo = TaxiFlightHelper.NearestFlightPathFromLocation(_destination);
            if (_destinationFlightPathInfo != null)
            {
                GarrisonBase.Debug("Destination FlightPathInfo {0}", _destinationFlightPathInfo.ToString());

                if (_destinationFlightPathInfo.MasterId == TaxiFlightHelper.FlightPathInfo.FrostwallMasterEntry ||
                    _destinationFlightPathInfo.MasterId == TaxiFlightHelper.FlightPathInfo.LunarfallMasterEntry)
                {
                    GarrisonBase.Debug("Flight path destination is garrison, ignore hearth set to false!");
                    Common.PreChecks.IgnoreHearthing = false;
                }
            }

            _currentMapId     = TaxiFlightHelper.GetMapId(Player.Location);
            _destinationMapId = TaxiFlightHelper.GetMapId(_destination);
            GarrisonBase.Debug("Current Map Id {0} -- Destination Map Id {1}", _currentMapId, _destinationMapId);
            if (_currentMapId != _destinationMapId)
            {
                _shouldCheckMapId = true;
            }

            Common.CloseOpenFrames();
            Initalized = true;
        }
Exemplo n.º 8
0
        private async Task <bool> CheckFlightNodes()
        {
            //Validate that we have a node we can use..
            var validInfoNodes = TaxiFlightHelper.TaxiNodes.Where(n => n.Known && n.Info != null).ToList();

            if (validInfoNodes.Count > 0)
            {
                var orderedNodes = validInfoNodes.OrderBy(n => n.Info.Location.Distance(_destination)).ToList();
                _selectedTaxiNode = orderedNodes[0];

                GarrisonBase.Debug("UseFlightPath using closest node {0}!", _selectedTaxiNode.Name);
            }
            else
            {
                GarrisonBase.Debug("UseFlightPath could not find a valid flight point using location!");
                IsDone = true;
                return(true);
            }

            //Garrison FP!
            if (_selectedTaxiNode.Name.Contains("frostwall garrison") ||
                _selectedTaxiNode.Name.Contains("lunarfall"))
            {
                Common.PreChecks.IgnoreHearthing = false;
            }


            return(false);
        }
Exemplo n.º 9
0
        /// <summary>
        /// The universal method used by all behaviors for execution.
        /// </summary>
        /// <returns></returns>
        public virtual async Task <bool> BehaviorRoutine()
        {
            TreeRoot.StatusText = GetStatusText;

            if (!Initalized)
            {
                GarrisonBase.Debug("Initalizing Behavior {0}", Type);
                Initalize();
            }
            if (!IsDone)
            {
                IsDone = !CheckRunCondition();
            }

            if (IsDone)
            {
                if (!Disposed)
                {
                    GarrisonBase.Debug("Disposing Behavior {0}", Type);
                    Dispose();
                }
                return(false);
            }

            //await Coroutine.Yield();
            return(await Common.CheckCommonCoroutines());
        }
Exemplo n.º 10
0
        public static bool ShouldTakeFlightPath(WoWPoint destination)
        {
            var runTravelTime = Styx.CommonBot.FlightPaths.GetRunPathTime(new[] { Player.Location, destination }, 14.7f);

            GarrisonBase.Debug("Checking ShouldTakeFlightpath for {0} with mounted time {1} seconds", destination, runTravelTime.TotalSeconds);
            if (runTravelTime.TotalSeconds < 90)
            {
                return(Styx.CommonBot.FlightPaths.ShouldTakeFlightpath(Player.Location, destination, 14.7f));
            }
            else
            {
                var playerMapId = !Player.MapIsContinent
                    ? Player.ParentMapId
                    : (int)Player.MapId.Value;

                //Lets verify that our possible destination
                var destinationTaxi = NearestFlightPathFromLocation(destination);
                var currentTaxi     = NearestFlightPath;
                if (destinationTaxi.Name == currentTaxi.Name)
                {
                    GarrisonBase.Debug("ShouldTakeFlight path return false due to matching names taxi and current taxi");
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 11
0
        private static async Task <bool> LootMovement()
        {
            if (_lootMovement == null)
            {
                _lootMovement = new Movement(TargetManager.LootableObject.Location,
                                             TargetManager.LootableObject.InteractRange - 0.25f,
                                             String.Format("Loot {0}", TargetManager.LootableObject.Name));
            }

            MoveResult result = await _lootMovement.MoveTo_Result();

            if (result == MoveResult.Failed)
            {
                if (_lootMovement.CanNavigateFailures > 2)
                {
                    GarrisonBase.Debug("Behavior Looting Movement FAILED 3x Times! for {0}", TargetManager.LootableObject.Name);
                    TargetManager.LootableObject.IgnoredTimer = WaitTimer.TenSeconds;
                    TargetManager.LootableObject.IgnoredTimer.Reset();
                    ResetLoot();
                    return(false);
                }

                return(true);
            }

            if (result != MoveResult.ReachedDestination)
            {
                return(true);
            }

            ResetLoot();
            return(false);
        }
Exemplo n.º 12
0
        private static int GetMerchantItemCount()
        {
            GarrisonBase.Debug("LuaCommand: GetMerchantNumItems");
            string        lua       = String.Format("return GetMerchantNumItems()");
            List <string> retvalues = Lua.GetReturnValues(lua);

            return(retvalues[0].ToInt32());
        }
Exemplo n.º 13
0
        private static int GetGossipEntryCount()
        {
            GarrisonBase.Debug("LuaCommand: GetNumGossipOptions");
            string        lua       = String.Format("return GetNumGossipOptions()");
            List <string> retvalues = Lua.GetReturnValues(lua);

            return(retvalues[0].ToInt32());
        }
Exemplo n.º 14
0
        private static async Task <bool> VendorInteraction(C_WoWObject vendor, List <C_WoWItem> items)
        {
            TreeRoot.StatusText = "Vendor Interaction Behavior";

            if (GossipHelper.IsOpen)
            {
                await Coroutine.Yield();

                if (GossipHelper.GossipOptions.All(o => o.Type != GossipEntry.GossipEntryType.Vendor))
                {
                    //Could not find Vendor Option!
                    GarrisonBase.Debug("Vendor Gossip Has No Option for Vendoring!");
                    return(false);
                }
                var gossipEntryVendor = GossipHelper.GossipOptions.FirstOrDefault(o => o.Type == GossipEntry.GossipEntryType.Vendor);

                QuestManager.GossipFrame.SelectGossipOption(gossipEntryVendor.Index);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

            if (MerchantHelper.IsOpen)
            {
                if (items.Count > 0)
                {
                    foreach (var item in items)
                    {
                        GarrisonBase.Debug("Vendoring Item {0} ({1}) Quality {2}", item.Name, item.Entry, item.Quality);
                        MerchantFrame.Instance.SellItem(item.ref_WoWItem);
                        await CommonCoroutines.SleepForRandomUiInteractionTime();

                        await Coroutine.Yield();

                        if (!MerchantHelper.IsOpen)
                        {
                            break;
                        }
                    }

                    return(true);
                }

                //No vendor items found..
                return(false);
            }

            if (StyxWoW.Me.IsMoving)
            {
                await CommonCoroutines.StopMoving();
            }
            await CommonCoroutines.SleepForLagDuration();

            vendor.Interact();
            await CommonCoroutines.SleepForRandomUiInteractionTime();

            return(true);
        }
Exemplo n.º 15
0
        public static async Task <bool> VendoringBehavior()
        {
            if (await DisenchantBehavior.Disenchanting())
            {
                return(true);
            }
            if (await VendorBehavior.Vendoring())
            {
                return(true);
            }
            if (await MailBehavior.Mailing())
            {
                return(true);
            }

            if (Player.Inventory.TotalFreeSlots < BaseSettings.CurrentSettings.MinimumBagSlotsFree || ForceBagCheck)
            {
                ForceBagCheck = false;

                if (VendorBehavior.ShouldVendor)
                {
                    GarrisonBase.Debug("Enabling Vendor behavior!");
                    VendorBehavior.IsVendoring = true;
                }

                if (MailBehavior.ShouldMail)
                {
                    GarrisonBase.Debug("Enabling Mailing behavior!");
                    MailBehavior.IsMailing = true;
                }

                if (DisenchantBehavior.ShouldDisenchant)
                {
                    GarrisonBase.Debug("Enabling Disenchanting behavior!");
                    DisenchantBehavior.IsDisenchanting = true;
                }

                if (VendorBehavior.IsVendoring || MailBehavior.ShouldMail || DisenchantBehavior.ShouldDisenchant)
                {
                    _originalTargetManagerLoot = TargetManager.ShouldLoot;
                    _originalTargetManagerKill = TargetManager.ShouldKill;
                    TargetManager.ShouldKill   = false;
                    TargetManager.ShouldLoot   = false;
                    _resetTargetManager        = true;
                    return(true);
                }
            }

            if (_resetTargetManager)
            {
                _resetTargetManager      = false;
                TargetManager.ShouldKill = _originalTargetManagerKill;
                TargetManager.ShouldLoot = _originalTargetManagerLoot;
            }

            return(false);
        }
Exemplo n.º 16
0
 /// <summary>
 /// This occurs only once to initalize any variable only after the Criteria check occurs and passes.
 /// </summary>
 public virtual void Initalize()
 {
     StartMovement      = new Movement(MovementPoints.ToArray(), 2f, name: String.Format("StartMovement({0})", Type.ToString()));
     EndMovement        = new Movement(MovementPoints.ToArray().Reverse().ToArray(), 2f, name: String.Format("EndMovement({0})", Type.ToString()));
     _interactionObject = null;
     IsDone             = false;
     Initalized         = true;
     GarrisonBase.Debug("Behavior {0} has been initalized", Type);
 }
        private async Task <bool> Interaction()
        {
            if (Building.CheckedWorkOrderStartUp)
            {
                return(false);
            }

            if ((Building.Type != BuildingType.TradingPost && Building.Type != BuildingType.Barn) &&
                Building.WorkOrder.TotalWorkorderStartups() == 0)
            {
                GarrisonBase.Debug("Total Work Order Startup Count is Zero!");
                Building.CheckedWorkOrderStartUp = true;
                return(false);
            }

            TreeRoot.StatusText = String.Format("Behavior {0} [{1}] Interaction", Type.ToString(), Building.Type);
            if (LuaEvents.ShipmentOrderFrameOpen)
            {
                if (BaseSettings.CurrentSettings.DEBUG_FAKESTARTWORKORDER || !LuaUI.WorkOrder.StartWorkOrder.IsEnabled())
                {
                    if (Building.Type != BuildingType.Barn)
                    {
                        Building.CheckedWorkOrderStartUp = true;
                    }
                    else
                    {
                        CurrentBarnCurrceny = null;
                        BarnWorkOrderCurrencies.RemoveAt(0);
                    }

                    //if (_specialMovement != null) _specialMovement.UseDeqeuedPoints(true);
                    GarrisonBase.Log("Order Button Disabled!");
                    Building.WorkOrder.Refresh();
                    LuaUI.WorkOrder.Close.Click();
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    await Coroutine.Yield();

                    return(Building.Type == BuildingType.Barn);
                }

                await CommonCoroutines.SleepForRandomUiInteractionTime();

                if (Building.Type == BuildingType.WarMillDwarvenBunker)
                {
                    LuaUI.WorkOrder.StartWorkOrder.Click();
                }
                else
                {
                    LuaUI.WorkOrder.CreateAllWorkOrder.Click();
                }

                await Coroutine.Yield();
            }

            return(true);
        }
Exemplo n.º 18
0
        private static async Task <bool> DisenchantInteraction(List <C_WoWItem> items)
        {
            if (Player.CurrentPendingCursorSpellId == DisenchantSpellId)
            {
                //Item Interaction!
                GarrisonBase.Log("Disenchant Cursor!");

                if (items.Count > 0)
                {
                    var item = items[0];
                    GarrisonBase.Debug("Disenchanting Item {0} ({1}) Quality {2}", item.Name, item.Entry, item.Quality);
                    bool bagChanged = await CommonCoroutines.WaitForLuaEvent(
                        "BAG_UPDATE",
                        6200,
                        null,
                        item.Use);

                    PlayerInventory.ItemDisenchantingBlacklistedGuids.Add(item.Guid);

                    //Force update if bag didn't change.. (so we ignore this item now)
                    if (!bagChanged)
                    {
                        Player.Inventory.UpdateBagItems();
                    }

                    return(true);
                }
                return(false);
            }

            var spell = DisenchantSpell;

            if (spell != null)
            {
                bool cursorChanged = await CommonCoroutines.WaitForLuaEvent(
                    "CURRENT_SPELL_CAST_CHANGED",
                    StyxWoW.Random.Next(555, 2002),
                    null,
                    spell.Cast);

                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await Coroutine.Yield();

                await Coroutine.Sleep(StyxWoW.Random.Next(1222, 2222));
            }
            else
            {
                GarrisonBase.Err("Disenchanting Spell returned null!");
                return(false);
            }



            return(true);
        }
Exemplo n.º 19
0
 /// <summary>
 /// This occurs only once after the behavior is considered done.
 /// </summary>
 public virtual void Dispose()
 {
     IsDone   = true;
     Disposed = true;
     if (DisposalAction != null)
     {
         DisposalAction.Invoke();
     }
     GarrisonBase.Debug("Behavior {0} has been disposed", Type);
 }
Exemplo n.º 20
0
 private static void PopulateFlightPaths()
 {
     GarrisonBase.Debug("Populating Flight Paths from XML..");
     //Populate the known flight paths incase we need it!
     FlightPaths.Clear();
     foreach (var node in Styx.CommonBot.FlightPaths.XmlNodes)
     {
         FlightPaths.Add(new FlightPathInfo(node));
     }
     GarrisonBase.Debug("Added a total of {0} Flight Paths!", FlightPaths.Count);
 }
Exemplo n.º 21
0
        private static MissionSimulatorResults SimulatorResults(Mission mission, GarrisonFollower[] followers, MissionSimulatorOptions options)
        {
            var _options = options ?? SuccessOnlyOptions;
            var result   = GarrisonMissionSimulator.Simulate(mission.refGarrisonMission, followers, _options);

            string followernames = result.Followers.Aggregate(String.Empty, (current, f) => current + f.Name + "\t");

            GarrisonBase.Log("Result: Success {0}%, Followers {1}", result.SuccessChance, followernames);

            return(result);
        }
Exemplo n.º 22
0
        private static bool buyitem(MItem item, int amount, bool forced = false)
        {
            GarrisonBase.Debug("Attempting to buy Merchant item ({0}) at index {1} of quantity {2} (forced={3})",
                               item.Name, item.Index, amount, forced);
            if (!forced)
            {
                return(MerchantFrame.Instance.BuyItem(item.Index, amount));
            }

            LuaBuyMerchantItem(item.Index, amount);
            return(true);
        }
Exemplo n.º 23
0
 public GossipOptionEntry(string text, string type)
 {
     Text = text;
     try
     {
         Type = (GossipEntry.GossipEntryType)Enum.Parse(typeof(GossipEntry.GossipEntryType), type, true);
     }
     catch (Exception)
     {
         GarrisonBase.Err("Failed to parse gossip entry type from {0}", type);
         Type = GossipEntry.GossipEntryType.Unknown;
     }
 }
Exemplo n.º 24
0
        private static async Task <bool> ValidateCombatPoi()
        {
            if (StyxWoW.Me.CurrentTarget == null || StyxWoW.Me.CurrentTarget.Guid != TargetManager.CombatObject.Guid)
            {
                GarrisonBase.Debug("Behavior Combat changing POI to unit {0}", TargetManager.CombatObject.Name);
                BotPoi.Current = new BotPoi(TargetManager.CombatObject.RefWoWUnit, PoiType.Kill);
                TargetManager.CombatObject.RefWoWUnit.Target();
                ResetCombat();
                return(true);
            }

            return(false);
        }
Exemplo n.º 25
0
        private static async Task <bool> MailMovement()
        {
            TreeRoot.StatusText = "Mail Movement Behavior";
            var result = await _mailingMovement.MoveTo_Result();

            if (result == MoveResult.Failed)
            {
                GarrisonBase.Debug("Behavior Mailbox Movement FAILED!");
                _mailingMovement = null;
                return(false);
            }

            return(true);
        }
Exemplo n.º 26
0
        internal static void InitalizeBehaviorsList()
        {
            GarrisonBase.Debug("Initalize Behaviors List..");
            //Insert new missions behavior at beginning!
            Behaviors.Clear();
            SwitchBehaviors.Clear();
            CurrentBehavior = null;
            SwitchBehavior  = null;

            //Garrison Related!
            Behaviors.AddRange(GarrisonManager.GetGarrisonBehaviors());

            InitalizedBehaviorList = true;
        }
Exemplo n.º 27
0
        private static bool ValidateCombatObject()
        {
            if (ObjectCacheManager.ShouldUpdateObjectCollection)
            {
                ObjectCacheManager.UpdateCache();
            }

            if (!TargetManager.ShouldKill)
            {
                ResetCombat();
                return(false);
            }

            if (TargetManager.CombatObject == null)
            {
                TargetManager.UpdateCombatTarget();
                if (TargetManager.CombatObject == null)
                {
                    ResetCombat();
                    return(false);
                }
            }

            if (!TargetManager.CombatObject.ValidForCombat)
            {
                GarrisonBase.Debug("EngageObject no longer valid for combat!");
                TargetManager.UpdateCombatTarget();


                //Clear and update lootable object
                TargetManager.LootableObject = null;
                LootBehavior.ResetLoot();
                TargetManager.UpdateLootableTarget();

                ResetCombat();
                return(false);
            }

            if (TargetManager.CombatObject.IsEvadeRunningBack)
            {
                GarrisonBase.Debug("EngageObject is evading!");
                TargetManager.CombatObject.IgnoredTimer = WaitTimer.TenSeconds;
                TargetManager.CombatObject.IgnoredTimer.Reset();
                return(false);
            }

            return(true);
        }
Exemplo n.º 28
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

            var millingHerbs = Player.Inventory.GetBagItemsMilling();

            if (millingHerbs.Count == 0)
            {
                IsDone = true;
                return(false);
            }

            if (Player.CurrentPendingCursorSpellId != 51005)
            {
                if (!MillingSpell.Cooldown && MillingSpell.CanCast)
                {
                    await CommonCoroutines.WaitForLuaEvent(
                        "CURRENT_SPELL_CAST_CHANGED",
                        10000,
                        () => false,
                        MillingSpell.Cast);
                }
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

            GarrisonBase.Debug("Milling Herb {0} stack {1}", millingHerbs[0].Name, millingHerbs[0].StackCount);
            await CommonCoroutines.WaitForLuaEvent(
                "BAG_UPDATE",
                10000,
                () => false,
                millingHerbs[0].Use);

            await CommonCoroutines.SleepForRandomUiInteractionTime();

            return(true);
        }
Exemplo n.º 29
0
        public static void PopulateTaxiNodes()
        {
            GarrisonBase.Debug("Populating Taxi Nodes!");

            if (!IsOpen)
            {
                return;
            }

            TaxiNodes.Clear();
            foreach (var node in TaxiFrame.Instance.Nodes)
            {
                TaxiNodes.Add(new TaxiNodeInfo(node));
            }


            GarrisonBase.Debug("Added a total of {0} Taxi Nodes!", TaxiNodes.Count);
        }
Exemplo n.º 30
0
        private static async Task <bool> CheckLootFrame()
        {
            // loot everything.
            if (!LuaEvents.LootOpened)
            {
                return(false);
            }

            var lootSlotInfos = new List <LootSlotInfo>();

            for (int i = 0; i < LootFrame.Instance.LootItems; i++)
            {
                lootSlotInfos.Add(LootFrame.Instance.LootInfo(i));
            }

            if (await Coroutine.Wait(2000, () =>
            {
                LootFrame.Instance.LootAll();
                return(!LuaEvents.LootOpened);
            }))
            {
                GarrisonBase.Log("Succesfully looted: ");
                foreach (LootSlotInfo lootinfo in lootSlotInfos)
                {
                    try
                    {
                        string lootQuanity = lootinfo.LootQuantity.ToString();
                        string lootName    = lootinfo.LootName;
                        GarrisonBase.Log(lootQuanity + "x " + lootName);
                    }
                    catch
                    {
                        GarrisonBase.Log("exception occured");
                    }
                }
            }
            else
            {
                GarrisonBase.Err("Failed to loot from Frame.");
            }
            await CommonCoroutines.SleepForLagDuration();

            return(true);
        }