public static bool GetRetainerGil() { BagSlot retainerGilSlot = null; BagSlot playerGilSlot = null; foreach (var item in InventoryManager.GetBagByInventoryBagId(PlayerGilId).Where(r => r.IsFilled)) { if (item.RawItemId == GilItemId) { playerGilSlot = item; break; } } foreach (var item in InventoryManager.GetBagByInventoryBagId(RetainerGilId).Where(r => r.IsFilled)) { if (item.RawItemId == GilItemId) { retainerGilSlot = item; break; } } if (retainerGilSlot != null && playerGilSlot != null && retainerGilSlot.Count > 0) { LogCritical("Retainer: {0} Player: {1}", String.Format("{0:n0}", retainerGilSlot.Count), String.Format("{0:n0}", playerGilSlot.Count)); return(retainerGilSlot.Move(playerGilSlot)); } return(false); }
public static bool MoveItem(BagSlot fromBagSlot, BagSlot toBagSlot) { if (fromBagSlot.Count + toBagSlot.Count > toBagSlot.Item.StackSize) { return(false); } return(fromBagSlot.Move(toBagSlot)); }
private static void EquipItem(BagSlot current, BagSlot prospect) { var item = prospect.Item; prospect.Move(current); Logger.AgilMessage("Equipped {0} on slot {2}.", item.EnglishName, prospect.Slot, Equipment.SlotToCategory[current.Slot]); }
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); }
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(); } }
public static bool MoveItem(BagSlot fromBagSlot, BagSlot toBagSlot) { return(fromBagSlot.Count + toBagSlot.Count <= toBagSlot.Item.StackSize && fromBagSlot.Move(toBagSlot)); }