public static void Trash() { if (HamHelpers.InValidSellArea() && ToggleAutoSell && ToggleVendorTrash && Mod.Enabled) { long gold = 0; foreach (ItemEntity item in ItemSlotHelper.ItemsToRemove(out gold)) { if (TrashItemsKeep.ContainsKey(item.Blueprint.AssetGuid)) { Game.Instance.Player.Inventory.Remove(item, item.Count - TrashItemsKeep[item.Blueprint.AssetGuid]); } else { Game.Instance.Player.Inventory.Remove(item, item.Count); } } Game.Instance.Player.GainMoney(gold); LogItemData data = new LogItemData($"{gold} gold made from autoselling trash loot!", GameLogStrings.Instance.DefaultColor, null, PrefixIcon.None, new List <LogChannel> { LogChannel.None }); Game.Instance.UI.BattleLogManager.LogView.AddLogEntry(data, false); } }
public void HandleSlotClick(Kingmaker.UI.ServiceWindow.ItemSlot slot) { Mod.Debug(MethodBase.GetCurrentMethod()); bool control = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); if (control && ToggleVendorTrash && Mod.Enabled) { if (!slot.Item.IsNonRemovable && VendorTrashItems.Contains(slot.Item.Blueprint.AssetGuid) && slot.Index != -1) { VendorTrashItems.Remove(slot.Item.Blueprint.AssetGuid); Mod.Debug(string.Format("{0} removed from trash list.", slot.Item.Blueprint.Name)); foreach (ItemTypicalSlot itp in slot.ParentGroup.Slots) { ItemSlotHelper.HighlightSlots(itp); } } else { if (!slot.Item.IsNonRemovable && !VendorInject.invalidItems.Contains(slot.Item.Blueprint.AssetGuid) && slot.Index != -1) { VendorTrashItems.Add(slot.Item.Blueprint.AssetGuid); Mod.Debug(string.Format("{0} added to trash list.", slot.Item.Blueprint.Name)); foreach (ItemTypicalSlot itp in slot.ParentGroup.Slots) { ItemSlotHelper.HighlightSlots(itp); } } } } }
public static bool Prefix() { Mod.Debug(MethodBase.GetCurrentMethod()); if (!ToggleVendorTrash && !Main.Mod.Enabled) { return(true); } foreach (ItemEntity i in ItemSlotHelper.ItemsToRemove(out gold)) { Game.Instance.Vendor.AddForSell(i, i.Count); } return(true); }
public static void Postfix(Kingmaker.UI.ServiceWindow.ItemSlot __instance) { ItemSlotHelper.HighlightSlots(__instance); __instance.UpdateCount(); }
public static void Postfix(ItemSlot __instance) { ItemSlotHelper.HighlightSlots(__instance); __instance.UpdateCount(); }