Пример #1
0
        private async Task LLUseObjectTask(uint NpcId)
        {
            var gameobj = GameObjectManager.GetObjectByNPCId(NpcId);

            if (gameobj == default(GameObject))
            {
                _isDone = true; return;
            }

            await Navigation.FlightorMove(gameobj.Location);

            if (gameobj.IsWithinInteractRange)
            {
                gameobj.Interact();

                await Coroutine.Wait(20000, () => !gameobj.IsVisible || SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    await Coroutine.Wait(20000, () => !SelectYesno.IsOpen);
                }
            }
            _isDone = true;
        }
Пример #2
0
        private async Task BuyItem(int itemId, int npcId, int selectString)
        {
            var unit = GameObjectManager.GetObjectsByNPCId <Character>((uint)npcId).OrderBy(r => r.Distance()).FirstOrDefault();

            if (unit == null)
            {
                _isDone = true;
                return;
            }

            if (!FreeShop.Instance.IsOpen && unit.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(unit.Location);

                await Coroutine.Sleep(500);
            }

            unit.Interact();

            await Coroutine.Wait(5000, () => Conversation.IsOpen);

            if (Conversation.IsOpen)
            {
                Conversation.SelectLine((uint)selectString);

                await Coroutine.Wait(5000, () => DialogOpen || FreeShop.Instance.IsOpen);

                if (DialogOpen)
                {
                    Next();
                }

                await Coroutine.Wait(5000, () => FreeShop.Instance.IsOpen);

                if (FreeShop.Instance.IsOpen)
                {
                    //Log("Opened");
                    await FreeShop.Instance.BuyItem((uint)itemId);
                }

                await Coroutine.Wait(2000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    await Coroutine.Wait(2000, () => !SelectYesno.IsOpen);

                    await Coroutine.Sleep(500);
                }



                if (FreeShop.Instance.IsOpen)
                {
                    FreeShop.Instance.Close();
                }
            }

            _isDone = true;
        }
Пример #3
0
        internal static async Task <bool> DeSelectRetainer()
        {
            if (!RetainerTasks.IsOpen)
            {
                return(true);
            }
            RetainerTasks.CloseTasks();

            await Coroutine.Wait(1500, () => DialogOpen || SelectYesno.IsOpen);

            if (SelectYesno.IsOpen)
            {
                SelectYesno.Yes();
                await Coroutine.Wait(1500, () => DialogOpen || RetainerList.Instance.IsOpen);
            }

            await Coroutine.Sleep(200);

            if (DialogOpen)
            {
                Next();
            }
            //await Coroutine.Sleep(200);
            return(await Coroutine.Wait(3000, () => RetainerList.Instance.IsOpen));
        }
Пример #4
0
        public async Task PassLoot()
        {
            //if (!NeedGreed.Instance.IsOpen)
            var window = RaptureAtkUnitManager.GetWindowByName("_Notification");

            if (!NeedGreed.Instance.IsOpen && window != null)
            {
                window.SendAction(3, 3, 0, 3, 2, 6, 0x375B30E7);
                await Coroutine.Wait(5000, () => NeedGreed.Instance.IsOpen);
            }

            if (NeedGreed.Instance.IsOpen)
            {
                for (int i = 0; i < NeedGreed.Instance.NumberOfItems; i++)
                {
                    NeedGreed.Instance.PassItem(i);
                    await Coroutine.Sleep(500);

                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                    }
                }
            }

            if (NeedGreed.Instance.IsOpen)
            {
                NeedGreed.Instance.Close();
            }
        }
Пример #5
0
        public static async Task <bool> DeSelectRetainer()
        {
            if (!RetainerTasks.IsOpen)
            {
                return(true);
            }
            RetainerTasks.CloseTasks();

            await Coroutine.Wait(3000, () => DialogOpen || SelectYesno.IsOpen);

            if (SelectYesno.IsOpen)
            {
                SelectYesno.Yes();
                await Coroutine.Wait(3000, () => DialogOpen || RetainerList.Instance.IsOpen);
            }

            while (!RetainerList.Instance.IsOpen)
            {
                if (DialogOpen)
                {
                    Next();
                    await Coroutine.Sleep(100);
                }
                await Coroutine.Wait(3000, () => DialogOpen || RetainerList.Instance.IsOpen);
            }

            return(RetainerList.Instance.IsOpen);
        }
Пример #6
0
        public static async Task Plant(BagSlot seeds, BagSlot soil)
        {
            var result = Core.Memory.CallInjected64 <IntPtr>(Offsets.PlantFunction, new object[3]
            {
                AgentHousingPlant.Instance.Pointer,
                (uint)soil.BagId,
                (ushort)soil.Slot
            });

            result = Core.Memory.CallInjected64 <IntPtr>(Offsets.PlantFunction, new object[3]
            {
                AgentHousingPlant.Instance.Pointer,
                (uint)seeds.BagId,
                (ushort)seeds.Slot
            });

            await Coroutine.Wait(5000, () => SeedStruct.ItemId == seeds.RawItemId && SoilStruct.ItemId == soil.RawItemId);

            HousingGardening.Confirm();
            await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

            if (SelectYesno.IsOpen)
            {
                SelectYesno.Yes();
            }
            await Coroutine.Wait(5000, () => !SelectYesno.IsOpen);
        }
Пример #7
0
        private async Task <bool> HandleCollectable()
        {
            uint   required = CollectabilityValue;
            string itemName = string.Empty;

            if (!string.IsNullOrWhiteSpace(Collectables.First().Name))
            {
                Item item = SelectYesno.Item;
                if (item == null ||
                    !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase)))
                {
                    int ticks = 0;
                    while ((item == null
                            ||
                            !Collectables.Any(c => string.Equals(c.Name, item.EnglishName, StringComparison.InvariantCultureIgnoreCase))) &&
                           ticks++ < 60 && Behaviors.ShouldContinue)
                    {
                        item = SelectYesno.Item;
                        await Coroutine.Yield();
                    }

                    if (ticks > 60)
                    {
                        required = (uint)Collectables.Select(c => c.Value).Max();
                    }
                }

                if (item != null)
                {
                    itemName = item.EnglishName;
                    Collectable collectable = Collectables.FirstOrDefault(c => string.Equals(c.Name, item.EnglishName));

                    if (collectable != null)
                    {
                        required = (uint)collectable.Value;
                    }
                }
            }

            uint value = SelectYesno.CollectabilityValue;

            if (value >= required)
            {
                Logger.Info(Localization.ExFish_Collecting, itemName, value, required);
                SelectYesno.Yes();
            }
            else
            {
                Logger.Info(Localization.ExFish_Declining, itemName, value, required);
                SelectYesno.No();
            }

            await Coroutine.Wait(3000, () => !SelectYesno.IsOpen);

            return(true);
        }
