Пример #1
0
        private void GenericPickupController_GrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, RoR2.GenericPickupController self, RoR2.CharacterBody body, RoR2.Inventory inventory)
        {
            orig.Invoke(self, body, inventory);

            //Debug.Log(self.pickupIndex);

            PickupIndex dio = new PickupIndex(ItemIndex.ExtraLife);

            if (self.pickupIndex == dio)
            {
                //List<PickupIndex> tier3Items = Run.instance.availableTier3DropList;

                //int rng = random.Next(0, tier3Items.Count);
                //if (tier3Items[rng] == dio)
                //    rng++;

                //ItemIndex rngItem = tier3Items[rng].itemIndex;
                //tier3Items[rng].itemIndex.ToString();
                //tier3Items[rng].GetPickupNameToken();

                string pickupName = self.GetComponentInChildren <PickupDisplay>().transform.GetChild(1).name.Replace("(Clone)", "");
                //Debug.Log(pickupName);


                ItemDef[] items    = typeof(ItemCatalog).GetFieldValue <ItemDef[]>("itemDefs");
                ItemDef   fakeItem = items[0];
                //Debug.Log(items.Length);
                //Debug.Log(items[0]);
                foreach (ItemDef item in items)
                {
                    if (item.pickupModelPath.Contains(pickupName))
                    {
                        Debug.Log("FOUND!!!!!!!!");
                        fakeItem = item;
                        break;
                    }
                }

                PickupIndex ogItem = new PickupIndex(fakeItem.itemIndex);
                //Debug.Log("----------");
                //Debug.Log(ogItem.GetPickupNameToken());
                //Debug.Log(Language.GetString(ogItem.GetPickupNameToken()));
                //Debug.Log(ogItem.itemIndex);
                //Debug.Log("----------");

                //PickupIndex ogItem = new PickupIndex(ItemIndex.Behemoth);

                //string rngItemName = Language.GetString(tier3Items[rng].GetPickupNameToken());
                //Color32 color = tier3Items[rng].GetPickupColor();
                //Color32 colorDark = tier3Items[rng].GetPickupColorDark();

                string  rngItemName = Language.GetString(ogItem.GetPickupNameToken());
                Color32 color       = ogItem.GetPickupColor();
                Color32 colorDark   = ogItem.GetPickupColorDark();


                //<color=#307FFF>Lunar Coin</color><style=cEvent> Dropped</style>
                Chat.AddMessage(String.Format("<style=cEvent>You were expecting </style>{0} {1}", Util.GenerateColoredString(rngItemName, color), Util.GenerateColoredString("BUT IT WAS ME DIO", colorDark)));
            }
        }
Пример #2
0
        private void GenericPickupController_GrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, RoR2.GenericPickupController self, RoR2.CharacterBody body, RoR2.Inventory inventory)
        {
            orig.Invoke(self, body, inventory);

            //Debug.Log(self.pickupIndex);

            PickupIndex trashDio = new PickupIndex(ItemIndex.Bear);

            if (self.pickupIndex == trashDio)
            {
                List <PickupIndex> tier1Items = Run.instance.availableTier1DropList;

                int rng = random.Next(0, tier1Items.Count);
                if (tier1Items[rng] == trashDio)
                {
                    rng++;
                }

                //ItemIndex rngItem = tier3Items[rng].itemIndex;
                //tier3Items[rng].itemIndex.ToString();
                //tier3Items[rng].GetPickupNameToken();

                string  rngItemName = Language.GetString(tier1Items[rng].GetPickupNameToken());
                Color32 color       = tier1Items[rng].GetPickupColor();
                Color32 colorDark   = tier1Items[rng].GetPickupColorDark();



                //<color=#307FFF>Lunar Coin</color><style=cEvent> Dropped</style>
                Chat.AddMessage(String.Format("<style=cEvent>You were expecting </style>{0} {1}", Util.GenerateColoredString(rngItemName, color), Util.GenerateColoredString("BUT IT WAS ME TRASH DIO", colorDark)));
            }
        }
Пример #3
0
        private void GiveRandomItem(CharacterBody body, Inventory inventory, ItemIndex itemIndex)
        {
            float chance = GetChance(itemIndex);

            if (chance - new Random().NextDouble() > 0f)
            {
                genericPickupController.pickupIndex = PickupCatalog.FindPickupIndex(GetRandomItemIndex(itemIndex));

                SendChatMessage("Lucky!");

                GrantItem.Invoke(genericPickupController, body, inventory);

                return;
            }

            if (chance > 0f)
            {
                SendChatMessage("No luck this time!");
            }

            GiveScrapItem(body, inventory, itemIndex);
        }
Пример #4
0
        private void OnGrantItem(
            On.RoR2.GenericPickupController.orig_GrantItem orig,
            GenericPickupController self,
            CharacterBody body,
            Inventory inventory
            )
        {
            GrantItem = orig;
            genericPickupController = self;

            ItemIndex itemIndex = PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex;

            if (PreventPickupConfigEntries.ContainsKey(itemIndex) && PreventPickupConfigEntries[itemIndex].Value)
            {
                GiveRandomItem(body, inventory, itemIndex);

                return;
            }

            orig.Invoke(self, body, inventory);
        }