Beispiel #1
0
        private void PreventMULTFromGrabbing(On.RoR2.Inventory.orig_GiveItem orig, Inventory self, ItemIndex itemIndex, int count)
        {
            var body = self.gameObject.GetComponent <PlayerCharacterMasterController>()?.body;

            if (body && body.baseNameToken.ToUpper().Contains("TOOLBOT") && itemIndex == catalogIndex)
            {
                var loot = Run.instance.treasureRng.NextElementUniform(Run.instance.availableTier3DropList);
                PickupDropletController.CreatePickupDroplet(loot, self.transform.position, body.inputBank.aimDirection * 5f);
                itemIndex = ItemIndex.None;
            }

            orig(self, itemIndex, count);
        }
Beispiel #2
0
        private void OnGiveItem(On.RoR2.Inventory.orig_GiveItem orig, Inventory self, ItemIndex itemIndex, int count)
        {
            if (PreventPickupConfigEntries.ContainsKey(itemIndex) && PreventPickupConfigEntries[itemIndex].Value)
            {
                CharacterMaster characterMasterByInvetory = GetCharacterMasterByInvetory(self);

                if (characterMasterByInvetory == null)
                {
                    return;
                }

                GiveRandomItem(characterMasterByInvetory.GetBody(), self, itemIndex);

                return;
            }

            orig.Invoke(self, itemIndex, count);
        }
        private void Inventory_GiveItem(On.RoR2.Inventory.orig_GiveItem orig, Inventory self, ItemIndex itemIndex, int count)
        {
            var scarfCount   = GetCount(self);
            var stridesCount = self.GetItemCount(ItemIndex.LunarUtilityReplacement);
            var body         = self.gameObject.GetComponent <PlayerCharacterMasterController>()?.body;

            // TODO: Replace with a switch statement or something holy shit man

            // Picking up a scarf while you have strides
            if (stridesCount > 0 && itemIndex == catalogIndex)
            {
                if (BloodiedScarf_DropCoins)
                {
                    DropLunarCoin(body.corePosition, stridesCount);
                }
                else
                {
                    DropItemIndex(body.corePosition, ItemIndex.LunarUtilityReplacement, stridesCount);
                }
                self.RemoveItem(ItemIndex.LunarUtilityReplacement, stridesCount);
            }
            // Picking up a Strides while you have Scarves
            if (scarfCount > 0 && itemIndex == ItemIndex.LunarUtilityReplacement)
            {
                if (BloodiedScarf_DropCoins)
                {
                    DropLunarCoin(body.corePosition, scarfCount);
                }
                else
                {
                    DropItemIndex(body.corePosition, instance.catalogIndex, scarfCount);
                }
                self.RemoveItem(catalogIndex, scarfCount);
            }
            orig(self, itemIndex, count);
        }