Exemplo n.º 1
0
        /*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");
                }
            }
        }
Exemplo n.º 2
0
    public override void SetUp(DialogParams param)
    {
        base.SetUp(param);

        for (int i = 1; i <= GameController.numOfSheepType; ++i)
        {
            if (!hasInitButton.Contains(i))
            {
                SheepConfigData sheepConfigData = ConfigManager.Instance.SheepConfigProp.dataArray[i - 1];
                if (sheepConfigData.Unlocklevel <= DataManager.Instance.PlayerData.userLevel)
                {
                    ShopItemController item = Instantiate(shopItem, shopContainer);
                    item.Setup(i.ToString(), SimpleResourcesManager.Instance.GetSprite("Sheep" + i), DataManager.Instance.PlayerData.sheepPriceCurrent[i - 1], OnBuySheep);
                    hasInitButton.Add(i);
                }
            }
        }

        //if (hasInitShop == false)
        //{
        //    hasInitShop = true;
        //    for (int i=1;i<=GameController.numOfSheepType;++i)
        //    {
        //        SheepConfigData sheepConfigData = ConfigManager.Instance.SheepConfigProp.dataArray[i - 1];
        //        if (sheepConfigData.Unlocklevel <= DataManager.Instance.PlayerData.userLevel)
        //        {
        //            ShopItemController item = Instantiate(shopItem, shopContainer);
        //            item.Setup(i.ToString(), SimpleResourcesManager.Instance.GetSprite("Sheep" + i), sheepConfigData.Price, OnBuySheep);
        //        }
        //    }

        //}
    }
Exemplo n.º 3
0
        private void OnItemPurchased(PlayerController player, ShopItemController obj)
        {
            AkSoundEngine.PostEvent("Play_WPN_radgun_cool_01", base.gameObject);


            AddStat(PlayerStats.StatType.Coolness, 0.5f);

            if (base.Owner.HasPickupID(22))
            {
                AddStat(PlayerStats.StatType.Coolness, 0.5f);
            }

            if (base.Owner.HasPickupID(35))
            {
                LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(70).gameObject, player);
            }

            if (base.Owner.HasPickupID(148))
            {
                float value = UnityEngine.Random.Range(0.0f, 1.0f);
                if (value < 0.5)
                {
                    LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(127).gameObject, player);
                }
            }

            player.stats.RecalculateStats(player, true, false);
        }
Exemplo n.º 4
0
 private void LuckOTheBunnyShoppe(PlayerController player, ShopItemController shop)
 {
     {
         int  num3  = UnityEngine.Random.Range(0, 5);
         bool flag3 = num3 == 0;
         if (flag3)
         {
             LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(67).gameObject, player);
         }
         bool flag4 = num3 == 1;
         if (flag4)
         {
             LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(120).gameObject, player);
         }
         bool aa = num3 == 3;
         if (aa)
         {
             LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(127).gameObject, player);
         }
         bool snote = num3 == 4;
         if (snote)
         {
             for (int counter = 0; counter < UnityEngine.Random.Range(7f, 23f); counter++)
             {
                 LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(68).gameObject, player);
             }
         }
     }
 }
Exemplo n.º 5
0
 private static void redrawItemToSelected(ShopItemController item)
 {
     if (item == null)
     {
         return;
     }
     item.buyButton.GetComponent <Image>().color = SELECTED;
 }
Exemplo n.º 6
0
 private void Check4MoreDustShop(PlayerController player, ShopItemController shop)
 {
     this.random = UnityEngine.Random.Range(0.0f, 1.0f);
     if (random <= 0.4f)
     {
         PickupObject var = Gungeon.Game.Items["bny:a_speck_of_dust"];
         LootEngine.GivePrefabToPlayer(var.gameObject, player);
     }
 }
Exemplo n.º 7
0
    public void Purchase(ShopItemController item)
    {
        //YesNoPrefabオブジェクトを生成して、GameObject型のconfirmに代入
        GameObject confirm = Instantiate(YesNoPrefab, transform.GetComponentInParent <Canvas>().transform);

        //Dialogcontrollerを取得
        Dialogcontroller dc = confirm.GetComponent <Dialogcontroller>();

        //アイテムイメージをAnimalImageに代入
        AnimalImage = dc.itemImage;

        //スプライト化したAnimalImageをonclick()に設定したファイルの画像を代入
        AnimalImage.sprite = item.Item.GetIcon();
        Debug.Log(AnimalImage.sprite);
        Debug.Log(item.Item.GetIcon());

        //ダイアログテキストを表示
        dc.ShowDialog(item.Item.GetAnimalPrice() + "G" + "で購入しますか?");

        //PurchaseScore変数に、onclick()に設定したファイルの価格を代入
        PurchaseScore = item.Item.GetAnimalPrice();//引数名.関数名

        Debug.Log("AnimalPrice" + item.Item.GetAnimalPrice());

        //はいボタンが押されたときの動作   //ラムダ式を使うことで、関数内で関数を定義できる
        dc.YesButton.onClick.AddListener(() =>
        {
            //売り切れの表示
            item.OutOfStock();

            // 在庫を減らす
            Debug.Log(item.Item.animalId);
            m_stock[item.Item.animalId]--; // 在庫がなくなった時の処理はしていない。減らすだけ。
            string json = JsonUtility.ToJson(new Serialization <int, int>(m_stock));
            Debug.LogFormat("stock: {0}", json);
            PlayerPrefs.SetString("StockData", json);
            //score(値)の復元
            int score = PlayerPrefs.GetInt("score");

            //どうぶつを購入
            AfterPurchaseScore = score - PurchaseScore;

            //CoinTextに表示
            CoinText.GetComponent <Text>().text = AfterPurchaseScore.ToString() + "G";

            //scoreを更新
            score = AfterPurchaseScore;

            //scoreを保存
            PlayerPrefs.SetInt("score", score);

            Debug.Log(item.Item.GetAnimalPrice() + "で購入しました");

            //YesNoPrefabを破壊
            Destroy(confirm);
        });
    }
Exemplo n.º 8
0
        private void KindnessBoost(PlayerController player, ShopItemController shop)
        {
            bool flag = this.PurchaseCounter == 30f;

            if (!flag)
            {
                this.PurchaseCounter += 1f;
                ApplyStat(player, PlayerStats.StatType.GlobalPriceMultiplier, -0.01f, StatModifier.ModifyMethod.ADDITIVE);
            }
        }
Exemplo n.º 9
0
 private static void redrawItemToAwailable(ShopItemController item)
 {
     if (item == null)
     {
         return;
     }
     item.price.gameObject.SetActive(false);
     item.useText.SetActive(true);
     item.buyButton.GetComponent <Image>().color = BOUGHT;
 }
Exemplo n.º 10
0
 private void Doublinator(PlayerController arg1, ShopItemController arg2)
 {
     if (arg1 && arg2 && arg2.item)
     {
         if (arg2.item.quality != ItemQuality.COMMON && arg2.item.quality != ItemQuality.SPECIAL && arg2.item.quality != ItemQuality.EXCLUDED && BoxOTools.BasicRandom(0.4f))
         {
             LootEngine.GivePrefabToPlayer(BoxOTools.GetTotallyRandomItem(arg2.item.quality, false).gameObject, arg1);
         }
     }
 }
Exemplo n.º 11
0
 private void Doublinator(PlayerController arg1, ShopItemController arg2)
 {
     TimesBought++;
     if (arg1 && arg2 && arg2.item)
     {
         if (arg2.item is Gun)
         {
             arg1.CurrentGun.gameObject.AddComponent <HowToExplain>();
         }
     }
 }
Exemplo n.º 12
0
        private void Check4MoreDustShop(PlayerController player, ShopItemController shop)
        {
            bool flag = this.doost == 0f;

            if (flag)
            {
                this.doost += 1f;
                PickupObject var = Gungeon.Game.Items["bny:a_speck_of_dust"];
                LootEngine.GivePrefabToPlayer(var.gameObject, player);
            }
        }
Exemplo n.º 13
0
 public static bool LockedHook(Func <ShopItemController, bool> orig, ShopItemController self)
 {
     if (self is CustomShopItemController)
     {
         return((self as CustomShopItemController).Locked);
     }
     else
     {
         return(orig(self));
     }
 }
Exemplo n.º 14
0
 public static int ModifiedPriceHook(Func <ShopItemController, int> orig, ShopItemController self)
 {
     if (self is CustomShopItemController)
     {
         return((self as CustomShopItemController).ModifiedPrice);
     }
     else
     {
         return(orig(self));
     }
 }
Exemplo n.º 15
0
        public override void PurchaseItem(ShopItemController itemBad, bool actualPurchase = true, bool allowSign = true)
        {
            var   item            = itemBad as CustomShopItemController;
            float heightOffGround = -1f;

            if (item && item.sprite)
            {
                heightOffGround = item.sprite.HeightOffGround;
            }
            if (actualPurchase)
            {
                if (giveStatsOnPurchase)
                {
                    foreach (var stat in statsToGive)
                    {
                        item.LastInteractingPlayer.ownerlessStatModifiers.Add(stat);
                    }
                    item.LastInteractingPlayer.stats.RecalculateStats(item.LastInteractingPlayer, false, false);
                }
                if (this.shopkeepFSM != null)
                {
                    FsmObject fsmObject = this.shopkeepFSM.FsmVariables.FindFsmObject("referencedItem");
                    if (fsmObject != null)
                    {
                        fsmObject.Value = item;
                    }
                    this.shopkeepFSM.SendEvent("succeedPurchase");
                }
            }
            if (!item.item.PersistsOnPurchase)
            {
                if (allowSign)
                {
                    GameObject     gameObject = (GameObject)UnityEngine.Object.Instantiate(BraveResources.Load("Global Prefabs/Sign_SoldOut", ".prefab"));
                    tk2dBaseSprite component  = gameObject.GetComponent <tk2dBaseSprite>();
                    component.PlaceAtPositionByAnchor(item.sprite.WorldCenter, tk2dBaseSprite.Anchor.MiddleCenter);
                    gameObject.transform.position = gameObject.transform.position.Quantize(0.0625f);
                    component.HeightOffGround     = heightOffGround;
                    component.UpdateZDepth();
                }
                GameObject     gameObject2 = (GameObject)UnityEngine.Object.Instantiate(ResourceCache.Acquire("Global VFX/VFX_Item_Spawn_Poof"));
                tk2dBaseSprite component2  = gameObject2.GetComponent <tk2dBaseSprite>();
                component2.PlaceAtPositionByAnchor(item.sprite.WorldCenter.ToVector3ZUp(0f), tk2dBaseSprite.Anchor.MiddleCenter);
                component2.transform.position = component2.transform.position.Quantize(0.0625f);
                component2.HeightOffGround    = 5f;
                component2.UpdateZDepth();
                this.m_room.DeregisterInteractable(item);
                UnityEngine.Object.Destroy(item.gameObject);
            }
        }
        private void OnItemPurchased(PlayerController player, ShopItemController obj)
        {
            if (Owner.HasPickupID(Gungeon.Game.Items["nn:spare_blank"].PickupObjectId))
            {
                LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(224).gameObject, player);
            }
            else if (UnityEngine.Random.value < .50f)
            {
                LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(224).gameObject, player);
            }

            if (Owner.HasPickupID(Gungeon.Game.Items["nn:spare_key"].PickupObjectId) && UnityEngine.Random.value <= 0.1f)
            {
                LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(67).gameObject, player);
            }
        }
    void Populate()
    {
        GameObject newObj; // Create GameObject instance

        Dictionary <GameManagerInstance.UnlockStateID, Unlockable> UnlockCosts = GameManagerInstance.Instance.GetUnlockCosts();

        foreach (var item in UnlockCosts)
        {
            Unlockable unlockable = item.Value;

            // Create new instances of our prefab until we've created as many as we specified
            newObj = (GameObject)Instantiate(prefab, transform);
            ShopItemController SIC = newObj.GetComponent <ShopItemController>();

            SIC.SetShopItem(item.Key, unlockable.Descriptions[0], unlockable.Cost);
        }
    }
 private void OnItemPurchased(PlayerController player, ShopItemController obj)
 {
     //ETGModConsole.Log("You purchased an item");
     if (couponActive)
     {
         if (priceChange <= 0)
         {
             return;
         }
         float curPriceMod = player.stats.GetBaseStatValue(PlayerStats.StatType.GlobalPriceMultiplier);
         float newPriceMod = curPriceMod + priceChange;
         player.stats.SetBaseStatValue(PlayerStats.StatType.GlobalPriceMultiplier, newPriceMod, player);
         //Give the miserly ring
         if (playerHasMiserlyRing == true && !player.HasPickupID(451))
         {
             PickupObject byId = PickupObjectDatabase.GetById(132);
             player.AcquirePassiveItemPrefabDirectly(byId as PassiveItem);
             PlayableCharacters characterIdentity = LastOwner.characterIdentity;
             if (characterIdentity == PlayableCharacters.Robot)
             {
                 LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(120).gameObject, LastOwner);
                 LootEngine.GivePrefabToPlayer(PickupObjectDatabase.GetById(120).gameObject, LastOwner);
             }
         }
         else if (playerHasMiserlyRing == true && player.HasPickupID(451))
         {
             applyWeirdHealing();
         }
         //Remove the second active slot upon purchasing an item
         float curActiveSlots = player.stats.GetBaseStatValue(PlayerStats.StatType.AdditionalItemCapacity);
         curActiveSlots -= 1;
         player.stats.SetBaseStatValue(PlayerStats.StatType.AdditionalItemCapacity, curActiveSlots, player);
         priceChange = -1;
         player.RemoveActiveItem(this.PickupObjectId);
     }
 }
Exemplo n.º 19
0
 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);
 }
 private void OnItemPurchased(PlayerController player, ShopItemController obj)
 {
     this.numberOfUses++;
 }
Exemplo n.º 21
0
        private static void InitializeInternalHook(Action <ShopItemController, PickupObject> orig, ShopItemController self, PickupObject i)
        {
            if (!self)
            {
                return;
            }

            if (self is CustomShopItemController)
            {
                (self as CustomShopItemController).InitializeInternal(i);
            }
            else
            {
                orig(self, i);
            }
        }
Exemplo n.º 22
0
 public static void OnExitRangeHook(Action <ShopItemController, PlayerController> orig, ShopItemController self, PlayerController player)
 {
     if (self is CustomShopItemController)
     {
         (self as CustomShopItemController).ForceSteal(player);
     }
     else
     {
         orig(self, player);
     }
 }
Exemplo n.º 23
0
 public static void InteractHook(Action <ShopItemController, PlayerController> orig, ShopItemController self, PlayerController player)
 {
     if (self is CustomShopItemController)
     {
         (self as CustomShopItemController).Interact(player);
     }
     else
     {
         orig(self, player);
     }
 }
Exemplo n.º 24
0
 private void BreakStealthOnSteal(PlayerController arg1, ShopItemController arg2)
 {
     this.BreakStealth(arg1);
 }
Exemplo n.º 25
0
 public static void CursedPurchase(Action <ShopItemController, PlayerController> orig, ShopItemController self, PlayerController player)
 {
     if (self.item is PlayerItem)
     {
         bool ringEquipped = player.CurrentItem != null && player.CurrentItem.name.Contains("Cursed Ring");
         if (player.maxActiveItemsHeld > 1 && ringEquipped)
         {
             MethodInfo changeItem = typeof(PlayerController).GetMethod("ChangeItem", BindingFlags.NonPublic | BindingFlags.Instance);
             changeItem.Invoke(player, new object[] { 1 });
         }
         if (cursedPlayers.Contains(player) && !self.name.Contains("Cursed Ring") && ringEquipped)
         {
             if (player.maxActiveItemsHeld <= player.activeItems.Count)
             {
                 return;
             }
         }
     }
     orig(self, player);
 }
Exemplo n.º 26
0
        public static void OnEnteredRangeHook(Action <ShopItemController, PlayerController> orig, ShopItemController self, PlayerController interactor)
        {
            if (!self)
            {
                return;
            }

            if (self is CustomShopItemController)
            {
                (self as CustomShopItemController).OnEnteredRange(interactor);
            }
            else
            {
                orig(self, interactor);
            }
        }
Exemplo n.º 27
0
 private void selectItem()
 {
     redrawItemToAwailable(selectedItem);
     selectedItem = this;
     redrawItemToSelected(this);
 }
Exemplo n.º 28
0
 private void SIMPIN(PlayerController player, ShopItemController shop)
 {
     {
         ApplyStat(player, PlayerStats.StatType.Damage, 0.025f, StatModifier.ModifyMethod.ADDITIVE);
     }
 }
Exemplo n.º 29
0
        public static void TheJank(Action <ShopItemController, PlayerController> orig, ShopItemController self, PlayerController player)
        {
            /*if (player.HasMTGConsoleID("psm:restock"))
             * {
             *  self.item.PersistsOnPurchase = true;
             *  LootEngine.DoDefaultItemPoof(self.gameObject.transform.position);
             *  if (self.item.quality != ItemQuality.COMMON && self.item.quality != ItemQuality.SPECIAL)
             *  {
             *      ETGModConsole.Log("nuts and wet");
             *      FieldInfo _parentShop = typeof(ShopItemController).GetField("m_parentShop", BindingFlags.NonPublic | BindingFlags.Instance);
             *      ShopController shop = (ShopController)_parentShop.GetValue(self);
             *      if (shop)
             *      {
             *          self.Initialize(shop.shopItemsGroup2.SelectByWeight().GetComponent<PickupObject>(), shop);
             *      }
             *      else
             *      {
             *          ETGModConsole.Log("loosen up");
             *          FieldInfo _parentBaseShop = typeof(ShopItemController).GetField("m_baseParentShop", BindingFlags.NonPublic | BindingFlags.Instance);
             *          BaseShopController baseShop = (BaseShopController)_parentBaseShop.GetValue(self);
             *          if (baseShop)
             *          {
             *              ETGModConsole.Log("dont forget about it");
             *              self.Initialize(baseShop.shopItemsGroup2.SelectByWeight().GetComponent<PickupObject>(), baseShop);
             *          }
             *          else
             *          {
             *              ETGModConsole.Log("f**k shit up");
             *          }
             *      }
             *  }
             * } else
             * {
             *  self.item.PersistsOnPurchase = false;
             * }*/
            FieldInfo _parentBaseShop = typeof(ShopItemController).GetField("pickedUp", BindingFlags.NonPublic | BindingFlags.Instance);

            ETGModConsole.Log(_parentBaseShop.GetValue(self).ToString());
            ETGModConsole.Log("yes, everything ran correctly");
            orig(self, player);
        }