Пример #8
0
        public static async Task <bool> UpdateGearSet()
        {
            if (!Character.Instance.IsOpen)
            {
                AgentCharacter.Instance.Toggle();
                await Coroutine.Wait(10000, () => Character.Instance.IsOpen);

                if (!Character.Instance.IsOpen)
                {
                    Log("Character window didn't open.");
                    return(false);
                }
            }

            if (!Character.Instance.IsOpen)
            {
                return(false);
            }

            if (!await Coroutine.Wait(1200, () => Character.Instance.CanUpdateGearSet()))
            {
                Character.Instance.Close();
                return(false);
            }

            Character.Instance.UpdateGearSet();

            if (await Coroutine.Wait(1500, () => SelectYesno.IsOpen))
            {
                SelectYesno.Yes();
            }
            else
            {
                if (Character.Instance.IsOpen)
                {
                    Character.Instance.Close();
                }

                return(true);
            }

            await Coroutine.Wait(10000, () => !SelectYesno.IsOpen);

            if (SelectYesno.IsOpen)
            {
                return(true);
            }

            if (Character.Instance.IsOpen)
            {
                Character.Instance.Close();
            }

            return(true);
        }
Пример #9
0
        //private bool ExecuteAutoAcceptTeleport()
        //{
        //	if (SelectYesno.IsOpen &&
        //		(RaptureAtkUnitManager.GetWindowByName("SelectYesno").FindLabel(2).Text.Contains("传送邀请") ||
        //		 RaptureAtkUnitManager.GetWindowByName("SelectYesno").FindLabel(2).Text.StartsWith("确定要花费") && RaptureAtkUnitManager.GetWindowByName("SelectYesno").FindLabel(2).Text.Contains("传送到")))
        //	{
        //		SelectYesno.Yes();
        //		return true;
        //	}

        //	return false;
        //}

        private bool ExecuteAutoSelectYes()
        {
            if (SelectYesno.IsOpen)
            {
                SelectYesno.Yes();
                LogHelper.Instance.Log("Selecting Yes");
                return(true);
            }

            return(false);
        }
Пример #10
0
        public override async Task <bool> Gather(ExGatherTag tag)
        {
            tag.StatusText = "Gathering collectable items";

            var rarity = CurrentRarity;

            while (tag.Node.CanGather && GatheringManager.SwingsRemaining > tag.SwingsRemaining && rarity > 0 &&
                   Behaviors.ShouldContinue)
            {
                while (!SelectYesno.IsOpen && tag.Node.CanGather && GatheringManager.SwingsRemaining > tag.SwingsRemaining &&
                       rarity > 0 && Behaviors.ShouldContinue)
                {
                    if (!GatheringMasterpiece.IsOpen)
                    {
                        await Coroutine.Wait(3000, () => GatheringMasterpiece.IsOpen);
                    }

                    if (GatheringMasterpiece.IsOpen)
                    {
                        GatheringMasterpiece.Collect();
                    }

                    await Coroutine.Sleep(500);
                }

                await Coroutine.Yield();

                var swingsRemaining = GatheringManager.SwingsRemaining - 1;

                while (SelectYesno.IsOpen && rarity > 0 && Behaviors.ShouldContinue)
                {
                    tag.Logger.Info(
                        "Collected item: {0}, value: {1} at {2} ET",
                        tag.GatherItem.ItemData.EnglishName,
                        SelectYesno.CollectabilityValue,
                        WorldManager.EorzaTime);

                    SelectYesno.Yes();
                    await Coroutine.Wait(2000, () => !SelectYesno.IsOpen);
                }

                var ticks = 0;
                while (swingsRemaining != GatheringManager.SwingsRemaining && ticks++ < 60 && Behaviors.ShouldContinue)
                {
                    await Coroutine.Yield();
                }
            }

            tag.StatusText = "Gathering collectable items complete";

            return(true);
        }
Пример #11
0
        private async Task BuyItem(int itemId, int npcId, int count, int selectString)
        {
            var unit = GameObjectManager.GetObjectsByNPCId <Character>((uint)npcId).OrderBy(r => r.Distance()).FirstOrDefault();

            if (unit == null)
            {
                _isDone = true;
                return;
            }

            if (!ShopExchangeCurrency.Open && unit.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(unit.Location);

                await Coroutine.Sleep(500);
            }

            unit.Interact();

            await Coroutine.Wait(5000, () => Conversation.IsOpen);

            if (Conversation.IsOpen)
            {
                Conversation.SelectLine((uint)selectString);

                await Coroutine.Wait(5000, () => ShopExchangeCurrency.Open);


                if (ShopExchangeCurrency.Open)
                {
                    //Log("Opened");
                    ShopExchangeCurrency.Purchase((uint)itemId, (uint)count);
                    await Coroutine.Wait(2000, () => SelectYesno.IsOpen || Request.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                        await Coroutine.Sleep(1000);
                    }
                }

                await Coroutine.Wait(2000, () => ShopExchangeCurrency.Open);

                if (ShopExchangeCurrency.Open)
                {
                    ShopExchangeCurrency.Close();
                }
            }

            _isDone = true;
        }
Пример #12
0
        public static async Task <int> BuyItem(uint ItemId, int qty)
        {
            if (!await OpenShop())
            {
                return(0);
            }

            var item = Items.FirstOrDefault(i => i.ItemID == ItemId);

            Logger.Info($"Itemid {item.ItemID}");
            if (item.ItemID != 0)
            {
                int qtyCanBuy = Math.Min(qty, CanAfford(item));
                Logger.Info($"CanBuy {qtyCanBuy}");
                GrandCompanyExchange.Instance.BuyItemByIndex(item.Index, qtyCanBuy);
                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    Logger.Info($"Clicked Yes");
                }
                await Coroutine.Sleep(800);

                GrandCompanyExchange.Instance.Close();
                await Coroutine.Wait(5000, () => !GrandCompanyExchange.Instance.IsOpen);

                Core.Me.ClearTarget();
                await Coroutine.Sleep(500);

                return(qtyCanBuy);
            }
            else
            {
                Logger.Info($"{(ActiveShopPtr + Offsets.GCArrayStart).ToString("X")}");
                foreach (var item1 in Items)
                {
                    Logger.Info($"{item1.ToString()}");
                }
            }
            GrandCompanyExchange.Instance.Close();
            await Coroutine.Wait(5000, () => !GrandCompanyExchange.Instance.IsOpen);

            Core.Me.ClearTarget();
            await Coroutine.Sleep(500);

            return(0);
        }
Пример #13
0
        public async Task EnableAction(int index)
        {
            SelectAction(index);
            await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ContextMenu") != null);

            if (RaptureAtkUnitManager.GetWindowByName("ContextMenu") != null)
            {
                SelectEnable();
                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                }
            }
        }
