Beispiel #1
0
        public static void AddDefaultShrineDrops()
        {
            var t1 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier1);
            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);
            var t3 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier3);
            var eq = ItemDropAPI.GetDefaultEquipmentDropList();

            var shrineSelections = new[] {
                new List <ItemIndex> {
                    ItemIndex.None
                }.ToSelection(ItemDropAPI.DefaultShrineFailureWeight),
                t1.ToSelection(ItemDropAPI.DefaultShrineTier1Weight),
                t2.ToSelection(ItemDropAPI.DefaultShrineTier2Weight),
                t3.ToSelection(ItemDropAPI.DefaultShrineTier3Weight),
                eq.ToSelection(ItemDropAPI.DefaultShrineEquipmentWeight)
            };

            foreach (var sel in shrineSelections)
            {
                sel.IsDefaults = true;
            }

            RemoveDefaultDrops(ItemDropLocation.Shrine);
            ItemDropAPI.AddDrops(ItemDropLocation.Shrine, shrineSelections);
        }
        public static void AddBossDefaultDrops()
        {
            ItemDropAPI.IncludeSpecialBossDrops = true;

            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);

            ItemDropAPI.AddDropInformation(ItemDropLocation.Boss, t2.ToSelection());
        }
Beispiel #3
0
        public static void AddChestDefaultDrops()
        {
            var t1 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier1);
            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);
            var t3 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier3);

            var chestSelections = new[] {
                t1.ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                t2.ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                t3.ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance)
            };

            var lockboxSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance)
            };

            var utilitySelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1, ItemTag.Utility).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2, ItemTag.Utility).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3, ItemTag.Utility).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance),
            };

            var damageSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1, ItemTag.Damage).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2, ItemTag.Damage).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3, ItemTag.Damage).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance),
            };

            var healingSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1, ItemTag.Healing).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2, ItemTag.Healing).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3, ItemTag.Healing).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance),
            };

            var scavSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1).ToSelection(ItemDropAPI.DefaultScavBackpackTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2).ToSelection(ItemDropAPI.DefaultScavBackpackTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3).ToSelection(ItemDropAPI.DefaultScavBackpackTier3DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Lunar).ToSelection(ItemDropAPI.DefaultScavBackpackLunarDropChance),
            };

            ItemDropAPI.AddDrops(ItemDropLocation.UtilityChest, utilitySelections);
            ItemDropAPI.AddDrops(ItemDropLocation.DamageChest, damageSelections);
            ItemDropAPI.AddDrops(ItemDropLocation.HealingChest, healingSelections);

            ItemDropAPI.AddDrops(ItemDropLocation.Lockbox, lockboxSelections);
            ItemDropAPI.AddDrops(ItemDropLocation.SmallChest, chestSelections);
            ItemDropAPI.AddDrops(ItemDropLocation.MediumChest, t2.ToSelection(ItemDropAPI.DefaultMediumChestTier2DropChance), t3.ToSelection(ItemDropAPI.DefaultMediumChestTier3DropChance));
            ItemDropAPI.AddDrops(ItemDropLocation.LargeChest, t3.ToSelection(ItemDropAPI.DefaultLargeChestTier3DropChance));
            ItemDropAPI.AddDrops(ItemDropLocation.ScavBackPack, scavSelections);
        }
Beispiel #4
0
        public static void AddBossDefaultDrops()
        {
            ItemDropAPI.IncludeSpecialBossDrops = true;

            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);

            var t2selections = t2.ToSelection();

            t2selections.IsDefaults = true;

            RemoveDefaultDrops(ItemDropLocation.Boss);
            ItemDropAPI.AddDrops(ItemDropLocation.Boss, t2selections);
        }
