Example #1
0
        public static void ReplaceDrops(ItemDropLocation dropLocation, List <PickupSelection> pickupSelections)
        {
            Logger.LogInfo(
                $"Adding drop information for {dropLocation}: {pickupSelections.Sum(x => x.Pickups.Count)} items");

            Selection[dropLocation] = pickupSelections;
        }
Example #2
0
        public static void AddDropInformation(ItemDropLocation dropLocation, List <PickupSelection> pickupSelections)
        {
            Logger.LogInfo(
                $"Adding drop information for {dropLocation.ToString()}: {pickupSelections.Sum(x => x.Pickups.Count)} items");

            Selection[dropLocation] = pickupSelections;
        }
Example #3
0
 public static void AddDrops(ItemDropLocation dropLocation, params PickupSelection[] pickups)
 {
     if (!Selection.ContainsKey(dropLocation))
     {
         Selection[dropLocation] = new List <PickupSelection>();
     }
     Selection[dropLocation].AddRange(pickups);
 }
Example #4
0
        public static void ReplaceDrops(ItemDropLocation dropLocation,
                                        params PickupSelection[] pickupSelections)
        {
            Logger.LogInfo(
                $"Adding drop information for {dropLocation.ToString()}: {pickupSelections.Sum(x => x.Pickups.Count)} items");

            Selection[dropLocation] = pickupSelections.ToList();
        }
Example #5
0
        public static PickupIndex GetSelection(ItemDropLocation dropLocation, float normalizedIndex)
        {
            if (!Selection.ContainsKey(dropLocation))
            {
                return(PickupCatalog.FindPickupIndex(ItemIndex.None));
            }

            return(GetSelection(Selection[dropLocation], normalizedIndex));
        }
Example #6
0
 private static void RemoveDefaultDrops(ItemDropLocation location)
 {
     if (ItemDropAPI.Selection.ContainsKey(location))
     {
         ItemDropAPI.RemoveDrops(location,
                                 ItemDropAPI.Selection[location]
                                 .Where(sel => sel.IsDefaults)
                                 .ToArray());
     }
 }
Example #7
0
        public static void RemoveDrops(ItemDropLocation dropLocation, params PickupSelection[] pickups)
        {
            if (!Selection.ContainsKey(dropLocation))
            {
                return;
            }

            foreach (var pickup in pickups)
            {
                Selection[dropLocation].Remove(pickup);
            }
        }
Example #8
0
        public static PickupIndex GetSelection(ItemDropLocation dropLocation, float normalizedIndex)
        {
            if (!Selection.ContainsKey(dropLocation))
            {
                return(new PickupIndex(ItemIndex.None));
            }

            var selections = Selection[dropLocation];

            var weightedSelection = new WeightedSelection <PickupIndex>();

            foreach (var selection in selections.Where(x => x != null))
            {
                foreach (var pickup in selection.Pickups)
                {
                    weightedSelection.AddChoice(pickup, selection.DropChance / selection.Pickups.Count);
                }
            }

            return(weightedSelection.Evaluate(normalizedIndex));
        }
Example #9
0
        public static void AddDropInformation(ItemDropLocation dropLocation, params PickupSelection[] pickupSelections)
        {
            Debug.Log($"Adding drop information for {dropLocation.ToString()}: {pickupSelections.Sum(x => x.Pickups.Count)} items");

            Selection[dropLocation] = pickupSelections.ToList();
        }