Beispiel #1
0
            void SubmitChoice(On.RoR2.PickupPickerController.orig_SubmitChoice orig, RoR2.PickupPickerController pickupPickerController, int integer)
            {
                if (Data.modEnabled)
                {
                    if (Data.mode == DataShop.mode)
                    {
                        System.Type type = typeof(RoR2.PickupPickerController);
                        System.Reflection.FieldInfo info = type.GetField("options", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                        ICollection collection           = info.GetValue(pickupPickerController) as ICollection;
                        int         index = 0;
                        foreach (object item in collection)
                        {
                            if (index == integer)
                            {
                                RoR2.PickupPickerController.Option option = (RoR2.PickupPickerController.Option)item;
                                ItemIndex itemIndex = RoR2.PickupCatalog.GetPickupDef(option.pickupIndex).itemIndex;

                                RoR2.NetworkUIPromptController promptController = pickupPickerController.GetComponent <RoR2.NetworkUIPromptController>();
                                type = typeof(RoR2.NetworkUIPromptController);
                                info = type.GetField("_currentLocalParticipant", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                                RoR2.LocalUser localUser = (RoR2.LocalUser)info.GetValue(promptController);
                                foreach (NetworkUser networkUser in RoR2.NetworkUser.readOnlyInstancesList)
                                {
                                    if (localUser.currentNetworkUser.netId == networkUser.netId)
                                    {
                                        if (networkUser.isLocalPlayer)
                                        {
                                            DataShop.RemoveScrap(Data.GetItemTier(Data.allItemsIndexes[itemIndex]), Mathf.Min(DataShop.purchaseCost, networkUser.GetCurrentBody().inventory.GetItemCount(itemIndex)));
                                        }
                                        break;
                                    }
                                }
                                break;
                            }
                            index += 1;
                        }
                    }
                    orig(pickupPickerController, integer);
                }
                ;
            }
Beispiel #2
0
        public void PickupPickerController_SubmitChoice(On.RoR2.PickupPickerController.orig_SubmitChoice orig, RoR2.PickupPickerController self, int index)
        {
            orig(self, index);

            ItemDef itemDef = ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(self.options[index].pickupIndex).itemIndex);

            if (itemDef.itemIndex != ItemIndex.None)
            {
                lastItem[(int)itemDef.tier] = itemDef.itemIndex;
            }
        }
            void SetOptionsServer(On.RoR2.PickupPickerController.orig_SetOptionsServer orig, RoR2.PickupPickerController pickupPickerController, RoR2.PickupPickerController.Option[] options)
            {
                List <RoR2.PickupPickerController.Option> optionsAdjusted = new List <PickupPickerController.Option>();

                foreach (RoR2.PickupPickerController.Option option in options)
                {
                    if (latestPickupDisplayType == "scrapper")
                    {
                        if (playerItems.Contains(PickupCatalog.FindPickupIndex(Catalogue.GetScrapIndex(ItemCatalog.GetItemDef(PickupCatalog.GetPickupDef(option.pickupIndex).itemIndex).tier))))
                        {
                            optionsAdjusted.Add(option);
                        }
                    }
                    else if (latestPickupDisplayType == "command")
                    {
                        if (playerItems.Contains(option.pickupIndex))
                        {
                            optionsAdjusted.Add(option);
                        }
                    }
                    else
                    {
                        optionsAdjusted.Add(option);
                    }
                }
                options = new RoR2.PickupPickerController.Option[optionsAdjusted.Count];
                for (int optionIndex = 0; optionIndex < optionsAdjusted.Count; optionIndex++)
                {
                    options[optionIndex] = optionsAdjusted[optionIndex];
                }
                orig(pickupPickerController, options);
            }
 void SetOptionsFromInteractor(On.RoR2.PickupPickerController.orig_SetOptionsFromInteractor orig, RoR2.PickupPickerController pickupPickerController, Interactor interactor)
 {
     latestPickupDisplayType = "scrapper";
     orig(pickupPickerController, interactor);
 }
 void SetOptionsFromPickupForCommandArtifact(On.RoR2.PickupPickerController.orig_SetOptionsFromPickupForCommandArtifact orig, RoR2.PickupPickerController pickupPickerController, PickupIndex pickupIndex)
 {
     latestPickupDisplayType = "command";
     orig(pickupPickerController, pickupIndex);
 }