public static void OnBroken(Chest self)
 {
     if (!self.IsOpen && self.GetComponent <JammedChestBehav>() != null)
     {
         LootEngine.SpawnCurrency(self.sprite.WorldCenter, 10, false);
     }
 }
 protected override void Update()
 {
     if (Owner)
     {
         if (Owner.CurrentRoom != null && !string.IsNullOrEmpty(Owner.CurrentRoom.GetRoomName()))
         {
             if (Owner.CurrentRoom != lastRoom)
             {
                 if (Owner.CurrentRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.SECRET)
                 {
                     if (!previouslyEnteredRooms.Contains(Owner.CurrentRoom))
                     {
                         IntVector2 location = Owner.CurrentRoom.GetCenteredVisibleClearSpot(2, 2);
                         LootEngine.SpawnCurrency(location.ToVector2(), UnityEngine.Random.Range(20, 51));
                         GiveRandomPermanentStatBuff();
                         previouslyEnteredRooms.Add(Owner.CurrentRoom);
                     }
                 }
                 lastRoom = Owner.CurrentRoom;
             }
         }
     }
     else
     {
         return;
     }
 }
Esempio n. 3
0
        private void onDestroyed(Projectile proj)
        {
            //plays the sound i made in my sound bank
            AkSoundEngine.PostEvent("Play_Wooden_Box_Break", GameManager.Instance.PrimaryPlayer.gameObject);

            var p = proj.Owner as PlayerController;

            //makes sure player doesnt have who needs money synergy.
            if (!p.PlayerHasActiveSynergy("who even needs money."))
            {
                //spawns 35 casings and 3 hegemony credit,
                //the manual gives it the effect of lootbag, where they disapear over time.
                LootEngine.SpawnCurrencyManual(proj.sprite.WorldCenter, 35);
                LootEngine.SpawnCurrency(proj.sprite.WorldCenter, 3, true);
            }
            else
            {
                //cause explosion
                var data = GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultExplosionData;
                data.damageToPlayer = 0;
                data.damage         = 5;
                Exploder.Explode(proj.sprite.WorldCenter, data, Vector2.zero, null, false, CoreDamageTypes.None, false);
            }

            //spawns random item at proj position if player has a certain synergy.

            if (p.PlayerHasActiveSynergy("oh you can open that!"))
            {
                var itemtopick = UnityEngine.Random.Range(0, Module.items.Count);
                LootEngine.SpawnItem(Game.Items[Module.items[itemtopick]].gameObject, proj.sprite.WorldCenter, Vector2.zero, 0);
            }
        }
Esempio n. 4
0
        public static void GiveRandomItem(PlayerController player)
        {
            switch ((int)UnityEngine.Random.Range(1, 11))
            {
            default:
                ETGModConsole.Log("you buffoon");
                break;

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
                LootEngine.SpawnCurrency(player.specRigidbody.UnitCenter, 8, false);
                break;

            case 9:
                player.carriedConsumables.KeyBullets += 1;
                player.BloopItemAboveHead(KeyDoubler.itemator.sprite);
                break;

            case 10:
                player.Blanks += 1;
                player.BloopItemAboveHead(BlankDoubler.itemator.sprite);
                break;
            }
        }
        public static void ChestPreOpen(Chest self, PlayerController opener)
        {
            JammedChestBehav jamness = self.gameObject.GetComponent <JammedChestBehav>();

            if (jamness != null)
            {
                self.PredictContents(opener);
                if (UnityEngine.Random.value <= 0.5f)
                {
                    List <PickupObject> items = GenerateContents(self.lootTable, self.breakertronLootTable, opener, 0, new System.Random());
                    self.contents.AddRange(items);
                }
                else
                {
                    int          lootID = BraveUtility.RandomElement(LootIDs);
                    PickupObject obj    = PickupObjectDatabase.GetById(lootID);
                    self.contents.Add(obj);
                }
            }
            if (jamness != null)
            {
                SaveAPIManager.RegisterStatChange(CustomTrackedStats.JAMMED_CHESTS_OPENED, 1);
                LootEngine.SpawnCurrency(self.sprite.WorldCenter, UnityEngine.Random.Range(10, 21), false);
                if (UnityEngine.Random.value <= 0.25f && opener.name != "PlayerShade(Clone)")
                {
                    opener.healthHaver.ApplyDamage(1f, Vector2.zero, "Jammed Chest");
                }
            }
        }
        private void CalculateHealth(PlayerController player)
        {
            currentArmour = player.healthHaver.Armor;
            if (currentArmour != lastArmour)
            {
                if (player.healthHaver.Armor > 1f)
                {
                    if (hasDoneFirstArmourResetThisRun)
                    {
                        int   amountOfSurplus  = (int)player.healthHaver.Armor - 1;
                        float percentPerArmour = 0.025f;
                        if (player.HasPickupID(FullArmourJacket.FullArmourJacketID))
                        {
                            percentPerArmour = 0.05f;
                        }

                        StatModifier statModifier = new StatModifier();
                        statModifier.amount      = (percentPerArmour * amountOfSurplus) + 1;
                        statModifier.modifyType  = StatModifier.ModifyMethod.MULTIPLICATIVE;
                        statModifier.statToBoost = PlayerStats.StatType.Damage;
                        Owner.ownerlessStatModifiers.Add(statModifier);
                        Owner.stats.RecalculateStats(Owner, false, false);

                        LootEngine.SpawnCurrency(player.sprite.WorldCenter, (15 * amountOfSurplus));
                    }
                    hasDoneFirstArmourResetThisRun = true;
                    player.healthHaver.Armor       = 1f;
                }
                lastArmour = currentArmour;
            }
        }
