private static bool ExecuteSellAllItems(SPInventoryVM __instance, ref InventoryLogic ____inventoryLogic, ref CharacterObject ____currentCharacter) { var golds = 0; var leftGold = __instance.LeftInventoryOwnerGold; __instance.IsRefreshed = false; for (int i = __instance.RightItemListVM.Count - 1; i >= 0; i--) { SPItemVM spitemVM = __instance.RightItemListVM[i]; if (spitemVM != null && !spitemVM.IsFiltered && !spitemVM.IsLocked) { golds += spitemVM.ItemCost * spitemVM.ItemRosterElement.Amount; if (__instance.IsTrading && golds > leftGold) { break; } TransferCommand command = TransferCommand.Transfer(spitemVM.ItemRosterElement.Amount, InventoryLogic.InventorySide.PlayerInventory, InventoryLogic.InventorySide.OtherInventory, spitemVM.ItemRosterElement, EquipmentIndex.None, EquipmentIndex.None, ____currentCharacter, !__instance.IsInWarSet); ____inventoryLogic.AddTransferCommand(command); } } Traverse.Create(__instance).Method("RefreshInformationValues").GetValue(); Traverse.Create(__instance).Method("ExecuteRemoveZeroCounts").GetValue(); __instance.IsRefreshed = true; return(false); }
/// <summary> /// Returns item usage in string /// </summary> /// <param name="item">inventory item</param> /// <returns></returns> public static string GetItemUsage(SPItemVM item) { if (item == null || item.ItemRosterElement.IsEmpty || item.ItemRosterElement.EquipmentElement.IsEmpty || item.ItemRosterElement.EquipmentElement.Item.WeaponComponent == null) { return(""); } return(item.ItemRosterElement.EquipmentElement.Item.PrimaryWeapon.ItemUsage); }
/// <summary> /// Returns a boolean if the item is a camel /// </summary> /// <param name="item">inventory item</param> /// <returns></returns> private static bool IsCamel(SPItemVM item) { if (item != null) { if (!item.ItemRosterElement.IsEmpty) { if (!item.ItemRosterElement.EquipmentElement.IsEmpty) { if (item.ItemRosterElement.EquipmentElement.Item.HasHorseComponent) { if (item.ItemRosterElement.EquipmentElement.Item.HorseComponent.Monster.MonsterUsage == "camel") { return(true); } } } } } return(false); }
/// <summary> /// Returns a boolean if the is a camel harness /// </summary> /// <param name="item">inventory item</param> /// <returns></returns> private static bool IsCamelHarness(SPItemVM item) { return(item != null && item.StringId.StartsWith("camel_sadd")); }