Exemple #1
0
        private void ChestBehavior_Open(On.RoR2.ChestBehavior.orig_Open orig, ChestBehavior self)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::Open()' called on client");
                return;
            }

            if (self.gameObject.name.StartsWith("LunarChest"))
            {
                orig(self);
                return;
            }

            FieldInfo dropPickup      = self.GetType().GetField("dropPickup", BindingFlags.Instance | BindingFlags.NonPublic);
            var       dropPickupValue = (PickupIndex)dropPickup.GetValue(self);

            if (dropPickupValue == PickupIndex.none)
            {
                self.ItemDrop();
            }
            else
            {
                orig(self);
            }
        }
Exemple #2
0
        public void Check(On.RoR2.ChestBehavior.orig_Open orig, ChestBehavior self)
        {
            if (self && self.tier3Chance >= 1f)
            {
                base.Grant();
            }

            orig(self);
        }
Exemple #3
0
        private void On_CBOpen(On.RoR2.ChestBehavior.orig_Open orig, ChestBehavior self)
        {
            orig(self);
            var dot = self.GetComponentInParent <CaptainsBroochDroppod>();

            if (dot)
            {
                dot.ServerUnlaunch();
            }
        }
        private void ChestBehavior_Open(On.RoR2.ChestBehavior.orig_Open orig, ChestBehavior self)
        {
            if (NetworkServer.active)
            {
                if (isCurrentStageBazaar())
                {
                    bool isCreatingDroplet = false;
                    if (!ModConfig.isShareSuiteLoaded || !ModConfig.isShareSuiteActive())
                    {
                        isCreatingDroplet = true;
                    }
                    else
                    {
                        if (ModConfig.ShareSuiteItemSharingEnabled.Value)
                        {
                            isCreatingDroplet = true;
                        }
                    }
                    if (isCreatingDroplet)
                    {
                        List <BazaarItem> bazaarItems = bazaar.GetBazaarItems();
                        for (int i = 0; i < bazaar.GetBazaarItemAmount(); i++)
                        {
                            if (bazaarItems[i].chestBehavior.Equals(self))
                            {
                                PickupDropletController.CreatePickupDroplet(bazaarItems[i].pickupIndex, self.transform.position + Vector3.up * 1.5f, Vector3.up * 20f + self.transform.forward * 2f);
                                bazaarItems[i].purchaseCount++;
                                if (bazaar.IsChestStillAvailable(bazaarItems[i]))
                                {
                                    self.GetComponent <PurchaseInteraction>().SetAvailable(true);
                                }

                                return;
                            }
                        }
                    }
                }
                ;
            }
            orig(self);
        }
Exemple #5
0
 public void Chest_Opened(On.RoR2.ChestBehavior.orig_Open o, RoR2.ChestBehavior s)
 {
     o(s);
     chestsOpened++;
     UpdateTextArea(StageStatsTextAreaName);
 }
 private void ChestBehavior_Open(On.RoR2.ChestBehavior.orig_Open orig, ChestBehavior self)
 {
     throw new NotImplementedException();
 }