Esempio n. 7
0
 private void HandleMoneyEffect(TableTechChaosEffectIdentifier identifier, FlippableCover sourceCover)
 {
     if (identifier == TableTechChaosEffectIdentifier.MONEY)
     {
         int amountToDrop = UnityEngine.Random.Range(1, 5);
         LootEngine.SpawnCurrency(sourceCover.specRigidbody.UnitCenter, amountToDrop, false);
     }
 }
Esempio n. 8
0
 public static void ammoPickupHookMethod(Action <AmmoPickup, PlayerController> orig, AmmoPickup self, PlayerController player)
 {
     orig(self, player);
     if (player && player.CurrentGun && player.CurrentGun.PickupObjectId == Creditor.CreditorID)
     {
         LootEngine.SpawnCurrency(player.sprite.WorldCenter, 10, true);
     }
 }
Esempio n. 9
0
 private void OnKilledEnemy(PlayerController player, HealthHaver enemy)
 {
     if (player.PlayerHasActiveSynergy("Fully Funded"))
     {
         if (player.CurrentGun.PickupObjectId == Creditor.CreditorID && UnityEngine.Random.value <= 0.25 && enemy.GetMaxHealth() >= 15)
         {
             LootEngine.SpawnCurrency(enemy.specRigidbody.UnitCenter, 1, true);
         }
     }
 }
        private void giveCash(PlayerController user)
        {
            int cashMoney = 10;

            if (Owner.PlayerHasActiveSynergy("Do-Gooder"))
            {
                cashMoney *= 2;
            }
            LootEngine.SpawnCurrency(user.sprite.WorldCenter, cashMoney);
        }
Esempio n. 11
0
        protected override void OnPickedUpByPlayer(PlayerController player)
        {
            player.OnKilledEnemyContext += this.OnKilledEnemy;

            if (!everPickedUpByPlayer)
            {
                LootEngine.SpawnCurrency(player.sprite.WorldCenter, 10, true);
            }
            base.OnPickedUpByPlayer(player);
        }
Esempio n. 12
0
 public static void PigHook(Action <CompanionController, PlayerController> orig, CompanionController companion, PlayerController owner)
 {
     orig(companion, owner);
     if (companion && companion.specRigidbody && companion.name.StartsWith("Pig") && owner.PlayerHasActiveSynergy("Oink"))
     {
         if (BoxOTools.BasicRandom(0.4f))
         {
             LootEngine.SpawnCurrency(companion.specRigidbody.UnitCenter, 2);
         }
     }
 }
Esempio n. 13
0
 private void OnKilledEnemy(PlayerController player, HealthHaver enemy)
 {
     if (gun && player && enemy && player.PlayerHasActiveSynergy("Fully Funded"))
     {
         if (player.CurrentGun.PickupObjectId == 476 && enemy.GetMaxHealth() >= 10)
         {
             //ETGModConsole.Log("Spawned bonus");
             LootEngine.SpawnCurrency(enemy.specRigidbody.UnitCenter, 1, false);
         }
     }
 }
 public static void giveCash(PlayerController player, int cashAmount)
 {
     if (player.HasPickupID(RustyCasingID))
     {
         if (player.PlayerHasActiveSynergy("Lost, Never Found"))
         {
             cashAmount += 5;
         }
         LootEngine.SpawnCurrency(player.sprite.WorldCenter, cashAmount);
     }
 }
Esempio n. 15
0
 private void OnHitEnemy(Projectile bullet, SpeculativeRigidbody enemy, bool fatal)
 {
     if (bullet && enemy)
     {
         if (UnityEngine.Random.value <= 0.05f)
         {
             VFXToolbox.DoStringSquirt(BraveUtility.RandomElement(dialogue), enemy.Position.GetPixelVector2(), ExtendedColours.honeyYellow);
             if (bullet.ProjectilePlayerOwner() && bullet.ProjectilePlayerOwner().PlayerHasActiveSynergy("De4l 0f 4 Lif3tim3"))
             {
                 LootEngine.SpawnCurrency(enemy.Position.GetPixelVector2(), UnityEngine.Random.Range(2, 5));
             }
         }
     }
 }
