protected override void OnDone() { if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } if (Window <MasterPieceSupply> .IsOpen) { MasterPieceSupply.Close(); } if (Window <ShopExchangeCurrency> .IsOpen) { ShopExchangeCurrency.Close(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } }
private async Task <bool> HandOver() { var masterpieceSupply = new MasterPieceSupply(); if (!masterpieceSupply.IsValid && !await masterpieceSupply.Refresh(5000)) { return(false); } if (item == null || item.Item == null) { SelectYesno.ClickNo(); await masterpieceSupply.CloseInstanceGently(15); return(false); } StatusText = Localization.Localization.ExTurnInCollectable_TurnIn; var itemName = item.Item.CurrentLocaleName; if (!await masterpieceSupply.TurnInAndHandOver(index, item)) { Logger.Error(Localization.Localization.ExTurnInCollectable_TurnInError); Blacklist.Add( (uint)item.Pointer.ToInt64(), BlacklistFlags.Loot, TimeSpan.FromMinutes(3), Localization.Localization.ExTurnInCollectable_TurnInBlackList); item = null; index = 0; if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); await Coroutine.Sleep(200); } if (Request.IsOpen) { Request.Cancel(); await Coroutine.Sleep(200); } return(true); } Logger.Info(Localization.Localization.ExTurnInCollectable_TurnInSuccessful, itemName, WorldManager.EorzaTime); turnedItemsIn = true; index = 0; if (!await Coroutine.Wait(1000, () => item == null)) { item = null; } return(true); }
private async Task <bool> MoveToShopNpc() { var masterPieceSupply = new MasterPieceSupply(); if (await masterPieceSupply.Refresh(2000)) { await masterPieceSupply.CloseInstanceGently(); } if (ExProfileBehavior.Me.Location.Distance(shopExchangeCurrencyNpc.Location) <= 4) { // we are already there, continue return(false); } await shopExchangeCurrencyNpc.Location.MoveTo( radius : 3.9f, name : Location + " ShopNpcId: " + shopExchangeCurrencyNpc.NpcId); Navigator.Stop(); return(false); }
public async Task <bool> PrintMasterPieceList() { Dictionary <ff14bot.Enums.ClassJobType, int> Classes = new Dictionary <ClassJobType, int> { { ClassJobType.Carpenter, 0 }, { ClassJobType.Blacksmith, 1 }, { ClassJobType.Armorer, 2 }, { ClassJobType.Goldsmith, 3 }, { ClassJobType.Leatherworker, 4 }, { ClassJobType.Weaver, 5 }, { ClassJobType.Alchemist, 6 }, { ClassJobType.Culinarian, 7 }, { ClassJobType.Miner, 8 }, { ClassJobType.Botanist, 9 }, { ClassJobType.Fisher, 10 }, }; if (!MasterPieceSupply.IsOpen) { Logging.Write($"Trying to open window"); AgentModule.ToggleAgentInterfaceById(95); await Coroutine.Wait(5000, () => RaptureAtkUnitManager.GetWindowByName("ContentsInfo") != null); await Coroutine.Sleep(500); if (RaptureAtkUnitManager.GetWindowByName("ContentsInfo") == null) { Logging.Write($"Nope failed opening timer window"); return(false); } await Coroutine.Sleep(500); RaptureAtkUnitManager.GetWindowByName("ContentsInfo").SendAction(2, 3, 0xC, 3, 6); await Coroutine.Wait(5000, () => MasterPieceSupply.IsOpen); await Coroutine.Sleep(500); } if (!MasterPieceSupply.IsOpen) { Logging.Write($"Nope failed"); return(false); } foreach (var job in Classes) { Logging.Write($"{job.Key}:"); MasterPieceSupply.ClassSelected = job.Value; await Coroutine.Sleep(1000); //Can also use MasterPieceSupply.GetTurninItems() if you don't wanted starred info foreach (var item in MasterPieceSupply.GetTurninItemsStarred()) { Logging.Write($"{item.Key} Starred: {item.Value}"); } } return(true); }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt64(), BlacklistFlags.Loot)).ToArray(); var blackListDictionnary = new Dictionary <string, uint> { { "Fire Moraine", 5214 }, { "Lightning Moraine", 5218 }, { "Radiant Fire Moraine", 5220 }, { "Radiant Lightning Moraine", 5224 }, { "Bright Fire Rock", 12966 }, { "Bright Lightning Rock", 12967 }, { "Granular Clay", 12968 }, { "Peat Moss", 12969 }, { "Black Soil", 12970 }, { "Highland Oregano", 12971 }, { "Furymint", 12972 }, { "Clary Sage", 12973 }, { "Lover's Laurel", 15948 }, { "Radiant Astral Moraine", 15949 }, { "Near Eastern Antique", 17549 }, { "Coerthan Souvenir", 17550 }, { "Maelstrom Materiel ", 17551 }, { "Heartfelt Gift", 17552 }, { "Orphanage Donation", 17553 }, { "Dated Radz-at-Han Coin", 17557 }, { "Ice Stalagmite", 17558 }, { "Duskfall Moss", 17559 }, { "Glass Eye", 17560 }, { "Rainbow Pigment", 17561 }, { "Thavnairian Leaf", 17562 }, { "Ghost Faerie", 17563 }, { "Red Sky Coral", 17564 }, { "Lovers' Clam", 17565 }, { "River Shrimp", 17566 }, { "Windtea Leaves", 19916 }, { "Torreya Branch", 19937 }, { "Schorl", 20009 }, { "Perlite", 20010 }, { "Almandine", 20011 }, { "Doman Yellow", 20012 }, { "Gyr Abanian Souvenir", 20775 }, { "Far Eastern Antique", 20776 }, { "Gold Saucer Consolation Prize", 20777 }, { "M Tribe Sundries", 20778 }, { "Resistance Materiel", 20779 }, { "Starcrack", 20780 }, { "Shishu Koban", 20781 }, { "Cotter Dynasty Relic", 20782 }, { "Peaks Pigment", 20783 }, { "Yellow Kudzu Root", 20784 }, { "Gyr Abanian Chub", 20785 }, { "Coral Horse", 20786 }, { "Maiden's Heart", 20787 }, { "Velodyna Salmon", 20788 }, { "Purple Buckler", 20789 }, { "Gyr Abanian Remedies", 23143 }, { "Anti-shark Harpoon", 23144 }, { "Coerthan Cold-weather Gear", 23145 }, { "Sui-no-Sato Special", 23146 }, { "Cloud Pearl", 23147 }, { "Yanxian Soil", 23220 }, { "Yanxian Verbena", 23221 } }; if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0 && !blackListDictionnary.ContainsValue(i.RawItemId)); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }
private async Task <bool> ResolveIndex() { if (item == null || item.Item == null) { return(false); } var provider = SqlData.Instance; var i = provider.GetIndexByItemId(item.RawItemId); if (i.HasValue) { index = i.Value; return(false); } switch (item.RawItemId) { case 12774U: case 12828U: index = 9; // Tiny Axotl + Thunderbolt Eel return(false); case 12900U: // Chysahl Greens index = 11; return(false); case 12538U: // Adamantite Ore index = 13; return(false); case 12804U: // Illuminati Perch index = 62; return(false); } // No perfect algorithm for this, but will attempt. Going to have to read the data from the window. // for some reason, seafood has a repair class of cul... go figure. var classIndex = uint.MaxValue; if (item.Item.RepairClass > 0 && item.Item.EquipmentCatagory != ItemUiCategory.Seafood) { classIndex = MasterPieceSupply.GetClassIndex((ClassJobType)item.Item.RepairClass); } else { switch (item.Item.EquipmentCatagory) { case ItemUiCategory.Seafood: classIndex = MasterPieceSupply.GetClassIndex(ClassJobType.Fisher); break; case ItemUiCategory.Stone: case ItemUiCategory.Metal: case ItemUiCategory.Bone: classIndex = MasterPieceSupply.GetClassIndex(ClassJobType.Miner); break; case ItemUiCategory.Reagent: case ItemUiCategory.Ingredient: case ItemUiCategory.Lumber: classIndex = MasterPieceSupply.GetClassIndex(ClassJobType.Botanist); break; } if (classIndex == uint.MaxValue) { Logger.Error(Localization.Localization.ExTurnInCollectable_ErrorClassType + item.Item.EnglishName); isDone = true; return(true); } } var itemLevel = item.Item.ItemLevel; switch (itemLevel) { case 80: itemLevel = 0; break; case 120: itemLevel = 1; break; case 125: itemLevel = 2; break; case 150: itemLevel = 10; break; case 160: itemLevel = 11; break; case 180: itemLevel = 12; break; default: itemLevel = itemLevel < 120 ? (byte)0 : (byte)((itemLevel - 121) / 3); break; } int indexOffset; if (classIndex >= 8) { if (itemLevel >= 10) { indexOffset = (8 + Math.Abs((int)classIndex - 10) * 2); } else { indexOffset = 62 + Math.Abs((int)classIndex - 10) * 6; indexOffset += Math.Abs(itemLevel - 10) / 2; } } else { if (itemLevel >= 10) { indexOffset = Math.Abs((int)classIndex - 7); } else { indexOffset = 14 + Math.Abs((int)classIndex - 7) * 6; indexOffset += Math.Abs(itemLevel - 10) / 2; } } index = (uint)indexOffset; return(false); }
private async Task<bool> ResolveItem() { if (item != null) { return false; } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint) i.Pointer.ToInt32(), BlacklistFlags.Loot)).ToArray(); if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return false; } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return false; } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return isDone = true; }
private async Task<bool> MoveToShopNpc() { var masterPieceSupply = new MasterPieceSupply(); if (await masterPieceSupply.Refresh(2000)) { await masterPieceSupply.CloseInstanceGently(); } if (ExProfileBehavior.Me.Location.Distance(shopExchangeCurrencyNpc.Location) <= 4) { // we are already there, continue return false; } await shopExchangeCurrencyNpc.Location.MoveTo( radius: 3.9f, name: Location + " ShopNpcId: " + shopExchangeCurrencyNpc.NpcId); Navigator.Stop(); return false; }
private async Task<bool> HandOver() { var masterpieceSupply = new MasterPieceSupply(); if (!masterpieceSupply.IsValid && !await masterpieceSupply.Refresh(5000)) { return false; } if (item == null || item.Item == null) { SelectYesno.ClickNo(); await masterpieceSupply.CloseInstanceGently(15); return false; } StatusText = Localization.Localization.ExTurnInCollectable_TurnIn; var itemName = item.Item.CurrentLocaleName; if (!await masterpieceSupply.TurnInAndHandOver(index, item)) { Logger.Error(Localization.Localization.ExTurnInCollectable_TurnInError); Blacklist.Add( (uint) item.Pointer.ToInt32(), BlacklistFlags.Loot, TimeSpan.FromMinutes(3), Localization.Localization.ExTurnInCollectable_TurnInBlackList); item = null; index = 0; if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); await Coroutine.Sleep(200); } if (Request.IsOpen) { Request.Cancel(); await Coroutine.Sleep(200); } return true; } Logger.Info(Localization.Localization.ExTurnInCollectable_TurnInSuccessful, itemName, WorldManager.EorzaTime); turnedItemsIn = true; index = 0; if (!await Coroutine.Wait(1000, () => item == null)) { item = null; } return true; }
private async Task<bool> HandOver() { var masterpieceSupply = new MasterPieceSupply(); if (!masterpieceSupply.IsValid && !await masterpieceSupply.Refresh(2000)) { return false; } if (item == null || item.Item == null) { SelectYesno.ClickNo(); await masterpieceSupply.CloseInstanceGently(15); return false; } StatusText = "Turning in items"; var itemName = item.Item.EnglishName; if (!await masterpieceSupply.TurnInAndHandOver(index, item)) { Logger.Error("An error has occured while turning in the item"); Blacklist.Add( (uint)item.Pointer.ToInt32(), BlacklistFlags.Loot, TimeSpan.FromMinutes(3), "Don't turn in this item for 3 minutes"); item = null; index = 0; if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); await Coroutine.Sleep(200); } if (Request.IsOpen) { Request.Cancel(); await Coroutine.Sleep(200); } return true; } Logger.Info("Turned in {0} at {1} ET", itemName, WorldManager.EorzaTime); turnedItemsIn = true; index = 0; if (!await Coroutine.Wait(1000, () => item == null)) { item = null; } return true; }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt64(), BlacklistFlags.Loot)).ToArray(); Dictionary <string, uint> BlackListDictionnary = new Dictionary <string, uint> { { "Fire Moraine", 5214 }, { "Lightning Moraine", 5218 }, { "Radiant Fire Moraine", 5220 }, { "Radiant Lightning Moraine", 5224 }, { "Bright Fire Rock", 12966 }, { "Bright Lightning Rock", 12967 }, { "Granular Clay", 12968 }, { "Peat Moss", 12969 }, { "Black Soil", 12970 }, { "Highland Oregano", 12971 }, { "Furymint", 12972 }, { "Clary Sage", 12973 }, { "Lover's Laurel", 15948 }, { "Radiant Astral Moraine", 15949 }, { "Dated Radz-at-Han Coin", 17557 }, { "Ice Stalagmite", 17558 }, { "Duskfall Moss", 17559 }, { "Glass Eye", 17560 }, { "Rainbow Pigment", 17561 }, { "Thavnairian Leaf", 17562 }, { "Ghost Faerie", 17563 }, { "Red Sky Coral", 17564 }, { "Lovers' Clam", 17565 }, { "River Shrimp", 17566 }, { "Windtea Leaves", 19916 }, { "Torreya Branch", 19937 }, { "Schorl", 20009 }, { "Perlite", 20010 }, { "Almandine", 20011 }, { "Doman Yellow", 20012 } }; if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0 && !BlackListDictionnary.ContainsValue(i.RawItemId)); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }
private async Task <bool> ResolveItem() { if (item != null) { return(false); } var slots = InventoryManager.FilledInventoryAndArmory.Where( i => !Blacklist.Contains((uint)i.Pointer.ToInt32(), BlacklistFlags.Loot)).ToArray(); if (Collectables == null) { item = slots.FirstOrDefault(i => i.Collectability > 0); } else { foreach (var collectable in Collectables) { var bagslots = slots.Where(i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn).ToArray(); if (collectable.Id > 0) { item = bagslots.FirstOrDefault(i => i.RawItemId == collectable.Id); } item = item ?? bagslots.FirstOrDefault( i => string.Equals(collectable.LocalName, i.Name, StringComparison.InvariantCultureIgnoreCase)) ?? bagslots.FirstOrDefault( i => string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose(Localization.Localization.ExTurnInCollectable_AttemptingTurnin, item.EnglishName, item.Pointer.ToString("X8")); return(false); } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return(false); } if (SelectYesno.IsOpen) { SelectYesno.ClickNo(); } if (Request.IsOpen) { Request.Cancel(); } var masterpieceSupply = new MasterPieceSupply(); if (masterpieceSupply.IsValid) { await masterpieceSupply.CloseInstanceGently(); } var shopExchangeCurrency = new ShopExchangeCurrency(); if (shopExchangeCurrency.IsValid) { await shopExchangeCurrency.CloseInstanceGently(); } if (SelectIconString.IsOpen) { SelectIconString.ClickSlot(uint.MaxValue); } return(isDone = true); }