Пример #14
0
        private static async Task EnterDiadem()
        {
            await Navigation.GetTo(886, new Vector3(-17.82406f, -16f, 141.3146f));

            var Aurvael = GameObjectManager.GetObjectByNPCId(1031694);

            if (Aurvael != null)
            {
                Aurvael.Interact();
                if (await Coroutine.Wait(3000, () => Talk.DialogOpen))
                {
                    Talk.Next();
                }

                await Coroutine.Wait(3000, () => SelectString.IsOpen);

                if (SelectString.IsOpen)
                {
                    SelectString.ClickSlot(0);
                    await Coroutine.Wait(3000, () => SelectYesno.IsOpen);

                    SelectYesno.Yes();

                    await Coroutine.Wait(30000, () => ContentsFinderConfirm.IsOpen);

                    await Coroutine.Yield();

                    while (ContentsFinderConfirm.IsOpen)
                    {
                        DutyManager.Commence();
                        await Coroutine.Yield();

                        if (await Coroutine.Wait(30000, () => CommonBehaviors.IsLoading))
                        {
                            await Coroutine.Yield();

                            await Coroutine.Wait(Timeout.Infinite, () => !CommonBehaviors.IsLoading);
                        }
                    }
                    await Coroutine.Sleep(2500);
                }
            }
        }
Пример #15
0
        public async Task <bool> BuyAction(int actionId)
        {
            if (IsOpen)
            {
                Logging.Write($"Buying {FcShopActions.First(i=> i.ActionId == actionId).Name}");
                ClickItem(FcShopActions.First(i => i.ActionId == actionId).ShopIndex);
                //Logging.Write("Waiting for Yes/No");
                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    //Logging.Write("Yes/No Open");
                    SelectYesno.Yes();
                    await Coroutine.Wait(5000, () => !SelectYesno.IsOpen);

                    await Coroutine.Sleep(500);
                }
            }
            return(true);
        }
Пример #16
0
        public static async Task UseNpcTransition(uint oldzone, Vector3 transition, uint npcId, uint dialogOption)
        {
            await GetTo(oldzone, transition);

            var unit = GameObjectManager.GetObjectByNPCId(npcId);

            if (!unit.IsWithinInteractRange)
            {
                await OffMeshMoveInteract(unit);
            }

            unit.Target();
            unit.Interact();

            await Coroutine.Wait(5000, () => SelectIconString.IsOpen || DialogOpen);

            if (DialogOpen)
            {
                Next();
            }

            if (SelectIconString.IsOpen)
            {
                SelectIconString.ClickSlot(dialogOption);

                await Coroutine.Wait(5000, () => DialogOpen || SelectYesno.IsOpen);
            }

            if (DialogOpen)
            {
                Next();
            }

            await Coroutine.Wait(3000, () => SelectYesno.IsOpen);

            if (SelectYesno.IsOpen)
            {
                SelectYesno.Yes();
            }
            await Coroutine.Wait(3000, () => !SelectYesno.IsOpen);
        }
Пример #17
0
        public static async Task <int> BuyItem(uint ItemId, int qty)
        {
            if (!await OpenShop())
            {
                return(0);
            }

            var item = Items.FirstOrDefault(i => i.ItemID == ItemId);

            Logger.Info($"Itemid {item.ItemID}");
            if (item.ItemID != 0)
            {
                int qtyCanBuy = Math.Min(qty, CanAfford(item));
                Logger.Info($"CanBuy {qtyCanBuy}");
                GrandCompanyExchange.Instance.BuyItemByIndex(item.Index, qtyCanBuy);
                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    Logger.Info($"Clicked Yes");
                }
                GrandCompanyExchange.Instance.Close();
                await Coroutine.Wait(5000, () => !GrandCompanyExchange.Instance.IsOpen);

                Core.Me.ClearTarget();
                await Coroutine.Sleep(500);

                return(qtyCanBuy);
            }
            GrandCompanyExchange.Instance.Close();
            await Coroutine.Wait(5000, () => !GrandCompanyExchange.Instance.IsOpen);

            Core.Me.ClearTarget();
            await Coroutine.Sleep(500);

            return(0);
        }
Пример #18
0
        public static async Task HandInExpert()
        {
            if (GCExpertSettings.Instance.Craft && ConditionParser.ItemCount((uint)GCExpertSettings.Instance.ItemId) == 0)
            {
                return;
            }


            if (!GrandCompanySupplyList.Instance.IsOpen)
            {
                await GrandCompanyHelper.InteractWithNpc(GCNpc.Personnel_Officer);

                await Coroutine.Wait(5000, () => SelectString.IsOpen);

                if (!SelectString.IsOpen)
                {
                    Log("Window is not open...maybe it didn't get to npc?");
                }

                SelectString.ClickSlot(0);
                await Coroutine.Wait(5000, () => GrandCompanySupplyList.Instance.IsOpen);

                if (!GrandCompanySupplyList.Instance.IsOpen)
                {
                    Log("Window is not open...maybe it didn't get to npc?");
                }
            }

            if (GrandCompanySupplyList.Instance.IsOpen)
            {
                await GrandCompanySupplyList.Instance.SwitchToExpertDelivery();

                await Coroutine.Sleep(3000);

                /*
                 * var bools = GrandCompanySupplyList.Instance.GetTurninBools();
                 * var windowItemIds = GrandCompanySupplyList.Instance.GetTurninItemsIds();
                 * var required = GrandCompanySupplyList.Instance.GetTurninRequired();
                 * var maxSeals = Core.Me.MaxGCSeals();*/
                //var items = Core.Memory.ReadArray<GCTurninItem>(Offsets.GCTurnin, Offsets.GCTurninCount);
                int i     = 0;
                int count = GrandCompanySupplyList.Instance.GetNumberOfTurnins();//ConditionParser.ItemCount((uint) GCExpertSettings.Instance.ItemId);

                if (count > 0)
                {
                    for (var index = 0; index < count; index++)
                    {
                        //var item = windowItemIds[index];
                        //Log($"{index}");
                        GrandCompanySupplyList.Instance.ClickItem(0);
                        await Coroutine.Wait(1000, () => SelectYesno.IsOpen);

                        if (SelectYesno.IsOpen)
                        {
                            SelectYesno.Yes();
                        }

                        await Coroutine.Wait(5000, () => GrandCompanySupplyReward.Instance.IsOpen);

                        GrandCompanySupplyReward.Instance.Confirm();
                        await Coroutine.Wait(5000, () => GrandCompanySupplyList.Instance.IsOpen);

                        i += 1;
                        await Coroutine.Sleep(500);
                    }
                }

                if (GrandCompanySupplyList.Instance.IsOpen)
                {
                    GrandCompanySupplyList.Instance.Close();
                    await Coroutine.Wait(5000, () => SelectString.IsOpen);

                    if (SelectString.IsOpen)
                    {
                        SelectString.ClickSlot((uint)(SelectString.LineCount - 1));
                    }
                }

                /*if (Core.Me.GCSeals() > 200)
                 * {
                 *  await GrandCompanyShop.BuyKnownItem(21072, (int) (Core.Me.GCSeals() / 200));
                 * }*/
            }
        }
