Beispiel #1
0
 private void MoveItems(DeliveryChest from, DeliveryChest to, Tuple <DeliveryCategories, int>[] filter)
 {
     // Store items because removing items aborts foreach()
     Item[] items = from.Chest.items.ToArray();
     foreach (Item item in items)
     {
         string type    = "";
         int    quality = 1;
         if (item is SObject obj)
         {
             type    = obj.Type;
             quality = 1 << obj.Quality;
         }
         DeliveryCategories cat = item.getDeliveryCategory();
         this.Monitor.Log($"Found existing item {item.Name} Type: {type} Category: {item.getCategoryName()} cat: {cat.Name()}", LogLevel.Trace);
         if (!filter.Any(x => x.Item1 == cat && (x.Item2 & quality) > 0))
         {
             continue;
         }
         Item chest_full = to.Chest.addItem(item);
         if (chest_full != null)
         {
             this.Monitor.Log($"Item {item.Name} will not fit in chest at {to.Location}", LogLevel.Info);
             continue;
         }
         //this.Monitor.Log($"Removing item", LogLevel.Trace);
         from.Chest.items.Remove(item);
     }
 }
        internal Category(DeliveryCategories type, int value = 0)
        {
            this.Type      = type;
            this.selectAll = new Rectangle(0, 0, 24, 24);
            int checkbox_count = Enum.GetNames(typeof(ItemQuality)).Length;

            this.Checkbox = new Checkbox[checkbox_count];
            for (int i = 0; i < checkbox_count; i++)
            {
                this.Checkbox[i] = new Checkbox();
            }
            this.SetValue(value);
        }
Beispiel #3
0
 private int CheckCategoryEnabledInSave(DeliveryCategories cat, List <string> match)
 {
     foreach (string item in match)
     {
         string[] items = item.Split(':');
         if (items[0] == cat.ToString())
         {
             //Quality level 3 (==8) is unused
             return(items.Length > 1 ? Int32.Parse(items[1]) : (16 + 4 + 2 + 1));
         }
     }
     return(0);
 }
Beispiel #4
0
 public static string Name(this DeliveryCategories category)
 {
     return(category.ToString().Replace("_", " "));
 }