public static void ChestPreOpen(Action <Chest, PlayerController> orig, Chest self, PlayerController opener) { if (opener.HasPickupID(CakeIDs.PlatJunk)) { self.PredictContents(opener); int bighead = UnityEngine.Random.Range(1, 101); if (bighead == 1) { PickupObject obj = PickupObjectDatabase.GetById(580); self.contents.Add(obj); } if (bighead == 2) { PickupObject obj1 = PickupObjectDatabase.GetById(641); self.contents.Add(obj1); } if (bighead == 3) { PickupObject obj11 = PickupObjectDatabase.GetById(CakeIDs.PlatJunk); self.contents.Add(obj11); } PickupObject obj2 = PickupObjectDatabase.GetById(127); self.contents.Add(obj2); } if (opener.HasPickupID(CakeIDs.CH)) { self.PredictContents(opener); int bighead = UnityEngine.Random.Range(1, 31); if (bighead == 1) { List <int> excludedGunsIds = new List <int>() { }; foreach (Gun gun in opener.inventory.AllGuns) { excludedGunsIds.Add(gun.PickupObjectId); } PickupObject obj2 = PickupObjectDatabase.GetRandomGunOfQualities(new System.Random(), excludedGunsIds, ItemQuality.D, ItemQuality.C); self.contents.Add(obj2); } int lootID = BraveUtility.RandomElement(ExtendedLoots); PickupObject obj3 = PickupObjectDatabase.GetById(lootID); self.contents.Add(obj3); } orig(self, opener); }