Beispiel #5
0
        private static void DropRewards(ILContext il)
        {
            var cursor = new ILCursor(il).Goto(0);

            cursor.GotoNext(MoveType.After, x => x.MatchCallvirt(typeof(Run).GetMethod("get_participatingPlayerCount")));
            cursor.Index += 1;

            cursor.EmitDelegate <Func <int> >(() => BossDropParticipatingPlayerCount ?? Run.instance.participatingPlayerCount);

            cursor.Emit(OpCodes.Stloc_0);

            cursor.GotoNext(x => x.MatchCall(typeof(PickupIndex).GetMethodCached("get_itemIndex")));

            var itemIndex = Reflection.ReadLocalIndex(cursor.Next.Next.OpCode, cursor.Next.Next.Operand);

            cursor.GotoNext(x => x.MatchCall(typeof(PickupIndex).GetConstructorCached(new[] { typeof(ItemIndex) })));
            cursor.GotoPrev(x => x.OpCode == OpCodes.Ldloca_S);

            var pickupIndex = (VariableDefinition)cursor.Next.Operand;

            cursor.Goto(0);

            cursor.GotoNext(x => x.MatchStloc(itemIndex));
            cursor.Emit(OpCodes.Stloc_S, itemIndex);


            cursor.Emit(OpCodes.Ldarg_0);
            cursor.Emit(OpCodes.Dup);
            cursor.Emit(OpCodes.Ldfld, typeof(BossGroup).GetFieldCached("rng"));
            cursor.EmitDelegate <Func <BossGroup, Xoroshiro128Plus, PickupIndex> >((self, rng) => {
                var norm = rng.nextNormalizedFloat;

                if (self.forceTier3Reward)
                {
                    var t3List    = ItemDropAPI.GetDefaultDropList(ItemTier.Tier3);
                    var selection = t3List.ToSelection();
                    return(GetSelection(new List <PickupSelection> {
                        selection
                    }, norm));
                }
                else
                {
                    return(GetSelection(ItemDropLocation.Boss, norm));
                }
            });

            cursor.Emit(OpCodes.Stloc_S, pickupIndex);
            cursor.Emit(OpCodes.Ldloca_S, pickupIndex);
            cursor.Emit(OpCodes.Call, typeof(PickupIndex).GetMethodCached("get_itemIndex"));
        }
        public static void AddChestDefaultDrops()
        {
            var t1 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier1);
            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);
            var t3 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier3);

            var chestSelections = new List <PickupSelection> {
                t1.ToSelection(ItemDropAPI.DefaultChestTier1DropChance),
                t2.ToSelection(ItemDropAPI.DefaultChestTier2DropChance),
                t3.ToSelection(ItemDropAPI.DefaultChestTier3DropChance)
            };

            ItemDropAPI.AddDropInformation(ItemDropLocation.SmallChest, chestSelections);
            ItemDropAPI.AddDropInformation(ItemDropLocation.MediumChest, t2.ToSelection(0.8f), t3.ToSelection(0.2f));
            ItemDropAPI.AddDropInformation(ItemDropLocation.LargeChest, t3.ToSelection());
        }
        public static void AddDefaultShrineDrops()
        {
            var t1 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier1);
            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);
            var t3 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier3);
            var eq = ItemDropAPI.GetDefaultEquipmentDropList();

            var shrineSelections = new List <PickupSelection> {
                new List <ItemIndex> {
                    ItemIndex.None
                }.ToSelection(ItemDropAPI.DefaultShrineFailureWeight),
                t1.ToSelection(ItemDropAPI.DefaultShrineTier1Weight),
                t2.ToSelection(ItemDropAPI.DefaultShrineTier2Weight),
                t3.ToSelection(ItemDropAPI.DefaultShrineTier3Weight),
                eq.ToSelection(ItemDropAPI.DefaultShrineEquipmentWeight)
            };

            ItemDropAPI.AddDropInformation(ItemDropLocation.Shrine, shrineSelections);
        }
Beispiel #8
0
        public static void AddChestDefaultDrops()
        {
            var t1 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier1);
            var t2 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier2);
            var t3 = ItemDropAPI.GetDefaultDropList(ItemTier.Tier3);

            var chestSelections = new[] {
                t1.ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                t2.ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                t3.ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance)
            };

            var lockboxSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance)
            };

            var utilitySelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1, ItemTag.Utility).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2, ItemTag.Utility).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3, ItemTag.Utility).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance),
            };

            var damageSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1, ItemTag.Damage).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2, ItemTag.Damage).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3, ItemTag.Damage).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance),
            };

            var healingSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1, ItemTag.Healing).ToSelection(ItemDropAPI.DefaultSmallChestTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2, ItemTag.Healing).ToSelection(ItemDropAPI.DefaultSmallChestTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3, ItemTag.Healing).ToSelection(ItemDropAPI.DefaultSmallChestTier3DropChance),
            };

            var scavSelections = new[] {
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier1).ToSelection(ItemDropAPI.DefaultScavBackpackTier1DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier2).ToSelection(ItemDropAPI.DefaultScavBackpackTier2DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Tier3).ToSelection(ItemDropAPI.DefaultScavBackpackTier3DropChance),
                ItemDropAPI.GetDefaultDropList(ItemTier.Lunar).ToSelection(ItemDropAPI.DefaultScavBackpackLunarDropChance),
            };

            var allSelections = new[] { chestSelections, lockboxSelections, utilitySelections, damageSelections, healingSelections, scavSelections };

            foreach (var selGroup in allSelections)
            {
                foreach (var sel in selGroup)
                {
                    sel.IsDefaults = true;
                }
            }

            var allLocations = new[] { ItemDropLocation.UtilityChest, ItemDropLocation.DamageChest, ItemDropLocation.HealingChest,
                                       ItemDropLocation.Lockbox, ItemDropLocation.SmallChest, ItemDropLocation.MediumChest, ItemDropLocation.LargeChest, ItemDropLocation.ScavBackPack };

            foreach (var selLoc in allLocations)
            {
                RemoveDefaultDrops(selLoc);
            }

            ItemDropAPI.AddDrops(ItemDropLocation.UtilityChest, utilitySelections);
            ItemDropAPI.AddDrops(ItemDropLocation.DamageChest, damageSelections);
            ItemDropAPI.AddDrops(ItemDropLocation.HealingChest, healingSelections);

            ItemDropAPI.AddDrops(ItemDropLocation.Lockbox, lockboxSelections);
            ItemDropAPI.AddDrops(ItemDropLocation.SmallChest, chestSelections);
            ItemDropAPI.AddDrops(ItemDropLocation.MediumChest, t2.ToSelection(ItemDropAPI.DefaultMediumChestTier2DropChance), t3.ToSelection(ItemDropAPI.DefaultMediumChestTier3DropChance));
            ItemDropAPI.AddDrops(ItemDropLocation.LargeChest, t3.ToSelection(ItemDropAPI.DefaultLargeChestTier3DropChance));
            ItemDropAPI.AddDrops(ItemDropLocation.ScavBackPack, scavSelections);
        }