Пример #19
0
        public async Task <bool> FCWorkshop()
        {
            Navigator.NavigationProvider = new ServiceNavigationProvider();
            Navigator.PlayerMover        = new SlideMover();

            if (!SubmarinePartsMenu.Instance.IsOpen)
            {
                Logging.Write("Trying to open window");

                if (!await OpenFCCraftingStation())
                {
                    Logging.Write("Nope failed opening FC Workshop window");
                    return(false);
                }
            }

            if (!SubmarinePartsMenu.Instance.IsOpen)
            {
                Logging.Write("Nope failed");
                return(false);
            }


            //    List<LisbethOrder> outList = new List<LisbethOrder>();
            var id     = 0;
            var counts = SubmarinePartsMenu.Instance.GetItemAvailCount();
            var done   = SubmarinePartsMenu.Instance.GetTurninsDone();

            foreach (var item in SubmarinePartsMenu.Instance.GetCraftingTurninItems())
            {
                var needed    = item.Qty * item.TurnInsRequired - item.Qty * done[id];
                var itemCount = (int)DataManager.GetItem((uint)item.ItemId).ItemCount();

                var turnInsAvail = itemCount / item.Qty;

                Logging.Write($"{item}");
                Logging.Write($"Player has {itemCount} and {needed} are still needed and can do {turnInsAvail} turnins");
                var turnInsNeeded = item.TurnInsRequired - done[id];

                if (turnInsNeeded >= 1)
                {
                    if (turnInsAvail >= 1)
                    {
                        for (var i = 0; i < Math.Min(turnInsAvail, turnInsNeeded); i++)
                        {
                            BagSlot bagSlot = null;

                            if (HqItemCount(item.ItemId) >= item.Qty)
                            {
                                bagSlot = InventoryManager.FilledSlots.First(slot => slot.RawItemId == item.ItemId && slot.IsHighQuality && slot.Count >= item.Qty);
                                Logging.Write($"Have HQ {bagSlot.Name}");
//                                continue;
                            }
                            else if (ItemCount(item.ItemId) >= item.Qty)
                            {
                                bagSlot = InventoryManager.FilledSlots.FirstOrDefault(slot => slot.RawItemId == item.ItemId && !slot.IsHighQuality && slot.Count >= item.Qty);

                                if (bagSlot == null)
                                {
                                    await CloseFCCraftingStation();

                                    await LowerQualityAndCombine(item.ItemId);

                                    // var nqSlot = InventoryManager.FilledSlots.FirstOrDefault(slot => slot.RawItemId == item.ItemId && slot.IsHighQuality && slot.Count < item.Qty);

                                    await OpenFCCraftingStation();

                                    bagSlot = InventoryManager.FilledSlots.FirstOrDefault(slot => slot.RawItemId == item.ItemId && !slot.IsHighQuality && slot.Count >= item.Qty);
                                    Logging.Write($"Need To Lower Quality {bagSlot.Name}");
                                }
                                else
                                {
                                    Logging.Write($"Have NQ {bagSlot.Name}");
                                }
                            }
                            else
                            {
                                Logging.Write($"Something went wrong {ItemCount(item.ItemId)}");
                            }

                            if (bagSlot != null)
                            {
                                Logging.Write($"Turn in {bagSlot.Name} HQ({bagSlot.IsHighQuality})");
                                await Coroutine.Sleep(500);

                                SubmarinePartsMenu.Instance.ClickItem(id);

                                await Coroutine.Wait(5000, () => Request.IsOpen);

                                var isHQ = bagSlot.IsHighQuality;
                                bagSlot.Handover();

                                await Coroutine.Wait(5000, () => Request.HandOverButtonClickable);

                                if (Request.HandOverButtonClickable)
                                {
                                    Request.HandOver();
                                    await Coroutine.Sleep(500);

                                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                                    if (SelectYesno.IsOpen)
                                    {
                                        SelectYesno.Yes();
                                    }

                                    await Coroutine.Sleep(700);

                                    if (!isHQ)
                                    {
                                        continue;
                                    }

                                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                                    if (SelectYesno.IsOpen)
                                    {
                                        SelectYesno.Yes();
                                    }
                                    await Coroutine.Sleep(700);
                                }
                                else
                                {
                                    Logging.Write("HandOver Stuck");
                                    return(false);
                                }
                            }
                            else
                            {
                                Logging.Write("Bagslot is null");
                            }
                        }
                    }
                    else
                    {
                        Logging.Write($"No Turn ins available {turnInsAvail}");
                    }
                }
                else
                {
                    Logging.Write($"turnInsNeeded {turnInsNeeded}");
                }

                Logging.Write("--------------");
                id++;
            }

            await CloseFCCraftingStation();

            return(true);
        }
Пример #20
0
        private async Task GoToWard(int Ward, string District)
        {
            Navigator.PlayerMover        = new SlideMover();
            Navigator.NavigationProvider = new ServiceNavigationProvider();

            if (District.Equals("Lavendar Beds", StringComparison.InvariantCultureIgnoreCase))
            {
                if (ConditionParser.IsQuestCompleted(66748))
                {
                    await LlamaLibrary.aHouseChecker.GetToResidential(2);

                    await LlamaLibrary.aHouseChecker.OpenHousingWards();

                    Log($"Traveling to ward {District} Ward - {Ward}");
                    HousingSelectBlock.Instance.SelectWard(Ward - 1);
                    LlamaLibrary.RemoteWindows.HousingSelectBlock.Instance.GoToWard(Ward - 1);
                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                    }

                    await Coroutine.Sleep(5000);

                    if (CommonBehaviors.IsLoading)
                    {
                        await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                    }
                }
                else
                {
                    Logging.WriteDiagnostic("Please complete the quest 'Where the Heart Is (The Lavender Beds)'");
                }
            }

            if (District.Equals("Mists", StringComparison.InvariantCultureIgnoreCase))
            {
                if (ConditionParser.IsQuestCompleted(66750))
                {
                    await LlamaLibrary.aHouseChecker.GetToResidential(8);

                    await LlamaLibrary.aHouseChecker.OpenHousingWards();

                    Log($"Traveling to ward {District} Ward - {Ward}");
                    HousingSelectBlock.Instance.SelectWard(Ward - 1);
                    LlamaLibrary.RemoteWindows.HousingSelectBlock.Instance.GoToWard(Ward - 1);
                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                    }

                    await Coroutine.Sleep(5000);

                    if (CommonBehaviors.IsLoading)
                    {
                        await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                    }
                }
                else
                {
                    Logging.WriteDiagnostic("Please complete the quest 'Where the Heart Is (The Mists)'");
                }
            }

            if (District.Equals("Goblet", StringComparison.InvariantCultureIgnoreCase))
            {
                if (ConditionParser.IsQuestCompleted(66749))
                {
                    await LlamaLibrary.aHouseChecker.GetToResidential(9);

                    await LlamaLibrary.aHouseChecker.OpenHousingWards();

                    Log($"Traveling to ward {District} Ward - {Ward}");
                    HousingSelectBlock.Instance.SelectWard(Ward - 1);
                    LlamaLibrary.RemoteWindows.HousingSelectBlock.Instance.GoToWard(Ward - 1);
                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                    }

                    await Coroutine.Sleep(5000);

                    if (CommonBehaviors.IsLoading)
                    {
                        await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                    }
                }
                else
                {
                    Logging.WriteDiagnostic("Please complete the quest 'Where the Heart Is (The Goblet)'");
                }
            }

            if (District.Equals("Shirogane", StringComparison.InvariantCultureIgnoreCase))
            {
                if (ConditionParser.IsQuestCompleted(68167))
                {
                    await LlamaLibrary.aHouseChecker.GetToResidential(111);

                    await LlamaLibrary.aHouseChecker.OpenHousingWards();

                    Log($"Traveling to ward {District} Ward - {Ward}");
                    HousingSelectBlock.Instance.SelectWard(Ward - 1);
                    LlamaLibrary.RemoteWindows.HousingSelectBlock.Instance.GoToWard(Ward - 1);
                    await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                    }

                    await Coroutine.Sleep(5000);

                    if (CommonBehaviors.IsLoading)
                    {
                        await Coroutine.Wait(-1, () => !CommonBehaviors.IsLoading);
                    }
                }
                else
                {
                    Logging.WriteDiagnostic("Please complete the quest 'I Dream of Shirogane'");
                }
            }


            _isDone = true;
        }
