/*public override void Pickup(PlayerController player) * { * player.OnItemPurchased += Restocker; * base.Pickup(player); * } * * public override DebrisObject Drop(PlayerController player) * { * player.OnItemPurchased -= Restocker; * return base.Drop(player); * }*/ private void Restocker(PlayerController arg1, ShopItemController arg2) { arg2.item.PersistsOnPurchase = true; if (!arg2.gameObject || !arg2) { ETGModConsole.Log("my coffins all i see"); } ETGModConsole.Log("time to drop"); FieldInfo _parentShop = typeof(ShopItemController).GetField("m_parentShop", BindingFlags.NonPublic | BindingFlags.Instance); ShopController shop = (ShopController)_parentShop.GetValue(arg2); if (shop) { arg2.Initialize(Gungeon.Game.Items["psm:randy"], shop); } else { ETGModConsole.Log("loosen up"); FieldInfo _parentBaseShop = typeof(ShopItemController).GetField("m_baseParentShop", BindingFlags.NonPublic | BindingFlags.Instance); BaseShopController baseShop = (BaseShopController)_parentBaseShop.GetValue(arg2); if (baseShop) { ETGModConsole.Log("dont forget about it"); arg2.Initialize(Gungeon.Game.Items["psm:randy"], baseShop); } else { ETGModConsole.Log("f**k shit up"); } } }
public static void OnPurchase(Action <BaseShopController, ShopItemController, bool, bool> orig, BaseShopController self, ShopItemController item, bool flag1, bool flag2) { ETGModConsole.Log("god"); if (GameManager.Instance.PrimaryPlayer.HasMTGConsoleID("psm:restock") && item.item.quality != ItemQuality.SPECIAL) { ETGModConsole.Log("shitkeeper"); item.item.PersistsOnPurchase = true; FieldInfo _pickedUp = typeof(ShopItemController).GetField("pickedUp", BindingFlags.NonPublic | BindingFlags.Instance); _pickedUp.SetValue(item, false); LootEngine.DoDefaultItemPoof(item.specRigidbody.UnitCenter); if (item.item.quality != ItemQuality.COMMON && item.item.quality != ItemQuality.SPECIAL) { ETGModConsole.Log("fart sex"); item.Initialize(self.shopItemsGroup2.defaultItemDrops.SelectByWeight().GetComponent <PickupObject>(), self); } } else { item.item.PersistsOnPurchase = false; FieldInfo _pickedUp = typeof(ShopItemController).GetField("pickedUp", BindingFlags.NonPublic | BindingFlags.Instance); _pickedUp.SetValue(item, true); } orig(self, item, flag1, flag2); }