public static bool FilterStackable(BagSlot item) { if (item.IsCollectable) { return(false); } if (item.Item.StackSize < 2) { return(false); } if (item.Count == item.Item.StackSize) { return(false); } return(true); }
private async Task EquipWeapons(int[] weapons) { foreach (var weapon in weapons) { var itemRole = DataManager.GetItem((uint)weapon).ItemRole; BagSlot EquipSlot = ff14bot.Managers.InventoryManager.GetBagByInventoryBagId(ff14bot.Enums.InventoryBagId.EquippedItems)[ff14bot.Enums.EquipmentSlot.MainHand]; if (itemRole == ItemRole.Shield) { EquipSlot = ff14bot.Managers.InventoryManager.GetBagByInventoryBagId(ff14bot.Enums.InventoryBagId.EquippedItems)[ff14bot.Enums.EquipmentSlot.OffHand]; } var item1 = ff14bot.Managers.InventoryManager.FilledInventoryAndArmory.FirstOrDefault(i => i.RawItemId == (uint)weapon); if (item1 != default(BagSlot)) { item1.Move(EquipSlot); } } _isDone = true; }
public static bool Split(this BagSlot bagSlot, int amount) { if (bagSlot.Count > amount) { lock (Core.Memory.Executor.AssemblyLock) { using (Core.Memory.TemporaryCacheState(false)) { return(Core.Memory.CallInjected64 <uint>(Offsets.ItemSplitFunc, new object[4] { Offsets.ItemFuncParam, (uint)bagSlot.BagId, bagSlot.Slot, amount }) == 0); } } } return(false); }
public static void RetainerRetrieveQuantity(this BagSlot bagSlot, int amount) { if (bagSlot.Count < amount) { amount = (int)bagSlot.Count; } lock (Core.Memory.Executor.AssemblyLock) { using (Core.Memory.TemporaryCacheState(false)) { Core.Memory.CallInjected64 <uint>(Offsets.RetainerRetrieveQuantity, new object[4] { Offsets.ItemFuncParam, (uint)bagSlot.BagId, bagSlot.Slot, amount }); } } }
public static bool LowerQuality(this BagSlot bagSlot) { if (bagSlot.IsHighQuality || bagSlot.IsCollectable) { lock (Core.Memory.Executor.AssemblyLock) { using (Core.Memory.TemporaryCacheState(false)) { Core.Memory.CallInjected64 <uint>(Offsets.ItemLowerQualityFunc, new object[3] { Offsets.ItemFuncParam, (uint)bagSlot.BagId, bagSlot.Slot, }); } } return(!bagSlot.IsHighQuality); } return(false); }
private void PopulateSlots() { if (optionIndex == 0) { maxPage = Mathf.CeilToInt(catalog.Length / 8F); } else { maxPage = Mathf.CeilToInt(Bag.Instance.bag.slots.Length / 8F); } int numSlot = 0; for (int i = (page * slots.Length); i < ((page + 1) * slots.Length); i++) { BagSlot bagSlot = Bag.Instance.bag.slots[i]; Item item = (optionIndex == 0) ? ((i < catalog.Length) ? catalog[i] : null) : bagSlot.item; if (item != null) { slots[numSlot].transform.GetChild(0).gameObject.SetActive(true); slots[numSlot].transform.GetChild(0).GetComponent <Image>().sprite = item.sprite; slots[numSlot].transform.GetChild(1).GetComponent <Text>().text = item.itemName; if (optionIndex == 0) { slots[numSlot].transform.GetChild(2).GetComponent <Text>().text = item.price.ToString(); } else { slots[numSlot].transform.GetChild(2).GetComponent <Text>().text = bagSlot.amount.ToString(); } } else // NO ITEM IN THIS POSITION { slots[numSlot].transform.GetChild(0).gameObject.SetActive(false); slots[numSlot].transform.GetChild(1).GetComponent <Text>().text = "__________"; slots[numSlot].transform.GetChild(2).GetComponent <Text>().text = "-"; } numSlot++; } }
private void AddBags(Character character) { for (int i = 0; i < _characterImportModel.BagImportModels.Count; i++) { var bagImportModel = _characterImportModel.BagImportModels[i]; if (i > 1 && bagImportModel.BagName == string.Empty) { continue; } var itemId = i > 1 ? GetItemId(bagImportModel.BagName, _characterImportModel.Localization) : null; var bag = new Bag() { Id = Guid.NewGuid(), isBank = i == 0 || i > 5, CharacterId = character.Id, ItemId = itemId, BagContainerId = Int32.Parse(bagImportModel.Container) }; foreach (var bagItemImportModel in bagImportModel.BagItemImportModels) { var bagSlot = new BagSlot() { BagId = bag.Id, ItemId = bagItemImportModel.ItemId, SlotId = bagItemImportModel.BagSlot, Quantity = bagItemImportModel.Quantity }; bag.BagSlots.Add(bagSlot); } character.Bags.Add(bag); } }
private async Task <bool> Main() { if (Core.Player.IsMounted) { await CommonTasks.StopAndDismount(); } if (Core.Player.InCombat) { await Coroutine.Wait(5000, () => !Core.Player.InCombat); return(true); } await Coroutine.Sleep(Delay); if (GearSet > 0) { if (GearsetManager.ActiveGearset.Index == GearSet) { Log("Desired Gearset is already active"); _done = true; return(false); } foreach (var gs in GearsetManager.GearSets) { if (gs.Index == GearSet) { Log($"Changing your Gearset to {gs.Class}."); gs.Activate(); } } } if (Aura > 0) { string thisAura = null; var auraId = Core.Player.GetAuraById((uint)Aura); if (Core.Player.HasAura((uint)Aura)) { thisAura = auraId.LocalizedName; } else { _done = true; return(false); } Log($"Removing Aura {thisAura}."); ChatManager.SendChat("/statusoff \"" + thisAura + "\""); } if (DoAction != null) { Log($"Using {DoAction} on Player."); ChatManager.SendChat("/ac \"" + DoAction + "\" <me>"); } if (DoActionTarget != null) { Log($"Using {DoActionTarget} on Current Target."); ChatManager.SendChat("/ac \"" + DoActionTarget + "\" <target>"); } if (Say != null) { Log($"Saying {Say}."); ChatManager.SendChat("/s " + Say); } if (Emote != null) { if (NpcId > 0) { var obj = GameObjectManager.GetObjectByNPCId((uint)NpcId); Log($"Targeting {obj.EnglishName}."); obj.Target(); } Log($"Using the {Emote} Emote."); ChatManager.SendChat("/" + Emote); } if (QuestItem > 0 && XYZ != null) { BagSlot item = InventoryManager.FilledSlots.FirstOrDefault(r => r.RawItemId == QuestItem); Log($"Using {item.EnglishName} on {XYZ.ToString()}."); ActionManager.DoActionLocation(Enums.ActionType.KeyItem, (uint)QuestItem, XYZ); await Coroutine.Wait(10000, () => !Core.Player.IsCasting); } await Coroutine.Sleep(Delay); if (QuestId > 0 && StepId > 0) { return(false); } else { _done = true; } return(false); }
public BagSlotSnapshot(BagSlot slot) { }
protected override void DoReset() { turnedItemsIn = false; item = null; index = 0; }
// the below is obtained from Athlon's RBTrust addon private static bool IsFoodItem(this BagSlot slot) => (slot.Item.EquipmentCatagory == ItemUiCategory.Meal);
private static bool ExtraCheck(BagSlot bs) { return(ReduceSettings.Instance.IncludeDE10000 && bs.Item.RequiredLevel < 70 || bs.Item.DesynthesisIndex < 10000); //return false; }
public static async Task Plant(int GardenIndex, int PlantIndex, BagSlot seeds, BagSlot soil) { var plants = GardenManager.Plants.Where(i => i.Distance(Core.Me.Location) < 10); EventObject plant = null; foreach (var tmpPlant in plants) { var _GardenIndex = Lua.GetReturnVal <int>($"return _G['{plant.LuaString}']:GetHousingGardeningIndex();"); if (_GardenIndex != GardenIndex) { continue; } var _PlantIndex = Lua.GetReturnVal <int>($"return _G['{plant.LuaString}']:GetHousingGardeningPlantIndex();"); if (_PlantIndex != PlantIndex) { continue; } var _Plant = DataManager.GetItem(Lua.GetReturnVal <uint>($"return _G['{plant.LuaString}']:GetHousingGardeningPlantCrop();")); if (_Plant != null) { plant = tmpPlant; break; } } if (plant != null) { await Plant(plant, seeds, soil); } }
private async Task<bool> HandOver() { var ticks = 0; var window = RaptureAtkUnitManager.GetWindowByName("MasterPieceSupply"); while (window == null && ticks < 60 && Behaviors.ShouldContinue) { RaptureAtkUnitManager.Update(); window = RaptureAtkUnitManager.GetWindowByName("MasterPieceSupply"); await Coroutine.Yield(); ticks++; } if (ticks >= 60) { return false; } if (item == null || item.Item == null) { SelectYesno.ClickNo(); if (window == null) { return false; } window.TrySendAction(1, 3, uint.MaxValue); return false; } if (SelectYesno.IsOpen) { Logging.Write(Colors.Red, "Full on scrips!"); Blacklist.Add((uint)item.Pointer.ToInt32(), BlacklistFlags.Loot, TimeSpan.FromMinutes(3), "Don't turn in this item for 3 minutes, we are full on these scrips"); item = null; index = 0; SelectYesno.ClickNo(); window.TrySendAction(1, 3, uint.MaxValue); return true; } var requestAttempts = 0; while (!Request.IsOpen && requestAttempts < 5 && Behaviors.ShouldContinue) { var result = window.TrySendAction(2, 0, 0, 1, index); if (result == SendActionResult.InjectionError) { await Coroutine.Sleep(1000); } await Coroutine.Wait(1500, () => Request.IsOpen); requestAttempts++; } if (!Request.IsOpen) { Logging.Write(Colors.Red, "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, most likely it isn't a turn in option today."); item = null; index = 0; SelectYesno.ClickNo(); window.TrySendAction(1, 3, uint.MaxValue); return true; } if (item == null || item.Item == null) { Logging.Write(Colors.Red, "The item has become null between the time we resolved it and tried to turn it in..."); item = null; index = 0; await Coroutine.Yield(); return true; } var attempts = 0; var itemName = item.Item.EnglishName; while (Request.IsOpen && attempts < 5 && Behaviors.ShouldContinue && item.Item != null) { item.Handover(); await Coroutine.Sleep(1000); Request.HandOver(); await Coroutine.Wait(4000, () => !Request.IsOpen); attempts++; } if (attempts < 5) { Logging.Write( Colors.SpringGreen, "Turned in {0} at {1} ET", itemName, WorldManager.EorzaTime); turnedItemsIn = true; item = null; index = 0; await Coroutine.Yield(); return true; } Logging.Write(Colors.Red, "Too many attempts"); Blacklist.Add((uint)item.Pointer.ToInt32(), BlacklistFlags.Loot, TimeSpan.FromMinutes(3), "Don't turn in this item for 3 minutes, something is wrong."); Request.Cancel(); SelectYesno.ClickNo(); window.TrySendAction(1, 3, uint.MaxValue); return true; }
protected override void OnResetCachedDone() { isDone = false; turnedItemsIn = false; item = null; index = 0; }
private async Task<bool> ResolveItem() { if (item != null) { return false; } var slots = InventoryManager.FilledSlots.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) { item = slots.FirstOrDefault( i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn && string.Equals( collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); } } if ((item == null || item.Item == null) && ((!turnedItemsIn && !ForcePurchase) || await HandleSkipPurchase())) { isDone = true; return true; } // if we do resolve the item, return false so we just move on. return false; }
private async Task<bool> ResolveItem() { if (item != null) { return false; } var slots = InventoryManager.FilledSlots.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) { item = slots.FirstOrDefault( i => i.Collectability >= collectable.Value && i.Collectability <= collectable.MaxValueForTurnIn && string.Equals(collectable.Name, i.EnglishName, StringComparison.InvariantCultureIgnoreCase)); if (item != null) { break; } } } if (item != null && item.Item != null) { Logger.Verbose("Attempting to turn in item {0} -> 0x{1}", item.EnglishName, item.Pointer.ToString("X8")); return false; } if ((turnedItemsIn || ForcePurchase) && !await HandleSkipPurchase()) { return false; } isDone = true; 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; }
public BaseItem PickupItem(int mapItemId, Client c, short mapItemAmount) { MapItem m = null; try { m = mapItems.Where(x => x.MapItemID == mapItemId).First(); } catch (Exception) { return(null); } BaseItem item = null; if (m.DroppedByCharacterID == 0 || m.DroppedByCharacterID == c.MyCharacter.CharacterId) { if (m.bType != (byte)bType.Jeon) { if (m.ItemID != 0) { item = itemDataManager.GetItemByItemID(m.ItemID); } else { item = itemDataManager.GetItemByReferenceID(m.ReferenceID); } BagSlot bagSlot = gameEngine.TryPickToBags(c.MyCharacter.Bags.ToArray(), item); item.Slot = bagSlot.Slot; item.Bag = bagSlot.Bag; mapItemManager.DeleteMapItem(m.MapItemID, 0); mapItems.Remove(m); item.OwnerID = c.MyCharacter.CharacterId; if (item.ItemID != 0) { itemDataManager.UpdateItem(item); } else { item.ItemID = itemDataManager.InsertItem(item); if (item is Equipment) { // later add chance to get these items blabla Equipment Item = item as Equipment; ImbueStat stat = ImbueStat.None; ImbueItem imbueitem = new ImbueItem { ImbueChance = 1, IncreaseValue = 1, }; // Possible plus for drop if (XiahRandom.PercentSuccess(40)) { int plus = gameEngine.RandomChance(0, 5); for (int i = 0; i < plus; i++) { gameEngine.BlackImbue(Item, ref stat, imbueitem, 1); Item.Plus++; } } if (XiahRandom.PercentSuccess(40)) { // Possible slvl for drop int slvl = gameEngine.RandomChance(0, 5); for (int i = 0; i < slvl && !(Item is Cape); i++) { gameEngine.WhiteImbue(Item, ref stat, imbueitem); Item.Slvl++; } } item = Item; itemDataManager.UpdateItem(item); } } } else { item = itemDataManager.GetItemByReferenceID(m.ReferenceID); mapItemManager.DeleteMapItem(m.MapItemID, 0); mapItems.Remove(m); item.Amount = mapItemAmount; } } else { c.Send(PacketEngine.PacketManager.SendPickUpText(0, 0, 0)); // send pickuperror blabal } return(item); }
/// <summary> /// Searches /// </summary> /// <param name="slot"></param> /// <returns></returns> protected virtual bool GetItemFilter(BagSlot slot) { return(slot.RawItemId == this.itemKey.Id && (slot.IsHighQuality == this.itemKey.Hq)); }
public async Task <bool> TurnInAndHandOver(uint index, BagSlot bagSlot, byte attempts = 20, ushort interval = 200) { var result = SendActionResult.None; var requestAttempts = 0; while (result != SendActionResult.Success && !Request.IsOpen && requestAttempts++ < attempts && Behaviors.ShouldContinue) { result = TurnIn(index); if (result == SendActionResult.InjectionError) { await Behaviors.Sleep(interval); } await Behaviors.Wait(interval, () => Request.IsOpen); } if (requestAttempts > attempts) { return(false); } await Behaviors.Sleep(interval); // Try waiting half of the overall set time, up to 3 seconds if (!Request.IsOpen) { if (!await Coroutine.Wait(Math.Min(3000, (interval * attempts) / 2), () => Request.IsOpen)) { Logger.Instance.Warn( Localization.Localization.MasterPieceSupply_CollectabilityValueNotEnough, bagSlot.Collectability, bagSlot.EnglishName); return(false); } } if (Memory.Request.ItemId1 != bagSlot.RawItemId) { Request.Cancel(); var item = DataManager.GetItem(Memory.Request.ItemId1); Logger.Instance.Warn( Localization.Localization.MasterPieceSupply_CannotTurnIn, bagSlot.EnglishName, item.EnglishName); return(false); } requestAttempts = 0; while (Request.IsOpen && requestAttempts++ < attempts && Behaviors.ShouldContinue && bagSlot.Item != null) { bagSlot.Handover(); await Behaviors.Wait(interval, () => Request.HandOverButtonClickable); Request.HandOver(); await Behaviors.Wait(interval, () => !Request.IsOpen || SelectYesno.IsOpen); } if (SelectYesno.IsOpen) { Logger.Instance.Warn(Localization.Localization.MasterPieceSupply_FullScrips, bagSlot.EnglishName); return(false); } return(!Request.IsOpen); }
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; }
protected override void DoReset() { turnedItemsIn = false; item = null; index = 0; }
private static bool IsFoodItem(this BagSlot slot) { return(slot.Item.EquipmentCatagory == ItemUiCategory.Meal || slot.Item.EquipmentCatagory == ItemUiCategory.Ingredient); }
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); }
private async Task <bool> Eatfood() { uint auraId = 0; bool waitForAura = false; bool shouldEat = false; bool alreadyPresent = false; if (expectedAura != null) { auraId = expectedAura.Id; waitForAura = true; if (Core.Me.HasAura(auraId)) { var auraInfo = Core.Player.GetAuraById(auraId); if (auraInfo.TimespanLeft.TotalMinutes < MinDuration) { shouldEat = true; alreadyPresent = true; } } else { shouldEat = true; } } else { shouldEat = true; } BagSlot itemslot = null; if (shouldEat) { itemslot = findItem(); if (itemslot == null) { shouldEat = false; // silent exit Log(System.Windows.Media.Color.FromRgb(0xCC, 0, 0), string.Format("We don't have any {0}{1} {2} in our inventory. Can't eat anymore." , (HqOnly ? "[HQ] " : "") , itemData.CurrentLocaleName, itemData.Id)); } } if (shouldEat) { if (CraftingLog.IsOpen || CraftingManager.IsCrafting) { await Coroutine.Wait(Timeout.InfiniteTimeSpan, () => CraftingLog.IsOpen); await Coroutine.Sleep(1000); CraftingLog.Close(); await Coroutine.Yield(); await Coroutine.Wait(Timeout.InfiniteTimeSpan, () => !CraftingLog.IsOpen); await Coroutine.Wait(Timeout.InfiniteTimeSpan, () => !CraftingManager.AnimationLocked); } Log("Waiting until the item is usable."); await Coroutine.Wait(Timeout.InfiniteTimeSpan, () => itemslot.CanUse(null)); Log("Eating {0}", itemData.CurrentLocaleName); itemslot.UseItem(); await Coroutine.Sleep(5000); if (waitForAura) { if (!alreadyPresent) { Log("Waiting for the aura to appear"); await Coroutine.Wait(Timeout.InfiniteTimeSpan, () => Core.Player.HasAura(auraId)); } else { Log("Waiting until the duration is refreshed"); await Coroutine.Wait(Timeout.InfiniteTimeSpan, () => Core.Player.GetAuraById(auraId).TimespanLeft.TotalMinutes > MinDuration); } } } _IsDone = true; return(true); }
public MarkedBagSlot(BagSlot slot) { BagSlot = slot; BeingTraded = false; }
public void SlotClick(BattleSlot battleSlot) { if (_selectBattleSlot == null) { if (_selectBagSlot != null) { _selectBagSlot.Deselect(); _selectBagSlot = null; } _selectBattleSlot = battleSlot; battleSlot.Select(); } else //has selected a battleSlot { if (_selectBattleSlot.Index == battleSlot.Index) //Click the same slot,deselect { battleSlot.Deselect(); _selectBattleSlot = null; } else if (_selectBattleSlot.concreteCard == null) { _selectBattleSlot.Deselect(); _selectBattleSlot = battleSlot; _selectBattleSlot.Select(); } else { _selectBattleSlot.Deselect(); ConcreteCard first = _selectBattleSlot.concreteCard, second = battleSlot.concreteCard; int indexFst = _selectBattleSlot.Index, indexSec = battleSlot.Index; _player.playCardSet [indexFst] = second; _player.playCardSet [indexSec] = first; HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { if (second != null) { _selectBattleSlot.LoadConcreteCard(second); HOTween.To(_selectBattleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); _selectBattleSlot = null; })); } else { _shieldPanel.Deactivate(); _selectBattleSlot.Unload(); _selectBattleSlot = null; } })); HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 0f).Ease(EaseType.Linear).OnStart(() => { _shieldPanel.Activate(); }).OnComplete(() => { battleSlot.LoadConcreteCard(first); HOTween.To(battleSlot.slotBody, _fadeDuration, new TweenParms().Prop("alpha", 1f).Ease(EaseType.Linear).OnComplete(() => { _shieldPanel.Deactivate(); })); })); } } }
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); }
public void SlotShowDetail(BagSlot bagSlot) { SlotShowDetail(bagSlot.concreteCard); }
private bool ExtraCheck(BagSlot bs) { return(ReduceSettings.Instance.IncludeDE10000 && bs.Item.DesynthesisIndex < 10000); //return false; }
private void SetComboBoxes(BagSlot slot) { var list = MateriaBase.Materia(slot); //var inventoryMateria = bindingSourceInventoryMateria.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia); // var materia = InventoryManager.FilledSlots.Where(i=> i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); switch (list.Count) { case 0: MateriaCb1.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb1.Enabled = true; MateriaCb1.DisplayMember = "Name"; MateriaCb2.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb2.Enabled = true; MateriaCb2.DisplayMember = "Name"; MateriaCb3.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb3.Enabled = true; MateriaCb3.DisplayMember = "Name"; MateriaCb4.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb4.Enabled = true; MateriaCb4.DisplayMember = "Name"; MateriaCb5.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb5.Enabled = true; MateriaCb5.DisplayMember = "Name"; break; case 1: MateriaCb1.DataSource = list.ToArray(); MateriaCb1.SelectedIndex = 0; MateriaCb1.DisplayMember = "ItemName"; MateriaCb1.Refresh(); MateriaCb1.Enabled = false; MateriaCb2.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb2.DisplayMember = "Name"; MateriaCb3.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb3.DisplayMember = "Name"; MateriaCb4.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb4.DisplayMember = "Name"; MateriaCb5.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb5.DisplayMember = "Name"; MateriaCb2.Enabled = true; MateriaCb3.Enabled = true; MateriaCb4.Enabled = true; MateriaCb5.Enabled = true; break; case 2: MateriaCb1.DataSource = list.ToArray(); MateriaCb1.SelectedIndex = 0; MateriaCb1.DisplayMember = "ItemName"; MateriaCb1.Refresh(); MateriaCb1.Enabled = false; MateriaCb2.DataSource = list.ToArray(); MateriaCb2.SelectedIndex = 1; MateriaCb2.DisplayMember = "ItemName"; MateriaCb2.Enabled = false; MateriaCb3.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb3.DisplayMember = "Name"; MateriaCb4.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb4.DisplayMember = "Name"; MateriaCb5.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb5.DisplayMember = "Name"; MateriaCb3.Enabled = true; MateriaCb4.Enabled = true; MateriaCb5.Enabled = true; break; case 3: MateriaCb1.DataSource = list.ToArray(); MateriaCb1.SelectedIndex = 0; MateriaCb1.DisplayMember = "ItemName"; MateriaCb1.Refresh(); MateriaCb1.Enabled = false; MateriaCb2.DataSource = list.ToArray(); MateriaCb2.SelectedIndex = 1; MateriaCb2.DisplayMember = "ItemName"; MateriaCb2.Enabled = false; MateriaCb3.DataSource = list.ToArray(); MateriaCb3.SelectedIndex = 2; MateriaCb3.DisplayMember = "ItemName"; MateriaCb3.Enabled = false; MateriaCb4.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb4.DisplayMember = "Name"; MateriaCb5.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb5.DisplayMember = "Name"; MateriaCb4.Enabled = true; MateriaCb5.Enabled = true; break; case 4: MateriaCb1.DataSource = list.ToArray(); MateriaCb1.SelectedIndex = 0; MateriaCb1.DisplayMember = "ItemName"; MateriaCb1.Refresh(); MateriaCb1.Enabled = false; MateriaCb2.DataSource = list.ToArray(); MateriaCb2.SelectedIndex = 1; MateriaCb2.DisplayMember = "ItemName"; MateriaCb2.Enabled = false; MateriaCb3.DataSource = list.ToArray(); MateriaCb3.SelectedIndex = 2; MateriaCb3.DisplayMember = "ItemName"; MateriaCb3.Enabled = false; MateriaCb4.Enabled = false; MateriaCb4.DataSource = list.ToArray(); MateriaCb4.SelectedIndex = 3; MateriaCb4.DisplayMember = "ItemName"; MateriaCb5.DataSource = InventoryManager.FilledSlots.Where(i => i.Item.EquipmentCatagory == ItemUiCategory.Materia).ToList(); MateriaCb5.DisplayMember = "Name"; MateriaCb5.Enabled = true; break; default: break; } }
public static async Task InventoryEquipBest(bool updateGearSet = true, bool useRecommendEquip = true) { await StopBusy(leaveDuty : false, dismount : false); if (!Character.Instance.IsOpen) { AgentCharacter.Instance.Toggle(); await Coroutine.Wait(5000, () => Character.Instance.IsOpen); } foreach (var bagSlot in InventoryManager.EquippedItems) { if (!bagSlot.IsValid) { continue; } if (bagSlot.Slot == 0 && !bagSlot.IsFilled) { Log("MainHand slot isn't filled. How?"); continue; } Item currentItem = bagSlot.Item; List <ItemUiCategory> category = GetEquipUiCategory(bagSlot.Slot); float itemWeight = bagSlot.IsFilled ? ItemWeight.GetItemWeight(bagSlot.Item) : -1; BagSlot betterItem = InventoryManager.FilledInventoryAndArmory .Where(bs => category.Contains(bs.Item.EquipmentCatagory) && bs.Item.IsValidForCurrentClass && bs.Item.RequiredLevel <= Core.Me.ClassLevel && bs.BagId != InventoryBagId.EquippedItems) .OrderByDescending(r => ItemWeight.GetItemWeight(r.Item)) .FirstOrDefault(); /* * Log($"# of Candidates: {betterItemCount}"); * if (betterItem != null) Log($"{betterItem.Name}"); * else Log("Betteritem was null."); */ if (betterItem == null || !betterItem.IsValid || !betterItem.IsFilled || betterItem == bagSlot || itemWeight >= ItemWeight.GetItemWeight(betterItem.Item)) { continue; } Log(bagSlot.IsFilled ? $"Equipping {betterItem.Name} over {bagSlot.Name}." : $"Equipping {betterItem.Name}."); betterItem.Move(bagSlot); await Coroutine.Wait(3000, () => bagSlot.Item != currentItem); if (bagSlot.Item == currentItem) { Log("Something went wrong. Item remained unchanged."); continue; } await Coroutine.Sleep(500); } if (useRecommendEquip) { if (!RecommendEquip.Instance.IsOpen) { AgentRecommendEquip.Instance.Toggle(); } await Coroutine.Wait(1500, () => RecommendEquip.Instance.IsOpen); RecommendEquip.Instance.Confirm(); await Coroutine.Sleep(500); } if (updateGearSet) { await UpdateGearSet(); } Character.Instance.Close(); if (!await Coroutine.Wait(800, () => !Character.Instance.IsOpen)) { AgentCharacter.Instance.Toggle(); } }
/// <summary> /// place item in specified slot. return false if the slot is occupied. /// will only allow count>1 if the item can stack /// </summary> public bool SetBagSlot(RPGItem item, int slot, int count) { CheckBagSize(); // again, cant depend on slot being null (see reason inside AddToBag() comments) if (bag[slot] != null) { if (bag[slot].stack != 0) return false; } int added = count; bag[slot] = new BagSlot(); bag[slot].item = item; bag[slot].stack = count; // check if stack size allowed if (bag[slot].stack > item.maxStack) { added -= (bag[slot].stack - item.maxStack); bag[slot].stack = item.maxStack; } for (int i = 0; i < added; i++) { UniRPGGameController.ExecuteActions(bag[slot].item.onAddedToBag, bag[slot].item.gameObject, null, gameObject, null, null, false); } return true; }
public static bool IsFullStack(this BagSlot bagSlot, bool includeNonStackable = false) { return(bagSlot != null && bagSlot.Item != null && bagSlot.IsFilled && (bagSlot.Count == bagSlot.Item.StackSize && (includeNonStackable || bagSlot.Item.StackSize > 1))); }
/// <summary> /// add the item to the first open bag slot. will auto stack if item can stack</summary> /// will add as many copies of item as possible as indicated by count /// If autoIncSize=true then will increase the bagSize if too small to hold new item (usefull for shopkeeper's bags which dont need set size) /// </summary> public bool AddToBag(RPGItem item, int count, bool autoIncSize) { if (count <= 0 || item == null) return false; //bool allGood = false; CheckBagSize(); // 1st check if item can stack and if same type in bag if (item.maxStack > 1) { foreach (BagSlot slot in bag) { if (count <= 0) break; if (slot == null) continue; if (slot.stack == 0) continue; if (slot.item == item && slot.stack < item.maxStack) { // found a spot where item can be placed int canTake = item.maxStack - slot.stack; if (count >= canTake) { count -= canTake; slot.stack += canTake; UniRPGGameController.ExecuteActions(item.onAddedToBag, item.gameObject, null, gameObject, null, null, false); //allGood = true; } else { slot.stack += count; count = 0; UniRPGGameController.ExecuteActions(item.onAddedToBag, item.gameObject, null, gameObject, null, null, false); //allGood = true; break; } } } } // find open slot(s) to place the item into if (count > 0) { for (int slot = 0; slot < bag.Count; slot++) { if (count <= 0) break; // cant use null to check if slot is empty cause unity's serialize seems to be creating empty objects for me // so i cant be sure that empty slots will be null, but I can do next best thing and check stack if (bag[slot] != null) { if (bag[slot].stack != 0) continue; } bag[slot] = new BagSlot(); bag[slot].item = item; if (item.maxStack > 1) { if (count >= item.maxStack) { count -= item.maxStack; bag[slot].stack = item.maxStack; UniRPGGameController.ExecuteActions(item.onAddedToBag, item.gameObject, null, gameObject, null, null, false); //allGood = true; } else { bag[slot].stack = count; count = 0; UniRPGGameController.ExecuteActions(item.onAddedToBag, item.gameObject, null, gameObject, null, null, false); //allGood = true; break; } } else { bag[slot].stack = 1; count--; UniRPGGameController.ExecuteActions(item.onAddedToBag, item.gameObject, null, gameObject, null, null, false); //allGood = true; } } if (autoIncSize && count > 0) { bagSize++; // simply add a slot and call Add again since it will make call to CheckBagSize(); AddToBag(item, count, autoIncSize); } } //if (allGood) //{ // UniRPGGameController.ExecuteActions(item.onAddedToBag, item.gameObject, null, gameObject, null, null, false); //} return (count <= 0); }
public static async Task <bool> AffixMateria(BagSlot bagSlot, List <BagSlot> materiaList) { Log($"MateriaList count {materiaList.Count}"); if (bagSlot != null && bagSlot.IsValid) { Log($"Want to affix Materia to {bagSlot}"); for (int i = 0; i < materiaList.Count; i++) { if (materiaList[i] == null) { continue; } Log($"Want to affix materia {i} {materiaList[i]}"); if (!materiaList[i].IsFilled) { continue; } int count = MateriaCount(bagSlot); while (materiaList[i].IsFilled && (count == MateriaCount(bagSlot))) { if (!MateriaAttach.Instance.IsOpen) { bagSlot.OpenMeldInterface(); await Coroutine.Wait(5000, () => MateriaAttach.Instance.IsOpen); if (!MateriaAttach.Instance.IsOpen) { Log($"Can't open meld window"); return(false); } MateriaAttach.Instance.ClickItem(0); await Coroutine.Sleep(1000); MateriaAttach.Instance.ClickMateria(0); await Coroutine.Sleep(1000); await Coroutine.Wait(5000, () => MateriaAttachDialog.Instance.IsOpen); } if (!MateriaAttachDialog.Instance.IsOpen) { MateriaAttach.Instance.ClickItem(0); await Coroutine.Sleep(1000); MateriaAttach.Instance.ClickMateria(0); await Coroutine.Sleep(1000); await Coroutine.Wait(5000, () => MateriaAttachDialog.Instance.IsOpen); if (!MateriaAttachDialog.Instance.IsOpen) { Log($"Can't open meld dialog"); return(false); } } //Log($"{Offsets.AffixMateriaFunc.ToInt64():X} {Offsets.AffixMateriaParam.ToInt64():X} {bagSlot.Pointer.ToInt64():X} {materiaList[i].Pointer.ToInt64():X}"); bagSlot.AffixMateria(materiaList[i]); await Coroutine.Sleep(7000); await Coroutine.Wait(7000, () => MateriaAttach.Instance.IsOpen || MateriaAttachDialog.Instance.IsOpen); } if (!materiaList[i].IsFilled) { return(false); } } } return(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; }
private void itemCb_SelectionChangeCommitted(object sender, EventArgs e) { _selectedBagSlot = (BagSlot)itemCb.SelectedItem; materiaListBox.DataSource = MateriaBase.Materia(_selectedBagSlot); materiaListBox.DisplayMember = "ItemName"; }
private void MoveItem(BagSlot source, BagSlot destination) { Logger.Verbose( "Moving {0} {1} from [{2},{3}] to [{4},{5}]", Math.Min(99 - destination.Count, source.Count), source.IsHighQuality ? source.EnglishName + " HQ" : source.EnglishName, (int)source.BagId, source.Slot, (int)destination.BagId, destination.Slot); source.Move(destination); }
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; }
public virtual void LoadState(string key) { bool failed = true; // helper // tell actor class to load ActorClass.LoadState(key); // load some misc things this.currency = UniRPGGlobal.LoadInt(key + "act_c", this.currency); // load bag/inventory bagSize = UniRPGGlobal.LoadInt(key + "act_bags", 0); int count = UniRPGGlobal.LoadInt(key + "act_bag", 0); if (count > 0 && bagSize > 0) { bag = new List<BagSlot>(bagSize); for (int i = 0; i < bagSize; i++) { if (i < count) { failed = true; string v = UniRPGGlobal.LoadString(key + "act_b" + i, null); if (!string.IsNullOrEmpty(v)) { string[] vs = v.Split('|'); if (vs.Length == 2) { GUID id = new GUID(vs[0]); if (id != null) { if (UniRPGGlobal.DB.RPGItems.ContainsKey(id.Value)) { int cnt = 0; if (int.TryParse(vs[1], out cnt)) { BagSlot slot = new BagSlot() { item = UniRPGGlobal.DB.RPGItems[id.Value], stack = cnt }; bag.Add(slot); failed = false; } } } } } if (failed) { Debug.LogWarning(count+"Actor LoadState BagSlot failed: Key (" + key + "act_b" + i + "), Value (" + v + ")"); bag.Add(null); } } else { // is simply empty slot bag.Add(null); } } } else bag.Clear(); // load skills count = UniRPGGlobal.LoadInt(key + "act_skill", -1); if (count > 0) { for (int i = 0; i < count; i++) { failed = true; string v = UniRPGGlobal.LoadString(key + "act_s" + i, null); if (!string.IsNullOrEmpty(v)) { string[] vs = v.Split('|'); if (vs.Length == 2) { GameObject skillFab = UniRPGGlobal.DB.GetSkillPrefab(new GUID(vs[0])); if (skillFab != null) { failed = false; int slot = -5; if (!int.TryParse(vs[1], out slot)) slot = -5; if (slot >= 0) SetActionSlot(slot, skillFab); else AddSkill(skillFab); } } } if (failed) { Debug.LogWarning("Actor LoadState Skill failed: Key (" + key + "act_s" + i + "), Value (" + v + ")"); } } } else if (count == 0) { skills.Clear(); for (int i = 0; i < actionSlots.Count; i++) actionSlots[i].Clear(); } // load what items are placed into action slots count = UniRPGGlobal.LoadInt(key + "act_slot_i", 0); for (int i = 0; i < actionSlots.Count; i++) { //if (i < actionSlots.Count) //{ string s = UniRPGGlobal.LoadString(key + "act_i" + i, null); GUID id = new GUID(s); if (!id.IsEmpty) { RPGItem item = UniRPGGlobal.DB.GetItem(id); SetActionSlot(i, item); } //} } // load states count = UniRPGGlobal.LoadInt(key + "act_state", 0); if (count > 0) { for (int i = 0; i < count; i++) { failed = true; string v = UniRPGGlobal.LoadString(key + "act_st" + i, null); if (!string.IsNullOrEmpty(v)) { RPGState st = UniRPGGlobal.DB.GetState(new GUID(v)); if (st != null) { failed = false; AddState(st); } } if (failed) { Debug.LogWarning("Actor LoadState State failed: Key (" + key + "act_st" + i + "), Value (" + v + ")"); } } } else states.Clear(); // load equipped count = UniRPGGlobal.LoadInt(key + "act_eq", 0); if (count > 0) { equipped.Clear(); CheckEquipSlotsSize(UniRPGGlobal.DB); for (int i = 0; i < equipped.Count; i++) { string s = UniRPGGlobal.LoadString(key + "act_eq" + i, null); if (!string.IsNullOrEmpty(s)) { GUID id = new GUID(s); if (UniRPGGlobal.DB.RPGItems.ContainsKey(id.Value)) { equipped[i] = UniRPGGlobal.DB.RPGItems[id.Value]; // InitSelf() will handle the following //UniRPGGameController.ExecuteActions(equipped[i].onEquipActions, equipped[i].gameObject, null, null, gameObject, null, true); } else { Debug.LogWarning("Actor LoadState Equipped Item failed: Key (" + key + "act_eq" + i + "), Value (" + s + ")"); } } } } else equipped.Clear(); }