Exemplo n.º 30
0
        public static void AntiDropPurchase(Action <ShopItemController, PlayerController> orig, ShopItemController self, PlayerController player)
        {
            bool flag     = self.item is PlayerItem;
            bool switched = false;

            if (flag)
            {
                bool flag_ = player.CurrentItem != null && (player.CurrentItem is SoulVessel);
                bool flag2 = player.maxActiveItemsHeld > 1 && flag_;
                if (flag2)
                {
                    MethodInfo method = typeof(PlayerController).GetMethod("ChangeItem", BindingFlags.Instance | BindingFlags.NonPublic);
                    method.Invoke(player, new object[]
                    {
                        1
                    });
                    switched = true;
                }
                bool hasVessel = false;
                foreach (PlayerItem active in player.activeItems)
                {
                    if (active is SoulVessel)
                    {
                        hasVessel = true;
                    }
                }
                bool flag3 = hasVessel && !(self.item is SoulVessel) && flag_;
                if (flag3)
                {
                    bool flag4 = player.maxActiveItemsHeld <= player.activeItems.Count && !switched;
                    if (flag4)
                    {
                        return;
                    }
                }
                if (!(player.CurrentItem is SoulVessel) && hasVessel)
                {
                    switched = true;
                }
            }
            orig(self, player);
            if (switched)
            {
                MethodInfo method = typeof(PlayerController).GetMethod("ChangeItem", BindingFlags.Instance | BindingFlags.NonPublic);
                method.Invoke(player, new object[]
                {
                    1
                });
            }
        }