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; }
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; }
public static void AddDrops(ItemDropLocation dropLocation, params PickupSelection[] pickups) { if (!Selection.ContainsKey(dropLocation)) { Selection[dropLocation] = new List <PickupSelection>(); } Selection[dropLocation].AddRange(pickups); }
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(); }
public static PickupIndex GetSelection(ItemDropLocation dropLocation, float normalizedIndex) { if (!Selection.ContainsKey(dropLocation)) { return(PickupCatalog.FindPickupIndex(ItemIndex.None)); } return(GetSelection(Selection[dropLocation], normalizedIndex)); }
private static void RemoveDefaultDrops(ItemDropLocation location) { if (ItemDropAPI.Selection.ContainsKey(location)) { ItemDropAPI.RemoveDrops(location, ItemDropAPI.Selection[location] .Where(sel => sel.IsDefaults) .ToArray()); } }
public static void RemoveDrops(ItemDropLocation dropLocation, params PickupSelection[] pickups) { if (!Selection.ContainsKey(dropLocation)) { return; } foreach (var pickup in pickups) { Selection[dropLocation].Remove(pickup); } }
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)); }
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(); }