Ejemplo n.º 1
0
        private static async Task <bool> SplitItem(C_WoWItem item, int Count, int BagIndex, int BagSlot)
        {
            if (!LuaCommands.CursorHasItem())
            {
                //Split Item..
                bool pickup =
                    await CommonCoroutines.WaitForLuaEvent("CURSOR_UPDATE",
                                                           2500,
                                                           null,
                                                           () => LuaCommands.SplitContainerItem(item.BagIndex + 1, item.BagSlot + 1, Count));

                await CommonCoroutines.SleepForRandomUiInteractionTime();

                if (pickup)
                {
                    //Select Empty Bag Slot
                    await CommonCoroutines.WaitForLuaEvent(
                        "CURSOR_UPDATE",
                        2500,
                        null,
                        () => LuaCommands.PickupContainerItem(BagIndex, BagSlot + 1));

                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
 public BehaviorHerb() : base(MovementCache.GardenPlot63SafePoint)
 {
     Criteria += () => (!GarrisonManager.Buildings[BuildingType.HerbGarden].IsBuilding &&
                        !GarrisonManager.Buildings[BuildingType.HerbGarden].CanActivate &&
                        GarrisonManager.Buildings[BuildingType.HerbGarden].FirstQuestCompleted &&
                        LuaCommands.CheckForDailyReset(BaseSettings.CurrentSettings.LastCheckedHerb) &&
                        BaseSettings.CurrentSettings.BehaviorHerbGather);
 }
Ejemplo n.º 3
0
 internal void RefreshBackpackContainerInfo()
 {
     BagContainerTotalSlots = new[] { 16, 0, 0, 0, 0 };
     for (int i = 1; i < 5; i++)
     {
         bool ignored = LuaCommands.GetBagSlotFlag(i, 1);
         IgnoredBackpackBags[i - 1] = ignored;
         BagContainerTotalSlots[i]  = LuaCommands.GetNumberContainerSlots(i);
     }
 }
Ejemplo n.º 4
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

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



            TargetManager.UpdateLootableTarget();

            if (_movement == null || _movement.CurrentMovementQueue.Count == 0)
            {
                if (_movementQueue.Count > 0)
                {
                    _movement = new Movement(_movementQueue.Dequeue(), 5f, name: "Herbing");
                }
            }

            if (ObjectCacheManager.FoundHerbObject)
            {
                if (_movementQueue.Count > 0)
                {
                    if (_movement != null)
                    {
                        if (await _movement.MoveTo())
                        {
                            return(true);
                        }
                    }

                    return(true);
                }
            }

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

            BaseSettings.CurrentSettings.LastCheckedHerbString = LuaCommands.GetGameTime().ToString("yyyy-MM-ddTHH:mm:ss");
            BaseSettings.SerializeToXML(BaseSettings.CurrentSettings);
            TargetManager.ShouldLoot = false;

            return(false);
        }
Ejemplo n.º 5
0
        public void Refresh()
        {
            string plotid;
            int    shipcap, shipmax, shipready;
            bool   isbuilding, canactivate;

            LuaCommands.GetBuildingInfo(BuildingId, out plotid, out canactivate, out shipcap, out shipready, out shipmax, out isbuilding);

            Maximum = shipcap;
            Pending = shipready;
            Pickup  = shipmax;
        }
Ejemplo n.º 6
0
    public static void Command(int _fromClient, Packet packet)
    {
        string cmd = packet.ReadString();

        try
        {
            LuaCommands.ExecCmd(_fromClient, cmd);
        }
        catch (Exception e)
        {
            Debug.LogError(e);
        }
    }
Ejemplo n.º 7
0
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

            LuaCommands.ClickStaticPopupButton(_buttonIndex);
            await CommonCoroutines.SleepForRandomUiInteractionTime();

            return(true);
        }
Ejemplo n.º 8
0
        internal static void Initalize()
        {
            PlayerGuid        = StyxWoW.Me.Guid;
            IsAlliance        = StyxWoW.Me.IsAlliance;
            Level             = StyxWoW.Me.Level;
            Location          = StyxWoW.Me.Location;
            Rotation          = StyxWoW.Me.Rotation;
            Class             = StyxWoW.Me.Class;
            CurrentTargetGuid = StyxWoW.Me.CurrentTargetGuid;
            Combat            = StyxWoW.Me.Combat;
            ActuallyInCombat  = StyxWoW.Me.IsActuallyInCombat;
            TraceLinePosition = StyxWoW.Me.GetTraceLinePos();
            Inventory         = new PlayerInventory();
            Professions       = new PlayerProfessions();

            MinimapZoneText = new CachedValue <string>(() => StyxWoW.Me.MinimapZoneText);
            MapId           = new CachedValue <uint>(() => StyxWoW.Me.CurrentMap.MapId);
            ParentMapId     = new CachedValue <int>(() => StyxWoW.Me.CurrentMap.ParentMapId);
            MapExpansionId  = new CachedValue <uint>(() => StyxWoW.Me.CurrentMap.ExpansionId);
            MapIsContinent  = new CachedValue <bool>(() => StyxWoW.Me.CurrentMap.IsContinent);
            ZoneId          = new CachedValue <uint>(() => StyxWoW.Me.ZoneId);
            //
            GarrisonResource            = new CachedValue <int>(() => LuaCommands.GetCurrencyCount(824));
            CurrentPendingCursorSpellId = new CachedValue <int>(_updateCurrentPendingCursorSpellId);
            LastErrorMessage            = new CachedValue <string>(GetLastErrorMessage);

            LuaEvents.OnZoneChangedNewArea += () =>
            {
                MapId.Reset();
                ParentMapId.Reset();
                MapExpansionId.Reset();
                MapIsContinent.Reset();
                MinimapZoneText.Reset();
                ZoneId.Reset();
            };

            LuaEvents.OnZoneChanged             += () => MinimapZoneText.Reset();
            LuaEvents.OnCurrencyDisplayUpdate   += () => GarrisonResource.Reset();
            LuaEvents.OnCurrentSpellCastChanged += () => CurrentPendingCursorSpellId.Reset();
            LuaEvents.OnUiErrorMessage          += () => LastErrorMessage.Reset();

            Update();
        }
        public override async Task <bool> BehaviorRoutine()
        {
            if (await base.BehaviorRoutine())
            {
                return(true);
            }
            if (IsDone)
            {
                return(false);
            }

            //Inject our lua addon code for mission success function
            if (!LuaEvents.LuaAddonInjected)
            {
                if (LuaCommands.TestLuaInjectionCode())
                {//Prevent multiple injections by checking simple function return!
                    LuaEvents.LuaAddonInjected = true;
                }
                else
                {
                    await LuaEvents.InjectLuaAddon();

                    return(true);
                }
            }

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

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

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

            return(false);
        }
Ejemplo n.º 10
0
        private static async Task <bool> MailboxInteraction(C_WoWObject mailbox, Dictionary <string, List <C_WoWItem> > items)
        {
            if (MailHelper.IsOpen)
            {
                //Click Send Mail Tab
                if (!LuaCommands.IsSendMailFrameVisible())
                {
                    LuaCommands.ClickSendMailTab();
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }

                foreach (var keypair in items)
                {
                    GarrisonBase.Log("Found {0} items to mail", keypair.Value.Count);
                    bool success = await SendMail(keypair.Key, keypair.Value);

                    if (!success)
                    {
                        GarrisonBase.Debug("Sending Mail Failed!");
                        return(false);
                    }
                    await Coroutine.Yield();

                    return(true);
                }
            }


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

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

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

            if (!QuestHelper.QuestContainedInQuestLog(QuestID) || QuestHelper.GetQuestFromQuestLog(QuestID).IsCompleted)
            {
                return(false);
            }

            if (Building.WorkOrder == null || Building.WorkOrder.TotalWorkorderStartups() == 0)
            {
                return(false);
            }

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

            if (GossipHelper.IsOpen)
            {
                GossipFrame.Instance.SelectGossipOption(0);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(true);
            }

            if (LuaCommands.IsGarrisonCapacitiveDisplayFrame())
            {
                if (!LuaCommands.ClickStartOrderButtonEnabled())
                {
                    Building.CheckedWorkOrderStartUp = true;
                    GarrisonBase.Log("Order Button Disabled!");
                    return(false);
                }


                LuaCommands.ClickStartOrderButton();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await CommonCoroutines.SleepForLagDuration();

                return(true);
            }

            if (InteractionObject != null && InteractionObject.IsValid)
            {
                if (InteractionObject.WithinInteractRange)
                {
                    TreeRoot.StatusText = String.Format("Behavior {0} Quest NPC Interact", Type.ToString());
                    InteractionObject.Interact();
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }

                if (_npcMovement == null)
                {
                    _npcMovement = new Movement(InteractionObject.Location, InteractionObject.InteractRange - 0.25f);
                }

                await _npcMovement.ClickToMove(false);

                return(true);
            }

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

            // ObjectCacheManager.UpdateLootableTarget();

            if (_movement == null || _movement.CurrentMovementQueue.Count == 0)
            {
                if (_movementQueue.Count > 0)
                {
                    //while (_movementQueue.Count > 0)
                    //{
                    //    if (ObjectCacheManager.GetGameObjectsNearPoint(_movementQueue.Peek(), 50f, WoWObjectTypes.OreVein).Count==0)
                    //    {
                    //        GarrisonBase.Debug("Dequeueing point from mine movement!");
                    //        _movementQueue.Dequeue();
                    //        continue;
                    //    }

                    //    break;
                    //}

                    if (_movementQueue.Count > 0)
                    {
                        _movement = new Movement(_movementQueue.Dequeue(), 5f, name: "Mining");
                        TargetManager.LootDistance += 10f;
                    }
                }
            }

            if (ObjectCacheManager.FoundOreObject)
            {
                if (_movementQueue.Count > 0)
                {
                    if (_movement != null)
                    {
                        if (await _movement.MoveTo())
                        {
                            return(true);
                        }
                    }

                    return(true);
                }
            }

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

            BaseSettings.CurrentSettings.LastCheckedMineString = LuaCommands.GetGameTime().ToString("yyyy-MM-ddTHH:mm:ss");
            BaseSettings.SerializeToXML(BaseSettings.CurrentSettings);
            TargetManager.ShouldLoot = false;

            return(false);
        }
Ejemplo n.º 13
0
        public Mission(GarrisonMission mission, bool completed=false)
        {
            refGarrisonMission = mission;
            Id = mission.Id;
            Name = mission.Name;
            Followers = mission.MaxFollowers;
            if (completed) return;


            foreach (var reward in mission.RewardRecords)
            {
                if (reward.CurrencyQuantity > 0)
                {
                    if ((int) reward.CurrencyType == 0)
                        RewardTypes |= RewardTypes.Gold;
                    else if (reward.CurrencyType == WoWCurrencyType.GarrisonResources)
                        RewardTypes |= RewardTypes.Garrison;
                    else if (reward.CurrencyType == WoWCurrencyType.ApexisCrystal)
                        RewardTypes |= RewardTypes.ApexisCrystal;
                    else if (reward.CurrencyType == WoWCurrencyType.HonorPoints)
                        RewardTypes |= RewardTypes.HonorPoints;
                    else if (reward.CurrencyType == WoWCurrencyType.SealOfTemperedFate)
                        RewardTypes |= RewardTypes.SealOfTemperedFate;
                }
                
                if (reward.FollowerXP>0)
                    RewardTypes |= RewardTypes.XP;

                if (reward.ItemId <= 0) continue;

                if (ItemIdReward == 0)
                    ItemIdReward = reward.ItemId;
                else
                    ItemIdReward2 = reward.ItemId;

                if (DictItemRewards_CharacterTokens.ContainsKey(reward.ItemId))
                    RewardTypes |= RewardTypes.CharacterToken;
                else if (ItemRewards_FollowerTokens.Contains(reward.ItemId))
                    RewardTypes |= RewardTypes.FollowerToken;
                else if (ItemRewards_FollowerRetraining.Contains(reward.ItemId))
                    RewardTypes |= RewardTypes.RetrainingCertificate;
                else if (ItemRewards_Contracts.Contains(reward.ItemId))
                    RewardTypes |= RewardTypes.FollowerContract;
                else if (ItemRewards_FollowerTraits.Contains(reward.ItemId))
                    RewardTypes |= RewardTypes.FollowerTrait;
                else if (ItemRewards_RushOrders.Contains(reward.ItemId))
                    RewardTypes |= RewardTypes.RushOrder;
                else if (ItemReward_AbrogatorStone==reward.ItemId)
                    RewardTypes |= RewardTypes.AbrogatorStone;
                else if (ItemReward_ElementalRune == reward.ItemId)
                    RewardTypes |= RewardTypes.ElementalRune;
                else if (ItemReward_SavageBlood == reward.ItemId)
                    RewardTypes |= RewardTypes.SavageBlood;
                else if (ItemReward_PrimalSpirit == reward.ItemId)
                    RewardTypes |= RewardTypes.PrimalSpirit;
                else
                    RewardTypes |= RewardTypes.Items;
            }

            var newMission = LuaCommands.GetMissionInfo(Id);
            Cost = newMission.Cost;
            Description = newMission.Description;
            Duration = newMission.Duration;
            ItemLevel = newMission.ItemLevel;
            Rare = newMission.Rare;
            Level = newMission.Level;
            Location = newMission.Location;
            Rewards = newMission.Rewards;
            State = newMission.State;
            Type = newMission.Type;
            Xp = newMission.Xp;
            Material = newMission.Material;
        }
Ejemplo n.º 14
0
 public BehaviorGetMail() : base(MovementCache.GarrisonEntrance)
 {
     Criteria += () => BaseSettings.CurrentSettings.MailAutoGet && LuaCommands.HasNewMail();
 }
Ejemplo n.º 15
0
        private async Task <bool> Interaction()
        {
            TreeRoot.StatusText = String.Format("Behavior {0} Interaction", Type.ToString());

            if (Character.Player.Inventory.TotalFreeSlots == 0)
            {
                GarrisonBase.Err("Bags are full!");
                IsDone = true;
                return(false);
            }

            RefreshInboxMailItemsCollection();

            if (InboxMailItems.Count > 0)
            {
                if (!LuaEvents.MailOpen)
                {
                    return(true);
                }

                if (LuaUI.InboxPreviousPage.IsEnabled())
                {
                    //We need to reset back to first page!
                    while (LuaUI.InboxPreviousPage.IsEnabled())
                    {
                        LuaUI.InboxPreviousPage.Click();
                        await CommonCoroutines.SleepForRandomUiInteractionTime();
                    }
                }

                int highestInboxPageIndex = 1;
                foreach (var item in InboxMailItems)
                {
                    if (item.InboxPageIndex > highestInboxPageIndex)
                    {
                        highestInboxPageIndex = item.InboxPageIndex;
                    }
                }

                if (highestInboxPageIndex > 1)
                {
                    //We want to loot mail that is not on the first page..
                    if (!LuaUI.InboxPreviousPage.IsEnabled())
                    {
                        for (int i = 1; i < highestInboxPageIndex; i++)
                        {//Click next page until we are at the correct page.
                            LuaUI.InboxNextPage.Click();
                            await CommonCoroutines.SleepForRandomUiInteractionTime();
                        }
                    }
                }

                //Now get all items on the same page.. order by highest index first (last item)
                var itemsToGet =
                    InboxMailItems.Where <InboxMailItem>(i => i.InboxPageIndex == highestInboxPageIndex)
                    .OrderByDescending(i => i.Index)
                    .ToList();

                foreach (var inboxMailItem in itemsToGet)
                {
                    //Open the mail item..
                    LuaCommands.ClickMailItemButton(inboxMailItem.RealIndex);
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    if (LuaCommands.OpenMailFrameIsVisible())
                    {
                        //Click the attachments..
                        for (int i = 0; i < inboxMailItem.ItemCount; i++)
                        {
                            LuaCommands.ClickOpenMailAttachmentButton(i + 1);
                            await CommonCoroutines.SleepForRandomUiInteractionTime();
                        }

                        //Close the open mail frame (if visible..)
                        if (LuaCommands.OpenMailFrameIsVisible())
                        {
                            LuaUI.InboxClose.Click();
                            await CommonCoroutines.SleepForRandomUiInteractionTime();
                        }
                    }

                    //LuaCommands.AutoLootMailItem(inboxMailItem.Index);
                    //await CommonCoroutines.SleepForRandomUiInteractionTime();
                }

                return(true);
            }

            return(false);
        }
Ejemplo n.º 16
0
 private void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 17
0
        internal static Behavior[] GetGarrisonBehaviors()
        {
            var retBehaviorList = new List <Behavior>
            {
                new BehaviorGetMail(),
                new BehaviorMissionComplete(),
                new BehaviorCache()
            };

            //Finalize Plots
            foreach (var b in Buildings.Values.Where(b => b.CanActivate))
            {
                retBehaviorList.Add(new BehaviorFinalizePlots(b));
            }

            #region Building First Quest Behaviors
            foreach (var b in Buildings.Values.Where(b => !b.FirstQuestCompleted && !b.IsBuilding && b.FirstQuestNpcId > -1 && b.FirstQuestId > -1))
            {
                retBehaviorList.Add(QuestHelper.GetGarrisonBuildingFirstQuestArray(b, Player.IsAlliance));
            }

            #endregion

            #region Herbing and Mining

            if (Buildings.Values.Any(b => b.Type == BuildingType.Mines))
            {
                var miningMoveTo = new BehaviorMove(MovementCache.MinePlot59SafePoint);
                miningMoveTo.Criteria += () => !GarrisonMineZoneIds.Contains(Player.ZoneId.Value);

                var miningArray = new BehaviorArray(new Behavior[]
                {
                    new BehaviorCustomAction(() =>
                    {
                        TargetManager.LootType = TargetManager.LootFlags.Units | TargetManager.LootFlags.Ore;
                    }),

                    miningMoveTo,
                    new BehaviorMine()
                });
                miningArray.Criteria += () => (!Buildings[BuildingType.Mines].IsBuilding &&
                                               !Buildings[BuildingType.Mines].CanActivate &&
                                               Buildings[BuildingType.Mines].FirstQuestCompleted &&
                                               LuaCommands.CheckForDailyReset(BaseSettings.CurrentSettings.LastCheckedMine) &&
                                               BaseSettings.CurrentSettings.BehaviorMineGather);
                miningArray.DisposalAction = () =>
                {
                    TargetManager.LootType = TargetManager.LootFlags.None;
                };

                retBehaviorList.Add(miningArray);
                retBehaviorList.Add(new BehaviorWorkOrderPickUp(Buildings[BuildingType.Mines]));
                retBehaviorList.Add(new BehaviorWorkOrderStartUp(Buildings[BuildingType.Mines]));
            }

            if (Buildings.Values.Any(b => b.Type == BuildingType.HerbGarden))
            {
                var herbingArray = new BehaviorArray(new Behavior[]
                {
                    new BehaviorCustomAction(() =>
                    {
                        TargetManager.LootType = TargetManager.LootFlags.Units | TargetManager.LootFlags.Herbs;
                    }),

                    new BehaviorMove(MovementCache.GardenPlot63SafePoint),
                    new BehaviorHerb()
                });
                herbingArray.Criteria += () => (!Buildings[BuildingType.HerbGarden].IsBuilding &&
                                                !Buildings[BuildingType.HerbGarden].CanActivate &&
                                                Buildings[BuildingType.HerbGarden].FirstQuestCompleted &&
                                                LuaCommands.CheckForDailyReset(BaseSettings.CurrentSettings.LastCheckedHerb) &&
                                                BaseSettings.CurrentSettings.BehaviorHerbGather);
                herbingArray.DisposalAction = () =>
                {
                    TargetManager.LootType = TargetManager.LootFlags.None;
                };

                retBehaviorList.Add(herbingArray);
                retBehaviorList.Add(new BehaviorWorkOrderPickUp(Buildings[BuildingType.HerbGarden]));
                retBehaviorList.Add(new BehaviorWorkOrderStartUp(Buildings[BuildingType.HerbGarden]));
            }

            #endregion

            #region Professions
            foreach (var profession in Player.Professions.ProfessionSkills.Values.Where(p => p.DailyCooldownSpellIds != null))
            {
                if (profession.Skill == SkillLine.Inscription)
                {
                    retBehaviorList.Add(new BehaviorMilling());
                }

                int[] spellIds = profession.DailyCooldownSpellIds;
                retBehaviorList.Add(new BehaviorCraftingProfession(profession.Skill, spellIds[1]));
                retBehaviorList.Add(new BehaviorCraftingProfession(profession.Skill, spellIds[0]));
            }
            #endregion

            #region Salvaging
            if (Buildings.Values.Any(b => b.Type == BuildingType.SalvageYard))
            {
                retBehaviorList.Add(new BehaviorSalvage());
            }
            #endregion

            #region Work Order Pickup && Startup
            foreach (var b in Buildings.Values.Where(b => b.FirstQuestId <= 0 || b.FirstQuestCompleted).OrderBy(b => b.Plot))
            {
                if (b.Type != BuildingType.Mines || b.Type != BuildingType.HerbGarden)
                {
                    if (b.WorkOrder != null)
                    {
                        retBehaviorList.Add(new BehaviorWorkOrderPickUp(b));

                        if (b.Type == BuildingType.EnchantersStudy)
                        {
                            retBehaviorList.Add(new BehaviorDisenchant()); //Disenchanting!
                        }
                        else if (b.Type == BuildingType.ScribesQuarters)
                        {
                            retBehaviorList.Add(new BehaviorMilling()); //Milling!
                        }
                        else if (b.Type == BuildingType.Barn)
                        {
                            if (Player.Inventory.Trap != null)
                            {
                                GarrisonBase.Log("Adding Trapping Behavior");

                                if (Player.Inventory.Trap.TrapRank > 1)
                                {
                                    retBehaviorList.Add(BehaviorManager.BehaviorArray_Trapping_Elites_Nagrand.Clone());
                                }

                                if (Player.IsAlliance)
                                {
                                    retBehaviorList.Add(BehaviorManager.BehaviorArray_Trapping_Leather_ShadowmoonVally.Clone());
                                    retBehaviorList.Add(BehaviorManager.BehaviorArray_Trapping_Fur_ShadowmoonValley.Clone());
                                }
                                else
                                {
                                    retBehaviorList.Add(BehaviorManager.BehaviorArray_Trapping_Leather_FrostfireRidge.Clone());
                                    retBehaviorList.Add(BehaviorManager.BehaviorArray_Trapping_Fur_Nagrand_Horde.Clone());
                                }

                                retBehaviorList.Add(BehaviorManager.BehaviorArray_Trapping_Boars_Gorgond.Clone());
                            }
                        }

                        retBehaviorList.Add(new BehaviorWorkOrderStartUp(b));

                        if (b.Type == BuildingType.WarMillDwarvenBunker && b.Level == 3)
                        {
                            var questid = Player.IsAlliance ? 38175 : 38188;
                            retBehaviorList.Add(QuestHelper.GetDailyQuestArray(Convert.ToUInt32(questid), Player.IsAlliance));
                        }
                        else if (b.Type == BuildingType.AlchemyLab && b.HasFollowerWorking)
                        {
                            retBehaviorList.Add(QuestHelper.GetDailyQuestArray(Convert.ToUInt32(37270), Player.IsAlliance));
                        }
                    }
                }
            }
            #endregion

            //Primal Spirit Exchange
            retBehaviorList.Add(new BehaviorPrimalTrader());

            var forceBagCheck = new BehaviorCustomAction(() =>
            {
                Common.ForceBagCheck = true;
            });
            retBehaviorList.Add(forceBagCheck);

            //Finally, start some new missions!
            retBehaviorList.Add(new BehaviorMissionStartup());

            //Optional follower behaviors (to unlock)
            retBehaviorList.Add(BehaviorArrayFollowers.Clone());

            return(retBehaviorList.ToArray());
        }
Ejemplo n.º 18
0
        private static async Task <bool> DisenchantForgeInteraction(C_WoWGameObject disenchantobject, List <C_WoWItem> items)
        {
            if (disenchantobject.GetCursor != WoWCursorType.InteractCursor)
            {
                GarrisonBase.Debug("Disenchant Interaction failed -- Cursor was not InteractCursor!");
                return(false);
            }

            if (Player.CurrentPendingCursorSpellId == 160201)
            {
                //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);
            }

            bool cursorChanged = await CommonCoroutines.WaitForLuaEvent(
                "CURRENT_SPELL_CAST_CHANGED",
                StyxWoW.Random.Next(555, 2002),
                null,
                disenchantobject.Interact);


            await CommonCoroutines.SleepForRandomUiInteractionTime();

            await Coroutine.Yield();

            await Coroutine.Sleep(StyxWoW.Random.Next(1222, 2222));

            if (!cursorChanged)
            {
                if (LuaCommands.IsStaticPopupVisible())
                {
                    LuaCommands.ClickStaticPopupButton(1);
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }
            }


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

            //Requires Anvil
            if (Skill == SkillLine.Blacksmithing || Skill == SkillLine.Engineering)
            {
                if (_movement != null && await _movement.MoveTo(false))
                {
                    return(true);
                }
            }

            Frame f = new Frame("TradeSkillFrame");

            //PreCheck (close any tradeskill frames!)
            if (!_prechecks)
            {
                if (f.IsVisible)
                {
                    LuaCommands.CloseTradeSkillFrame();
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    await Coroutine.Sleep(StyxWoW.Random.Next(750, 2222));
                }
                _prechecks = true;
                await CommonCoroutines.SleepForRandomUiInteractionTime();
            }

            //Open Crafting Spellbook
            if (!LuaEvents.TradeSkillFrameOpen)
            {
                WoWSpell.FromId(SkillBookId).Cast();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await Coroutine.Sleep(StyxWoW.Random.Next(1777, 3333));

                return(true);
            }

            //Craft Item
            if (!Spell.Cooldown && Spell.CanCast)
            {
                await CommonCoroutines.WaitForLuaEvent(
                    "BAG_UPDATE",
                    10000,
                    () => false,
                    Spell.Cast);

                return(true);
            }

            //Close UI
            if (f.IsVisible)
            {
                LuaCommands.CloseTradeSkillFrame();
                await CommonCoroutines.SleepForRandomUiInteractionTime();
            }

            return(false);
        }
Ejemplo n.º 20
0
        private static async Task <bool> SendMail(string recipient, List <C_WoWItem> items)
        {
            int count = 0;

            foreach (var cWoWItem in items)
            {
                if (!MailHelper.IsOpen)
                {
                    GarrisonBase.Debug("Send Mail Failed due to mailbox not open!");
                    return(false);
                }

                if (count > 11)
                {
                    break;
                }

                if (BaseSettings.CurrentSettings.MailSendItems.Any(i => i.EntryId == cWoWItem.Entry && i.OnCount > 0))
                {
                    var mailItemInfo = BaseSettings.CurrentSettings.MailSendItems.FirstOrDefault(i => i.EntryId == cWoWItem.Entry);

                    if (mailItemInfo != null)
                    {
                        int excessCount = (int)cWoWItem.StackCount - mailItemInfo.OnCount;

                        if (excessCount > 0)
                        {
                            GarrisonBase.Log("Send Mail Spliting Item {0} to send count {1}", cWoWItem.Name, excessCount);
                            int  freeBagIndex, freeBagSlot;
                            bool foundFreeSpot = Character.Player.Inventory.FindFreeBagSlot(out freeBagIndex, out freeBagSlot);

                            if (foundFreeSpot)
                            {
                                GarrisonBase.Log("Send Mail Split Item Moving to Bag Index {0} Slot {1}", freeBagIndex, freeBagSlot);

                                bool success = await SplitItem(cWoWItem, excessCount, freeBagIndex, freeBagSlot);

                                if (success)
                                {
                                    GarrisonBase.Log("Attaching item {0} to mail", cWoWItem.Name);
                                    LuaCommands.UseContainerItem(freeBagIndex, freeBagSlot + 1);
                                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                                    await Coroutine.Sleep(StyxWoW.Random.Next(1250, 2223));

                                    count++;
                                }

                                LuaCommands.ClearCursor();
                                continue;
                            }
                        }
                    }
                }

                GarrisonBase.Log("Attaching item {0} to mail", cWoWItem.Name);
                LuaCommands.UseContainerItem(cWoWItem.BagIndex + 1, cWoWItem.BagSlot + 1);
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await Coroutine.Sleep(StyxWoW.Random.Next(1250, 2223));

                count++;
            }

            if (!_mailingSetRecipient)
            {
                if (!MailHelper.IsOpen)
                {
                    GarrisonBase.Debug("Send Mail Failed due to mailbox not open!");
                    return(false);
                }
                LuaCommands.SetSendMailRecipient(recipient);
                _mailingSetRecipient = true;
                await CommonCoroutines.SleepForRandomUiInteractionTime();
            }

            if (!MailHelper.IsOpen)
            {
                GarrisonBase.Debug("Send Mail Failed due to mailbox not open!");
                _mailingSetRecipient = false;
                return(false);
            }
            LuaCommands.ClickSendMailButton();
            await CommonCoroutines.SleepForRandomUiInteractionTime();

            await Coroutine.Sleep(StyxWoW.Random.Next(1250, 2223));

            _mailingSetRecipient = false;
            return(true);
        }
Ejemplo n.º 21
0
 public void MarkAsCompleted()
 {
     LuaCommands.MissionCompleteMarkComplete(Id);
     MarkedAsCompleted = true;
 }
Ejemplo n.º 22
0
        internal static BehaviorArray GetDailyQuestArray(uint questid, bool alliance)
        {
            switch (questid)
            {
            case 38175:
            case 38188:
            {
                var questNpcId    = alliance ? 77377 : 79815;
                var warmillBunker = GarrisonManager.Buildings[BuildingType.WarMillDwarvenBunker];
                var questPickup   = new BehaviorQuestPickup(questid, warmillBunker.SpecialMovementPoints[1], questNpcId);
                var questTurnin   = new BehaviorQuestTurnin(questid, warmillBunker.SpecialMovementPoints[1], questNpcId, BaseSettings.CurrentSettings.DailyWarMillQuestSettings.RewardIndex);
                var barray        = new BehaviorArray(new Behavior[]
                    {
                        questPickup,
                        questTurnin,
                    });
                barray.Criteria += () => BaseSettings.CurrentSettings.BehaviorQuests &&
                                   BaseSettings.CurrentSettings.DailyWarMillQuestSettings.Enabled &&
                                   BaseSettings.CurrentSettings.DailyWarMillQuestSettings.RewardIndex > -1 &&
                                   !LuaCommands.IsQuestFlaggedCompleted(questid.ToString());

                barray.Criteria += () =>
                {
                    var items = Player.Inventory.GetBagItemsById(113681).Where(i => i.StackCount > 24).ToList();
                    return(items.Count > 0);
                };

                return(barray);
            }

            case 37270:
            {
                var alchemyLab = GarrisonManager.Buildings[BuildingType.AlchemyLab];

                var questPickup = new BehaviorQuestPickup(
                    questid,
                    alchemyLab.EntranceMovementPoint,
                    0,
                    true,
                    BaseSettings.CurrentSettings.DailyAlchemyLabQuestSettings.RewardIndex);

                //Use special method of getting the interaction object since it varies on which follower is assigned!
                questPickup.GetInteractionObject = i =>
                {
                    var validObjects =
                        ObjectCacheManager.GetUnitsNearPoint(alchemyLab.EntranceMovementPoint, 30f, false)
                        .Where(u => u.QuestGiverStatus == QuestGiverStatus.AvailableRepeatable && !ObjectCacheManager.QuestNpcIds.Contains(u.Entry))
                        .ToList();

                    return(validObjects.Count > 0 ? validObjects[0] : null);
                };

                var barray = new BehaviorArray(new Behavior[]
                    {
                        questPickup,
                    });
                barray.Criteria += () => BaseSettings.CurrentSettings.BehaviorQuests &&
                                   BaseSettings.CurrentSettings.DailyAlchemyLabQuestSettings.Enabled &&
                                   BaseSettings.CurrentSettings.DailyAlchemyLabQuestSettings.RewardIndex > -1 &&
                                   !LuaCommands.IsQuestFlaggedCompleted(questid.ToString());

                return(barray);
            }
            }

            return(null);
        }
        private async Task <bool> Interaction()
        {
            GarrisonManager.RefreshMissions();
            //GarrisonManager.CompletedMissionIds = LuaCommands.GetCompletedMissionIds();
            if (GarrisonManager.CompletedMissions.Count == 0)
            {
                LuaUI.MissionFrame.Close.Click();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                return(false);
            }

            if (!_commandtableCompletemissionsWaittimer.IsFinished)
            {
                await Coroutine.Sleep(_Waitmilliseconds);
            }


            //Check if the first dialog is visible..
            if (GarrisonMissionFrame.Instance.CompleteDialogIsVisible())
            {
                LuaUI.MissionFrame.MissionCompleteViewButton.Click();
                //LuaCommands.ClickButton(LuaCommands.ButtonNames.GarrisonMissionFrameMissions_CompleteDialog_BorderFrame_ViewButton);
                _commandtableCompletemissionsWaittimer.Reset();
                return(true);
            }

            //Check if mission complete dialogs are even visible..
            //if (!LuaUI.MissionFrame.IsMissionCompleteBackgroundVisible)
            //{
            //    LuaUI.MissionFrame.Close.Click();
            //    //LuaCommands.ClickButton(LuaCommands.ButtonNames.GarrisonMissionFrame_CloseButton);
            //    await CommonCoroutines.SleepForRandomUiInteractionTime();
            //    return true;
            //}

            var curMission = GarrisonManager.CompletedMissions[0];

            if (curMission.refGarrisonMission.State == MissionState.InProgress)
            {
                LuaCommands.MissionCompleteMarkComplete(curMission.Id);
                await Coroutine.Sleep(1000);
            }

            if (curMission.refGarrisonMission.State == MissionState.Complete)
            {
                LuaCommands.MissionCompleteRollChest(curMission.Id);
                await Coroutine.Sleep(1000);
            }

            GarrisonManager.CompletedMissions.RemoveAt(0);
            await Coroutine.Sleep(1000);

            return(true);

            //Find the current completed mission!
            // if (_currentMission == null)
            // {

            //     //Click next..
            //     //if (LuaCommands.IsButtonEnabled(LuaCommands.ButtonNames.GarrisonMissionFrame_MissionComplete_NextMissionButton))
            //     if(LuaUI.MissionFrame.MissionNextButton.IsEnabled())
            //     {
            //         LuaUI.MissionFrame.MissionNextButton.Click();
            //         //LuaCommands.ClickButton(LuaCommands.ButtonNames.GarrisonMissionFrame_MissionComplete_NextMissionButton);
            //         _commandtableCompletemissionsWaittimer.Reset();
            //         return true;
            //     }

            //     foreach (var id in GarrisonManager.CompletedMissions)
            //     {
            //         //Mission newmission = LuaCommands.GetMission(id);

            //         if (id.Valid && id.refGarrisonMission.State== MissionState.Complete) //State of zero means its the current one.
            //         {
            //             _currentMission = id;
            //             break;
            //         }
            //     }

            //     if (_currentMission != null)
            //     {
            //         if (!_currentMission.CanOpenMissionChest())
            //             _currentMission.BonusRolled = true;

            //         //Add sleep here since a mission can vary before we can click the treasure.
            //         if (_currentMission.Followers == 2)
            //             await Coroutine.Sleep(10000);
            //         else if (_currentMission.Followers == 3)
            //             await Coroutine.Sleep(15000);
            //         else
            //             await Coroutine.Sleep(5000);

            //         _commandtableCompletemissionsWaittimer.Reset();
            //         Logging.Write("{0}", _currentMission.ToString());
            //         return true;
            //     }
            // }

            // _commandtableCompletemissionsWaittimer = WaitTimer.OneSecond;
            // _Waitmilliseconds = 1000;

            // if (_currentMission == null || !_currentMission.Valid)
            // {
            //     //Click next..
            //     //if (LuaCommands.IsButtonEnabled(LuaCommands.ButtonNames.GarrisonMissionFrame_MissionComplete_NextMissionButton))
            //     if (LuaUI.MissionFrame.MissionNextButton.IsEnabled())
            //     {
            //         LuaUI.MissionFrame.MissionNextButton.Click();
            //         //LuaCommands.ClickButton(LuaCommands.ButtonNames.GarrisonMissionFrame_MissionComplete_NextMissionButton);
            //     }
            //     return true;
            // }


            // if (!_currentMission.MarkedAsCompleted)
            // {
            //     await CommonCoroutines.SleepForRandomUiInteractionTime();
            //     GarrisonBase.Debug("Current Mission Marking as completed");
            //     _currentMission.MarkAsCompleted();
            // }
            // if (!_currentMission.BonusRolled)
            // {
            //     await CommonCoroutines.SleepForRandomUiInteractionTime();
            //     GarrisonBase.Debug("Current Mission Bonus Rolled");
            //     _currentMission.BonusRoll();
            // }

            // await Coroutine.Yield();

            //// if (LuaCommands.IsButtonEnabled(LuaCommands.ButtonNames.GarrisonMissionFrame_MissionComplete_NextMissionButton))
            // if (LuaUI.MissionFrame.MissionNextButton.IsEnabled())
            // {

            //     LuaUI.MissionFrame.MissionNextButton.Click();
            //     //LuaCommands.ClickButton(LuaCommands.ButtonNames.GarrisonMissionFrame_MissionComplete_NextMissionButton);
            //     await CommonCoroutines.SleepForRandomUiInteractionTime();
            //     _commandtableCompletemissionsWaittimer.Reset();
            //     GarrisonManager.CompletedMissionIds.Remove(_currentMission.Id);
            //     GarrisonManager.CompletedMissions.Remove(_currentMission);
            //     _currentMission = null;
            //     return true;
            // }


            //return true;
        }
Ejemplo n.º 24
0
        public Building(int id)
        {
            Id    = id;
            Type  = GetBuildingTypeUsingId(Id);
            Level = GetBuildingUpgradeLevel(Id);
            Plot  = GetBuildingPlotSize(Type);
            HasFollowerWorking = GarrisonManager.BuildingIdsWithFollowerWorking.Contains(Id);

            WorkOrderType = WorkOrder.GetWorkorderType(Type);

            if (WorkOrderType != WorkOrderType.None)
            {
                WorkOrderObjectEntryId = WorkOrder.WorkOrderPickupEntryIds[WorkOrderType];
                WorkOrderObjectName    = WorkOrder.WorkOrderPickupNames[WorkOrderType];
                if (WorkOrderType == WorkOrderType.WarMillDwarvenBunker && Player.IsAlliance)
                {
                    WorkOrderObjectName = WorkOrder.WorkOrderPickupNames[WorkOrderType.DwarvenBunker];
                }
            }
            else
            {
                WorkOrderObjectEntryId = -1;
                WorkOrderObjectName    = String.Empty;
            }

            WorkOrderNpcEntryId = WorkOrder.GetWorkOrderNpcEntryId(Type, Player.IsAlliance);


            if (GarrisonManager.BuildingIDs.Contains(Id))
            {
                string plotid;
                bool   canActivate, isBuilding;
                int    shipTotal, shipCap, shipReady;

                LuaCommands.GetBuildingInfo(id, out plotid, out canActivate, out shipCap, out shipReady, out shipTotal, out isBuilding);
                if (WorkOrderType != WorkOrderType.None)
                {
                    _workorder = new WorkOrder(Id, Type, WorkOrderType, shipCap,
                                               WorkOrder.GetWorkOrderItemAndQuanityRequired(WorkOrderType), shipReady, shipTotal);
                }

                PlotId      = plotid.ToInt32();
                CanActivate = canActivate;
                IsBuilding  = isBuilding;

                SafeMovementPoint     = MovementCache.GetBuildingSafeMovementPoint(PlotId);
                EntranceMovementPoint = MovementCache.GetBuildingEntranceMovementPoint(PlotId);
            }
            else if (Type == BuildingType.HerbGarden || Type == BuildingType.Mines)
            {//if not completed first quest than we must insert temp info.
                PlotId                = Type == BuildingType.HerbGarden ? 63 : 59;
                SafeMovementPoint     = MovementCache.GetBuildingSafeMovementPoint(PlotId);
                EntranceMovementPoint = MovementCache.GetBuildingEntranceMovementPoint(PlotId);
                _workorder            = new WorkOrder(Id, Type, WorkOrderType, 0,
                                                      WorkOrder.GetWorkOrderItemAndQuanityRequired(WorkOrderType));
            }

            SpecialMovementPoints = MovementCache.GetSpecialMovementPoints(Type, PlotId, Level, Player.IsAlliance);

            int firstquestID = GetBuildingFirstQuestId(Type, Player.IsAlliance);

            if (firstquestID > 0)
            {
                FirstQuestId        = Convert.ToUInt32(firstquestID);
                FirstQuestCompleted = LuaCommands.IsQuestFlaggedCompleted(FirstQuestId.ToString());

                if (Type == BuildingType.TradingPost)
                {
                    FirstQuestNpcId = WorkOrderNpcEntryId;
                }
                else
                {
                    FirstQuestNpcId = GetBuildingFirstQuestNpcId(Type, Player.IsAlliance);
                }
            }
            else
            {
                FirstQuestId        = 0;
                FirstQuestNpcId     = 0;
                FirstQuestCompleted = true;
            }
        }
Ejemplo n.º 25
0
 public int GetBonusChance()
 {
     return LuaCommands.GetMissionBonusChance(Id);
 }
Ejemplo n.º 26
0
 public void BonusRoll()
 {
     LuaCommands.MissionCompleteRollChest(Id);
     BonusRolled = true;
 }
Ejemplo n.º 27
0
        private async Task <bool> Interaction()
        {
            /*
             * Check Cursor Spell ID
             * Click Interaction
             * Await for event CURRENT_SPELL_CAST_CHANGED
             *      -If event did not fire then check for confirmation popup
             *
             * Item Interaction
             *
             *
             */

            if (Player.CurrentPendingCursorSpellId == 160201)
            {
                //Item Interaction!
                GarrisonBase.Log("Disenchant Cursor!");

                if (Player.Inventory.DisenchantItems.Count > 0)
                {
                    var item = Player.Inventory.DisenchantItems[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);
            }

            bool cursorChanged = await CommonCoroutines.WaitForLuaEvent(
                "CURRENT_SPELL_CAST_CHANGED",
                StyxWoW.Random.Next(555, 2002),
                null,
                DisenchantingObject.Interact);


            await CommonCoroutines.SleepForRandomUiInteractionTime();

            await Coroutine.Yield();

            await Coroutine.Sleep(StyxWoW.Random.Next(1222, 2222));

            if (!cursorChanged)
            {
                if (LuaCommands.IsStaticPopupVisible())
                {
                    LuaCommands.ClickStaticPopupButton(1);
                    await CommonCoroutines.SleepForRandomUiInteractionTime();

                    return(true);
                }
                GarrisonBase.Err("Could not find static popup confirmation frame!");
            }


            return(true);
        }
        private async Task <bool> Interaction()
        {
            if (!_commandtableCompletemissionsWaittimer.IsFinished)
            {
                return(true);
            }
            _commandtableCompletemissionsWaittimer.Reset();

            if (GarrisonManager.AvailableMissionIds.Count == 0)
            {
                await Coroutine.Yield();

                return(false);
            }

            if (LuaUI.MissionFrame.IsMissionCompleteDialogVisible)
            {
                //Complete Dialog is visible..
                //We need to add complete missions to coroutines
                //Add it again..
                //Finish this behavior
                GarrisonBase.Log("Garrison Mission Complete Is Visible!");
                BehaviorManager.Behaviors.Insert(1, new BehaviorMissionComplete());
                BehaviorManager.Behaviors.Insert(2, new BehaviorMissionStartup());
                LuaUI.MissionFrame.Close.Click();
                await CommonCoroutines.SleepForRandomUiInteractionTime();

                await Coroutine.Yield();

                return(false);
            }

            //Find our next mission.. if any.
            double _successChance = 0;

            if (_currentMission == null)
            {
                int[] followerIds;
                var   removalList = new List <int>();
                for (int i = 0; i < GarrisonManager.AvailableMissions.Count; i++)
                {
                    var mission = GarrisonManager.AvailableMissions[i];

                    if (mission.Level >= mission.MinimumLevel &&
                        mission.Priority > 0 &&
                        mission.Cost <= Character.Player.AvailableGarrisonResource)
                    {
                        _successChance = LuaCommands.GetMissionBestSuccessAttempt(mission.Id, out followerIds);
                        if (_successChance < mission.SuccessRate)
                        {
                            removalList.Add(i);
                            continue;
                        }
                        _currentMission = mission;
                        break;
                    }

                    removalList.Add(i);
                }

                if (removalList.Count > 0)
                {
                    foreach (var mission in removalList.OrderByDescending(k => k).Select(k => GarrisonManager.AvailableMissions[k]))
                    {
                        GarrisonManager.AvailableMissionIds.Remove(mission.Id);
                        GarrisonManager.AvailableMissions.Remove(mission);
                    }
                }
            }

            if (_currentMission != null)
            {
                GarrisonBase.Log("Starting Mission {0} Rewards {1} Priority {2} Success {3}",
                                 _currentMission.Name, _currentMission.RewardTypes, _currentMission.Priority, _successChance);



                //GARRISON_FOLLOWER_LIST_UPDATE
                await
                CommonCoroutines.WaitForLuaEvent("GARRISON_FOLLOWER_LIST_UPDATE", 7500, null, Action);

                await Coroutine.Sleep(2218);

                await
                CommonCoroutines.WaitForLuaEvent("GARRISON_MISSION_STARTED",
                                                 7500,
                                                 null,
                                                 LuaUI.MissionFrame.StartMissionButton.Click);

                await Coroutine.Sleep(2500);

                //LuaCommands.CloseMission();
                //await Coroutine.Sleep(1500);
                GarrisonManager.AvailableMissionIds.Remove(_currentMission.Id);
                GarrisonManager.AvailableMissions.Remove(_currentMission);
                _currentMission = null;
                await Coroutine.Yield();

                return(true);
            }

            _currentMission = null;
            GarrisonManager.AvailableMissions.Clear();
            GarrisonManager.AvailableMissionIds.Clear();
            return(false);
        }