Пример #21
0
        private async Task ChangeJob()
        {
            var          gearSets = GearsetManager.GearSets.Where(i => i.InUse);
            ClassJobType newjob;
            var          foundJob = Enum.TryParse(job.Trim(), true, out newjob);

            if (Core.Me.CurrentJob == newjob)
            {
                _isDone = true;
                return;
            }
            Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Started");
            Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found job: {foundJob} Job:{newjob}");
            if (foundJob && gearSets.Any(gs => gs.Class == newjob))
            {
                Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found GearSet");
                gearSets.First(gs => gs.Class == newjob).Activate();

                await Coroutine.Wait(3000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    await Coroutine.Sleep(3000);
                }

                // await Coroutine.Sleep(1000);
            }

            else if (foundJob)
            {
                job = job.Trim() + ("s_Primary_Tool");

                ItemUiCategory category;
                var            categoryFound = Enum.TryParse(job, true, out category);

                if (categoryFound)
                {
                    Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found Item Category: {categoryFound} Category:{category}");
                    var     item      = InventoryManager.FilledInventoryAndArmory.Where(i => i.Item.EquipmentCatagory == category).OrderByDescending(i => i.Item.ItemLevel).FirstOrDefault();
                    BagSlot EquipSlot = InventoryManager.GetBagByInventoryBagId(InventoryBagId.EquippedItems)[EquipmentSlot.MainHand];

                    Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found Item {item}");
                    if (item != null)
                    {
                        item.Move(EquipSlot);
                    }

                    await Coroutine.Sleep(1000);

                    ChatManager.SendChat("/gs save");

                    await Coroutine.Sleep(1000);
                }
                else
                {
                    Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Couldn't find item category'");
                }
            }

            _isDone = true;
        }
Пример #22
0
        public async Task <bool> HandInKupoTicket(int slot)
        {
            if ((!HWDLottery.Instance.IsOpen && KupoNpc == null) || KupoNpc.Location.Distance(Core.Me.Location) > 5f)
            {
                await Navigation.GetTo(886, new Vector3(43.59162f, -16f, 170.3864f));
            }

            if (!HWDLottery.Instance.IsOpen && KupoNpc.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(KupoNpc.Location);

                await Coroutine.Sleep(500);
            }

            if (!HWDLottery.Instance.IsOpen && KupoNpc != null)
            {
                KupoNpc.Interact();
                Log("Interact with npc");
                await Coroutine.Wait(5000, () => HWDLottery.Instance.IsOpen || Talk.DialogOpen);

                await Coroutine.Sleep(100);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => !Talk.DialogOpen);
                }
                Log("Talking done");
                await Coroutine.Wait(2000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                    Log("Select Yes/No open");
                    await Coroutine.Wait(5000, () => HWDLottery.Instance.IsOpen);

                    await Coroutine.Sleep(4000);

                    Log("Ticket Should be loaded");
                }
            }

            if (HWDLottery.Instance.IsOpen)
            {
                Log("Clicking");
                await HWDLottery.Instance.ClickSpot(slot);

                await Coroutine.Sleep(1000);

                HWDLottery.Instance.Close();
                Log("Close");

                await Coroutine.Wait(5000, () => SelectYesno.IsOpen || Talk.DialogOpen);

                Log($"Select Yes/No {SelectYesno.IsOpen} Talk {Talk.DialogOpen}");
                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(2000, () => !Talk.DialogOpen);

                    await Coroutine.Wait(2000, () => Talk.DialogOpen || SelectYesno.IsOpen);
                }

                await Coroutine.Sleep(1000);

                await HandInKupoTicket(slot);
            }
            else
            {
                Log("Out of Tickets");
            }
            Log("Done with Kupo Tickets");
            return(false);
        }
Пример #23
0
        public async Task <bool> HandInGatheringItem(int job)
        {
            if ((!HWDGathereInspect.Instance.IsOpen && GatherNpc == null) || GatherNpc.Location.Distance(Core.Me.Location) > 5f)
            {
                await Navigation.GetTo(886, new Vector3(-20.04274f, -16f, 141.3337f));
            }

            if (!HWDGathereInspect.Instance.IsOpen && GatherNpc.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(GatherNpc.Location);

                await Coroutine.Sleep(500);
            }

            if (!HWDGathereInspect.Instance.IsOpen)
            {
                GatherNpc.Interact();
                await Coroutine.Wait(5000, () => HWDGathereInspect.Instance.IsOpen || Talk.DialogOpen);

                await Coroutine.Sleep(100);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => !Talk.DialogOpen);
                }

                await Coroutine.Wait(5000, () => HWDGathereInspect.Instance.IsOpen);
            }

            if (HWDGathereInspect.Instance.IsOpen)
            {
                HWDGathereInspect.Instance.ClickClass(job);
                await Coroutine.Sleep(500);

                if (HWDGathereInspect.Instance.CanAutoSubmit())
                {
                    ;
                }
                {
                    HWDGathereInspect.Instance.ClickAutoSubmit();
                    await Coroutine.Wait(6000, () => HWDGathereInspect.Instance.CanRequestInspection());

                    if (HWDGathereInspect.Instance.CanRequestInspection())
                    {
                        HWDGathereInspect.Instance.ClickRequestInspection();
                        if (ScriptConditions.Helpers.GetSkybuilderScrips() > 9000)
                        {
                            await Coroutine.Wait(2000, () => SelectYesno.IsOpen);
                        }
                        else
                        {
                            await Coroutine.Sleep(100);
                        }
                        if (SelectYesno.IsOpen)
                        {
                            SelectYesno.Yes();
                        }
                    }
                }
            }

            return(false);
        }