Esempio n. 16
0
        //HandleDarkSoulsReset_CR
        //HandleSkullTrigger
        //PassiveItem.Pickup
        //ResetToFactorySettings
        //CoopResurrectInternal
        //HandleCloneEffect
        //TriggerDarkSoulsReset
        //CheckCost
        //ApplyCost
        //BasicStatPickup.Pickup

        public static void BasicStatPickupPickupHook(BasicStatPickup self, PlayerController player)
        {
            FieldInfo _pickedUp        = typeof(BasicStatPickup).GetField("m_pickedUp", BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo _pickedUpThisRun = typeof(BasicStatPickup).GetField("m_pickedUpThisRun", BindingFlags.NonPublic | BindingFlags.Instance);

            if ((bool)_pickedUp.GetValue(self))
            {
                return;
            }
            if (self.ArmorToGive > 0 && !(bool)_pickedUpThisRun.GetValue(self))
            {
                player.healthHaver.Armor += (float)self.ArmorToGive;
            }
            else if (!(bool)_pickedUpThisRun.GetValue(self) && self.IsMasteryToken && player.AllowZeroHealthState && player.ForceZeroHealthState)
            {
                player.healthHaver.Armor += 1f;
            }
            if (self.ModifiesDodgeRoll)
            {
                player.rollStats.rollDistanceMultiplier          *= self.DodgeRollDistanceMultiplier;
                player.rollStats.rollTimeMultiplier              *= self.DodgeRollTimeMultiplier;
                player.rollStats.additionalInvulnerabilityFrames += self.AdditionalInvulnerabilityFrames;
            }
            if (!(bool)_pickedUpThisRun.GetValue(self) && self.IsJunk && player.AllowZeroHealthState && player.ForceZeroHealthState)
            {
                StatModifier statModifier = new StatModifier();
                statModifier.statToBoost = PlayerStats.StatType.Damage;
                statModifier.amount      = 0.05f;
                statModifier.modifyType  = StatModifier.ModifyMethod.ADDITIVE;
                player.ownerlessStatModifiers.Add(statModifier);
                player.stats.RecalculateStats(player, false, false);
            }
            if (!(bool)_pickedUpThisRun.GetValue(self) && self.GivesCurrency)
            {
                player.carriedConsumables.Currency += self.CurrencyToGive;
            }
            if (!(bool)_pickedUpThisRun.GetValue(self) && player.AllowZeroHealthState && player.ForceZeroHealthState)
            {
                for (int i = 0; i < self.modifiers.Count; i++)
                {
                    if (self.modifiers[i].statToBoost == PlayerStats.StatType.Health && self.modifiers[i].amount > 0f)
                    {
                        int amountToDrop = Mathf.FloorToInt(self.modifiers[i].amount * (float)UnityEngine.Random.Range(GameManager.Instance.RewardManager.RobotMinCurrencyPerHealthItem, GameManager.Instance.RewardManager.RobotMaxCurrencyPerHealthItem + 1));
                        LootEngine.SpawnCurrency(player.CenterPosition, amountToDrop, false);
                    }
                }
            }
            self.Pickup(player);
        }
Esempio n. 17
0
        public override DebrisObject Drop(PlayerController player)
        {
            DebrisObject debrisObject = base.Drop(player);
            ShellBank    item         = debrisObject.gameObject.GetComponent <ShellBank>();

            debrisObject.GetComponent <ShellBank>().m_pickedUpThisRun = true;
            player.OnReceivedDamage -= this.Oof;
            if (Stored > 0)
            {
                LootEngine.SpawnCurrency(player.specRigidbody.UnitCenter, Stored * 2);
                Destroy(this.gameObject, 1f);

                //Make cool spell guns yo ufucking nerd!!
            }
            return(debrisObject);
        }
Esempio n. 18
0
 private void OnEnemyDamaged(float damage, bool fatal, HealthHaver enemyHealth)
 {
     if (fatal && Owner)
     {
         if (Owner.PlayerHasActiveSynergy("Miiiining Away~"))
         {
             string enemyGuid = enemyHealth?.aiActor?.EnemyGuid;
             if (enemyHealth?.aiActor?.EnemyGuid == "98ca70157c364750a60f5e0084f9d3e2" && Owner.PlayerHasActiveSynergy("Eye of the Spider"))
             {
                 LootEngine.SpawnCurrency(enemyHealth.sprite.WorldCenter, 5);
             }
             else if (EasyEnemyTypeLists.CubicEnemies.Contains(enemyGuid))
             {
                 LootEngine.SpawnCurrency(enemyHealth.sprite.WorldCenter, 5);
             }
         }
     }
 }
Esempio n. 19
0
            private void OnRoomClear(PlayerController playerController)
            {
                int maxCurrency = 4;
                int minCurrency = 1;

                if (Owner.PlayerHasActiveSynergy("What does it do?"))
                {
                    maxCurrency = 7; minCurrency = 2;
                }
                if (Owner.PlayerHasActiveSynergy("Pot O' Gold") && UnityEngine.Random.value <= 0.01f)
                {
                    maxCurrency = 51; minCurrency = 49;
                }
                LootEngine.SpawnCurrency(base.specRigidbody.UnitCenter, UnityEngine.Random.Range(minCurrency, maxCurrency));
                if (this.aiAnimator)
                {
                    this.aiAnimator.PlayUntilFinished("spawnobject", false, null, -1f, false);
                }
            }
Esempio n. 20
0
 protected override void DoEffect(PlayerController user)
 {
     for (int i = 0; i < StaticReferenceManager.AllProjectiles.Count; i++)
     {
         Projectile projectile = StaticReferenceManager.AllProjectiles[i];
         if (projectile)
         {
             if (!(projectile.Owner is PlayerController))
             {
                 if (projectile.collidesWithPlayer || projectile.Owner is AIActor)
                 {
                     if (!projectile.ImmuneToBlanks)
                     {
                         LootEngine.SpawnCurrency(projectile.specRigidbody.UnitCenter, 1);
                     }
                 }
             }
         }
     }
     user.ForceBlank();
 }
        public static void PrePickuphookLogic(Action <HealthPickup, SpeculativeRigidbody, SpeculativeRigidbody> orig, HealthPickup self, SpeculativeRigidbody player, SpeculativeRigidbody selfBody)
        {
            if (self && player.gameActor && player.gameActor is PlayerController)
            {
                PlayerController playerCont = player.gameActor as PlayerController;
                if (playerCont.ModdedCharacterIdentity() == ModdedCharacterID.Shade && self.armorAmount <= 0)
                {
                    if (playerCont.HasPickupID(BloodshotEye.BloodshotEyeID))
                    {
                        float percentPerArmour = 0.02f;
                        float amt1             = self.healAmount / 0.5f;
                        int   amt2             = Mathf.CeilToInt(amt1);

                        StatModifier statModifier = new StatModifier();
                        statModifier.amount      = (percentPerArmour * amt2) + 1;
                        statModifier.modifyType  = StatModifier.ModifyMethod.MULTIPLICATIVE;
                        statModifier.statToBoost = PlayerStats.StatType.Damage;
                        playerCont.ownerlessStatModifiers.Add(statModifier);
                        playerCont.stats.RecalculateStats(playerCont, false, false);
                    }
                    FieldInfo field = typeof(HealthPickup).GetField("m_pickedUp", BindingFlags.Instance | BindingFlags.NonPublic);
                    field.SetValue(self, true);
                    AkSoundEngine.PostEvent("Play_OBJ_coin_medium_01", self.gameObject);
                    int amountToDrop = (self.healAmount >= 1f) ? UnityEngine.Random.Range(5, 12) : UnityEngine.Random.Range(3, 7);
                    LootEngine.SpawnCurrency((!self.sprite) ? self.specRigidbody.UnitCenter : self.sprite.WorldCenter, amountToDrop, false);

                    var type = typeof(HealthPickup);
                    var func = type.GetMethod("GetRidOfMinimapIcon", BindingFlags.Instance | BindingFlags.NonPublic);
                    var ret  = func.Invoke(self, null);

                    self.ToggleLabel(false);
                    UnityEngine.Object.Destroy(self.gameObject);
                }
                else
                {
                    orig(self, player, selfBody);
                }
            }
        }
 // Token: 0x060074F4 RID: 29940 RVA: 0x002DA348 File Offset: 0x002D8548
 private void OwnerTookDamage(PlayerController obj)
 {
     if (this.SlowBulletsOnDamage)
     {
         if (!this.m_isSlowingBullets)
         {
             obj.StartCoroutine(this.HandleSlowBullets());
         }
         else
         {
             this.m_slowDurationRemaining = this.SlowBulletsDuration;
         }
     }
     if (this.ChanceToHealOnDamage)
     {
         if (obj.healthHaver.GetCurrentHealth() < 0.5f)
         {
             bool flag = obj.HasActiveBonusSynergy(CustomSynergyType.GUON_UPGRADE_GREEN, false);
             if (UnityEngine.Random.value < ((!flag) ? this.HealChanceCritical : this.GreenerChanceCritical))
             {
                 Debug.Log("Green Guon Critical Heal");
                 obj.healthHaver.ApplyHealing(0.5f);
                 if (flag)
                 {
                     LootEngine.SpawnCurrency(obj.CenterPosition, this.GreenerSynergyMoneyGain, false);
                 }
             }
         }
         else if (UnityEngine.Random.value < this.HealChanceNormal)
         {
             Debug.Log("Green Guon Normal Heal");
             obj.healthHaver.ApplyHealing(0.5f);
             if (obj.HasActiveBonusSynergy(CustomSynergyType.GUON_UPGRADE_GREEN, false))
             {
                 LootEngine.SpawnCurrency(obj.CenterPosition, this.GreenerSynergyMoneyGain, false);
             }
         }
     }
 }
Esempio n. 23
0
 private void OnTookDamage(PlayerController player)
 {
     if (RandomlySelectedGuonState == GuonState.GREEN)
     {
         float critProc = 0.5f;
         if (player.PlayerHasActiveSynergy("Rainbower Guon Stone"))
         {
             critProc = 0.7f;
         }
         if (player.healthHaver.GetCurrentHealth() < critProc)
         {
             if (UnityEngine.Random.value <= 0.5f)
             {
                 player.healthHaver.ApplyHealing(0.5f);
                 if (player.PlayerHasActiveSynergy("Rainbower Guon Stone"))
                 {
                     LootEngine.SpawnCurrency(player.CenterPosition, 20, false);
                 }
             }
         }
         else
         {
             if (UnityEngine.Random.value <= 0.2f)
             {
                 player.healthHaver.ApplyHealing(0.5f);
                 if (player.PlayerHasActiveSynergy("Rainbower Guon Stone"))
                 {
                     LootEngine.SpawnCurrency(player.CenterPosition, 20, false);
                 }
             }
         }
     }
     if (RandomlySelectedGuonState == GuonState.BLUE)
     {
         player.StartCoroutine(this.HandleSlowBullets());
     }
 }
Esempio n. 24
0
        protected override void DoEffect(PlayerController user)
        {
            IPlayerInteractable nearestInteractable = user.CurrentRoom.GetNearestInteractable(user.CenterPosition, 1f, user);

            if (!(nearestInteractable is Chest))
            {
                return;
            }

            AkSoundEngine.PostEvent("Play_ENM_electric_charge_01", user.gameObject);

            Chest rerollChest = nearestInteractable as Chest;
            int   selected    = UnityEngine.Random.Range(1, 15);

            ETGModConsole.Log(selected.ToString());

            VFXToolbox.GlitchScreenForSeconds(1.5f);


            switch (selected)
            {
            case 1:     //Blow up chest
                if (user.PlayerHasActiveSynergy("KEYGEN"))
                {
                    SpareChest(rerollChest);
                }
                else
                {
                    Exploder.DoDefaultExplosion(rerollChest.specRigidbody.UnitCenter, Vector2.zero);
                    if (rerollChest.IsMimic)
                    {
                        OMITBReflectionHelpers.ReflectSetField <bool>(typeof(Chest), "m_isMimic", false, rerollChest);
                    }
                    rerollChest.majorBreakable.Break(Vector2.zero);
                    if (rerollChest.GetChestTier() == ChestToolbox.ChestTier.RAT)
                    {
                        UnityEngine.Object.Destroy(rerollChest.gameObject);
                    }
                }
                break;

            case 2:     //Open Chest
                rerollChest.ForceOpen(user);
                break;

            case 3:     //Break Lock
                if (user.PlayerHasActiveSynergy("KEYGEN"))
                {
                    SpareChest(rerollChest);
                }
                else
                {
                    if (rerollChest.IsLocked)
                    {
                        rerollChest.BreakLock();
                    }
                    else
                    {
                        rerollChest.majorBreakable.Break(Vector2.zero);
                    }
                }
                break;

            case 4:     //Duplicate Chest
                DupeChest(rerollChest, user);
                break;

            case 5:     //Turn into mimic
                if (!rerollChest.IsMimic)
                {
                    rerollChest.overrideMimicChance = 100; rerollChest.MaybeBecomeMimic();
                }
                rerollChest.ForceOpen(user);
                break;

            case 6:     //Englitch
                List <GlobalDungeonData.ValidTilesets> bannedGlitchFloors = new List <GlobalDungeonData.ValidTilesets>()
                {
                    GlobalDungeonData.ValidTilesets.CATACOMBGEON,
                    GlobalDungeonData.ValidTilesets.HELLGEON,
                    GlobalDungeonData.ValidTilesets.OFFICEGEON,
                    GlobalDungeonData.ValidTilesets.FORGEGEON,
                };
                if (!bannedGlitchFloors.Contains(GameManager.Instance.Dungeon.tileIndices.tilesetId))
                {
                    rerollChest.BecomeGlitchChest();
                }
                else
                {
                    if (!rerollChest.IsMimic)
                    {
                        rerollChest.MaybeBecomeMimic();
                    }
                    rerollChest.ForceOpen(user);
                }
                break;

            case 7:     //Enrainbow
                if (UnityEngine.Random.value <= 0.65f)
                {
                    UpgradeChest(rerollChest, user);
                }
                else
                {
                    rerollChest.BecomeRainbowChest();
                }
                break;

            case 8:     //Reroll
                RerollChest(rerollChest, user);
                break;

            case 9:     //Turn into pickups
                if (user.PlayerHasActiveSynergy("KEYGEN"))
                {
                    SpareChest(rerollChest);
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        LootEngine.SpawnItem(PickupObjectDatabase.GetById(BraveUtility.RandomElement(BabyGoodChanceKin.lootIDlist)).gameObject, rerollChest.sprite.WorldCenter, Vector2.zero, 0);
                    }
                    LootEngine.SpawnCurrency(rerollChest.sprite.WorldCenter, UnityEngine.Random.Range(5, 11));
                    user.CurrentRoom.DeregisterInteractable(rerollChest);
                    rerollChest.DeregisterChestOnMinimap();
                    UnityEngine.Object.Destroy(rerollChest.gameObject);
                }
                break;

            case 10:     //Fuse
                if (user.PlayerHasActiveSynergy("KEYGEN"))
                {
                    SpareChest(rerollChest);
                }
                else
                {
                    var type = typeof(Chest);
                    var func = type.GetMethod("TriggerCountdownTimer", BindingFlags.Instance | BindingFlags.NonPublic);
                    var ret  = func.Invoke(rerollChest, null);
                    AkSoundEngine.PostEvent("Play_OBJ_fuse_loop_01", rerollChest.gameObject);
                }
                break;

            case 11:     //Unlock
                if (rerollChest.IsLocked)
                {
                    rerollChest.ForceUnlock();
                }
                else
                {
                    rerollChest.ForceOpen(user);
                }
                break;

            case 12:     //Enjam
                rerollChest.gameObject.GetOrAddComponent <JammedChestBehav>();
                break;

            case 13:     //TeleportChest
                TeleportChest(rerollChest, user);
                break;

            case 14:     //Drill
                FauxDrill(rerollChest, user);
                break;
            }
        }
        private IEnumerator HandleSoldItem(PickupObject targetItem)
        {
            if (!targetItem)
            {
                m_currentlySellingAnItem = false; yield break;
            }
            while (m_currentlySellingAnItem)
            {
                yield return(null);
            }
            m_currentlySellingAnItem = true;
            targetItem.IsBeingSold   = true;
            float magnitude = (targetItem.sprite.WorldCenter - specRigidbody.UnitCenter).magnitude;

            if (!targetItem.sprite || magnitude > 1.8f)
            {
                targetItem.IsBeingSold   = false;
                m_currentlySellingAnItem = false;
                yield break;
            }
            IPlayerInteractable ixable = null;

            if (targetItem is PassiveItem)
            {
                PassiveItem passiveItem = targetItem as PassiveItem;
                passiveItem.GetRidOfMinimapIcon();
                ixable = (targetItem as PassiveItem);
            }
            else if (targetItem is Gun)
            {
                Gun gun = targetItem as Gun;
                gun.GetRidOfMinimapIcon();
                ixable = (targetItem as Gun);
            }
            else if (targetItem is PlayerItem)
            {
                PlayerItem playerItem = targetItem as PlayerItem;
                playerItem.GetRidOfMinimapIcon();
                ixable = (targetItem as PlayerItem);
            }
            if (ixable != null)
            {
                RoomHandler.unassignedInteractableObjects.Remove(ixable);
                GameManager.Instance.PrimaryPlayer.RemoveBrokenInteractable(ixable);
            }
            float          elapsed      = 0f;
            float          duration     = 0.5f;
            Vector3        startPos     = targetItem.transform.position;
            Vector3        finalOffset  = Vector3.zero;
            tk2dBaseSprite targetSprite = targetItem.GetComponentInChildren <tk2dBaseSprite>();

            if (targetSprite)
            {
                finalOffset = targetSprite.GetBounds().extents;
            }
            while (elapsed < duration)
            {
                elapsed += BraveTime.DeltaTime;
                if (!targetItem || !targetItem.transform)
                {
                    m_currentlySellingAnItem = false; yield break;
                }
                targetItem.transform.localScale = Vector3.Lerp(Vector3.one, new Vector3(0.01f, 0.01f, 1f), elapsed / duration);
                targetItem.transform.position   = Vector3.Lerp(startPos, startPos + new Vector3(finalOffset.x, 0f, 0f), elapsed / duration);
                yield return(null);
            }
            if (!targetItem || !targetItem.transform)
            {
                m_currentlySellingAnItem = false; yield break;
            }
            SellPitDweller.SendPlaymakerEvent("playerSoldSomething");
            int sellPrice = Mathf.Clamp(Mathf.CeilToInt(targetItem.PurchasePrice * SellValueModifier), 0, 200);

            if (targetItem.quality == PickupObject.ItemQuality.SPECIAL || targetItem.quality == PickupObject.ItemQuality.EXCLUDED)
            {
                sellPrice = 3;
            }
            LootEngine.SpawnCurrency(targetItem.sprite.WorldCenter, sellPrice, false);
            m_thingsSold++;
            if (targetItem.PickupObjectId == GlobalItemIds.MasteryToken_Castle || targetItem.PickupObjectId == GlobalItemIds.MasteryToken_Catacombs || targetItem.PickupObjectId == GlobalItemIds.MasteryToken_Gungeon || targetItem.PickupObjectId == GlobalItemIds.MasteryToken_Forge || targetItem.PickupObjectId == GlobalItemIds.MasteryToken_Mines)
            {
                m_masteryRoundsSold++;
            }
            if (targetItem is Gun && targetItem.GetComponentInParent <DebrisObject>())
            {
                Destroy(targetItem.transform.parent.gameObject);
            }
            else
            {
                Destroy(targetItem.gameObject);
            }
            if (m_thingsSold >= 3 && m_masteryRoundsSold > 0)
            {
                StartCoroutine(HandleSellPitOpening());
            }
            m_currentlySellingAnItem = false;
            yield break;
        }
 private static void WindowFunction(int windowID)
 {
     if (windowID == 0)
     {
         GUILayout.BeginArea(new Rect(5f, 15f, 290f, 400f));
         GUILayout.Label(string.Format("Current Actor Name: {0}", GameManager.Instance.PrimaryPlayer.ActorName), new GUILayoutOption[0]);
         GUILayout.Label(string.Format("Current Gun Name: {0}", GameManager.Instance.PrimaryPlayer.CurrentGun.name), new GUILayoutOption[0]);
         if (GUILayout.Button(string.Format("Stealthed {0}", GameManager.Instance.PrimaryPlayer.IsStealthed ? "On" : "Off"), new GUILayoutOption[0]))
         {
             if (GameManager.Instance.PrimaryPlayer.IsStealthed)
             {
                 GameManager.Instance.PrimaryPlayer.gameActor.SetIsStealthed(false, "box");
             }
             else
             {
                 GameManager.Instance.PrimaryPlayer.gameActor.SetIsStealthed(true, "box");
             }
         }
         if (GUILayout.Button(string.Format("Clear Floor", new object[0]), new GUILayoutOption[0]))
         {
             GameManager.Instance.Dungeon.FloorCleared();
         }
         if (GUILayout.Button(string.Format("Heal All Players", new object[0]), new GUILayoutOption[0]))
         {
             for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++)
             {
                 if (GameManager.Instance.AllPlayers[i].healthHaver.IsAlive)
                 {
                     GameManager.Instance.AllPlayers[i].healthHaver.FullHeal();
                 }
             }
         }
         if (GUILayout.Button(string.Format("Change to Random Gun", new object[0]), new GUILayoutOption[0]))
         {
             GameManager.Instance.PrimaryPlayer.inventory.AddGunToInventory(PickupObjectDatabase.GetRandomGun(), true);
         }
         if (GUILayout.Button(string.Format("Add 100 currency", new object[0]), new GUILayoutOption[0]))
         {
             GameStatsManager.Instance.RegisterStatChange(TrackedStats.META_CURRENCY, 100f);
             GameManager.Instance.PrimaryPlayer.carriedConsumables.Currency += 100;
         }
         if (GUILayout.Button(string.Format("Unlimited Ammo {0}", ModMenu.unlimAmmo ? "On" : "Off"), new GUILayoutOption[0]))
         {
             ModMenu.unlimAmmo = !ModMenu.unlimAmmo;
         }
         if (GUILayout.Button(string.Format("Destroy Enemy Bullets", new object[0]), new GUILayoutOption[0]))
         {
             SilencerInstance.DestroyBulletsInRange(GameManager.Instance.PrimaryPlayer.transform.PositionVector2(), 100f, true, false, null, false, null, false, null);
         }
         if (GUILayout.Button(string.Format("Teleport Hax {0}", ModMenu.teleportHax ? "On" : "Off"), new GUILayoutOption[0]))
         {
             ModMenu.teleportHax = !ModMenu.teleportHax;
         }
         if (GUILayout.Button(string.Format("Spawn Currency", new object[0]), new GUILayoutOption[0]))
         {
             LootEngine.SpawnCurrency(GameManager.Instance.PrimaryPlayer.CenterPosition, 1000, false);
         }
         if (GUILayout.Button(string.Format("Can always steal {0}", ModMenu.canAlwaysSteal ? "On" : "Off"), new GUILayoutOption[0]))
         {
             ModMenu.canAlwaysSteal = !ModMenu.canAlwaysSteal;
         }
         if (GUILayout.Button(string.Format("Add Ammo Automatically {0}", ModMenu.addAmmoAutomatically ? "On" : "Off"), new GUILayoutOption[0]))
         {
             ModMenu.addAmmoAutomatically = !ModMenu.addAmmoAutomatically;
         }
         if (GUILayout.Button(string.Format("Auto Heal {0}", ModMenu.autoHeal ? "On" : "Off"), new GUILayoutOption[0]))
         {
             ModMenu.autoHeal = !ModMenu.autoHeal;
         }
         if (GUILayout.Button(string.Format("Increase Base Ammo", new object[0]), new GUILayoutOption[0]))
         {
             GameManager.Instance.PrimaryPlayer.CurrentGun.SetBaseMaxAmmo(10000);
         }
         GUILayout.EndArea();
     }
     if (windowID == 1)
     {
         GUILayout.BeginArea(new Rect(5f, 15f, 290f, 400f));
         ModMenu.scrollViewVector = GUILayout.BeginScrollView(ModMenu.scrollViewVector, new GUILayoutOption[]
         {
             GUILayout.Width(280f),
             GUILayout.Height(380f)
         });
         if (GameManager.Instance.PrimaryPlayer.inventory.AllGuns != null)
         {
             for (int j = 0; j < GameManager.Instance.PrimaryPlayer.inventory.AllGuns.Count; j++)
             {
                 if (GUILayout.Button(string.Format("Get Ammo for {0}", GameManager.Instance.PrimaryPlayer.inventory.AllGuns[j].DisplayName), ModMenu.BtnStyle, new GUILayoutOption[0]))
                 {
                     GameManager.Instance.PrimaryPlayer.inventory.AllGuns[j].GainAmmo(1000);
                 }
                 GUILayout.Label(string.Concat(new object[]
                 {
                     "Gun Name: ",
                     GameManager.Instance.PrimaryPlayer.inventory.AllGuns[j].name,
                     "\nDisplay Name: ",
                     GameManager.Instance.PrimaryPlayer.inventory.AllGuns[j].DisplayName,
                     "\nGun Ammo: ",
                     GameManager.Instance.PrimaryPlayer.inventory.AllGuns[j].ammo,
                     "\n================"
                 }), new GUILayoutOption[0]);
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndArea();
     }
     if (windowID == 2)
     {
         GUILayout.BeginArea(new Rect(5f, 15f, 490f, 400f));
         ModMenu.scrollViewVector2 = GUILayout.BeginScrollView(ModMenu.scrollViewVector2, new GUILayoutOption[]
         {
             GUILayout.Width(480f),
             GUILayout.Height(380f)
         });
         int count = PickupObjectDatabase.Instance.Objects.Count;
         for (int k = 0; k < PickupObjectDatabase.Instance.Objects.Count; k++)
         {
             if (PickupObjectDatabase.Instance.Objects[k] != null && PickupObjectDatabase.Instance.Objects[k] is Gun)
             {
                 EncounterTrackable component = PickupObjectDatabase.Instance.Objects[k].GetComponent <EncounterTrackable>();
                 if (component && component.PrerequisitesMet())
                 {
                     if (GUILayout.Button(string.Format("Add {0} to your Inventory", PickupObjectDatabase.Instance.Objects[k].DisplayName), ModMenu.BtnStyle, new GUILayoutOption[0]))
                     {
                         GameManager.Instance.PrimaryPlayer.inventory.AddGunToInventory(PickupObjectDatabase.Instance.Objects[k] as Gun, true);
                     }
                     GUILayout.Label(string.Concat(new object[]
                     {
                         "Gun Name: ",
                         PickupObjectDatabase.Instance.Objects[k].name,
                         "\nDisplay Name: ",
                         PickupObjectDatabase.Instance.Objects[k].DisplayName,
                         "\nItem Quality: ",
                         PickupObjectDatabase.Instance.Objects[k].quality.ToString(),
                         "\n================"
                     }), new GUILayoutOption[0]);
                 }
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndArea();
     }
     if (windowID == 3)
     {
         GUILayout.BeginArea(new Rect(5f, 15f, 490f, 400f));
         ModMenu.scrollViewVector3 = GUILayout.BeginScrollView(ModMenu.scrollViewVector3, new GUILayoutOption[]
         {
             GUILayout.Width(480f),
             GUILayout.Height(380f)
         });
         for (int l = 0; l < PickupObjectDatabase.Instance.Objects.Count; l++)
         {
             if (PickupObjectDatabase.Instance.Objects[l] != null && PickupObjectDatabase.Instance.Objects[l] is PassiveItem)
             {
                 EncounterTrackable component2 = PickupObjectDatabase.Instance.Objects[l].GetComponent <EncounterTrackable>();
                 if (component2 && component2.PrerequisitesMet())
                 {
                     if (GUILayout.Button(string.Format("Add {0} to your Inventory", PickupObjectDatabase.Instance.Objects[l].DisplayName), ModMenu.BtnStyle, new GUILayoutOption[0]))
                     {
                         GameManager.Instance.PrimaryPlayer.AcquirePassiveItem(PickupObjectDatabase.Instance.Objects[l] as PassiveItem);
                     }
                     GUILayout.Label(string.Concat(new object[]
                     {
                         "Item Name: ",
                         PickupObjectDatabase.Instance.Objects[l].name,
                         "\nDisplay Name: ",
                         PickupObjectDatabase.Instance.Objects[l].DisplayName,
                         "\n================"
                     }), new GUILayoutOption[0]);
                 }
             }
         }
         GUILayout.EndScrollView();
         GUILayout.EndArea();
     }
 }
Esempio n. 27
0
        private void OnTableFlipped(FlippableCover obj)
        {
            if (Owner && obj)
            {
                int selectedEffect = UnityEngine.Random.Range(1, (27 + 1));
                ETGModConsole.Log("Selected Effect: " + selectedEffect);
                switch (selectedEffect)
                {
                case 1:
                    SpawnFoldingTable();
                    break;

                case 2:
                    DoSafeExplosion(obj.specRigidbody.UnitCenter);
                    break;

                case 3:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.FireDef);
                    break;

                case 4:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.PoisonDef);
                    break;

                case 5:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.CharmGoopDef);
                    break;

                case 6:
                    DoGoop(obj.specRigidbody.UnitCenter, EasyGoopDefinitions.CheeseDef);
                    break;

                case 7:
                    LootEngine.SpawnCurrency(obj.specRigidbody.UnitCenter, UnityEngine.Random.Range(5, 10), false);
                    break;

                case 8:
                    Owner.DoEasyBlank(obj.specRigidbody.UnitCenter, EasyBlankType.FULL);
                    break;

                case 9:
                    Owner.DoEasyBlank(obj.specRigidbody.UnitCenter, EasyBlankType.MINI);
                    break;

                case 10:
                    FullRoomStatusEffect(StaticStatusEffects.charmingRoundsEffect);
                    break;

                case 11:
                    FullRoomStatusEffect(PickupObjectDatabase.GetById(569).GetComponent <ChaosBulletsItem>().FreezeModifierEffect);
                    break;

                case 12:
                    FullRoomStatusEffect(StaticStatusEffects.tripleCrossbowSlowEffect);
                    break;

                case 13:
                    Exploder.DoRadialKnockback(obj.specRigidbody.UnitCenter, 200, 100);
                    break;

                case 14:
                    SpawnBlackHole(obj.specRigidbody.UnitCenter);
                    break;

                case 15:
                    if (Owner.CurrentGun != null)
                    {
                        Owner.CurrentGun.GainAmmo(UnityEngine.Random.Range(5, 26));
                    }
                    break;

                case 16:
                    FreezeTime();
                    break;

                case 17:
                    TurnTableIntoRocket(obj);
                    break;

                case 18:
                    StunEnemies();
                    break;

                case 19:
                    LootEngine.SpawnCurrency(obj.specRigidbody.UnitCenter, UnityEngine.Random.Range(2, 6), true);
                    break;

                case 20:
                    CompanionisedEnemyUtility.SpawnCompanionisedEnemy(Owner, "01972dee89fc4404a5c408d50007dad5", Owner.sprite.WorldCenter.ToIntVector2(), false, Color.red, 7, 2, false, true);
                    break;

                case 21:
                    int numBullat = UnityEngine.Random.Range(2, 6);
                    for (int i = 0; i < numBullat; i++)
                    {
                        CompanionisedEnemyUtility.SpawnCompanionisedEnemy(Owner, "2feb50a6a40f4f50982e89fd276f6f15", Owner.sprite.WorldCenter.ToIntVector2(), false, Color.red, 15, 2, false, false);
                    }
                    break;

                case 22:
                    FullRoomStatusEffect(StaticStatusEffects.hotLeadEffect);
                    break;

                case 23:
                    float degrees = 0;
                    for (int i = 0; i < 15; i++)
                    {
                        SpawnBullets((PickupObjectDatabase.GetById(50) as Gun).DefaultModule.projectiles[0], obj.specRigidbody.UnitCenter, degrees);
                        degrees += 24;
                    }
                    break;

                case 24:
                    SpawnBullets((PickupObjectDatabase.GetById(372) as Gun).DefaultModule.projectiles[0], Owner.sprite.WorldCenter, Owner.sprite.WorldCenter.GetVectorToNearestEnemy().ToAngle());
                    break;

                case 25:
                    StartCoroutine(HandleShield(Owner, 7));
                    break;

                case 26:
                    Owner.StartCoroutine(this.HandleSlowBullets());
                    break;

                case 27:
                    Owner.Enrage(4f);
                    break;
                }
            }
        }