// Token: 0x06001671 RID: 5745 RVA: 0x0006AD50 File Offset: 0x00068F50
 private void Start()
 {
     if (this.clearRadiusIndicator)
     {
         float num = this.clearRadius * 2f;
         this.clearRadiusIndicator.transform.localScale = new Vector3(num, num, num);
     }
     if (NetworkServer.active)
     {
         this.rng = new Xoroshiro128Plus(Run.instance.stageRng.nextUlong);
         SceneInfo instance = SceneInfo.instance;
         if (instance)
         {
             ClassicStageInfo component = instance.GetComponent <ClassicStageInfo>();
             if (component && component.destinations.Length != 0)
             {
                 Run.instance.PickNextStageScene(component.destinations);
             }
         }
         float nextNormalizedFloat = this.rng.nextNormalizedFloat;
         float num2 = this.baseShopSpawnChance / (float)(Run.instance.shopPortalCount + 1);
         this.shouldAttemptToSpawnShopPortal = (nextNormalizedFloat < num2);
         int num3            = 4;
         int stageClearCount = Run.instance.stageClearCount;
         if ((stageClearCount + 1) % num3 == 3 && stageClearCount > num3)
         {
             this.shouldAttemptToSpawnMSPortal = true;
         }
     }
 }
Exemple #2
0
 // Token: 0x0600150B RID: 5387 RVA: 0x00064DDC File Offset: 0x00062FDC
 private void Start()
 {
     if (NetworkServer.active)
     {
         this.rng = new Xoroshiro128Plus((ulong)Run.instance.stageRng.nextUint);
         float            num       = 0.5f + (float)Run.instance.participatingPlayerCount * 0.5f;
         ClassicStageInfo component = SceneInfo.instance.GetComponent <ClassicStageInfo>();
         if (component)
         {
             this.interactableCredit = (int)((float)component.sceneDirectorInteractibleCredits * num);
             Debug.LogFormat("Spending {0} credits on interactables...", new object[]
             {
                 this.interactableCredit
             });
             this.monsterCredit = (int)((float)component.sceneDirectorMonsterCredits * Run.instance.difficultyCoefficient);
         }
         this.PopulateScene();
     }
 }
 // Token: 0x0600128D RID: 4749 RVA: 0x0004FA28 File Offset: 0x0004DC28
 private void Start()
 {
     if (NetworkServer.active)
     {
         this.rng = new Xoroshiro128Plus((ulong)Run.instance.stageRng.nextUint);
         float            num       = 0.5f + (float)Run.instance.participatingPlayerCount * 0.5f;
         ClassicStageInfo component = SceneInfo.instance.GetComponent <ClassicStageInfo>();
         if (component)
         {
             this.interactableCredit = (int)((float)component.sceneDirectorInteractibleCredits * num);
             if (component.bonusInteractibleCreditObjects != null)
             {
                 for (int i = 0; i < component.bonusInteractibleCreditObjects.Length; i++)
                 {
                     ClassicStageInfo.BonusInteractibleCreditObject bonusInteractibleCreditObject = component.bonusInteractibleCreditObjects[i];
                     if (bonusInteractibleCreditObject.objectThatGrantsPointsIfEnabled.activeSelf)
                     {
                         this.interactableCredit += bonusInteractibleCreditObject.points;
                     }
                 }
             }
             Debug.LogFormat("Spending {0} credits on interactables...", new object[]
             {
                 this.interactableCredit
             });
             this.monsterCredit = (int)((float)component.sceneDirectorMonsterCredits * Run.instance.difficultyCoefficient);
         }
         Action <SceneDirector> action = SceneDirector.onPrePopulateSceneServer;
         if (action != null)
         {
             action(this);
         }
         this.PopulateScene();
         Action <SceneDirector> action2 = SceneDirector.onPostPopulateSceneServer;
         if (action2 == null)
         {
             return;
         }
         action2(this);
     }
 }
        // Token: 0x06001294 RID: 4756 RVA: 0x0004FF00 File Offset: 0x0004E100
        private void PopulateScene()
        {
            ClassicStageInfo component = SceneInfo.instance.GetComponent <ClassicStageInfo>();

            this.PlaceTeleporter();
            Action action = new Action(this.DefaultPlayerSpawnPointGenerator);

            SceneDirector.GenerateSpawnPointsDelegate generateSpawnPointsDelegate = SceneDirector.onPreGeneratePlayerSpawnPointsServer;
            if (generateSpawnPointsDelegate != null)
            {
                generateSpawnPointsDelegate(this, ref action);
            }
            if (action != null)
            {
                action();
            }
            Run.instance.OnPlayerSpawnPointsPlaced(this);
            while (this.interactableCredit > 0)
            {
                DirectorCard directorCard = this.SelectCard(component.interactableSelection, this.interactableCredit);
                if (directorCard == null)
                {
                    break;
                }
                if (directorCard.CardIsValid())
                {
                    this.interactableCredit -= directorCard.cost;
                    if (Run.instance)
                    {
                        int i = 0;
                        while (i < 10)
                        {
                            DirectorPlacementRule placementRule = new DirectorPlacementRule
                            {
                                placementMode = DirectorPlacementRule.PlacementMode.Random
                            };
                            GameObject gameObject = this.directorCore.TrySpawnObject(new DirectorSpawnRequest(directorCard.spawnCard, placementRule, this.rng));
                            if (gameObject)
                            {
                                PurchaseInteraction component2 = gameObject.GetComponent <PurchaseInteraction>();
                                if (component2 && component2.costType == CostTypeIndex.Money)
                                {
                                    component2.Networkcost = Run.instance.GetDifficultyScaledCost(component2.cost);
                                    break;
                                }
                                break;
                            }
                            else
                            {
                                i++;
                            }
                        }
                    }
                }
            }
            if (Run.instance && Run.instance.stageClearCount == 0)
            {
                this.monsterCredit = 0;
            }
            int num = 0;

            while (this.monsterCredit > 0 && num < 40)
            {
                DirectorCard directorCard2 = this.SelectCard(component.monsterSelection, this.monsterCredit);
                if (directorCard2 == null)
                {
                    break;
                }
                if (directorCard2.CardIsValid())
                {
                    this.monsterCredit -= directorCard2.cost;
                    int j = 0;
                    while (j < 10)
                    {
                        DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(directorCard2.spawnCard, new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.Random
                        }, this.rng);
                        directorSpawnRequest.teamIndexOverride = new TeamIndex?(TeamIndex.Monster);
                        GameObject gameObject2 = this.directorCore.TrySpawnObject(directorSpawnRequest);
                        if (gameObject2)
                        {
                            num++;
                            CharacterMaster component3 = gameObject2.GetComponent <CharacterMaster>();
                            if (component3)
                            {
                                GameObject bodyObject = component3.GetBodyObject();
                                if (bodyObject)
                                {
                                    DeathRewards component4 = bodyObject.GetComponent <DeathRewards>();
                                    if (component4)
                                    {
                                        component4.expReward  = (uint)((float)directorCard2.cost * this.expRewardCoefficient * Run.instance.difficultyCoefficient);
                                        component4.goldReward = (uint)((float)directorCard2.cost * this.expRewardCoefficient * 2f * Run.instance.difficultyCoefficient);
                                    }
                                    foreach (EntityStateMachine entityStateMachine in bodyObject.GetComponents <EntityStateMachine>())
                                    {
                                        entityStateMachine.initialStateType = entityStateMachine.mainStateType;
                                    }
                                }
                                num++;
                                break;
                            }
                            break;
                        }
                        else
                        {
                            j++;
                        }
                    }
                }
            }
            Xoroshiro128Plus xoroshiro128Plus = new Xoroshiro128Plus(this.rng.nextUlong);

            if (SceneInfo.instance.countsAsStage)
            {
                int num2 = 0;
                foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList)
                {
                    num2 += characterMaster.inventory.GetItemCount(ItemIndex.TreasureCache);
                }
                if (num2 > 0)
                {
                    GameObject gameObject3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/iscLockbox"), new DirectorPlacementRule
                    {
                        placementMode = DirectorPlacementRule.PlacementMode.Random
                    }, xoroshiro128Plus));
                    if (gameObject3)
                    {
                        ChestBehavior component5 = gameObject3.GetComponent <ChestBehavior>();
                        if (component5)
                        {
                            component5.tier2Chance *= (float)num2;
                            component5.tier3Chance *= Mathf.Pow((float)num2, 2f);
                        }
                    }
                }
            }
        }
Exemple #5
0
 // Token: 0x06000910 RID: 2320 RVA: 0x000273B1 File Offset: 0x000255B1
 private void OnDisable()
 {
     ClassicStageInfo.instance = null;
 }
Exemple #6
0
 // Token: 0x0600090F RID: 2319 RVA: 0x000273A9 File Offset: 0x000255A9
 private void OnEnable()
 {
     ClassicStageInfo.instance = this;
 }