Пример #24
0
        public async Task <bool> HandInItem(uint itemId, int index, int job)
        {
            if ((!HWDSupply.Instance.IsOpen && Npc == null) || Npc.Location.Distance(Core.Me.Location) > 5f)
            {
                await Navigation.GetTo(886, new Vector3(43.59162f, -16f, 170.3864f));
            }

            if (!HWDSupply.Instance.IsOpen && Npc.Location.Distance(Core.Me.Location) > 4f)
            {
                await Navigation.OffMeshMove(Npc.Location);

                await Coroutine.Sleep(500);
            }

            if (!HWDSupply.Instance.IsOpen)
            {
                //NpcId = GameObjectManager.GameObjects.First(i => i.EnglishName == EnglishName).NpcId;
                Npc.Interact();
                await Coroutine.Wait(5000, () => HWDSupply.Instance.IsOpen || Talk.DialogOpen);

                await Coroutine.Sleep(1000);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => !Talk.DialogOpen);
                }

                await Coroutine.Sleep(1000);
            }

            if (HWDSupply.Instance.IsOpen)
            {
                if (HWDSupply.Instance.ClassSelected != job)
                {
                    HWDSupply.Instance.ClassSelected = job;
                    await Coroutine.Sleep(1000);
                }
                //var item = InventoryManager.FilledSlots.FirstOrDefault(i => i.RawItemId == itemId);

                foreach (var item in InventoryManager.FilledSlots.Where(i => i.RawItemId == itemId))
                {
                    HWDSupply.Instance.ClickItem(index);

                    await Coroutine.Wait(5000, () => Request.IsOpen);

                    await Coroutine.Sleep(700);

                    item.Handover();
                    await Coroutine.Sleep(100);

                    await Coroutine.Wait(5000, () => Request.HandOverButtonClickable);

                    Request.HandOver();

                    if (ScriptConditions.Helpers.GetSkybuilderScrips() > 9000)
                    {
                        await Coroutine.Wait(2000, () => SelectYesno.IsOpen);
                    }
                    else
                    {
                        await Coroutine.Sleep(100);
                    }

                    if (Translator.Language != Language.Chn)
                    {
                        Log($"Kupo Tickets: {HWDSupply.Instance.NumberOfKupoTickets()}");

                        if (HWDSupply.Instance.NumberOfKupoTickets() >= 9)
                        {
                            Log($"Going to turn in Kupo Tickets: {HWDSupply.Instance.NumberOfKupoTickets()}");
                            if (SelectYesno.IsOpen)
                            {
                                SelectYesno.Yes();
                                await Coroutine.Sleep(1000);
                            }

                            HWDSupply.Instance.Close();
                            await Coroutine.Sleep(2000);
                            await HandInKupoTicket(1);

                            break;
                        }
                    }

                    if (!SelectYesno.IsOpen)
                    {
                        continue;
                    }

                    SelectYesno.Yes();
                    await Coroutine.Sleep(2000);
                }
            }

            if (Request.IsOpen)
            {
                Request.Cancel();
                await Coroutine.Sleep(2000);
            }

            if (InventoryManager.FilledSlots.Any(i => i.RawItemId == itemId))
            {
                await HandInItem(itemId, index, job);
            }
            return(false);
        }
Пример #25
0
        private static async Task TradeItems(Queue <QueuedTradeItem> tradeQueue, BattleCharacter target)
        {
            FailedTradeCount = 0;
            int gilToTrade = AutoTradeSettings.GilToTrade;

            if (gilToTrade > 0)
            {
                LogSuccess($"We want to trade a total of {gilToTrade:N0} gil.");
            }
            LogSuccess("---Starting Trades---");
            while ((TradeQueue.Any() || gilToTrade > 0) && FailedTradeCount < 3)
            {
                if (!target.IsWithinInteractRange)
                {
                    LogCritical("Our trading partner ran away from us!");
                    break;
                }

                int result = target.OpenTradeWindow();

                if (result != 0)
                {
                    FailedTradeCount++;
                    LogCritical("Couldn't open trade window. Pausing to retry...");
                    await Coroutine.Sleep(3000);

                    continue;
                }


                await Coroutine.Wait(5000, () => Trade.IsOpen);

                if (!Trade.IsOpen)
                {
                    FailedTradeCount++;
                    LogCritical("Trade window never opened. Pausing to retry...");
                    await Coroutine.Sleep(3000);

                    continue;
                }

                LogSuccess("Trading window opened.");

                int gilAmount  = 0;
                int currentGil = AutoTradeSettings.CurrentGil;

                if (gilToTrade > 0)
                {
                    gilAmount = Math.Min(gilToTrade, 1000000);
                    LogSuccess($"Adding {gilAmount:N0} gil.");
                    RaptureAtkUnitManager.GetWindowByName("Trade").SendAction(1, 3, 2);
                    await WaitForInputNumeric((uint)gilAmount);

                    await Coroutine.Sleep(250);
                }

                if (tradeQueue.Any())
                {
                    WatchedBagSlots.Clear();
                    List <MarkedBagSlot> markedBagSlots = AutoTradeSettings.MainBagsFilledSlots
                                                          .Where(x => x.CanTrade() && AutoTradeSettings.ItemsToTrade.Any(y => y.TrueItemId == x.TrueItemId))
                                                          .Select(x => new MarkedBagSlot(x))
                                                          .ToList();

                    for (int i = 0; i < 5 && tradeQueue.Any(); i++)
                    {
                        QueuedTradeItem itemToTrade = tradeQueue.Dequeue();

                        MarkedBagSlot itemSlot = markedBagSlots
                                                 .Where(x => x.BagSlot.TrueItemId == itemToTrade.TrueItemId && !x.BeingTraded)
                                                 .OrderByDescending(x => x.BagSlot.Count)
                                                 .FirstOrDefault();
                        if (itemSlot?.BagSlot == null || !itemSlot.BagSlot.IsFilled)
                        {
                            LogCritical($"Couldn't find any ID: {itemToTrade.TrueItemId} in our inventory.");
                            i--;
                            continue;
                        }

                        itemSlot.BeingTraded = true;
                        WatchedBagSlots.Add(new WatchedBagSlot(itemSlot.BagSlot));
                        LogSuccess($"Adding x{itemToTrade.QtyToTrade} {itemToTrade.ItemName} to Slot {i+1}.");
                        itemSlot.BagSlot.TradeItem();
                        if (itemToTrade.QtyToTrade > 1 && itemToTrade.StackSize > 1)
                        {
                            await WaitForInputNumeric(itemToTrade.QtyToTrade);
                        }

                        await Coroutine.Sleep(250);
                    }
                }

                RaptureAtkUnitManager.GetWindowByName("Trade").SendAction(1, 3uL, 0);
                await Coroutine.Wait(30000, () => Trade.TradeStage == 5);

                if (Trade.TradeStage != 5)
                {
                    LogCritical("Our target still hasn't accepted the trade... aborting.");
                    break;
                }
                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                }
                await Coroutine.Wait(5000, () => !SelectYesno.IsOpen);

                await Coroutine.Wait(30000, () => Trade.TradeStage == 1);

                if (Trade.TradeStage == 6)
                {
                    LogCritical("Our target still hasn't accepted the trade... aborting.");
                    break;
                }

                LogSuccess("Trade completed.");

                // Arbitrary wait to let values update after trade is complete.
                await Coroutine.Sleep(1500);

                if (gilToTrade > 0 && currentGil == AutoTradeSettings.CurrentGil)
                {
                    LogCritical("Trading gil didn't go through.");
                    FailedTradeCount++;
                    continue;
                }
                gilToTrade -= gilAmount;
                if (WatchedSlotsUnchanged(WatchedBagSlots))
                {
                    LogCritical("Some items were unchanged, even though they should have been traded.");
                    FailedTradeCount++;
                    continue;
                }
            }
        }
