Beispiel #1
0
        protected static ListenerAction PerformedSong(Event e)
        {
            Sim sim = e.Actor as Sim;

            if (sim != null)
            {
                if (sim.LotCurrent.IsCommunityLot)
                {
                    List <Theatre> rList = new List <Theatre>(Sims3.Gameplay.Queries.GetObjects <Theatre>());
                    foreach (Theatre r in rList)
                    {
                        //If we performed a song in a lot with a theater in it, trigger perfomance
                        if (r.LotCurrent.IsCommunityLot && r.LotCurrent == sim.LotCurrent && sim.Occupation != null && sim.Occupation.Guid == OccupationNames.Music)
                        {
                            EventTracker.SendEvent(EventTypeId.kPerformedConcert, sim);

                            Music occupation = sim.Occupation as Music;
                            occupation.ConcertsPerformed++;
                            if ((sim.Occupation as Music).CurLevel.Level >= Music.LevelToGetPaidForConcerts)
                            {
                                int concertPayAmount = (int)(RandomUtil.GetDouble((double)(1f - kPerformConcertPayoffVariance), (double)(1f + kPerformConcertPayoffVariance)) * kPerformConcertPayoff);
                                sim.Household.ModifyFamilyFunds(concertPayAmount);
                                sim.ShowTNSIfSelectable(LocalizeString("ConcertPay", new object[] { sim, concertPayAmount }), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, sim.ObjectId);
                            }
                            else
                            {
                                sim.Occupation.ShowOccupationTNS(Localization.LocalizeString(sim.IsFemale, "Gameplay/Careers/Music/PerformTone:ConcertPerformed", new object[] { sim }));
                            }
                        }
                    }
                }
            }
            return(ListenerAction.Keep);
        }
        protected static bool GiveTip(BandInstrument ths, Sim tipper, Sim player, int moneyPerLevel, int moneyPerComposition)
        {
            if (ths.mTipJar == null)
            {
                return(false);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(false);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
            BandSkill skill = player.SkillManager.GetSkill <BandSkill>(ths.SkillName);
            int       delta = skill.SkillLevel * moneyPerLevel;

            delta += skill.NumberCompositionsPlayed() * moneyPerComposition;
            delta  = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            RockBand.GiveXpForMoney(player, delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            int original = skill.mMoneyMadeFromGuitarPlaying;

            skill.MadeTips(delta, false);

            delta = skill.mMoneyMadeFromGuitarPlaying - original;

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(true);
        }
Beispiel #3
0
        protected static int GiveTipEx(DJTurntable ths, Sim tipper, Sim player)
        {
            if (ths.mTipJar == null)
            {
                return(0);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(0);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);

            int delta = 0;

            int dJLevel = ths.GetDJLevel(player);

            if (((dJLevel >= 0x0) && (dJLevel <= 0x5)) && (dJLevel >= DJTurntable.kMakeATipLevel))
            {
                delta = DJTurntable.kTipAmountPerLevel[dJLevel];
            }

            delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(delta);
        }
Beispiel #4
0
        protected static bool GiveTip(PerformanceCareer.PerformerPerformForTips ths, Sim tipper, Sim player)
        {
            if (ths.mTipJar == null)
            {
                return(false);
            }
            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.mTipJar.Position;
            destination.mConeVector        = ths.mTipJar.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths.mTipJar;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (!tipper.DoRoute(r))
            {
                return(false);
            }
            tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
            PerformanceCareer occupationAsPerformanceCareer = player.OccupationAsPerformanceCareer;
            int delta = occupationAsPerformanceCareer.CareerLevel * occupationAsPerformanceCareer.Tuning.TipMoneyPerLevel;

            delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
            delta++;

            NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

            int original = occupationAsPerformanceCareer.mTipsCurrentGig;

            occupationAsPerformanceCareer.MadeTips(delta, false);

            delta = occupationAsPerformanceCareer.mTipsCurrentGig - original;

            NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

            return(true);
        }
        protected static bool GiveTip(SnakeCharmingBasket ths, Sim tipper, Sim player, int moneyPerLevel, int moneyPerComposition)
        {
            if (!ths.CanTip(player))
            {
                return(false);
            }

            Route r = tipper.CreateRoute();
            RadialRangeDestination destination = new RadialRangeDestination();

            destination.mCenterPoint       = ths.Position;
            destination.mConeVector        = ths.ForwardVector;
            destination.mFacingPreference  = RouteOrientationPreference.TowardsObject;
            destination.mfConeAngle        = 3.141593f;
            destination.mfMinRadius        = 1.25f;
            destination.mfPreferredSpacing = 0.1f;
            destination.mTargetObject      = ths;
            r.AddDestination(destination);
            r.SetValidRooms(0x0L, null);
            r.ExitReasonsInterrupt &= -33;
            r.Plan();
            if (tipper.DoRoute(r))
            {
                int delta = player.SkillManager.GetSkillLevel(SkillNames.SnakeCharming) * moneyPerLevel;
                delta = (int)RandomUtil.GetDouble(delta * 0.75, delta * 1.25);
                delta++;

                NRaas.StoryProgression.Main.Money.AdjustFunds(tipper.SimDescription, "Tips", -delta);

                NRaas.StoryProgression.Main.Money.AdjustFunds(player.SimDescription, "Tips", delta);

                tipper.PlaySoloAnimation("a2o_guitar_tip_x", true);
                SnakeCharmingBasket.CharmForTips currentInteraction = player.CurrentInteraction as SnakeCharmingBasket.CharmForTips;
                if (currentInteraction != null)
                {
                    currentInteraction.MoneyEarnedThisSession += delta;
                }
                return(true);
            }
            return(false);
        }
        public void BuildEntities(out string[] sourceVoxelFiles, out MyObjectBuilder_EntityBase[] sourceEntities)
        {
            var entities    = new List <MyObjectBuilder_EntityBase>();
            var sourceFiles = new List <string>();

            MainViewModel.ResetProgress(0, VoxelCollection.Count);

            foreach (var voxelDesign in VoxelCollection)
            {
                MainViewModel.Progress++;
                if (string.IsNullOrEmpty(voxelDesign.VoxelFile.SourceFilename) || !MyVoxelMap.IsVoxelMapFile(voxelDesign.VoxelFile.SourceFilename))
                {
                    continue;
                }


                var    asteroid           = new MyVoxelMap();
                string tempSourcefilename = null;

                switch (AsteroidFillType)
                {
                case Support.AsteroidFillType.None:
                    asteroid.Load(voxelDesign.VoxelFile.SourceFilename, voxelDesign.MainMaterial.Value, false);
                    tempSourcefilename = voxelDesign.VoxelFile.SourceFilename;
                    break;

                case AsteroidFillType.ByteFiller:
                    asteroid.Load(voxelDesign.VoxelFile.SourceFilename, voxelDesign.MainMaterial.Value, false);
                    var filler = new AsteroidByteFiller();
                    filler.FillAsteroid(asteroid, voxelDesign);
                    tempSourcefilename = TempfileUtil.NewFilename(MyVoxelMap.V2FileExtension);
                    asteroid.Save(tempSourcefilename);
                    break;
                }


                // automatically number all files, and check for duplicate filenames.
                var filename = MainViewModel.CreateUniqueVoxelStorageName(voxelDesign.VoxelFile.Name + MyVoxelMap.V2FileExtension, entities.ToArray());

                var radius    = RandomUtil.GetDouble(MinimumRange, MaximumRange);
                var longitude = RandomUtil.GetDouble(0, 2 * Math.PI);
                var latitude  = RandomUtil.GetDouble(-Math.PI / 2, (Math.PI / 2) + double.Epsilon);

                // Test data. Place asteroids items into a circle.
                //radius = 500;
                //longitude = Math.PI * 2 * ((double)voxelDesign.Index / VoxelCollection.Count);
                //latitude = 0;

                var x = radius * Math.Cos(latitude) * Math.Cos(longitude);
                var z = radius * Math.Cos(latitude) * Math.Sin(longitude);
                var y = radius * Math.Sin(latitude);

                var center   = new Vector3D(CenterPositionX, CenterPositionY, CenterPositionZ);
                var position = center + new Vector3D(x, y, z) - asteroid.BoundingContent.Center;
                var entity   = new MyObjectBuilder_VoxelMap(position, filename)
                {
                    EntityId               = SpaceEngineersApi.GenerateEntityId(IDType.ASTEROID),
                    PersistentFlags        = MyPersistentEntityFlags2.CastShadows | MyPersistentEntityFlags2.InScene,
                    StorageName            = Path.GetFileNameWithoutExtension(filename),
                    PositionAndOrientation = new MyPositionAndOrientation
                    {
                        Position = position,
                        Forward  = Vector3.Forward, // Asteroids currently don't have any orientation.
                        Up       = Vector3.Up
                    }
                };

                entities.Add(entity);
                sourceFiles.Add(tempSourcefilename);
            }

            sourceVoxelFiles = sourceFiles.ToArray();
            sourceEntities   = entities.ToArray();
        }
        public IMyVoxelFillProperties CreateRandom(int index, MaterialSelectionModel defaultMaterial, IEnumerable <MaterialSelectionModel> materialsCollection, IEnumerable <GenerateVoxelDetailModel> voxelCollection)
        {
            int idx;

            var randomModel = new AsteroidByteFillProperties
            {
                Index           = index,
                MainMaterial    = defaultMaterial,
                SecondMaterial  = defaultMaterial,
                ThirdMaterial   = defaultMaterial,
                FourthMaterial  = defaultMaterial,
                FifthMaterial   = defaultMaterial,
                SixthMaterial   = defaultMaterial,
                SeventhMaterial = defaultMaterial,
            };

            // Must be by reference, not value.
            var largeVoxelFileList = voxelCollection.Where(v => v.FileSize > 100000).ToList();
            var smallVoxelFileList = voxelCollection.Where(v => v.FileSize > 0 && v.FileSize < 100000).ToList();

            // Random Asteroid.
            var d       = RandomUtil.GetDouble(1, 100);
            var islarge = false;

            if (largeVoxelFileList.Count == 0 && smallVoxelFileList.Count == 0)
            {
                // no asteroids?  You are so screwed.
                throw new Exception("No valid asteroids found. Re-validate your game cache.");
            }

            if (largeVoxelFileList.Count == 0) // empty last list? Force to small list.
            {
                d = 1;
            }
            if (smallVoxelFileList.Count == 0) // empty small list? Force to large list.
            {
                d = 100;
            }

            if (d > 70)
            {
                idx = RandomUtil.GetInt(largeVoxelFileList.Count);
                randomModel.VoxelFile = largeVoxelFileList[idx];
                islarge = true;
            }
            else
            {
                idx = RandomUtil.GetInt(smallVoxelFileList.Count);
                randomModel.VoxelFile = smallVoxelFileList[idx];
            }

            // Random Main Material non-Rare.
            var nonRare = materialsCollection.Where(m => m.IsRare == false).ToArray();

            idx = RandomUtil.GetInt(nonRare.Length);
            randomModel.MainMaterial = nonRare[idx];

            int percent;
            var rare      = materialsCollection.Where(m => m.IsRare && m.MinedRatio >= 1).ToList();
            var superRare = materialsCollection.Where(m => m.IsRare && m.MinedRatio < 1).ToList();

            if (islarge)
            {
                // Random 1. Rare.
                if (rare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(rare.Count);
                    percent = RandomUtil.GetInt(40, 60);
                    randomModel.SecondMaterial = rare[idx];
                    randomModel.SecondPercent  = percent;
                    rare.RemoveAt(idx);
                }

                // Random 2. Rare.
                if (rare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(rare.Count);
                    percent = RandomUtil.GetInt(6, 12);
                    randomModel.ThirdMaterial = rare[idx];
                    randomModel.ThirdPercent  = percent;
                    rare.RemoveAt(idx);
                }

                // Random 3. Rare.
                if (rare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(rare.Count);
                    percent = RandomUtil.GetInt(6, 12);
                    randomModel.ThirdMaterial = rare[idx];
                    randomModel.ThirdPercent  = percent;
                    rare.RemoveAt(idx);
                }

                // Random 4. Super Rare.
                if (superRare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(superRare.Count);
                    percent = RandomUtil.GetInt(2, 4);
                    randomModel.FourthMaterial = superRare[idx];
                    randomModel.FourthPercent  = percent;
                    superRare.RemoveAt(idx);
                }

                // Random 5. Super Rare.
                if (superRare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(superRare.Count);
                    percent = RandomUtil.GetInt(1, 3);
                    randomModel.FifthMaterial = superRare[idx];
                    randomModel.FifthPercent  = percent;
                    superRare.RemoveAt(idx);
                }

                // Random 6. Super Rare.
                if (superRare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(superRare.Count);
                    percent = RandomUtil.GetInt(1, 3);
                    randomModel.SixthMaterial = superRare[idx];
                    randomModel.SixthPercent  = percent;
                    superRare.RemoveAt(idx);
                }

                // Random 7. Super Rare.
                if (superRare.Count > 0)
                {
                    idx     = RandomUtil.GetInt(superRare.Count);
                    percent = RandomUtil.GetInt(1, 3);
                    randomModel.SeventhMaterial = superRare[idx];
                    randomModel.SeventhPercent  = percent;
                    superRare.RemoveAt(idx);
                }
            }
            else // Small Asteroid.
            {
                // Random 1. Rare.
                idx     = RandomUtil.GetInt(rare.Count);
                percent = RandomUtil.GetInt(6, 13);
                randomModel.SecondMaterial = rare[idx];
                randomModel.SecondPercent  = percent;

                // Random 2. Super Rare.
                idx     = RandomUtil.GetInt(superRare.Count);
                percent = RandomUtil.GetInt(2, 4);
                randomModel.ThirdMaterial = superRare[idx];
                randomModel.ThirdPercent  = percent;
                superRare.RemoveAt(idx);
            }

            return(randomModel);
        }
Beispiel #8
0
        public IMyVoxelFillProperties CreateRandom(int index, MaterialSelectionModel defaultMaterial, IEnumerable <MaterialSelectionModel> materialsCollection, IEnumerable <GenerateVoxelDetailModel> voxelCollection)
        {
            int idx;

            var randomModel = new AsteroidSeedFillProperties
            {
                Index           = index,
                MainMaterial    = defaultMaterial,
                FirstMaterial   = defaultMaterial,
                SecondMaterial  = defaultMaterial,
                ThirdMaterial   = defaultMaterial,
                FourthMaterial  = defaultMaterial,
                FifthMaterial   = defaultMaterial,
                SixthMaterial   = defaultMaterial,
                SeventhMaterial = defaultMaterial,
            };

            // Must be by reference, not value.
            var largeVoxelFileList = voxelCollection.Where(v => v.FileSize > 100000).ToList();
            var smallVoxelFileList = voxelCollection.Where(v => v.FileSize > 0 && v.FileSize < 100000).ToList();

            // Random Asteroid.
            var d       = RandomUtil.GetDouble(1, 100);
            var islarge = false;

            if (largeVoxelFileList.Count == 0 && smallVoxelFileList.Count == 0)
            {
                // no asteroids?  You are so screwed.
                throw new Exception("No valid asteroids found. Re-validate your game cache.");
            }

            if (largeVoxelFileList.Count == 0) // empty last list? Force to small list.
            {
                d = 1;
            }
            if (smallVoxelFileList.Count == 0) // empty small list? Force to large list.
            {
                d = 100;
            }

            if (d > 70)
            {
                idx = RandomUtil.GetInt(largeVoxelFileList.Count);
                randomModel.VoxelFile = largeVoxelFileList[idx];
                islarge = true;
            }
            else
            {
                idx = RandomUtil.GetInt(smallVoxelFileList.Count);
                randomModel.VoxelFile = smallVoxelFileList[idx];
            }

            // Random Main Material non-Rare.
            var nonRare = materialsCollection.Where(m => m.IsRare == false).ToArray();

            idx = RandomUtil.GetInt(nonRare.Length);
            randomModel.MainMaterial = nonRare[idx];

            int    chunks, chunkSize;
            double multiplier = 1.0;
            var    rare       = materialsCollection.Where(m => m.IsRare && m.MinedRatio >= 2).ToList();
            var    superRare  = materialsCollection.Where(m => m.IsRare && m.MinedRatio < 2).ToList();

            if (islarge)
            {
                // Random 1-4 are rare.
                chunks    = 20;
                chunkSize = 5;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.FirstMaterial = rare[idx];
                    randomModel.FirstVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.FirstRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }
                multiplier *= 0.85;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.SecondMaterial = rare[idx];
                    randomModel.SecondVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.SecondRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }
                multiplier *= 0.85;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.ThirdMaterial = rare[idx];
                    randomModel.ThirdVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.ThirdRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }
                multiplier *= 0.85;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.FourthMaterial = rare[idx];
                    randomModel.FourthVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.FourthRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }

                // Random 5-7 are super-rare

                multiplier = 1.0;
                chunks     = 50;
                chunkSize  = 2;

                if (superRare.Count > 0)
                {
                    idx = RandomUtil.GetInt(superRare.Count);
                    randomModel.FifthMaterial = superRare[idx];
                    randomModel.FifthVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.FifthRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    superRare.RemoveAt(idx);
                }
                multiplier *= 0.5;

                if (superRare.Count > 0)
                {
                    idx = RandomUtil.GetInt(superRare.Count);
                    randomModel.SixthMaterial = superRare[idx];
                    randomModel.SixthVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.SixthRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    superRare.RemoveAt(idx);
                }
                multiplier *= 0.5;

                if (superRare.Count > 0)
                {
                    idx = RandomUtil.GetInt(superRare.Count);
                    randomModel.SeventhMaterial = superRare[idx];
                    randomModel.SeventhVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.SeventhRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    superRare.RemoveAt(idx);
                }
                multiplier *= 0.5;
            }
            else // Small Asteroid.
            {
                // Random 1-3 are rare.
                chunks    = 10;
                chunkSize = 2;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.FirstMaterial = rare[idx];
                    randomModel.FirstVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.FirstRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }
                multiplier *= 0.75;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.SecondMaterial = rare[idx];
                    randomModel.SecondVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.SecondRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }
                multiplier *= 0.75;

                if (rare.Count > 0)
                {
                    idx = RandomUtil.GetInt(rare.Count);
                    randomModel.ThirdMaterial = rare[idx];
                    randomModel.ThirdVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.ThirdRadius   = RandomUtil.GetInt((int)(chunkSize * multiplier), (int)(chunkSize * 1.5 * multiplier));
                    rare.RemoveAt(idx);
                }


                // Random 4-5 is super-rare

                multiplier = 1.0;
                chunks     = 15;

                if (superRare.Count > 0)
                {
                    idx = RandomUtil.GetInt(superRare.Count);
                    randomModel.FourthMaterial = superRare[idx];
                    randomModel.FourthVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.FourthRadius   = 0;
                    superRare.RemoveAt(idx);
                }
                multiplier *= 0.5;

                if (superRare.Count > 0)
                {
                    idx = RandomUtil.GetInt(superRare.Count);
                    randomModel.FifthMaterial = superRare[idx];
                    randomModel.FifthVeins    = RandomUtil.GetInt((int)(chunks * multiplier), (int)(chunks * 1.5 * multiplier));
                    randomModel.FifthRadius   = 0;
                    superRare.RemoveAt(idx);
                }
            }

            return(randomModel);
        }