Пример #1
0
        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);
                        }
                    }
                }
            }
        }
Пример #2
0
 public static void HighlightSlots(Kingmaker.UI.ServiceWindow.ItemSlot itemSlot)
 {
     if (itemSlot.Index != -1 && itemSlot.HasItem && VendorTrashItems.Contains(itemSlot.Item.Blueprint.AssetGuid) && ToggleVendorTrash && Mod.Enabled)
     {
         itemSlot.ItemImage.color = TrashColor;
     }
     else if (itemSlot.Index != -1 && itemSlot.HasItem && itemSlot.IsScroll && ToggleHighlightScrolls && Mod.Enabled)
     {
         itemSlot.ItemImage.color = ScrollColor;
     }
     else
     {
         if (itemSlot.HasItem)
         {
             itemSlot.ItemImage.color = Color.white;
         }
         else
         {
             itemSlot.ItemImage.color = Color.clear;
         }
     }
 }
Пример #3
0
        public static List <ItemEntity> ItemsToRemove(out long gold)
        {
            Dictionary <string, int> keepCount = new Dictionary <string, int>();
            List <ItemEntity>        listSell  = new List <ItemEntity>();

            gold = 0;
            foreach (ItemEntity item in Game.Instance.Player.Inventory)
            {
                if (VendorTrashItems.Contains(item.Blueprint.AssetGuid) && item.IsInStash)
                {
                    if (keepCount.ContainsKey(item.Blueprint.AssetGuid))
                    {
                        if (keepCount[item.Blueprint.AssetGuid] >= TrashItemsKeep[item.Blueprint.AssetGuid])
                        {
                            continue;
                        }
                    }

                    gold += (item.Blueprint.SellPrice * (long)item.Count);

                    listSell.Add(item);
                    if (TrashItemsKeep.ContainsKey(item.Blueprint.AssetGuid))
                    {
                        if (keepCount.ContainsKey(item.Blueprint.AssetGuid))
                        {
                            keepCount[item.Blueprint.AssetGuid]++;
                        }
                        else
                        {
                            keepCount.Add(item.Blueprint.AssetGuid, 1);
                        }
                    }
                }
            }

            return(listSell);
        }