Пример #26
0
        public async Task <uint> Purchase(uint itemId, uint itemCount = 1)
        {
            if (!IsOpen)
            {
                return(0u);
            }

            var items = SpecialShopManager.Items;

            var specialShopItem = items?.Cast <SpecialShopItem?>().FirstOrDefault(i => i.HasValue && i.Value.ItemIds.Contains(itemId));

            //Logging.Write(Colors.Fuchsia, $"[ShopExchangeItem] Buying {specialShopItem}");
            if (!specialShopItem.HasValue)
            {
                return(0u);
            }

            if (itemCount > specialShopItem.Value.Item0.StackSize)
            {
                itemCount = specialShopItem.Value.Item0.StackSize;
            }

            if (!CanAfford(specialShopItem.Value))
            {
                return(0);
            }
            // Logging.Write(Colors.Fuchsia, $"[Purchase] Can afford {CanAfford(specialShopItem.Value)}");
            var index = items.IndexOf(specialShopItem.Value);
            var obj   = new ulong[8]
            {
                3uL,
                0uL,
                3uL,
                0uL,
                3uL,
                0uL,
                0uL,
                0uL
            };

            obj[3] = (uint)index;
            obj[5] = itemCount;
            SendAction(4, obj);
            // Logging.Write(Colors.Fuchsia, $"[Purchase] Sent Action");
            await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog") != null);

            if (RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog") != null)
            {
                //Logging.Write(Colors.Fuchsia, $"[Purchase] ShopExchangeItemDialog Open");
                RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog").SendAction(1, 3, 0);
                await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ShopExchangeItemDialog") == null);

                await Coroutine.Wait(2000, () => SelectYesno.IsOpen || Request.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    //Logging.Write(Colors.Fuchsia, $"[Purchase] Yes/no");
                    SelectYesno.Yes();
                    await Coroutine.Wait(2000, () => !SelectYesno.IsOpen);

                    await Coroutine.Wait(3000, () => Request.IsOpen);
                }

                if (Request.IsOpen)
                {
                    // Logging.Write(Colors.Fuchsia, $"[Purchase] Request");
                    for (int i = 0; i < 3; i++)
                    {
                        BagSlot item;
                        if (specialShopItem.Value.HqCurrencies[i])
                        {
                            item = InventoryManager.FilledInventoryAndArmory.FirstOrDefault(j => j.RawItemId == specialShopItem.Value.CurrencyTypes[i] && j.Count >= specialShopItem.Value.CurrencyCosts[i] && j.IsHighQuality == specialShopItem.Value.HqCurrencies[i]);
                        }
                        else
                        {
                            item = InventoryManager.FilledInventoryAndArmory.FirstOrDefault(j => j.RawItemId == specialShopItem.Value.CurrencyTypes[i] && j.Count >= specialShopItem.Value.CurrencyCosts[i]);
                        }
                        // Logging.Write(Colors.Fuchsia, $"[Purchase] Request item {item}");
                        if (item != null)
                        {
                            item.Handover();
                            await Coroutine.Sleep(500);
                        }
                    }

                    if (Request.HandOverButtonClickable)
                    {
                        Request.HandOver();
                    }

                    await Coroutine.Sleep(1000);
                }
                else
                {
                    //Logging.Write(Colors.Fuchsia, $"[Purchase] Request Not open");
                }

                if (QuestLogManager.InCutscene && AgentInterface <AgentCutScene> .Instance.CanSkip && !SelectString.IsOpen)
                {
                    AgentInterface <AgentCutScene> .Instance.PromptSkip();

                    await Coroutine.Wait(6000, () => SelectString.IsOpen);

                    SelectString.ClickSlot(0);
                    await CommonTasks.HandleLoading();

                    await Coroutine.Wait(6000, () => !QuestLogManager.InCutscene);

                    await CommonTasks.HandleLoading();

                    await Coroutine.Sleep(500);
                }
            }


            return(itemCount);
        }
Пример #27
0
        /*public static int GetLeveTodoArgsItem1(int index)
         * {
         *  if (DirectorManager.ActiveDirector == null) return -1;
         *  var type = DirectorManager.ActiveDirector.GetType();
         *
         *  if (type == typeof(ff14bot.Directors.BattleLeveConciliate))
         *      return (DirectorManager.ActiveDirector as BattleLeveConciliate).GetTodoArgs(index).Item1;
         *  if (type == typeof(ff14bot.Directors.BattleLeveSweep))
         *      return (DirectorManager.ActiveDirector as BattleLeveSweep).GetTodoArgs(index).Item1;
         *  if (type == typeof(ff14bot.Directors.BattleLeveDetect))
         *      return (DirectorManager.ActiveDirector as BattleLeveDetect).GetTodoArgs(index).Item1;
         *  if (type == typeof(ff14bot.Directors.BattleLeveGuide))
         *      return (DirectorManager.ActiveDirector as BattleLeveGuide).GetTodoArgs(index).Item1;
         *
         *  DirectorManager.ActiveDirector.GetTodoArgs(index)
         * }*/

        public static async Task <bool> UpdateGearSet()
        {
            if (!Character.Instance.IsOpen)
            {
                //Logger.Info("Character window not open");
                AgentCharacter.Instance.Toggle();
                //Logger.Info("Toggled");
                try
                {
                    await WaitUntil(() => Character.Instance.IsOpen, timeout : 10000);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            if (!Character.Instance.IsOpen)
            {
                return(false);
            }
            //Logger.Info($"Can click {Character.Instance.CanUpdateGearSet()}");
            if (!Character.Instance.CanUpdateGearSet())
            {
                Character.Instance.Close();
                return(false);
            }

            Character.Instance.UpdateGearSet();

            try
            {
                await WaitUntil(() => SelectYesno.IsOpen, timeout : 1500);
            }
            catch (Exception e)
            {
                if (Character.Instance.IsOpen)
                {
                    Character.Instance.Close();
                }
                return(true);
            }

            if (SelectYesno.IsOpen)
            {
                SelectYesno.Yes();
            }

            try
            {
                await WaitUntil(() => !SelectYesno.IsOpen, timeout : 10000);
            }
            catch (Exception e)
            {
                return(true);
            }

            //await Coroutine.Sleep(200);

            if (Character.Instance.IsOpen)
            {
                Character.Instance.Close();
            }

            return(true);
        }
Пример #28
0
        public async Task <bool> Shop()
        {
            var npcId = GameObjectManager.GetObjectByNPCId(1012301);

            if (!npcId.IsWithinInteractRange)
            {
                var _target = npcId.Location;
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                Navigator.PlayerMover.MoveStop();
            }

            npcId.Interact();

            await Coroutine.Wait(5000, () => SelectIconString.IsOpen);

            SelectIconString.ClickSlot(0);

            await Coroutine.Wait(5000, () => SelectString.IsOpen);

            SelectString.ClickSlot(5);

            await Coroutine.Sleep(700);

            var windowName = "ShopExchangeCurrency";
            await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName(windowName) != null);

            var windowByName = RaptureAtkUnitManager.GetWindowByName(windowName);

            if (windowByName == null)
            {
                return(false);
            }

            while (SpecialCurrencyManager.GetCurrencyCount(SpecialCurrency.YellowCraftersScrips) > 50 && InventoryManager.FreeSlots > 1)
            {
                if (windowByName != null)
                {
                    windowByName.SendAction(4, 3, 0, 3, 0x19, 3, 1, 0, 0);
                }

                await Coroutine.Wait(5000, () => SelectYesno.IsOpen);

                if (SelectYesno.IsOpen)
                {
                    SelectYesno.Yes();
                }

                await Coroutine.Sleep(700);
            }

            windowByName.SendAction(1, 3uL, 4294967295uL);

            await Coroutine.Wait(5000, () => SelectString.IsOpen);

            SelectString.ClickSlot((uint)(SelectString.LineCount - 1));

            await Coroutine.Sleep(700);

            return(true);
        }
Пример #29
0
        private static async Task <bool> GoToHousingBell(WorldManager.TeleportLocation house)
        {
            Log($"Teleporting to housing: (ZID: {house.ZoneId}, AID: {house.AetheryteId}) {house.Name}");
            await CommonTasks.Teleport(house.AetheryteId);

            Log("Waiting for zone to change");
            await Coroutine.Wait(20000, () => WorldManager.ZoneId == house.ZoneId);

            Log("Getting closest housing entrance");
            uint houseEntranceId = 2002737;
            uint aptEntranceId   = 2007402;

            var entranceIds = new uint[] { houseEntranceId, aptEntranceId };

            var entrance = GameObjectManager.GetObjectsByNPCIds <GameObject>(entranceIds).OrderBy(x => x.Distance2D()).FirstOrDefault();

            if (entrance != null)
            {
                Log("Found housing entrance, approaching");
                await Navigation.FlightorMove(entrance.Location);

                if (entrance.IsWithinInteractRange)
                {
                    Navigator.NavigationProvider.ClearStuckInfo();
                    Navigator.Stop();
                    await Coroutine.Wait(5000, () => !IsJumping);

                    entrance.Interact();

                    // Handle different housing entrance menus
                    if (entrance.NpcId == houseEntranceId)
                    {
                        Log("Entering house");

                        await Coroutine.Wait(10000, () => SelectYesno.IsOpen);

                        if (SelectYesno.IsOpen)
                        {
                            SelectYesno.Yes();
                        }
                    }
                    else if (entrance.NpcId == aptEntranceId)
                    {
                        Log("Entering apartment");

                        await Coroutine.Wait(10000, () => SelectString.IsOpen);

                        if (SelectString.IsOpen)
                        {
                            SelectString.ClickSlot(0);
                        }
                    }

                    await CommonTasks.HandleLoading();

                    Log("Getting best summoning bell");
                    var bell = HelperFunctions.FindSummoningBell();
                    if (bell != null)
                    {
                        Log("Found summoning bell, approaching");
                        await HelperFunctions.GoToSummoningBell();

                        return(true);
                    }
                    else
                    {
                        Log("Couldn't find any summoning bells");
                    }
                }
            }
            else
            {
                Log($"Couldn't find any housing entrances.  Are we in the right zone?  Current: ({WorldManager.ZoneId}) {WorldManager.CurrentZoneName}");
            }

            return(false);
        }
Пример #30
0
        public async Task <bool> HandInItem(uint itemId, int index, int job)
        {
            //GameObjectType.EventNpc;

            if (!HWDSupply.Instance.IsOpen && Npc == null)
            {
                await GetToNpc();
            }

            if (!HWDSupply.Instance.IsOpen && Npc.Location.Distance(Core.Me.Location) > 5f)
            {
                // NpcId = Npc.NpcId;
                // await CommonTasks.MoveAndStop(
                //     new MoveToParameters(Npc.Location, "Moving To HandinVendor"), 2f);
                //await CommonTasks.MoveAndStop(Npc.Location, "Moving To HandinVendor");

                var _target = new Vector3(10.58188f, -15.96282f, 163.8702f);
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                Navigator.PlayerMover.MoveStop();

                _target = Npc.Location;
                Navigator.PlayerMover.MoveTowards(_target);
                while (_target.Distance2D(Core.Me.Location) >= 4)
                {
                    Navigator.PlayerMover.MoveTowards(_target);
                    await Coroutine.Sleep(100);
                }

                Navigator.PlayerMover.MoveStop();


                Navigator.PlayerMover.MoveStop();
                await Coroutine.Sleep(500);
            }

            if (!HWDSupply.Instance.IsOpen)
            {
                //NpcId = GameObjectManager.GameObjects.First(i => i.EnglishName == EnglishName).NpcId;
                Npc.Interact();
                await Coroutine.Wait(5000, () => HWDSupply.Instance.IsOpen || Talk.DialogOpen);

                await Coroutine.Sleep(1000);

                while (Talk.DialogOpen)
                {
                    Talk.Next();
                    await Coroutine.Wait(5000, () => !Talk.DialogOpen);
                }

                await Coroutine.Sleep(1000);
            }

            if (HWDSupply.Instance.IsOpen)
            {
                if (HWDSupply.Instance.ClassSelected != job)
                {
                    HWDSupply.Instance.ClassSelected = job;
                    await Coroutine.Sleep(1000);
                }
                //var item = InventoryManager.FilledSlots.FirstOrDefault(i => i.RawItemId == itemId);

                foreach (var item in InventoryManager.FilledSlots.Where(i => i.RawItemId == itemId))
                {
                    HWDSupply.Instance.ClickItem(index);

                    await Coroutine.Wait(5000, () => Request.IsOpen);

                    await Coroutine.Sleep(1000);

                    item.Handover();
                    await Coroutine.Sleep(200);

                    await Coroutine.Wait(5000, () => Request.HandOverButtonClickable);

                    Request.HandOver();
                    await Coroutine.Wait(2000, () => SelectYesno.IsOpen);

                    if (SelectYesno.IsOpen)
                    {
                        SelectYesno.Yes();
                        await Coroutine.Sleep(2000);
                    }
                }
            }

            return(false);
        }